From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (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 F3FD8337BB5; Thu, 9 Jul 2026 02:38:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783564712; cv=none; b=eh1tTIxmco1WONYkFEYSaALLHd+p89Bsq+yJ+5HRtwN4k7Mm8TCLjOHbhHkI6/ei6Wz7yEWN27t7b2GUizBivwLMjgsr04pYIZTU1Lb2yXObFleSjjeMsMZUoyOj9Xnf0qcbo3ZKzfeeYe6tLVWA5j2gMQa0lWAyn2OwPTZafUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783564712; c=relaxed/simple; bh=iS+26+jqPEYUIg+ersU8BTTr/PDh9fxLaAxhF+p4vRY=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=jKs3UasfKx2wSDUHtUI50pPTMzSWE4uX5tIPt0Q7CM/ncGZRyV/HqGl0Tr89y6xOb5j+o3sTSft2U3+GQt/CmJ/I34I7uRAi0e1wmEli/96zPWUdwlPUYbJ4SzS3oUTAJUo6gpq44pusoiLUNu94BlElgGHe2wqit2SfrFLDea0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=ST3e9oUK; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="ST3e9oUK" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=Ww0l0J+WzLm2I007l67w1IY4Z5stSto6ys5C8AACtYs=; b=ST3e9oUKssOfPmMY3DgfPuqdPm7bagpb0kNr8jU2bDSxjwXVWz68rymLUIMXeQbnu3KrJiO/1 VOS0dWhOMt501L/QtXkMkYOfbb1FssgbN72OTxVQKogkmpced3u2bb3UZvwPs8eRy/beAHmmRn+ XCn/kfpMz8zNU2xwSERmJ3w= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4gwf6g4p9Kzcb0T; Thu, 9 Jul 2026 10:29:15 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 2848F2012A; Thu, 9 Jul 2026 10:38:20 +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 10:38:17 +0800 Message-ID: <4137b646-3b51-41e7-b5c1-d45ab5c6a535@huawei.com> Date: Thu, 9 Jul 2026 10:38:16 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch 05/18] powerpc/syscall: Use syscall_enter_from_user_mode_randomize_stack() 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.918861529@kernel.org> From: Jinjie Ruan In-Reply-To: <20260707190253.918861529@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To dggpemf500011.china.huawei.com (7.185.36.131) On 7/8/2026 3:06 AM, Thomas Gleixner wrote: > syscall_enter_from_user_mode_randomize_stack() replaces > syscall_enter_from_user_mode() and the subsequent invocation of > add_random_kstack_offset(). > > The advantage is that it applies the stack randomization right after > enter_from_user_mode() and thereby avoids the overhead of get/put_cpu_var() > as that code is invoked with interrupts disabled. > > No functional change. > > Signed-off-by: Thomas Gleixner > Cc: Michael Ellerman > Cc: Shrikanth Hegde > Cc: linuxppc-dev@lists.ozlabs.org > --- > arch/powerpc/kernel/syscall.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > --- a/arch/powerpc/kernel/syscall.c > +++ b/arch/powerpc/kernel/syscall.c > @@ -2,7 +2,6 @@ > > #include > #include > -#include > #include > > #include > @@ -19,8 +18,7 @@ notrace long system_call_exception(struc > long ret; > syscall_fn f; > > - r0 = syscall_enter_from_user_mode(regs, r0); > - add_random_kstack_offset(); > + r0 = syscall_enter_from_user_mode_randomize_stack(regs, r0); Reviewed-by: Jinjie Ruan > > if (unlikely(r0 >= NR_syscalls)) { > if (unlikely(trap_is_unsupported_scv(regs))) { >