Re: [PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-11-21 Thread Josh Poimboeuf
already defines get_user() to __get_user(), with __get_user() having an access_ok(). It would be really nice to have the same behavior and shared code across all the arches. -- Josh

Re: [PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-11-21 Thread Josh Poimboeuf
*/ #endif ASM_BARRIER_NOSPEC 11: .endm /* .. and the same for __get_user, just without the range checks */ SYM_FUNC_START(__get_user_nocheck_1) __get_user_nocheck_nospec ASM_STAC UACCESS movzbl (%_ASM_AX),%edx xor %eax,%eax ASM_CLAC RET SYM_FUNC_END(__get_user_nocheck_1) EXPORT_SYMBOL(__get_user_nocheck_1) -- Josh

Re: [PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-11-21 Thread Josh Poimboeuf
> On Fri, 15 Nov 2024 at 15:06, Josh Poimboeuf wrote: > So I think the thing to do is > > (a) find out which __get_user() it is that matters so much for that load > > Do you have a profile somewhere? > > (b) convert them to use "unsafe_get_user()", with

Re: [PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-11-15 Thread 'Josh Poimboeuf'
On Fri, Nov 08, 2024 at 05:12:53PM +, David Laight wrote: > From: Josh Poimboeuf > > On Mon, Oct 28, 2024 at 06:56:15PM -0700, Josh Poimboeuf wrote: > > > The barrier_nospec() in 64-bit __get_user() is slow. Instead use > > > pointer masking to force the user point

Re: [PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-29 Thread Josh Poimboeuf
it makes sense to hook into that existing can_do_masked_user_access() thing. The patch looks good, and it boots without blowing up. Thanks! Reviewed-by: Josh Poimboeuf -- Josh

Re: [PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-10-28 Thread Josh Poimboeuf
On Mon, Oct 28, 2024 at 06:56:15PM -0700, Josh Poimboeuf wrote: > The barrier_nospec() in 64-bit __get_user() is slow. Instead use > pointer masking to force the user pointer to all 1's if a previous > access_ok() mispredicted true for an invalid address. Linus pointed out that __

[PATCH v3 0/6] x86/uaccess: avoid barrier_nospec()

2024-10-28 Thread Josh Poimboeuf
user() and converge code. Josh Poimboeuf (6): x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user() x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user() x86/uaccess: Avoid barrier_nospec() in 32-bit copy_from_user() x86/uaccess: Convert 32-bit get_user() to unconditional pointer

[PATCH v3 1/6] x86/uaccess: Avoid barrier_nospec() in 64-bit copy_from_user()

2024-10-28 Thread Josh Poimboeuf
cal speculation issue"). Link: https://lore.kernel.org/202410281344.d02c72a2-oliver.s...@intel.com Signed-off-by: Josh Poimboeuf --- arch/powerpc/include/asm/uaccess.h | 2 ++ arch/x86/include/asm/uaccess_32.h | 1 + arch/x86/include/asm/uaccess_64.h | 1 + include/linux/uaccess.h

[PATCH v3 4/6] x86/uaccess: Convert 32-bit get_user() to unconditional pointer masking

2024-10-28 Thread Josh Poimboeuf
Convert the 32-bit get_user() implementations to use the new unconditional masking scheme for consistency with 64-bit. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/arch/x86/lib

[PATCH v3 2/6] x86/uaccess: Avoid barrier_nospec() in 64-bit __get_user()

2024-10-28 Thread Josh Poimboeuf
er address masking non-canonical speculation issue"). Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S index 4357ec2a0bfc..998d5be6b794 100644 ---

[PATCH v3 6/6] x86/uaccess: Converge [__]get_user() implementations

2024-10-28 Thread Josh Poimboeuf
The x86 implementations of get_user() and __get_user() are now identical. Merge their implementations and make the __get_user() implementations aliases of their get_user() counterparts. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 58 +- 1

[PATCH v3 5/6] x86/uaccess: Avoid barrier_nospec() in 32-bit __get_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 34-bit __get_user() is slow. Instead use pointer masking to force the user pointer to all 1's if the access_ok() mispredicted true for an invalid address. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/getuser.S | 18 -- 1 file changed, 18 dele

[PATCH v3 3/6] x86/uaccess: Avoid barrier_nospec() in 32-bit copy_from_user()

2024-10-28 Thread Josh Poimboeuf
The barrier_nospec() in 32-bit copy_from_user() is slow. Instead use pointer masking to force the user pointer to all 1's if a previous access_ok() mispredicted true for an invalid address. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/uaccess.h

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-20 Thread Josh Poimboeuf
On Sun, Oct 20, 2024 at 04:11:25PM -0700, Josh Poimboeuf wrote: > #define FORCE_CANONICAL > \ > ALTERNATIVE_2 > \ > "

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-20 Thread Josh Poimboeuf
On Sun, Oct 20, 2024 at 03:59:25PM -0700, Linus Torvalds wrote: > On Sun, 20 Oct 2024 at 15:44, Josh Poimboeuf wrote: > > > > Anyway, I'd really like to make forward progress on getting rid of the > > LFENCEs in copy_from_user() and __get_user(), so until if/when

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-20 Thread Josh Poimboeuf
On Mon, Oct 14, 2024 at 04:39:26PM +0100, Andrew Cooper wrote: > On 14/10/2024 1:30 pm, Kirill A. Shutemov wrote: > > +++ b/arch/x86/lib/getuser.S > > @@ -37,9 +37,14 @@ > > +#define SHIFT_LEFT_TO_MSB ALTERNATIVE \ > > + "shl $(64 - 48), %rdx", \ > > + "shl $(64 - 57), %rdx", X86_FEATURE_LA57 >

Re: [PATCH v2 3/6] x86/uaccess: Rearrange putuser.S

2024-10-18 Thread Josh Poimboeuf
On Fri, Oct 18, 2024 at 11:51:06AM +0300, Kirill A . Shutemov wrote: > On Thu, Oct 17, 2024 at 02:55:22PM -0700, Josh Poimboeuf wrote: > > SYM_FUNC_START(__put_user_2) > > check_range size=2 > > ASM_STAC > > -3: movw %ax,(%_ASM_CX) > > +2: movw %ax

[PATCH v2 6/6] x86/uaccess: Add user pointer masking to clear_user()

2024-10-17 Thread Josh Poimboeuf
Add user pointer masking to clear_user() to mitigate Spectre v1. A write in a mispredicted access_ok() branch to a user-controlled kernel address can populate the rest of the affected cache line with kernel data. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/uaccess_64.h | 2 +- 1

[PATCH v2 2/6] x86/uaccess: Avoid barrier_nospec() in __get_user()

2024-10-17 Thread Josh Poimboeuf
: Josh Poimboeuf --- arch/x86/lib/getuser.S | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S index 094224ec9dca..7c9bf8f0b3ac 100644 --- a/arch/x86/lib/getuser.S +++ b/arch/x86/lib/getuser.S @@ -105,6

[PATCH v2 5/6] x86/uaccess: Add user pointer masking to copy_to_user()

2024-10-17 Thread Josh Poimboeuf
Add user pointer masking to copy_to_user() to mitigate Spectre v1. A write in a mispredicted access_ok() branch to a user-controlled kernel address can populate the rest of the affected cache line with kernel data. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/uaccess_64.h | 1 + 1

[PATCH v2 3/6] x86/uaccess: Rearrange putuser.S

2024-10-17 Thread Josh Poimboeuf
Separate __put_user_*() from __put_user_nocheck_*() to make the layout similar to getuser.S. This will also make it easier to do a subsequent change. No functional changes. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/putuser.S | 67 ++ 1 file changed

[PATCH v2 4/6] x86/uaccess: Add user pointer masking to __put_user()

2024-10-17 Thread Josh Poimboeuf
. Signed-off-by: Josh Poimboeuf --- arch/x86/lib/putuser.S | 27 ++- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/x86/lib/putuser.S b/arch/x86/lib/putuser.S index cb137e0286be..1b122261b7aa 100644 --- a/arch/x86/lib/putuser.S +++ b/arch/x86/lib

[PATCH v2 0/6] x86/uaccess: Avoid barrier_nospec()

2024-10-17 Thread Josh Poimboeuf
__put_user() v1: https://lore.kernel.org/b626840e55d4aa86b4b9b377a4cc2cda7038d33d.1728706156.git.jpoim...@kernel.org Josh Poimboeuf (6): x86/uaccess: Avoid barrier_nospec() in copy_from_user() x86/uaccess: Avoid barrier_nospec() in __get_user() x86/uaccess: Rearrange putuser.S x86/uaccess

[PATCH v2 1/6] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-17 Thread Josh Poimboeuf
there's no functional change. Signed-off-by: Josh Poimboeuf --- arch/powerpc/include/asm/uaccess.h | 2 ++ arch/x86/include/asm/uaccess_64.h | 7 --- arch/x86/lib/getuser.S | 2 +- arch/x86/lib/putuser.S | 2 +- include/linux/uaccess.h| 6 -- 5

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-13 Thread Josh Poimboeuf
On Sat, Oct 12, 2024 at 06:21:12PM -0700, Linus Torvalds wrote: > On Sat, 12 Oct 2024 at 17:53, Linus Torvalds > wrote: > > > > So no, the address masking can not depend on things like > > __VIRTUAL_MASK_SHIFT, it would need to at least take LAM into account > > too. Not that I know if there are a

Re: [PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-12 Thread Josh Poimboeuf
On Sat, Oct 12, 2024 at 09:48:57AM +0100, Andrew Cooper wrote: > On 12/10/2024 5:09 am, Josh Poimboeuf wrote: > > For x86-64, the barrier_nospec() in copy_from_user() is overkill and > > painfully slow. Instead, use pointer masking to force the user pointer > > to a non

[PATCH] x86/uaccess: Avoid barrier_nospec() in copy_from_user()

2024-10-11 Thread Josh Poimboeuf
mispredicted access_ok() branch to a user-controlled kernel address can populate the rest of the affected cache line with kernel data. To avoid regressing powerpc, move the barrier_nospec() to the powerpc raw_copy_from_user() implementation so there's no functional change. Signed-off-by: Josh Poim

Re: [PATCH 3/3] drm/amd/display: Support DRM_AMD_DC_FP on RISC-V

2023-12-12 Thread Josh Poimboeuf
bjtool should be able to do that reasonably easily, it already > does it for checking section where userspace address access is enabled > or not, which is very similar. Yeah, that might be doable. I can look into it. -- Josh

Re: [PATCH] objtool: Make 'sec-address' always on

2023-06-25 Thread Josh Poimboeuf
> > with modified stack frame > > > > I can't really see any link between that warning and the changes in the > patch. I suspect it's a pre-existing warning, but because the patch made a change to the default formatting (adding .text+off), it looks like a new warning to the bots. -- Josh

Re: [PATCH] objtool: Make 'sec-address' always on

2023-06-21 Thread Josh Poimboeuf
t more used to it. But the scripts make it fine. Also it helps with identifying the same warning across different configs/compilers. -- Josh

Re: [PATCH v2 0/2] start_kernel: omit stack canary

2023-04-18 Thread Josh Poimboeuf
-0-46a69b507...@google.com > (sorry for the spam with v2, mrincon is helping me get kinks worked out > with b4 and our corporate mailer) Acked-by: Josh Poimboeuf -- Josh

Re: [PATCH v2.1 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-03-01 Thread Josh Poimboeuf
On Thu, Feb 16, 2023 at 10:42:52AM -0800, Josh Poimboeuf wrote: > Include to make sure play_dead() matches its prototype going > forward. > > Acked-by: Florian Fainelli > Reviewed-by: Philippe Mathieu-Daudé > Signed-off-by: Josh Poimboeuf The latest version of this pat

Re: [PATCH] powerpc/64: Fix unannotated intra-function call warning

2023-02-16 Thread Josh Poimboeuf
symbol with the > SYM_FUNC_START_LOCAL and SYM_FUNC_END macros. > > Reported-by: Stephen Rothwell > Signed-off-by: Sathvika Vasireddy Suggested-by: Josh Poimboeuf -- Josh

Re: linux-next: build warning after merge of the powerpc tree

2023-02-16 Thread Josh Poimboeuf
On Fri, Feb 17, 2023 at 12:35:17PM +1100, Michael Ellerman wrote: > Josh Poimboeuf writes: > > On Thu, Feb 16, 2023 at 02:40:31PM +1100, Stephen Rothwell wrote: > >> Hi all, > >> > >> After merging the powerpc tree, today's linux-next build (powerpc

[PATCH v2.1 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-02-16 Thread Josh Poimboeuf
Include to make sure play_dead() matches its prototype going forward. Acked-by: Florian Fainelli Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Josh Poimboeuf --- arch/mips/cavium-octeon/smp.c | 1 + arch/mips/kernel/smp-bmips.c | 1 + arch/mips/kernel/smp-cps.c| 1 + arch/mips

[PATCH v2.1 04/24] arm64/cpu: Mark cpu_die() __noreturn

2023-02-16 Thread Josh Poimboeuf
cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Acked-by: Mark Rutland Signed-off-by: Josh Poimboeuf --- arch/arm64/include/asm/smp.h | 2 +- arch/arm64/kernel/smp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)

[PATCH v2.1 03/24] arm/cpu: Add unreachable() to arch_cpu_idle_dead()

2023-02-16 Thread Josh Poimboeuf
arch_cpu_idle_dead() doesn't return. Make that visible to the compiler with an unreachable() code annotation. Signed-off-by: Josh Poimboeuf --- arch/arm/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 0b8c257

Re: linux-next: build warning after merge of the powerpc tree

2023-02-16 Thread Josh Poimboeuf
On Thu, Feb 16, 2023 at 02:40:31PM +1100, Stephen Rothwell wrote: > Hi all, > > After merging the powerpc tree, today's linux-next build (powerpc > pseries_le_defconfig) produced this warning: > > arch/powerpc/kernel/head_64.o: warning: objtool: .text+0x6128: unannotated > intra-function call >

Re: [PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn

2023-02-15 Thread Josh Poimboeuf
On Wed, Feb 15, 2023 at 01:09:21PM +, Mark Rutland wrote: > On Tue, Feb 14, 2023 at 09:13:08AM +0100, Philippe Mathieu-Daudé wrote: > > On 14/2/23 08:05, Josh Poimboeuf wrote: > > > cpu_die() doesn't return. Annotate it as such. By extension this also > &g

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

2023-02-14 Thread Josh Poimboeuf
On Tue, Feb 14, 2023 at 11:48:41AM -0800, Max Filippov wrote: > On Tue, Feb 14, 2023 at 10:23 AM Josh Poimboeuf wrote: > > On Tue, Feb 14, 2023 at 08:55:32AM +0100, Philippe Mathieu-Daudé wrote: > > > Can you update the documentation along? Currently we have: > > > &

Re: [PATCH v2 03/24] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-14 Thread Josh Poimboeuf
On Tue, Feb 14, 2023 at 11:15:23AM +, Russell King (Oracle) wrote: > On Mon, Feb 13, 2023 at 11:05:37PM -0800, Josh Poimboeuf wrote: > > arch_cpu_idle_dead() doesn't return. Make that more explicit with a > > BUG(). > > > > BUG() is preferable to unrea

Re: [PATCH v2 00/24] cpu,sched: Mark arch_cpu_idle_dead() __noreturn

2023-02-14 Thread Josh Poimboeuf
On Tue, Feb 14, 2023 at 10:25:50AM +0100, Philippe Mathieu-Daudé wrote: > On 14/2/23 08:05, Josh Poimboeuf wrote: > > v2: > > - make arch_call_rest_init() and rest_init() __noreturn > > - make objtool 'global_returns' work for weak functions > > - rebase

Re: [PATCH v2 13/24] sh/cpu: Make sure play_dead() doesn't return

2023-02-14 Thread Josh Poimboeuf
On Tue, Feb 14, 2023 at 08:57:39AM +0100, Philippe Mathieu-Daudé wrote: > On 14/2/23 08:05, Josh Poimboeuf wrote: > > play_dead() doesn't return. Make that more explicit with a BUG(). > > > > BUG() is preferable to unreachable() because BUG() is a more explicit &

Re: [PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

2023-02-14 Thread Josh Poimboeuf
On Tue, Feb 14, 2023 at 08:55:32AM +0100, Philippe Mathieu-Daudé wrote: > Hi Josh, > > On 14/2/23 08:05, Josh Poimboeuf wrote: > > cpu_die() doesn't return. Make that more explicit with a BUG(). > > > > BUG() is preferable to unreachable() because BUG() is a mo

Re: [PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-02-14 Thread Josh Poimboeuf
On Tue, Feb 14, 2023 at 08:46:41AM +0100, Philippe Mathieu-Daudé wrote: > Hi Josh, > > On 14/2/23 08:05, Josh Poimboeuf wrote: > > Include to make sure play_dead() matches its prototype going > > forward. > > > > Acked-by: Florian Fainelli > > Signed-off

[PATCH v2 24/24] sched/idle: Mark arch_cpu_idle_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
plain if an arch-specific implementation might return. It also improves code generation for both caller and callee. Also fixes the following warning: vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction Reported-by: Paul E. McKenney Tested-by: Paul E. McKenney Signed-off-by:

[PATCH v2 23/24] init: Make arch_call_rest_init() and rest_init() __noreturn

2023-02-13 Thread Josh Poimboeuf
arch_call_rest_init() and rest_init() don't return. Annotate them as such. Fixes the following warning: init/main.o: warning: objtool: start_kernel+0x4ad: unreachable instruction Signed-off-by: Josh Poimboeuf --- arch/s390/kernel/setup.c | 2 +- include/linux/start_kernel.

[PATCH v2 22/24] objtool: Include weak functions in 'global_noreturns' check

2023-02-13 Thread Josh Poimboeuf
If a global __noreturn function prototype has a corresponding weak function, it should also be __noreturn. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index

[PATCH v2 21/24] sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
arch_cpu_idle_dead() should never return. Make it so. Signed-off-by: Josh Poimboeuf --- kernel/sched/idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index e9ef66be2870..56e152f06d0f 100644 --- a/kernel/sched/idle.c +++ b

[PATCH v2 20/24] xtensa/cpu: Mark cpu_die() __noreturn

2023-02-13 Thread Josh Poimboeuf
cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/xtensa/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/include/asm/smp.h b/arch/xtensa/in

[PATCH v2 19/24] xtensa/cpu: Make sure cpu_die() doesn't return

2023-02-13 Thread Josh Poimboeuf
cpu_die() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH v2 18/24] x86/cpu: Mark play_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/smp.h | 2 +- arch/x86/kernel/process.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/in

[PATCH v2 17/24] x86/cpu: Make sure play_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
of the function into whatever code happens to be next. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/smp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index b4dbb20dab1a..8f628e08b25a 100644 --- a/arch/x86/include/asm/smp.h

[PATCH v2 16/24] sparc/cpu: Mark cpu_play_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
cpu_play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/sparc/include/asm/smp_64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/include/asm/smp_64.h b/arch/

[PATCH v2 15/24] sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition

2023-02-13 Thread Josh Poimboeuf
Include to make sure arch_cpu_idle_dead() matches its prototype going forward. Signed-off-by: Josh Poimboeuf --- arch/sh/kernel/idle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c index 3418c40f0099..114f0c4abeac 100644 --- a/arch/sh/kernel

[PATCH v2 14/24] sh/cpu: Mark play_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/sh/include/asm/smp-ops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sh/include/asm/smp-ops.h b/arch/sh/in

[PATCH v2 13/24] sh/cpu: Make sure play_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH v2 12/24] powerpc/cpu: Mark start_secondary_resume() __noreturn

2023-02-13 Thread Josh Poimboeuf
start_secondary_resume() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Acked-by: Michael Ellerman (powerpc) Signed-off-by: Josh Poimboeuf --- arch/powerpc/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --

[PATCH v2 11/24] mips/cpu: Mark play_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Acked-by: Florian Fainelli Signed-off-by: Josh Poimboeuf --- arch/mips/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/includ

[PATCH v2 10/24] mips/cpu: Make sure play_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
igned-off-by: Josh Poimboeuf --- arch/mips/kernel/smp-bmips.c | 2 ++ arch/mips/loongson64/smp.c | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index df9158e8329d..be85fa075830 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch

[PATCH v2 09/24] mips/cpu: Expose play_dead()'s prototype definition

2023-02-13 Thread Josh Poimboeuf
Include to make sure play_dead() matches its prototype going forward. Acked-by: Florian Fainelli Signed-off-by: Josh Poimboeuf --- arch/mips/kernel/smp-bmips.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index f5d7bfa3472a

[PATCH v2 08/24] loongarch/cpu: Mark play_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/loongarch/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/smp.h b/arch/loon

[PATCH v2 07/24] loongarch/cpu: Make sure play_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH v2 06/24] ia64/cpu: Mark play_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/ia64/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/ia64/kernel/process.c b/arch/ia64/k

[PATCH v2 05/24] csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
igned-off-by: Josh Poimboeuf --- arch/csky/kernel/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c index b45d1073307f..0ec20efaf5fd 100644 --- a/arch/csky/kernel/smp.c +++ b/arch/csky/kernel/smp.c @@ -317,5 +317,7 @@ void arch_cpu_idle_dead

[PATCH v2 04/24] arm64/cpu: Mark cpu_die() __noreturn

2023-02-13 Thread Josh Poimboeuf
cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/arm64/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/includ

[PATCH v2 03/24] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by:

[PATCH v2 01/24] alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration

2023-02-13 Thread Josh Poimboeuf
Include to make sure arch_cpu_idle_dead() matches its prototype going forward. Signed-off-by: Josh Poimboeuf --- arch/alpha/kernel/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index ce20c31828a0..d1f2e8b6b107 100644

[PATCH v2 02/24] alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-13 Thread Josh Poimboeuf
arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by:

[PATCH v2 00/24] cpu,sched: Mark arch_cpu_idle_dead() __noreturn

2023-02-13 Thread Josh Poimboeuf
v2: - make arch_call_rest_init() and rest_init() __noreturn - make objtool 'global_returns' work for weak functions - rebase on tip/objtool/core with dependencies merged in (mingo) - add acks v1.1: - add __noreturn to all arch_cpu_idle_dead() implementations (mpe) Josh Poimboeuf (24

[PATCH v1.1 22/22] sched/idle: Mark arch_cpu_idle_dead() __noreturn

2023-02-07 Thread Josh Poimboeuf
plain if an arch-specific implementation might return. It also improves code generation for both caller and callee. Also fixes the following warning: vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction Reported-by: Paul E. McKenney Tested-by: Paul E. McKenney Signed-off-by:

Re: [PATCH 12/22] powerpc/cpu: Mark start_secondary_resume() __noreturn

2023-02-06 Thread Josh Poimboeuf
On Mon, Feb 06, 2023 at 10:10:22PM +1100, Michael Ellerman wrote: > Josh Poimboeuf writes: > > start_secondary_resume() doesn't return. Annotate it as such. By > > extension this also makes arch_cpu_idle_dead() noreturn. > > Can we also mark arch_cpu_idle_dead() (

Re: [PATCH 0/2] powerpc: Fix livepatch module re-patching issue

2023-02-05 Thread Josh Poimboeuf
On Sun, Feb 05, 2023 at 11:46:12AM +1100, Michael Ellerman wrote: > Josh Poimboeuf writes: > > On Tue, Jan 24, 2023 at 07:38:03PM -0800, Josh Poimboeuf wrote: > >> Fix a livepatch bug seen when reloading a patched module. > >> > >> This is the powerpc counter

Re: [PATCH 0/2] powerpc: Fix livepatch module re-patching issue

2023-02-04 Thread Josh Poimboeuf
On Tue, Jan 24, 2023 at 07:38:03PM -0800, Josh Poimboeuf wrote: > Fix a livepatch bug seen when reloading a patched module. > > This is the powerpc counterpart to Song Liu's fix for a similar issue on > x86: > > https://lkml.kernel.org/lkml/20230121004945.697003-2-s.

Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

2023-02-04 Thread Josh Poimboeuf
On Sat, Feb 04, 2023 at 02:10:34PM +0100, Christophe Leroy wrote: > Ok, got the same problem as you with next-20230203 > > DESCEND objtool > :1:10: fatal error: libelf.h: No such file or directory > compilation terminated. > HOSTCC /home/chleroy/linux-powerpc/tools/objtool/fixdep.o > HOSTLD

Re: [PATCH 05/22] csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
On Sat, Feb 04, 2023 at 09:12:31AM +0800, Guo Ren wrote: > On Sat, Feb 4, 2023 at 6:05 AM Josh Poimboeuf wrote: > > > > arch_cpu_idle_dead() doesn't return. Make that more explicit with a > > BUG(). > > > > BUG() is preferable to unreachable() because BUG

[PATCH 22/22] sched/idle: Mark arch_cpu_idle_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
plain if an arch-specific implementation might return. It also improves code generation for both caller and callee. Also fixes the following warning: vmlinux.o: warning: objtool: do_idle+0x25f: unreachable instruction Reported-by: Paul E. McKenney Tested-by: Paul E. McKenney Sign

[PATCH 21/22] sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
arch_cpu_idle_dead() should never return. Make it so. Signed-off-by: Josh Poimboeuf --- kernel/sched/idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index e9ef66be2870..56e152f06d0f 100644 --- a/kernel/sched/idle.c +++ b

[PATCH 20/22] xtensa/cpu: Mark cpu_die() __noreturn

2023-02-03 Thread Josh Poimboeuf
cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/xtensa/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/include/asm/smp.h b/arch/xtensa/in

[PATCH 18/22] x86/cpu: Mark play_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/smp.h | 2 +- arch/x86/kernel/process.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/in

[PATCH 19/22] xtensa/cpu: Make sure cpu_die() doesn't return

2023-02-03 Thread Josh Poimboeuf
cpu_die() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH 17/22] x86/cpu: Make sure play_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
of the function into whatever code happens to be next. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/smp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index b4dbb20dab1a..8f628e08b25a 100644 --- a/arch/x86/include/asm/smp.h

[PATCH 15/22] sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition

2023-02-03 Thread Josh Poimboeuf
Include to make sure arch_cpu_idle_dead() matches its prototype going forward. Signed-off-by: Josh Poimboeuf --- arch/sh/kernel/idle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c index 3418c40f0099..114f0c4abeac 100644 --- a/arch/sh/kernel

[PATCH 16/22] sparc/cpu: Mark cpu_play_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
cpu_play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/sparc/include/asm/smp_64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/sparc/include/asm/smp_64.h b/arch/

[PATCH 13/22] sh/cpu: Make sure play_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH 14/22] sh/cpu: Mark play_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/sh/include/asm/smp-ops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sh/include/asm/smp-ops.h b/arch/sh/in

[PATCH 12/22] powerpc/cpu: Mark start_secondary_resume() __noreturn

2023-02-03 Thread Josh Poimboeuf
start_secondary_resume() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/powerpc/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/smp.h b

[PATCH 10/22] mips/cpu: Make sure play_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH 11/22] mips/cpu: Mark play_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/mips/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/include/asm/smp.h b/arch/mips/includ

[PATCH 09/22] mips/cpu: Expose play_dead()'s prototype definition

2023-02-03 Thread Josh Poimboeuf
Include to make sure play_dead() matches its prototype going forward. Signed-off-by: Josh Poimboeuf --- arch/mips/kernel/smp-bmips.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index f5d7bfa3472a..df9158e8329d 100644 --- a

[PATCH 08/22] loongarch/cpu: Mark play_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/loongarch/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/smp.h b/arch/loon

[PATCH 07/22] loongarch/cpu: Make sure play_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by: Josh Poim

[PATCH 06/22] ia64/cpu: Mark play_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
play_dead() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/ia64/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/ia64/kernel/process.c b/arch/ia64/k

[PATCH 05/22] csky/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by:

[PATCH 04/22] arm64/cpu: Mark cpu_die() __noreturn

2023-02-03 Thread Josh Poimboeuf
cpu_die() doesn't return. Annotate it as such. By extension this also makes arch_cpu_idle_dead() noreturn. Signed-off-by: Josh Poimboeuf --- arch/arm64/include/asm/smp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/includ

[PATCH 03/22] arm/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by:

[PATCH 00/22] cpu,sched: Mark arch_cpu_idle_dead() __noreturn

2023-02-03 Thread Josh Poimboeuf
attribute. [1] 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return") Josh Poimboeuf (22): alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return arm/cpu: Make sure arch_cpu_idle_dead()

[PATCH 02/22] alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return

2023-02-03 Thread Josh Poimboeuf
arch_cpu_idle_dead() doesn't return. Make that more explicit with a BUG(). BUG() is preferable to unreachable() because BUG() is a more explicit failure mode and avoids undefined behavior like falling off the edge of the function into whatever code happens to be next. Signed-off-by:

[PATCH 01/22] alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration

2023-02-03 Thread Josh Poimboeuf
Include to make sure arch_cpu_idle_dead() matches its prototype going forward. Signed-off-by: Josh Poimboeuf --- arch/alpha/kernel/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 0eddd22c6212..4813172547b5 100644

Re: [PATCH 2/2] powerpc/module_64: Fix "expected nop" error on module re-patching

2023-01-25 Thread Josh Poimboeuf
On Wed, Jan 25, 2023 at 09:36:02AM -0800, Song Liu wrote: > On Wed, Jan 25, 2023 at 8:46 AM Josh Poimboeuf wrote: > > > > On Tue, Jan 24, 2023 at 10:09:56PM -0800, Song Liu wrote: > > > > @@ -514,9 +515,18 @@ static int restore_r2(const char *name, u32 > > &g

  1   2   3   4   5   6   7   8   9   10   >