From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA90BC44503 for ; Thu, 9 Jul 2026 01:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=logP0BkDzgfpBgfCtRyUdHGD12mFR8OHhUuGpKFX0fc=; b=NMf4B14zyGVQw8OIWpvmxdSUv3 lweYQD4VJLtpe0FhdHjFt5SbGnjpn5S8NcHb6dnP074UK77jy8wlXvofiUXkjHu4iJYylzkPwwIrJ /LHHLgX+OTj0dc7wwVPdZuJoQZi/kqeLxUMRpqkDDzNW4dJ1Ig0hPxm8HrPp8rnWNO/0NQWCEiCOj jBKE8ksTiktZMVjUc3pAxHoMldPxMPk2KSZHme1y62u8ho03JlZJgVbz60sjYL3VjXNbxuEsagnWq bobgLNyOwZhggmofVTB1ALIF29s3yTTFhHFmLgf6QOonnw+unAX0SCADKQgAMpWQfI0ZPWpXCgGwA 14nnntFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whdRd-00000000k7e-07aE; Thu, 09 Jul 2026 01:20:53 +0000 Received: from canpmsgout05.his.huawei.com ([113.46.200.220]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1whdRY-00000000k6q-0t47; Thu, 09 Jul 2026 01:20:51 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=logP0BkDzgfpBgfCtRyUdHGD12mFR8OHhUuGpKFX0fc=; b=GMOyW0Y9dGCUAfbHEgIpOCSfEMuETD0KYr6Ue7/qDl7GpDg/5Sjsm1Gv0Y0IEx9z9hjuQn/BR 2nzEy6HW2PEJaQkULjJJTrYZaOyXfj3rMgSC0E2TaG7iEt98R+lOK6nifZTfaMx5zXfaT45lgQf b9N52qi/4XIOax4YomANpFo= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4gwcPT5Nbtz12LJx; Thu, 9 Jul 2026 09:11:57 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 930AB40538; Thu, 9 Jul 2026 09:20:36 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 9 Jul 2026 09:20:33 +0800 Message-ID: <59017dbf-ad6a-4087-963c-5f0807326821@huawei.com> Date: Thu, 9 Jul 2026 09:20:32 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch 01/18] powerpc: Move stack randomization after syscall_enter_from_user_mode() To: Thomas Gleixner , LKML CC: Peter Zijlstra , Michael Ellerman , Shrikanth Hegde , , Kees Cook , Huacai Chen , , Paul Walmsley , Palmer Dabbelt , , Sven Schnelle , , , Mark Rutland , Andy Lutomirski , Oleg Nesterov , Richard Henderson , Russell King , Catalin Marinas , Guo Ren , Geert Uytterhoeven , Thomas Bogendoerfer , Helge Deller , Yoshinori Sato , Richard Weinberger , Chris Zankel , , , , , , , , , Arnd Bergmann , Vineet Gupta , Will Deacon , Brian Cain , Michal Simek , Dinh Nguyen , "David S. Miller" , Andreas Larsson , , , , , , =?UTF-8?Q?Michal_Such=C3=A1nek?= , Jonathan Corbet , References: <20260707181957.433213175@kernel.org> <20260707190253.718191130@kernel.org> From: Jinjie Ruan In-Reply-To: <20260707190253.718191130@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.109.254] X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260708_182048_894143_B2F42830 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org On 7/8/2026 3:05 AM, Thomas Gleixner wrote: > add_random_kstack_offset() is invoked before syscall_enter_from_user_mode() > establishes state. That's wrong because add_random_kstack_offset() calls > into instrumentable code. > > Move it after syscall_enter_from_user_mode() to ensure that state is > correctly established. > > Signed-off-by: Thomas Gleixner > Cc: Michael Ellerman > Cc: Shrikanth Hegde > Cc: linuxppc-dev@lists.ozlabs.org > --- > arch/powerpc/kernel/syscall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- a/arch/powerpc/kernel/syscall.c > +++ b/arch/powerpc/kernel/syscall.c > @@ -19,8 +19,8 @@ notrace long system_call_exception(struc > long ret; > syscall_fn f; > > - add_random_kstack_offset(); > r0 = syscall_enter_from_user_mode(regs, r0); > + add_random_kstack_offset(); Reviewed-by: Jinjie Ruan > > if (unlikely(r0 >= NR_syscalls)) { > if (unlikely(trap_is_unsupported_scv(regs))) { >