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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 90EBEC43458 for ; Thu, 9 Jul 2026 02:37:56 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gwfJg1jxDz3cMB; Thu, 09 Jul 2026 12:37:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=113.46.200.219 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783564675; cv=none; b=LpE/wcAAqL/xUHyWbhCbJ6WsfB5MUbc1gV64o/Xyb9FXQfjkb96HUs+yNGSlivYj5O7xdVXSTnsqSRhgZI2YV0MfVaorIVg5nkaV2g0lCMvFknpeUD0dAh3b4I6QhQxJe0xZFf7oFGce90QTYx9XWwHvomTah0UPBVAqf73y0e0Tbw41qKpeYy8rr/XfCq13QF7BeMVcU6aLFkcGL1VCvi9lALGq4N3FulFjztXn2bSmbLgJjEEx5OOdICGGscJ6CHiv6siE4pydO/2taJzI3t0LSiqkyS1icrz8TWV5deUlBkflluwfWAF1aA4u+oNwZxkjrY7HXct8PNU+kvFrHw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783564675; c=relaxed/relaxed; bh=CwcGE+6TqYRPrrhAkEtXG7hYy5lii8lETPb+wdpZQ2A=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=QFPYCzoDe3WTxM0NP1tqPptjYzva2r9GDNDnrZug+HHEx7UOLK2f2bePi3PX+u3J8K3UDxLIcdOfb14F2eLMcesTMYfrlUkv/KdsoA4Yy/Bxyn1xp31USfbw636uUp/cwPTV+B3smnX0c5ruojLbo1hmnelj38eY/XikMHDL139xKleQFl0hcTCp9ob51v+XxM0TNYGYJEsaCc/RwWbk71+syZLo7ilOJpfA222YsfOx50XV2evyrG9Uk8/0KydjXhcUvSBTtkxmDRyUgYYhqJ28R65yEtR4eC6o7Gl+GIrR6M0PokPUcuEVDQJlpo/Unoj1TgsSnLlnk0JsOfFlew== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=3cOfegVU; dkim-atps=neutral; spf=pass (client-ip=113.46.200.219; helo=canpmsgout04.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=3cOfegVU; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=113.46.200.219; helo=canpmsgout04.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (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 4gwfJd6Sslz3by8 for ; Thu, 09 Jul 2026 12:37:53 +1000 (AEST) 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 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list 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-Originating-IP: [10.67.109.254] 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)]; >