From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF40C322B87 for ; Mon, 18 May 2026 09:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779097852; cv=none; b=YuTcBJGHh6LfSuy0qcDIvt9lIvev43CRE7XQ6Z2yV94zrVpEqdXTFwqC9sda4fJp9dilPB2q8O6SiI9KCkNP7wGMiWgPo85Ji6J+MbSavZ8TTKntm9O5cStsISuAdq90PG5kVx4OraZ3+SH7LFTzQoGe/6MYaS8d8U5NVMrHeM8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779097852; c=relaxed/simple; bh=dPJZ4cyiY7usvh3Dj3xb9H24EuXZmchSS2shKwLhI4s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W3rNDAIs/++MnnU+QwT42eIVQcC8zsfAUVPSzDBIvJbFlvK8n669Msl3PPQSnoCh2uzQWj38Bnl6+C9GpJpyUzH+rQmPYJlVXb+KqR8VJ5uKS6okIVRb0YrEF6+LJjognpL5qKlQZcADF5MsZZzwT8jRxtioHnm75iodCcBLqEk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GUX7YQkV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=4j1ux4y0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GUX7YQkV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4j1ux4y0" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779097849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xDACfn5mnkk4BzBZ8LQOYFhz188HcBcZRBoZRe6gBL4=; b=GUX7YQkV9tH8B+pbuxQlopuV/TuHc+IBlvcg1io/zbgozZbno/dhr0oPqgRIxvMqZdCca/ 6PRMWJxqC6wOe4JIez2PeXjxCHpH97RutmTF0siTM33lCXU6Q/busByu94iwSU0HgBLILQ zw11c1qXNaCmLJxTdpDLQyB0IVjzzzQexSJqskY4wTDz1Nbmz2dB00+dU0jwau1eGOTGUO lS20j9to7ftr0bCFPgk2uSUGewxJFn6j2TZpvGmqpnnu80yTdh79nWmBzlSuYFOCyxpUQA 7/+8GjlhWGaeszU+MAO0kF/pdWYZKeMbgsq2HV6naQpDcbnurxMkiEXHQk8oIw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779097849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xDACfn5mnkk4BzBZ8LQOYFhz188HcBcZRBoZRe6gBL4=; b=4j1ux4y0bHtY1BECe8ojDJ+mMSEqAh6xfrUs5WIVGZlz8w5//pwGo19JMLRHUggLVwbDuI 1oMgsPX9kFXIzKBg== Date: Mon, 18 May 2026 11:49:41 +0200 Subject: [PATCH v3 3/6] vdso/datastore: Map zeroed pages for unavailable data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260518-vdso-mlockall-v3-3-bf4f2af2b41f@linutronix.de> References: <20260518-vdso-mlockall-v3-0-bf4f2af2b41f@linutronix.de> In-Reply-To: <20260518-vdso-mlockall-v3-0-bf4f2af2b41f@linutronix.de> To: Anna-Maria Behnsen , Frederic Weisbecker , Andy Lutomirski , Vincenzo Frascino , Thomas Gleixner Cc: Nam Cao , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Andrew Morton , David Hildenbrand , Jason Gunthorpe , John Hubbard , Peter Xu , linux-mm@kvack.org, Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1779097846; l=1779; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=dPJZ4cyiY7usvh3Dj3xb9H24EuXZmchSS2shKwLhI4s=; b=Ng+knDPvybZE2AWH1rVLYkUjoc6qSujYwPAPvd2pWS+dgpTx5w5LSoOpY0egzbrYBeGzFOmNs 4JljMACKH3fBuU6RnvMEExmOPnHDDlpVN1oJX2dkwe0I13GGMfTKmKB X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= mlockall() stops if a page in a VMA is unmappable. As the datastore VMA can contain holes, mlockall() would not process all data pages. Replace the mapping error VM_FAULT_SIGBUS by just mapping the underlying unused and zeroed-out data page. The vDSO will not access these pages in any case and for other userspace these pages have undefined contents. This will allow mlockall() to process all pages within the VMA as soon as VM_IO is removed from the VMA. Signed-off-by: Thomas Weißschuh Tested-by: Nam Cao --- lib/vdso/datastore.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/vdso/datastore.c b/lib/vdso/datastore.c index 8aabb289a7b5..f9a1f0fb7ccd 100644 --- a/lib/vdso/datastore.c +++ b/lib/vdso/datastore.c @@ -74,7 +74,7 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm, switch (vmf->pgoff) { case VDSO_TIME_PAGE_OFFSET: if (!IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)) - return VM_FAULT_SIGBUS; + break; if (timens_page) { /* * Fault in VVAR page too, since it will be accessed @@ -99,16 +99,11 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm, * See also the comment near timens_setup_vdso_data(). */ if (!IS_ENABLED(CONFIG_TIME_NS) || !timens_page) - return VM_FAULT_SIGBUS; + break; page = vdso_data_pages + VDSO_TIME_PAGE_OFFSET; break; case VDSO_RNG_PAGE_OFFSET: - if (!IS_ENABLED(CONFIG_VDSO_GETRANDOM)) - return VM_FAULT_SIGBUS; - break; case VDSO_ARCH_PAGES_START ... VDSO_ARCH_PAGES_END: - if (!IS_ENABLED(CONFIG_ARCH_HAS_VDSO_ARCH_DATA)) - return VM_FAULT_SIGBUS; break; default: return VM_FAULT_SIGBUS; -- 2.53.0