Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1867087lqm; Fri, 3 May 2024 08:39:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlzEyfjHBuGfDHWqdZW8Lp2VAd0OF1LrgkPjD4+SZt0atLn1MiNjfmyrEHvIXwS6IkJbHFXImnQRvNyRy6dCFd5FyJWXB1zinRlJ5iWw== X-Google-Smtp-Source: AGHT+IFbX1fh8R7hU8WrzV/wbBAulw0Z/rKQ/LwMdfzdk9p9lGoIdaEa1N5p37/FG+knOBZS/CoO X-Received: by 2002:a17:90a:f188:b0:2b1:1c1e:f489 with SMTP id bv8-20020a17090af18800b002b11c1ef489mr2752872pjb.4.1714750757435; Fri, 03 May 2024 08:39:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714750757; cv=pass; d=google.com; s=arc-20160816; b=JB5oz0BPfUTiBwAI07H9cV4T5kfl74sOU5EYwJaHbQKjsAO+kT04Tzb9QdLiZLIiuI 68edI3culLjsFMnLGoVkHPNeqYqx0WpP3Fre36fo8mnd77fT5O91e5kZLrM5dDzEGs9q qdDrSDgN/hdIL6Kxny5lVlGo5ErY0/rUwCoqvF6pT7aNWp3JoeaWpyteJ8gs9AbB9/pb 3I9RKBGZSxMIqoEkqvGvAJfAECmIeKMRNtZxsvbsYAQLR2hADD1rWi8H3ZTwjOv1lgNe rFs7rdJILAXEHljq4194DJfADDia2Bw6nugAzWuTY8zBbWsezw5ZhY5bTGf10hZ2sjzS hmJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NM4QMRdSpWuD91EDzP8Lokbi+ckmwnpzjvewihy4ylU=; fh=4BDVTfJbo8P5OG61S7WB6tlTrLd9jpKzYS6+JDGpTTw=; b=aHGza8MDhtdbY3lqGqwnzjPO5RvDtRa9ja0Ib8UGn3pYpMcDKkj5dpkkNhWe6myl1z aXIMxnba+JHgNrOMR/luX+ZzuO5Mj/4gB3EZbcWKtn/ht2+RqPnYEk8HIakvukQzULOm s9yE22vx4rqSIDHCzXZ6lumlVsYMP9nJ+ePd0vCJLx0eImvgq0DLyFlldg5kem+dwNJX ej6RO93jYJtv70bVSbERJh9Ij7LXJjRhQ/W7etJJl9VPq2ZNv74d+EHn6Sm+0BndEkBP rAYeD7Y5ke4rZrRLh/BXf1GZtEDtiYacDKXHYJAE9BLj5Lrsm2hPjm+m6rsKsZP8vcMY MESA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ElaEb/0r"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-167840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q6-20020a17090a304600b002a79ba0f002si3121818pjl.189.2024.05.03.08.39.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 08:39:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ElaEb/0r"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-167840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3CD63284E33 for ; Fri, 3 May 2024 15:38:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E17B15444D; Fri, 3 May 2024 15:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ElaEb/0r" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F0E9D1BF31 for ; Fri, 3 May 2024 15:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714750721; cv=none; b=mf1u2/sETpVvEcq1KHPaM7rwPXUnao2Nmzbk8CV1hKGa+WdaOO/KXRGTCh/3+kngBhbwmxhAQuGTyJzunvBpxBkbTEJdeYOb1jXTMOInrQ5t3+wIuXtgE44hWXagEShMb/0Xwj8nu+ash9S0Pz8DKaUl0OspniFU64AQtm9yJTQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714750721; c=relaxed/simple; bh=d+1hj+KtolyClSgAn/aaA7UuMqZuu3CIQzON9Od1rac=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g1LXCschjsHOKqPje0vqQPt7ezmuwHAtdYp1EMolKsnLnj3FCuSa2qlWBo7aUH/k4+bk6lPhwph7xNca+dep/LYLEfqgmp0Ca/ML4+oWWIGh2zJK+yfrfk217RG7EkRy080zzakuhrWF7P8OOEHeBHlN+iQJcvei7becDulrEPA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ElaEb/0r; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71346C116B1; Fri, 3 May 2024 15:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714750720; bh=d+1hj+KtolyClSgAn/aaA7UuMqZuu3CIQzON9Od1rac=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ElaEb/0rYGv83b5Ow2uJIH0YREDs7PKx2/ArLfXiEgS4C27d6R39w6YGU3RpdaWiL 7hedzZiynNe4Ok9N2kkMdWOaVT+nOREb7GT0gLy9VK8YDPmvpfqCyFqdAO759aky4R ftN8CO8sJ+GnGPAJI3QhRpsEQXqyEoLv0qsBBSLvK0pMIou37Y4vEu0nr8j+dQdb/Z Qci7i5cd/1jPfBCQAa8eSSdEgYEA/qns7CIEb5bKHY0shglekrqDBu6kw54kJNTINz IAWiVR2jy/Mb4MVLlQq+dJlUI5oPTaMCkY6fi1fE8MGfpz2kcV6imol9Q4V+xc9Vbw 32dk6aps6ljIQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 1737DCE098A; Fri, 3 May 2024 08:38:40 -0700 (PDT) Date: Fri, 3 May 2024 08:38:40 -0700 From: "Paul E. McKenney" To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Daniel Sneddon , Pawan Gupta , Thomas Gleixner , Alexandre Chartre , Konrad Rzeszutek Wilk , Peter Zijlstra , Greg Kroah-Hartman , Sean Christopherson , Andrew Cooper , Dave Hansen , Nikolay Borisov , KP Singh , Waiman Long , Borislav Petkov , Ingo Molnar Subject: Re: [PATCH v4 3/5] x86/syscall: Mark exit[_group] syscall handlers __noreturn Message-ID: <539fc0d0-eb4f-4403-8385-ecdbefa6ca44@paulmck-laptop> Reply-To: paulmck@kernel.org References: <3b99cb2919c88ab3d353337423b2f0f1b9173f0a.1713559768.git.jpoimboe@kernel.org> <0c410ba5-0e42-43b6-80b8-a69c5419a97d@paulmck-laptop> <20240421052540.w7gtahoko2qerhqq@treble> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, May 02, 2024 at 04:48:13PM -0700, Paul McKenney wrote: > On Sun, Apr 21, 2024 at 2:47 PM Paul McKenney wrote: > > > > And this definitely helped, thank you! > > > > However, this one still remains: > > > > vmlinux.o: warning: objtool: ia32_sys_call+0x29b6: > > __ia32_sys_exit_group() is missing a __noreturn annotation > > And looking at the patched code, this function looks to me to be > correctly marked. > > No idea... :-/ But thank you for getting rid of the other warning: Tested-by: Paul E. McKenney > > Please see below for my diffs against next-20240419, in case I messed > > something up. > > > > I attached a copy as well, given that I am away from mutt, hence using > > gmail directly. > > > > Thanx, Paul > > > > ----------------------------------------------------- > > > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c > > index 6de50b80702e6..9810ba2857a5c 100644 > > --- a/arch/x86/entry/common.c > > +++ b/arch/x86/entry/common.c > > @@ -49,7 +49,10 @@ static __always_inline bool do_syscall_x64(struct > > pt_regs *regs, int nr) > > > > if (likely(unr < NR_syscalls)) { > > unr = array_index_nospec(unr, NR_syscalls); > > - regs->ax = x64_sys_call(regs, unr); > > + if (likely(cpu_feature_enabled(X86_FEATURE_INDIRECT_BRANCH_OK))) > > + regs->ax = sys_call_table[unr](regs); > > + else > > + regs->ax = x64_sys_call(regs, unr); > > return true; > > } > > return false; > > @@ -66,7 +69,10 @@ static __always_inline bool do_syscall_x32(struct > > pt_regs *regs, int nr) > > > > if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { > > xnr = array_index_nospec(xnr, X32_NR_syscalls); > > - regs->ax = x32_sys_call(regs, xnr); > > + if (likely(cpu_feature_enabled(X86_FEATURE_INDIRECT_BRANCH_OK))) > > + regs->ax = x32_sys_call_table[xnr](regs); > > + else > > + regs->ax = x32_sys_call(regs, xnr); > > return true; > > } > > return false; > > @@ -162,7 +168,10 @@ static __always_inline void > > do_syscall_32_irqs_on(struct pt_regs *regs, int nr) > > > > if (likely(unr < IA32_NR_syscalls)) { > > unr = array_index_nospec(unr, IA32_NR_syscalls); > > - regs->ax = ia32_sys_call(regs, unr); > > + if (likely(cpu_feature_enabled(X86_FEATURE_INDIRECT_BRANCH_OK))) > > + regs->ax = ia32_sys_call_table[unr](regs); > > + else > > + regs->ax = ia32_sys_call(regs, unr); > > } else if (nr != -1) { > > regs->ax = __ia32_sys_ni_syscall(regs); > > } > > diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c > > index c2235bae17ef6..aab31760b4e3e 100644 > > --- a/arch/x86/entry/syscall_32.c > > +++ b/arch/x86/entry/syscall_32.c > > @@ -14,25 +14,16 @@ > > #endif > > > > #define __SYSCALL(nr, sym) extern long __ia32_##sym(const struct pt_regs *); > > - > > #include > > #undef __SYSCALL > > > > -/* > > - * The sys_call_table[] is no longer used for system calls, but > > - * kernel/trace/trace_syscalls.c still wants to know the system > > - * call address. > > - */ > > -#ifdef CONFIG_X86_32 > > #define __SYSCALL(nr, sym) __ia32_##sym, > > -const sys_call_ptr_t sys_call_table[] = { > > +const sys_call_ptr_t ia32_sys_call_table[] = { > > #include > > }; > > #undef __SYSCALL > > -#endif > > > > #define __SYSCALL(nr, sym) case nr: return __ia32_##sym(regs); > > - > > long ia32_sys_call(const struct pt_regs *regs, unsigned int nr) > > { > > switch (nr) { > > diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c > > index 33b3f09e6f151..ff36a993a07e0 100644 > > --- a/arch/x86/entry/syscall_64.c > > +++ b/arch/x86/entry/syscall_64.c > > @@ -8,14 +8,13 @@ > > #include > > > > #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); > > +#define __SYSCALL_NORETURN(nr, sym) extern long __noreturn > > __x64_##sym(const struct pt_regs *); > > #include > > #undef __SYSCALL > > > > -/* > > - * The sys_call_table[] is no longer used for system calls, but > > - * kernel/trace/trace_syscalls.c still wants to know the system > > - * call address. > > - */ > > +#undef __SYSCALL_NORETURN > > +#define __SYSCALL_NORETURN __SYSCALL > > + > > #define __SYSCALL(nr, sym) __x64_##sym, > > const sys_call_ptr_t sys_call_table[] = { > > #include > > @@ -23,7 +22,6 @@ const sys_call_ptr_t sys_call_table[] = { > > #undef __SYSCALL > > > > #define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs); > > - > > long x64_sys_call(const struct pt_regs *regs, unsigned int nr) > > { > > switch (nr) { > > diff --git a/arch/x86/entry/syscall_x32.c b/arch/x86/entry/syscall_x32.c > > index 03de4a9321318..4221ecce6e689 100644 > > --- a/arch/x86/entry/syscall_x32.c > > +++ b/arch/x86/entry/syscall_x32.c > > @@ -8,11 +8,20 @@ > > #include > > > > #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); > > +#define __SYSCALL_NORETURN(nr, sym) extern long __noreturn > > __x64_##sym(const struct pt_regs *); > > #include > > #undef __SYSCALL > > > > -#define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs); > > +#undef __SYSCALL_NORETURN > > +#define __SYSCALL_NORETURN __SYSCALL > > + > > +#define __SYSCALL(nr, sym) __x64_##sym, > > +const sys_call_ptr_t x32_sys_call_table[] = { > > +#include > > +}; > > +#undef __SYSCALL > > > > +#define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs); > > long x32_sys_call(const struct pt_regs *regs, unsigned int nr) > > { > > switch (nr) { > > diff --git a/arch/x86/entry/syscalls/syscall_64.tbl > > b/arch/x86/entry/syscalls/syscall_64.tbl > > index a396f6e6ab5bf..7ec68d94eb593 100644 > > --- a/arch/x86/entry/syscalls/syscall_64.tbl > > +++ b/arch/x86/entry/syscalls/syscall_64.tbl > > @@ -2,7 +2,7 @@ > > # 64-bit system call numbers and entry vectors > > # > > # The format is: > > -# > > +# [0 noreturn] > > # > > # The __x64_sys_*() stubs are created on-the-fly for sys_*() system calls > > # > > @@ -68,7 +68,7 @@ > > 57 common fork sys_fork > > 58 common vfork sys_vfork > > 59 64 execve sys_execve > > -60 common exit sys_exit > > +60 common exit sys_exit 0 noreturn > > 61 common wait4 sys_wait4 > > 62 common kill sys_kill > > 63 common uname sys_newuname > > @@ -239,7 +239,7 @@ > > 228 common clock_gettime sys_clock_gettime > > 229 common clock_getres sys_clock_getres > > 230 common clock_nanosleep sys_clock_nanosleep > > -231 common exit_group sys_exit_group > > +231 common exit_group sys_exit_group 0 noreturn > > 232 common epoll_wait sys_epoll_wait > > 233 common epoll_ctl sys_epoll_ctl > > 234 common tgkill sys_tgkill > > diff --git a/arch/x86/include/asm/cpufeatures.h > > b/arch/x86/include/asm/cpufeatures.h > > index 3c7434329661c..d64b0a5291f10 100644 > > --- a/arch/x86/include/asm/cpufeatures.h > > +++ b/arch/x86/include/asm/cpufeatures.h > > @@ -470,6 +470,7 @@ > > #define X86_FEATURE_BHI_CTRL (21*32+ 2) /* "" BHI_DIS_S HW control available */ > > #define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* "" BHI_DIS_S HW > > control enabled */ > > #define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* "" Clear > > branch history at vmexit using SW loop */ > > +#define X86_FEATURE_INDIRECT_BRANCH_OK (21*32+ 5) /* "" It's OK to > > use indirect branches */ > > > > /* > > * BUG word(s) > > diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h > > index 2fc7bc3863ff6..dfb59521244c2 100644 > > --- a/arch/x86/include/asm/syscall.h > > +++ b/arch/x86/include/asm/syscall.h > > @@ -16,14 +16,20 @@ > > #include /* for TS_COMPAT */ > > #include > > > > -/* This is used purely for kernel/trace/trace_syscalls.c */ > > typedef long (*sys_call_ptr_t)(const struct pt_regs *); > > extern const sys_call_ptr_t sys_call_table[]; > > > > +#if defined(CONFIG_X86_32) > > +#define ia32_sys_call_table sys_call_table > > +#else > > /* > > * These may not exist, but still put the prototypes in so we > > * can use IS_ENABLED(). > > */ > > +extern const sys_call_ptr_t ia32_sys_call_table[]; > > +extern const sys_call_ptr_t x32_sys_call_table[]; > > +#endif > > + > > extern long ia32_sys_call(const struct pt_regs *, unsigned int nr); > > extern long x32_sys_call(const struct pt_regs *, unsigned int nr); > > extern long x64_sys_call(const struct pt_regs *, unsigned int nr); > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > > index ab18185894dfd..5fca46c78daf2 100644 > > --- a/arch/x86/kernel/cpu/bugs.c > > +++ b/arch/x86/kernel/cpu/bugs.c > > @@ -1665,6 +1665,12 @@ static void __init bhi_select_mitigation(void) > > if (!IS_ENABLED(CONFIG_X86_64)) > > return; > > > > + /* > > + * There's no HW mitigation in place. Mark indirect branches as > > + * "not OK". > > + */ > > + setup_clear_cpu_cap(X86_FEATURE_INDIRECT_BRANCH_OK); > > + > > /* Mitigate KVM by default */ > > setup_force_cpu_cap(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT); > > pr_info("Spectre BHI mitigation: SW BHB clearing on vm exit\n"); > > @@ -1679,6 +1685,28 @@ static void __init spectre_v2_select_mitigation(void) > > enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline(); > > enum spectre_v2_mitigation mode = SPECTRE_V2_NONE; > > > > + /* > > + * X86_FEATURE_INDIRECT_BRANCH_OK indicates that indirect calls are > > + * "OK" to use due to (at least) one of the following being true: > > + * > > + * - the CPU isn't vulnerable to Spectre v2, BHI, etc; > > + * > > + * - a HW mitigation is in place (e.g., IBRS, eIBRS+BHI_DIS_S); or > > + * > > + * - the user disabled mitigations. > > + * > > + * Clearing the bit enables certain indirect branch "easy targets" [*] > > + * to be converted to a series of direct branches. > > + * > > + * Assume innocence until proven guilty: set it now and clear it later > > + * if/when needed. > > + * > > + * [*] The closer the indirect branch is to kernel entry, and the more > > + * user-controlled registers there are, the easier target it may be > > + * for future Spectre v2 variants. > > + */ > > + setup_force_cpu_cap(X86_FEATURE_INDIRECT_BRANCH_OK); > > + > > /* > > * If the CPU is not affected and the command line mode is NONE or AUTO > > * then nothing to do. > > @@ -1765,11 +1793,16 @@ static void __init spectre_v2_select_mitigation(void) > > break; > > > > case SPECTRE_V2_LFENCE: > > + setup_clear_cpu_cap(X86_FEATURE_INDIRECT_BRANCH_OK); > > + fallthrough; > > case SPECTRE_V2_EIBRS_LFENCE: > > setup_force_cpu_cap(X86_FEATURE_RETPOLINE_LFENCE); > > - fallthrough; > > + setup_force_cpu_cap(X86_FEATURE_RETPOLINE); > > + break; > > > > case SPECTRE_V2_RETPOLINE: > > + setup_clear_cpu_cap(X86_FEATURE_INDIRECT_BRANCH_OK); > > + fallthrough; > > case SPECTRE_V2_EIBRS_RETPOLINE: > > setup_force_cpu_cap(X86_FEATURE_RETPOLINE); > > break; > > diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c > > index 89df5d89d6640..c7d4bf955d2ba 100644 > > --- a/arch/x86/um/sys_call_table_32.c > > +++ b/arch/x86/um/sys_call_table_32.c > > @@ -24,6 +24,7 @@ > > #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) > > > > #define __SYSCALL(nr, sym) extern asmlinkage long sym(unsigned long, > > unsigned long, unsigned long, unsigned long, unsigned long, unsigned > > long); > > +#define __SYSCALL_NORETURN __SYSCALL > > #include > > > > #undef __SYSCALL > > diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c > > index b0b4cfd2308c8..4760c40ae5cd0 100644 > > --- a/arch/x86/um/sys_call_table_64.c > > +++ b/arch/x86/um/sys_call_table_64.c > > @@ -19,6 +19,7 @@ > > #define sys_ioperm sys_ni_syscall > > > > #define __SYSCALL(nr, sym) extern asmlinkage long sym(unsigned long, > > unsigned long, unsigned long, unsigned long, unsigned long, unsigned > > long); > > +#define __SYSCALL_NORETURN __SYSCALL > > #include > > > > #undef __SYSCALL > > diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh > > index 6abe143889ef6..16487d47e06a3 100755 > > --- a/scripts/syscalltbl.sh > > +++ b/scripts/syscalltbl.sh > > @@ -54,7 +54,7 @@ nxt=0 > > > > grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | { > > > > - while read nr abi name native compat ; do > > + while read nr abi name native compat noreturn; do > > > > if [ $nxt -gt $nr ]; then > > echo "error: $infile: syscall table is not sorted or duplicates the > > same syscall number" >&2 > > @@ -66,7 +66,9 @@ grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | { > > nxt=$((nxt + 1)) > > done > > > > - if [ -n "$compat" ]; then > > + if [ -n "$noreturn" ]; then > > + echo "__SYSCALL_NORETURN($nr, $native)" > > + elif [ -n "$compat" ]; then > > echo "__SYSCALL_WITH_COMPAT($nr, $native, $compat)" > > elif [ -n "$native" ]; then > > echo "__SYSCALL($nr, $native)" > > diff --git a/tools/objtool/noreturns.h b/tools/objtool/noreturns.h > > index 7ebf29c911849..1e8141ef1b15d 100644 > > --- a/tools/objtool/noreturns.h > > +++ b/tools/objtool/noreturns.h > > @@ -7,12 +7,16 @@ > > * Yes, this is unfortunate. A better solution is in the works. > > */ > > NORETURN(__fortify_panic) > > +NORETURN(__ia32_sys_exit) > > +NORETURN(__ia32_sys_exit_group) > > NORETURN(__kunit_abort) > > NORETURN(__module_put_and_kthread_exit) > > NORETURN(__reiserfs_panic) > > NORETURN(__stack_chk_fail) > > NORETURN(__tdx_hypercall_failed) > > NORETURN(__ubsan_handle_builtin_unreachable) > > +NORETURN(__x64_sys_exit) > > +NORETURN(__x64_sys_exit_group) > > NORETURN(arch_cpu_idle_dead) > > NORETURN(bch2_trans_in_restart_error) > > NORETURN(bch2_trans_restart_error) > > > > On Sun, Apr 21, 2024 at 1:40 PM Paul McKenney wrote: > > > > > > They apply fine as is, so I have started tests with that pair of patches. > > > > > > Thanx, Paul > > > > > > On Sat, Apr 20, 2024 at 10:25 PM Josh Poimboeuf wrote: > > > > > > > > On Sat, Apr 20, 2024 at 06:58:58AM -0700, Paul E. McKenney wrote: > > > > > On Fri, Apr 19, 2024 at 02:09:49PM -0700, Josh Poimboeuf wrote: > > > > > > The direct-call syscall dispatch functions don't know that the exit() > > > > > > and exit_group() syscall handlers don't return. As a result the call > > > > > > sites aren't optimized accordingly. > > > > > > > > > > > > Fix that by marking those exit syscall declarations as __noreturn. > > > > > > > > > > > > Fixes the following warnings: > > > > > > > > > > > > vmlinux.o: warning: objtool: x64_sys_call+0x2804: __x64_sys_exit() is missing a __noreturn annotation > > > > > > vmlinux.o: warning: objtool: ia32_sys_call+0x29b6: __ia32_sys_exit_group() is missing a __noreturn annotation > > > > > > > > > > > > Fixes: 7390db8aea0d ("x86/bhi: Add support for clearing branch history at syscall entry") > > > > > > Reported-by: "Paul E. McKenney" > > > > > > Closes: https://lkml.kernel.org/lkml/6dba9b32-db2c-4e6d-9500-7a08852f17a3@paulmck-laptop > > > > > > Signed-off-by: Josh Poimboeuf > > > > > > > > > > Looks good, but it does not apply on top of current -next and I don't > > > > > trust myself to hand-apply it (something about having just got off of > > > > > a flight across the big pond). > > > > > > > > > > Could you please let me know what else do I need to pull in to be able > > > > > to cleanly apply this one? > > > > > > > > This patch has a dependency on an earlier patch in the set: > > > > > > > > https://lkml.kernel.org/lkml/982d05a2f669140f26500bee643011896d661094.1713559768.git.jpoimboe@kernel.org > > > > > > > > Though I think it's not a hard dependency and I could reverse the order > > > > of the patches if needed. > > > > > > > > -- > > > > Josh