From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (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 B1C9B337BB5; Thu, 9 Jul 2026 02:37:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.219 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783564676; cv=none; b=TU61xdhdRyNYLLYgDJ6g07AF5IJOoEu0ELQFF6kWqiQolOamRRZ/tcYxXvwcXnQoobY4fu7wJfLwgLzWZkqFs/VgK/qEPXWKeBInf/3X4TmbEkJozqQ76+RnYRMpIisuzgmy+bzdK5PSOKARRVPF4oWuQnTFNCEqPjRbKiQ0Ouc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783564676; c=relaxed/simple; bh=TWqg97g+HYPzQx8gqri4UBofQqW1xaj48tP3wC0CcTA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=VomFlaBG2mdbCV3YobNC6zCic3tePa+OBfdso4yoZB6KlCpg9XFVfq9S1Va93vc3+81wKKlxOhj5QAvOWt91wWY09WrsrDUcsyATL+m1DSRNIl67cyZO+OmZyAL9Dz6X3TzDZNUIAaHx40Cmrf3x4PLbjN4j0OpcWcoydmeNDYM= 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=3cOfegVU; arc=none smtp.client-ip=113.46.200.219 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="3cOfegVU" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=CwcGE+6TqYRPrrhAkEtXG7hYy5lii8lETPb+wdpZQ2A=; b=3cOfegVUtWQVDj2YBQq8VWPfgH+UfrImjCwfWrU3iHIUzj4n/1U144z1QxaNoxkimdADHvK3H Vm/aO6VgBUD7N6if7he9FiIsMVhv/ND+dvY9MlaJYWrIj3fW/dcz8EHcLzbKaxlg6bBXyOF3Q5W L2m32cr9A4J8YhKN1aHIjMQ= Received: from mail.maildlp.com (unknown [172.19.162.223]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4gwf5r5KcNz1prKM; Thu, 9 Jul 2026 10:28:32 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 2FDFD40561; Thu, 9 Jul 2026 10:37:49 +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:37:46 +0800 Message-ID: Date: Thu, 9 Jul 2026 10:37:44 +0800 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch 04/18] loongarch/syscall: Use syscall_enter_from_user_mode_randomize_stack() To: Thomas Gleixner , LKML CC: Peter Zijlstra , Huacai Chen , , Michael Ellerman , Shrikanth Hegde , , Kees Cook , 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.865955911@kernel.org> From: Jinjie Ruan In-Reply-To: <20260707190253.865955911@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: Huacai Chen > Cc: loongarch@lists.linux.dev > --- > arch/loongarch/kernel/syscall.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > --- a/arch/loongarch/kernel/syscall.c > +++ b/arch/loongarch/kernel/syscall.c > @@ -11,7 +11,6 @@ > #include > #include > #include > -#include > #include > #include > > @@ -70,9 +69,7 @@ void noinstr __no_stack_protector do_sys > regs->orig_a0 = regs->regs[4]; > regs->regs[4] = -ENOSYS; > > - nr = syscall_enter_from_user_mode(regs, nr); > - > - add_random_kstack_offset(); > + nr = syscall_enter_from_user_mode_randomize_stack(regs, nr); Reviewed-by: Jinjie Ruan > > if (nr < NR_syscalls) { > syscall_fn = sys_call_table[array_index_nospec(nr, NR_syscalls)]; >