From patchwork Tue Aug 27 08:26:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 1977201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev+bounces-590-incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WtLHV73n2z1yg0 for ; Tue, 27 Aug 2024 18:26:46 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WtLHV2bdCz2yRM; Tue, 27 Aug 2024 18:26:46 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=93.17.235.10 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1724747206; cv=none; b=b2LBHFMsI0eOFxpUyaQmmuFcJmypUAr78vQpCmbQ3WzLr1ycWH9FgZwt3Ys3ven+s9PuAsHq4BF40l0vGA32LrONvxaoCbe/y/jq9froaPeLfwpTGOhnEj+xvSokmYnwX+QlkC6rDOjE9ajdKA5rfBxFflK5OOjd0cgxiXkFUiQ1PQzBMKYMoUosVsr4y3kFr9gWHzLLrjP7VCQbU9CW+OmxVHu6LFCZ3mcSSQILLF0tmentW+2uG1o63y0ee8IHHQHMMu8viwzIbSFLc+g7FkPlch7Gbn0WjgadPghVU7dt6oobE6VyvmQZOHdj0hUHLL+RoOaRxqIC2C/RmaEK1Q== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1724747206; c=relaxed/relaxed; bh=+US9x+xhjl+BdlXk/gfdrODsuhhOirzXYczcpZbJWPI=; h=Received:X-Virus-Scanned:Received:Received:Received: X-Virus-Scanned:Received:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: X-Developer-Signature:X-Developer-Key:Content-Transfer-Encoding; b=Vi8FWYPgX+kORYk1wr3iABoOH+eRQqKnO4piUzoAaVr5ocChKD48qMGfDCRpNQJPNhOVKJKnkdkBum6jYTSQKF+fgvJnxGoZ+rFvptpRXsDqJv/HKL6XjFe6iIrg/RQcSO6JBEC7JDaF3vinBSGaw8KABMr+tuD5slPyEM1JojGyRipX8q52BmShTnYE+QP2BjJxOf5ERGMZpA80F10vlZPR/uOfD4n6FkkkSaRTpyJKteUV9w/SMdO6nsClHrsfg2sdHJpDdbMzdBXN+waCD/fIWDrpT3WuB1hrSWJs7uys10UsZ/xH5zf4I3LLVBA2/f09hD/JqaFdHpI79oMW9Q== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass (client-ip=93.17.235.10; helo=pegase2.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=lists.ozlabs.org) smtp.mailfrom=csgroup.eu Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.235.10; helo=pegase2.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=lists.ozlabs.org) Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4WtLHV0CPvz2yPj for ; Tue, 27 Aug 2024 18:26:45 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WtLHN1ly9z9sRs; Tue, 27 Aug 2024 10:26:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mhh1S0ena9Vk; Tue, 27 Aug 2024 10:26:40 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WtLHN10Zcz9sRk; Tue, 27 Aug 2024 10:26:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 118488B77B; Tue, 27 Aug 2024 10:26:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ZKjKsRV7tgiQ; Tue, 27 Aug 2024 10:26:40 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO19727.IDSI0.si.c-s.fr [192.168.233.149]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 67AAD8B763; Tue, 27 Aug 2024 10:26:39 +0200 (CEST) From: Christophe Leroy To: "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org Subject: [PATCH] random: vDSO: Redefine PAGE_SIZE and PAGE_MASK Date: Tue, 27 Aug 2024 10:26:28 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Post: List-Subscribe: , , List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724747190; l=1185; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=VrUjwEsvjnm9x92ftet3dAaDiU/lOPFlBddTh4Jimzg=; b=kXAukdoV22AMsdQQpQEpkGpxMPMlzm7uRM0sQw9po6PRu9HvBgS2oHyJjKNPLjhmEOZYsqrhO N3vOjjEuqsWD8DT3YN2IIqXDZod7JASfOWe/U5my37En5+alm+LgojT X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Using PAGE_SIZE and PAGE_MASK in VDSO requires inclusion of page.h and it creates several problems, see commit 8b3843ae3634 ("vdso/datapage: Quick fix - use asm/page-def.h for ARM64") and commit cffaefd15a8f ("vdso: Use CONFIG_PAGE_SHIFT in vdso/datapage.h"). Redefine PAGE_SIZE and PAGE_MASK based on CONFIG_PAGE_SHIFT. Signed-off-by: Christophe Leroy Signed-off-by: Christophe Leroy Signed-off-by: Jason A. Donenfeld --- v3: Use local consts instead of _PAGE_SIZE and _PAGE_MASK macros that are already defined by some architectures. v4: undefine and redefine PAGE_SIZE and PAGE_MASK --- lib/vdso/getrandom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c index f1643656d0b0..e5968ed141cb 100644 --- a/lib/vdso/getrandom.c +++ b/lib/vdso/getrandom.c @@ -14,6 +14,11 @@ #include #include +#undef PAGE_SIZE +#undef PAGE_MASK +#define PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE - 1)) + #define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \ while (len >= sizeof(type)) { \ __put_unaligned_t(type, __get_unaligned_t(type, src), dst); \