From patchwork Thu Aug 22 07:13:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11021C531DF for ; Thu, 22 Aug 2024 07:13:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 969E06B02A6; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91A166B02A7; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7935A6B02A8; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 553B46B02A6 for ; Thu, 22 Aug 2024 03:13:54 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 02E8512144D for ; Thu, 22 Aug 2024 07:13:54 +0000 (UTC) X-FDA: 82479016788.24.D5E0298 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf27.hostedemail.com (Postfix) with ESMTP id DB3C240002 for ; Thu, 22 Aug 2024 07:13:51 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf27.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310752; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gin0KM29g+LOb2tgM21IdolWj9FiJmh08DvLxNUq9yQ=; b=Gl+4X8gsmsD3FpNG/ZiEFR72oqETBe4ptrN2vD+slctxV2XJKMLoh6sr+M7CK0o1EtnrPA 8Mnmn4B+L9iz9Yx/ZDoZ/KtcisMHWtq62rgNwN+Jl104UOGMAMZ5uybgE4EHElPwyElHzB Y8Wrxu2vwAxHNilgu7UAPEJYFslWqPs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310752; a=rsa-sha256; cv=none; b=MAbmRZUsO84ZI+2r2rCXyM2r8BMznq1X91i8H9Odfs885OjIvbfj4w8YIAb/ovM3y7D85y ZJw5eKFJ5fL6CI/aI13P89a5zZRyANcjRW9H2vZOXJROq4TMzFHBunY02G6VD0cZpJw0I+ nquFAKYzLmnV5cC7KjztA8xBKco23Kg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=csgroup.eu; spf=pass (imf27.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvF1Dg6z9sSW; Thu, 22 Aug 2024 09:13:29 +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 RkC5cLxZ4aFG; Thu, 22 Aug 2024 09:13:29 +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 4WqDvD6yC3z9sSH; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D585A8B763; Thu, 22 Aug 2024 09:13:28 +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 6SSl1lnhD-ee; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CBB698B77D; Thu, 22 Aug 2024 09:13:27 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long Date: Thu, 22 Aug 2024 09:13:14 +0200 Message-ID: <525b48eb79978ddba2d1b8ee23b27bd6c5b0b4ee.1724309198.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724310794; l=1276; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=DHKz0nvjKBEZw1qFdyeiMuLRmQ0ExqxUlDOlPsu+3EA=; b=6rTkR9UfUapFGijZerpzLYHhj4PimSMK+GNZzXry6VAozVYosYDA1h8oocTbDByNjWJQ8Sh+H SV2G/Pz6kbDAVsKqsh13uCcc2q8jEtNaLgRwvLicmTZ4KYZyiB5QJXR X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspamd-Queue-Id: DB3C240002 X-Stat-Signature: 6c4x36dr4f44tttmd8e798xu99jjreqn X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724310831-725524 X-HE-Meta: U2FsdGVkX1+te/RYE+MtWmm8cAwdxfE+J+E+LNZVn/rXqWKSakbdSH6PFmlXEQ7yuG2RdPEJoDKWfwyOerHNVR+Ck0E1ci4JoiQUaHgcffTD0HVqiyrMVgUchCoHScD6IM/SAkB2ueD8/x4fl6JA9Ohsxcj1TelnIQS9i0So2tSNUn5ZAyrovbPvjuUCI6G6w04ROZ4tY1mBc1/hVNR21PYMtgeA9LhN0TtKb51IUJ+YtD/KoowZa/915cJpBKTIiSqzJEaWH2GhyS5DOKfQ1mNm4ugd1L/+PzBkRsZcuweOOGMIsg4Q79dIOIFz8WTujdzk+A203h4ztjlIY7hlah2i+92HGptTVmjb9koEVD2tJo93qaEYSe+lrG7FA0MrDYK7piqe+lrRzZ6zJEbU04EOfz3CW4pHnWEJPAYWcuubsvmds6PX0vyn4icuitg+rtTyqz7b8fyWAVsbHj5qxqXCEj3PoVNybuZl6Nex01ft887E/wd7G3bccp2qtyHsAwXwHNECoepl96Ls5v9cx1Xhsk1blyMQL9MXFoNdxe9iNmiu2W06H3LWjF+aQuU3bIGQEyoHq93jNOWrZJemwLokHuBZwnNEAmjniGmhM3RfQMAAt04guyPnDTwi5/Do9Ib4XbaTOyKdWEhEN7lF1VzqLrUs6pZnR2pw0xOiSjNdFmfctxAHXbKOin7MMBMX6teX2Ual1B7BUZr9bZsYvr2d6dfe9g0xMOW+rSg6BNc9+h0KdEZp011QixB3yN5eoQ2r0YU4+8jOUlqJlZgTWp9gkLpOTUbFLMHGFjo2pVWhpee3meCTr41EOC8dvkcpKs+LDXtpmFchvb2RPppP5r1yyBSXj72qnk31CIho2yAm6MnPVjB7p86ISFxCEFtzCVqQftufVu1PmQrVa8aWAqcgGOdFTIn1oFX2dIYOwUIkCRNHG9NAyblqeEPg8EbFQLv32RkPaky1dAyZHGy Ue8ku1KT 7Lz6kdA2VXG2e/l3qumVUtowvKxjCNC1+3JFKN3RStIdFNUvt+ZLZp1a5bHt5uarj6MLqjJsjOqtMTCIfEh2NDWNx52wJzvtBic4XZP1jzWJKcU6duCVMvU6bI/I6aIkZd+Gv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Performing SMP atomic operations on u64 fails on powerpc32. Random driver generation is handled as unsigned long not u64, see for instance base_cnrg or struct crng. Use the same type for vDSO's getrandom as it gets copied from the above. This is also in line with the local current_generation which is already an unsigned long. Signed-off-by: Christophe Leroy --- include/vdso/datapage.h | 2 +- include/vdso/getrandom.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index b85f24cac3f5..00b66a9b5778 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -123,7 +123,7 @@ struct vdso_data { * @is_ready: boolean signaling whether the RNG is initialized */ struct vdso_rng_data { - u64 generation; + unsigned long generation; u8 is_ready; }; diff --git a/include/vdso/getrandom.h b/include/vdso/getrandom.h index a8b7c14b0ae0..36fd166bf330 100644 --- a/include/vdso/getrandom.h +++ b/include/vdso/getrandom.h @@ -38,7 +38,7 @@ struct vgetrandom_state { }; u8 batch_key[CHACHA_BLOCK_SIZE * 2]; }; - u64 generation; + unsigned long generation; u8 pos; bool in_use; };