Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Sven Schnelle
Mark Rutland writes: > On Thu, Jan 27, 2022 at 07:46:01AM -0500, Steven Rostedt wrote: >> On Thu, 27 Jan 2022 12:27:04 + >> Mark Rutland wrote: >> >> > Ah, so those non-ELF relocations for the mcount_loc table just mean "apply >> > the >> > KASLR offset here", which is equivalent for all

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Sven Schnelle
Mark Rutland writes: >> Isn't x86 relocatable in some configurations (e.g. for KASLR)? >> >> I can't see how the sort works for those cases, because the mcount_loc >> entries >> are absolute, and either: >> >> * The sorted entries will get overwritten by the unsorted relocation entries, >>

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Kees Cook
On Thu, Jan 27, 2022 at 11:46:49AM +, Mark Rutland wrote: > I'm not sure how x86 works here; AFAICT the relocations are performed during > decompression, but it looks like there's some special build-time processing > associated with that, and the vmlinux doesn't contain standard ELF >

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Ard Biesheuvel
On Thu, 27 Jan 2022 at 15:55, Mark Rutland wrote: > > On Thu, Jan 27, 2022 at 02:59:31PM +0100, Ard Biesheuvel wrote: > > On Thu, 27 Jan 2022 at 14:24, Mark Rutland wrote: > > > > > > On Thu, Jan 27, 2022 at 02:07:03PM +0100, Ard Biesheuvel wrote: > > > > I suppose that on arm64, we can work

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 08:55:43AM -0500, Steven Rostedt wrote: > On Thu, 27 Jan 2022 13:33:02 + > Mark Rutland wrote: > > > I want to get the regression fixed ASAP, so can we take a simple patch for > > -rc2 > > which disables the build-time sort where it's currently broken (by limiting >

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 02:59:31PM +0100, Ard Biesheuvel wrote: > On Thu, 27 Jan 2022 at 14:24, Mark Rutland wrote: > > > > On Thu, Jan 27, 2022 at 02:07:03PM +0100, Ard Biesheuvel wrote: > > > I suppose that on arm64, we can work around this by passing > > > --apply-dynamic-relocs to the linker,

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Ard Biesheuvel
On Thu, 27 Jan 2022 at 14:24, Mark Rutland wrote: > > On Thu, Jan 27, 2022 at 02:07:03PM +0100, Ard Biesheuvel wrote: > > On Thu, 27 Jan 2022 at 13:59, Mark Rutland wrote: > > > > > > On Thu, Jan 27, 2022 at 01:22:17PM +0100, Ard Biesheuvel wrote: > > > > On Thu, 27 Jan 2022 at 13:20, Mark

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Steven Rostedt
On Thu, 27 Jan 2022 13:33:02 + Mark Rutland wrote: > I want to get the regression fixed ASAP, so can we take a simple patch for > -rc2 > which disables the build-time sort where it's currently broken (by limiting > the > opt-in to arm and x86), then follow-up per-architecture to re-enable

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 02:16:31PM +0100, Sven Schnelle wrote: > Mark Rutland writes: > > > On Thu, Jan 27, 2022 at 07:46:01AM -0500, Steven Rostedt wrote: > >> On Thu, 27 Jan 2022 12:27:04 + > >> Mark Rutland wrote: > >> > >> > Ah, so those non-ELF relocations for the mcount_loc table

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 02:07:03PM +0100, Ard Biesheuvel wrote: > On Thu, 27 Jan 2022 at 13:59, Mark Rutland wrote: > > > > On Thu, Jan 27, 2022 at 01:22:17PM +0100, Ard Biesheuvel wrote: > > > On Thu, 27 Jan 2022 at 13:20, Mark Rutland wrote: > > > > On Thu, Jan 27, 2022 at 01:03:34PM +0100,

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 07:46:01AM -0500, Steven Rostedt wrote: > On Thu, 27 Jan 2022 12:27:04 + > Mark Rutland wrote: > > > Ah, so those non-ELF relocations for the mcount_loc table just mean "apply > > the > > KASLR offset here", which is equivalent for all entries. > > > > That makes

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Ard Biesheuvel
On Thu, 27 Jan 2022 at 13:59, Mark Rutland wrote: > > On Thu, Jan 27, 2022 at 01:22:17PM +0100, Ard Biesheuvel wrote: > > On Thu, 27 Jan 2022 at 13:20, Mark Rutland wrote: > > > On Thu, Jan 27, 2022 at 01:03:34PM +0100, Ard Biesheuvel wrote: > > > > > > > These architectures use place-relative

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 01:22:17PM +0100, Ard Biesheuvel wrote: > On Thu, 27 Jan 2022 at 13:20, Mark Rutland wrote: > > On Thu, Jan 27, 2022 at 01:03:34PM +0100, Ard Biesheuvel wrote: > > > > > These architectures use place-relative extables for the same reason: > > > place relative references

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Steven Rostedt
On Thu, 27 Jan 2022 12:27:04 + Mark Rutland wrote: > Ah, so those non-ELF relocations for the mcount_loc table just mean "apply the > KASLR offset here", which is equivalent for all entries. > > That makes sense, thanks! And this is why we were having such a hard time understanding each

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 01:04:41PM +0100, Sven Schnelle wrote: > Mark Rutland writes: > > >> Isn't x86 relocatable in some configurations (e.g. for KASLR)? > >> > >> I can't see how the sort works for those cases, because the mcount_loc > >> entries > >> are absolute, and either: > >> > >> *

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Ard Biesheuvel
On Thu, 27 Jan 2022 at 13:20, Mark Rutland wrote: > > On Thu, Jan 27, 2022 at 01:03:34PM +0100, Ard Biesheuvel wrote: > > On Thu, 27 Jan 2022 at 12:47, Mark Rutland wrote: > > > > > > [adding LKML so this is easier for others to find] > > > > > > If anyone wants to follow the thread from the

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
On Thu, Jan 27, 2022 at 01:03:34PM +0100, Ard Biesheuvel wrote: > On Thu, 27 Jan 2022 at 12:47, Mark Rutland wrote: > > > > [adding LKML so this is easier for others to find] > > > > If anyone wants to follow the thread from the start, it's at: > > > > > >

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Ard Biesheuvel
On Thu, 27 Jan 2022 at 12:47, Mark Rutland wrote: > > [adding LKML so this is easier for others to find] > > If anyone wants to follow the thread from the start, it's at: > > > https://lore.kernel.org/linuxppc-dev/944d10da-8200-4ba9-8d0a-3bed9aa99...@linux.ibm.com/ > > Ard, I was under the

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-27 Thread Mark Rutland
[adding LKML so this is easier for others to find] If anyone wants to follow the thread from the start, it's at: https://lore.kernel.org/linuxppc-dev/944d10da-8200-4ba9-8d0a-3bed9aa99...@linux.ibm.com/ Ard, I was under the impression that the 32-bit arm kernel was (virtually) relocatable,

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-26 Thread Mark Rutland
Hi, Steve pointed me at this thread over IRC -- I'm not subscribed to this list so grabbed a copy of the thread thus far via b4. On Tue, Jan 25, 2022 at 11:20:27AM +0800, Yinan Liu wrote: > > Yeah, I think it's time to opt in, instead of opting out. I agree this must be opt-in rather than

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-25 Thread Steven Rostedt
On Tue, 25 Jan 2022 09:30:51 +0530 Sachin Sant wrote: > Tested-by: Sachin Sant Thanks, I'll start running it through my tests and send it to Linus later today or tomorrow. -- Steve

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Sachin Sant
> On 24-Jan-2022, at 10:15 PM, Steven Rostedt wrote: > > On Mon, 24 Jan 2022 20:15:06 +0800 > Yinan Liu wrote: > >> Hi, Steven and Sachin >> >> I don't have a powerpc machine for testing, I guess the ppc has a >> similar problem with the s390. It's not clear to me why the compiler >> does

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Yinan Liu
Yeah, I think it's time to opt in, instead of opting out. Something like this: -- Steve diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c2724d986fa0..5256ebe57451 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -82,6 +82,7 @@ config ARM select HAVE_EBPF_JIT if

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Yinan Liu
在 2022/1/24 下午5:19, Sachin Sant 写道: While running stress_code_patching test from selftests/powerpc/mm against 5.17-rc1 booted on a POWER10 LPAR following ftrace warning is seen: WARNING: CPU: 1 PID: 2017392 at kernel/trace/ftrace.c:2068 ftrace_bug+0x274/0x2d8 Modules linked in: dm_mod bonding

Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests

2022-01-24 Thread Steven Rostedt
On Mon, 24 Jan 2022 20:15:06 +0800 Yinan Liu wrote: > Hi, Steven and Sachin > > I don't have a powerpc machine for testing, I guess the ppc has a > similar problem with the s390. It's not clear to me why the compiler > does this. Maybe we can handle ppc like you did with the s390 before, >