[PATCH 05/22] x86/entry: Fix thunk function ELF sizes

2019-07-14 Thread Josh Poimboeuf
: lockdep_sys_exit_thunk() is missing an ELF size annotation Signed-off-by: Josh Poimboeuf --- arch/x86/entry/thunk_64.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S index cfdca8b42c70..cc20465b2867 100644 --- a/arch/x86

[PATCH 02/22] x86/kvm: Fix fastop function ELF metadata

2019-07-14 Thread Josh Poimboeuf
: setc() is missing an ELF size annotation Signed-off-by: Josh Poimboeuf --- Cc: Paolo Bonzini Cc: Radim Krčmář --- arch/x86/kvm/emulate.c | 44 +- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm

[PATCH 10/22] bpf: Disable GCC -fgcse optimization for ___bpf_prog_run()

2019-07-14 Thread Josh Poimboeuf
adding -fno-gcse to the command line. So just disable the optimization for this function. Fixes: e55a73251da3 ("bpf: Fix ORC unwinding in non-JIT BPF code") Reported-by: Randy Dunlap Signed-off-by: Josh Poimboeuf Acked-by: Alexei Starovoitov --- Cc: Alexei Starovoitov Cc: Danie

[PATCH 15/22] objtool: Change dead_end_function() to return boolean

2019-07-14 Thread Josh Poimboeuf
dead_end_function() can no longer return an error. Simplify its interface by making it return boolean. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 36 ++-- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/tools/objtool/check.c b

[PATCH 01/22] x86/paravirt: Fix callee-saved function ELF sizes

2019-07-14 Thread Josh Poimboeuf
Signed-off-by: Josh Poimboeuf --- Cc: Juergen Gross Cc: Alok Kataria --- arch/x86/include/asm/paravirt.h | 1 + arch/x86/kernel/kvm.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index c25c38a05c1c

Re: objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o)

2019-07-12 Thread Josh Poimboeuf
On Fri, Jul 12, 2019 at 04:19:02PM +0200, Arnd Bergmann wrote: > On Fri, Jul 12, 2019 at 3:57 PM Josh Poimboeuf wrote: > > > > On Fri, Jul 12, 2019 at 09:51:35AM +0200, Arnd Bergmann wrote: > > > I no longer see any of the "can't find switch jump table&quo

Re: objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o)

2019-07-12 Thread Josh Poimboeuf
On Fri, Jul 12, 2019 at 09:51:35AM +0200, Arnd Bergmann wrote: > I no longer see any of the "can't find switch jump table" in last > nights randconfig > builds. I do see one other rare warning, see attached object file: > > fs/reiserfs/do_balan.o: warning: objtool: replace_key()+0x158: stack >

Re: objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o)

2019-07-11 Thread Josh Poimboeuf
On Thu, Jul 11, 2019 at 11:04:35PM +0200, Jann Horn wrote: > On Thu, Jul 11, 2019 at 11:00 PM Arnd Bergmann wrote: > > > > On Thu, Jul 11, 2019 at 7:26 PM Josh Poimboeuf wrote: > > > > > > On Thu, Jul 11, 2019 at 02:40:06PM +0200, Arnd Bergmann wrote: > > &

Re: [RFC PATCH] x86: Remove X86_FEATURE_MFENCE_RDTSC

2019-07-11 Thread Josh Poimboeuf
On Wed, Jul 10, 2019 at 01:33:48PM +0200, Thomas Gleixner wrote: > On Wed, 10 Jul 2019, Paolo Bonzini wrote: > > On 08/07/19 21:32, Lendacky, Thomas wrote: > > >> AMD and Intel both have serializing lfence (X86_FEATURE_LFENCE_RDTSC). > > >> They've both had it for a long time, and AMD has had it

Re: objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o)

2019-07-11 Thread Josh Poimboeuf
On Thu, Jul 11, 2019 at 02:40:06PM +0200, Arnd Bergmann wrote: > During randconfig testing with clang-9, I came across an object file > that makes objtool segfault, see attachment. Let me know if you need > more information to > debug this. > > I also get a ton of objtool warnings building random

Re: objtool warnings in prerelease clang-9

2019-07-10 Thread Josh Poimboeuf
On Wed, Jul 10, 2019 at 04:42:43PM -0700, Nick Desaulniers wrote: > 7e: 0f 85 00 00 00 00jne 0 > > 0080: R_X86_64_PC32 __x86_indirect_thunk_r11-4 > 84: c3retq > > I've sent you the .o file off thread as well. Thanks for taking a >

Re: objtool warnings in prerelease clang-9

2019-07-10 Thread Josh Poimboeuf
On Sat, Jul 06, 2019 at 10:50:01AM -0500, Josh Poimboeuf wrote: > On Tue, Jul 02, 2019 at 11:58:27PM +0200, Thomas Gleixner wrote: > > platform-quirks.o: > > > > if (x86_platform.set_legacy_features) > > 74: 4c 8b 1d 00 00 00 00mov0x0(%rip),%r11

[PATCH] objtool: Rename elf_open() to prevent conflict with libelf from elftoolchain

2019-07-10 Thread Josh Poimboeuf
-off-by: Michael Forney Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 2 +- tools/objtool/elf.c | 2 +- tools/objtool/elf.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 172f99195726..de8f40730b37 100644

[PATCH] objtool: Use Elf_Scn typedef instead of assuming struct name

2019-07-10 Thread Josh Poimboeuf
From: Michael Forney The libelf implementation might use a different struct name, and the Elf_Scn typedef is already used throughout the rest of objtool. Signed-off-by: Michael Forney Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

Re: [PATCH v2 00/13] Cleanup recordmcount and begin objtool conversion

2019-07-10 Thread Josh Poimboeuf
On Wed, Jul 10, 2019 at 01:09:24PM -0400, Steven Rostedt wrote: > > Josh, > > Can you have a look at these? I can apply them if you think they are OK. Sorry for the delay. I didn't forget about it, it's just been a hectic month. I plan to give it a proper review soon (in the next week or so).

Re: [RFC V3 00/18] objtool: Add support for arm64

2019-07-10 Thread Josh Poimboeuf
On Wed, Jul 10, 2019 at 08:31:28AM +0100, Raphael Gault wrote: > Hi all, > > Just a gentle ping to see if anyone has comments to make about this version > :) Hi Raphael, Sorry for the delay. I haven't forgotten about these patches. I hope to do a proper review in the next week or so. --

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-09 Thread Josh Poimboeuf
On Tue, Jul 09, 2019 at 11:02:40AM -0700, Alexei Starovoitov wrote: > On Tue, Jul 9, 2019 at 10:48 AM Josh Poimboeuf wrote: > > > > On Mon, Jul 08, 2019 at 04:16:25PM -0700, Alexei Starovoitov wrote: > > > total time is hard to compare. > > > Could you

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-09 Thread Josh Poimboeuf
On Mon, Jul 08, 2019 at 04:16:25PM -0700, Alexei Starovoitov wrote: > total time is hard to compare. > Could you compare few tests? > like two that are called "tcpdump *" > > I think small regression is ok. > Folks that care about performance should be using JIT. I did each test 20 times and

Re: linux-next: Tree for Jul 9 (objtool)

2019-07-09 Thread Josh Poimboeuf
On Tue, Jul 09, 2019 at 09:07:09AM -0700, Randy Dunlap wrote: > On 7/9/19 5:00 AM, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20190708: > > > > on x86_64, with an older gcc: gcc (SUSE Linux) 4.8.5 > > some builds (3) say: > kernel/bpf/core.o: warning: objtool:

Re: [PATCH] x86/alternatives: Fix int3_emulate_call() selftest stack corruption

2019-07-09 Thread Josh Poimboeuf
On Tue, Jul 09, 2019 at 02:57:44PM +0200, Peter Zijlstra wrote: > On Mon, Jul 08, 2019 at 03:55:30PM -0500, Josh Poimboeuf wrote: > > > arch/x86/kernel/alternative.c | 9 - > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/k

[tip:x86/debug] objtool: Add support for C jump tables

2019-07-09 Thread tip-bot for Josh Poimboeuf
Commit-ID: 87b512def792579641499d9bef1d640994ea9c18 Gitweb: https://git.kernel.org/tip/87b512def792579641499d9bef1d640994ea9c18 Author: Josh Poimboeuf AuthorDate: Thu, 27 Jun 2019 20:50:46 -0500 Committer: Ingo Molnar CommitDate: Tue, 9 Jul 2019 13:55:46 +0200 objtool: Add support

[tip:x86/debug] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-09 Thread tip-bot for Josh Poimboeuf
Commit-ID: e55a73251da335873a6e87d68fb17e5aabb8978e Gitweb: https://git.kernel.org/tip/e55a73251da335873a6e87d68fb17e5aabb8978e Author: Josh Poimboeuf AuthorDate: Thu, 27 Jun 2019 20:50:47 -0500 Committer: Ingo Molnar CommitDate: Tue, 9 Jul 2019 13:55:57 +0200 bpf: Fix ORC unwinding

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-08 Thread Josh Poimboeuf
On Mon, Jul 08, 2019 at 05:53:59PM -0500, Josh Poimboeuf wrote: > On Mon, Jul 08, 2019 at 03:49:33PM -0700, Alexei Starovoitov wrote: > > > > Sorry for delay. I'm mostly offgrid until next week. > > > > As far as -fno-gcse.. I don't mind as long as it doesn'

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-08 Thread Josh Poimboeuf
On Mon, Jul 08, 2019 at 03:49:33PM -0700, Alexei Starovoitov wrote: > > > Sorry for delay. I'm mostly offgrid until next week. > > > As far as -fno-gcse.. I don't mind as long as it doesn't hurt performance. > > > Which I suspect it will :( > > > All these indirect gotos are there for performance.

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-08 Thread Josh Poimboeuf
On Mon, Jul 08, 2019 at 03:15:37PM -0700, Alexei Starovoitov wrote: > > 2) > > > > After doing the first optimization, GCC then does another one which is > > a little trickier. It replaces: > > > > select_insn: > > jmp *jumptable(, %rax, 8) > > ... > >

[PATCH] x86/alternatives: Fix int3_emulate_call() selftest stack corruption

2019-07-08 Thread Josh Poimboeuf
xes: 7457c0da024b ("x86/alternatives: Add int3_emulate_call() selftest") Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/alternative.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 99ef8b6f9a1a.

Re: [PATCH] [RFC] Revert "bpf: Fix ORC unwinding in non-JIT BPF code"

2019-07-08 Thread Josh Poimboeuf
On Mon, Jul 08, 2019 at 02:45:23PM +0200, Arnd Bergmann wrote: > Apparently this was a bit premature, at least I still get this > warning with gcc-8.1: > > kernel/bpf/core.o: warning: objtool: ___bpf_prog_run()+0x44d2: sibling call > from callable instruction with modified stack frame > > This

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-06 Thread Josh Poimboeuf
On Sat, Jul 06, 2019 at 08:32:06PM -0500, Josh Poimboeuf wrote: > On Sat, Jul 06, 2019 at 10:29:42PM +0200, Ingo Molnar wrote: > > Hm, I get this new build warning on x86-64 defconfig-ish kernels plus > > these enabled: > > > > CONFIG_BPF=y > > CONFIG_BPF

Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-07-06 Thread Josh Poimboeuf
On Sat, Jul 06, 2019 at 10:29:42PM +0200, Ingo Molnar wrote: > > * tip-bot for Josh Poimboeuf wrote: > > > Commit-ID: b22cf36c189f31883ad0238a69ccf82aa1f3b16b > > Gitweb: > > https://git.kernel.org/tip/b22cf36c189f31883ad0238a69ccf82aa1f3b16b > > Author:

Re: objtool warnings in prerelease clang-9

2019-07-06 Thread Josh Poimboeuf
On Tue, Jul 02, 2019 at 11:58:27PM +0200, Thomas Gleixner wrote: > platform-quirks.o: > > if (x86_platform.set_legacy_features) > 74: 4c 8b 1d 00 00 00 00mov0x0(%rip),%r11# 7b > > 7b: 4d 85 dbtest %r11,%r11 > 7e: 0f 85 00 00 00 00 jne

[RFC PATCH] x86: Remove X86_FEATURE_MFENCE_RDTSC

2019-07-04 Thread Josh Poimboeuf
an alternative_3() macro. Signed-off-by: Josh Poimboeuf Cc: Tom Lendacky Cc: Andrew Cooper Cc: Thomas Gleixner Cc: Pu Wen Cc: Borislav Petkov --- arch/x86/include/asm/barrier.h | 3 +-- arch/x86/include/asm/cpufeatures.h | 1 - arch/x86/include/asm/msr.h | 3 +-- arch

Re: linux-next: Tree for Jul 2 (objtool)

2019-07-03 Thread Josh Poimboeuf
On Wed, Jul 03, 2019 at 02:46:14PM -0500, Josh Poimboeuf wrote: > On Wed, Jul 03, 2019 at 02:45:28PM -0500, Josh Poimboeuf wrote: > > On Wed, Jul 03, 2019 at 10:23:21AM -0700, Randy Dunlap wrote: > > > On 7/3/19 9:44 AM, Josh Poimboeuf wrote: > > > > On Tue, Jul 02, 2

Re: linux-next: Tree for Jul 2 (objtool)

2019-07-03 Thread Josh Poimboeuf
On Wed, Jul 03, 2019 at 02:45:28PM -0500, Josh Poimboeuf wrote: > On Wed, Jul 03, 2019 at 10:23:21AM -0700, Randy Dunlap wrote: > > On 7/3/19 9:44 AM, Josh Poimboeuf wrote: > > > On Tue, Jul 02, 2019 at 11:47:02AM -0700, Randy Dunlap wrote: > > >> On 7/2/19 2

Re: linux-next: Tree for Jul 2 (objtool)

2019-07-03 Thread Josh Poimboeuf
On Wed, Jul 03, 2019 at 10:23:21AM -0700, Randy Dunlap wrote: > On 7/3/19 9:44 AM, Josh Poimboeuf wrote: > > On Tue, Jul 02, 2019 at 11:47:02AM -0700, Randy Dunlap wrote: > >> On 7/2/19 2:51 AM, Stephen Rothwell wrote: > >>> Hi all, > >>> > >>

Re: linux-next: Tree for Jul 2 (objtool)

2019-07-03 Thread Josh Poimboeuf
On Tue, Jul 02, 2019 at 11:47:02AM -0700, Randy Dunlap wrote: > On 7/2/19 2:51 AM, Stephen Rothwell wrote: > > Hi all, > > > > Changes since 20190701: > > > > on x86_64: > > kernel/bpf/core.o: warning: objtool: ___bpf_prog_run()+0x22: can't find > switch jump table I don't see it on current

[tip:x86/urgent] objtool: Add support for C jump tables

2019-06-29 Thread tip-bot for Josh Poimboeuf
Commit-ID: d31acc2cc6ee313cee663ffed89c6a8f807bd87b Gitweb: https://git.kernel.org/tip/d31acc2cc6ee313cee663ffed89c6a8f807bd87b Author: Josh Poimboeuf AuthorDate: Thu, 27 Jun 2019 20:50:46 -0500 Committer: Thomas Gleixner CommitDate: Sat, 29 Jun 2019 07:55:13 +0200 objtool: Add

[tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code

2019-06-29 Thread tip-bot for Josh Poimboeuf
Commit-ID: b22cf36c189f31883ad0238a69ccf82aa1f3b16b Gitweb: https://git.kernel.org/tip/b22cf36c189f31883ad0238a69ccf82aa1f3b16b Author: Josh Poimboeuf AuthorDate: Thu, 27 Jun 2019 20:50:47 -0500 Committer: Thomas Gleixner CommitDate: Sat, 29 Jun 2019 07:55:14 +0200 bpf: Fix ORC

Re: [PATCH] ftrace: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()

2019-06-28 Thread Josh Poimboeuf
On Fri, Jun 28, 2019 at 11:46:27AM -0400, Steven Rostedt wrote: > On Fri, 28 Jun 2019 09:54:24 -0400 > Steven Rostedt wrote: > > > On Fri, 28 Jun 2019 12:52:32 +0200 > > Petr Mladek wrote: > > > > > On Fri 2019-06-28 09:32:03, Miroslav Benes wrote: > > > > On Thu, 27 Jun 2019, Petr Mladek

[PATCH v4 0/2] x86: bpf unwinder fixes

2019-06-27 Thread Josh Poimboeuf
. - The other two fixes from v3 have been merged into -tip. Josh Poimboeuf (2): objtool: Add support for C jump tables bpf: Fix ORC unwinding in non-JIT BPF code include/linux/compiler.h | 5 + kernel/bpf/core.c| 3 +-- tools/objtool/check.c| 27 --- 3 files

[PATCH v4 2/2] bpf: Fix ORC unwinding in non-JIT BPF code

2019-06-27 Thread Josh Poimboeuf
NTER") Reported-by: Song Liu Signed-off-by: Josh Poimboeuf --- kernel/bpf/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 7c473f208a10..45456a796d7f 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1299,7 +

[PATCH v4 1/2] objtool: Add support for C jump tables

2019-06-27 Thread Josh Poimboeuf
section. The '.rodata' prefix ensures that the data will be placed in the rodata section by the vmlinux linker script. The double periods are part of an existing convention which distinguishes kernel sections from GCC sections. Signed-off-by: Josh Poimboeuf --- include/linux/compiler.h | 5

Re: [PATCH] ftrace/x86: Add a comment to why we take text_mutex in ftrace_arch_code_modify_prepare()

2019-06-27 Thread Josh Poimboeuf
permissions while ftrace has it as read/write. This > really needs to be documented in the code. Add a comment that does such. > > Suggested-by: Josh Poimboeuf > Signed-off-by: Steven Rostedt (VMware) > --- > arch/x86/kernel/ftrace.c | 5 + > 1 file changed, 5 insertion

Re: [PATCH] ftrace: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()

2019-06-27 Thread Josh Poimboeuf
On Thu, Jun 27, 2019 at 09:13:04PM -0400, Steven Rostedt wrote: > On Thu, 27 Jun 2019 18:19:52 -0500 > Josh Poimboeuf wrote: > > > > Maybe a comment or two would help though. > > > > I'm adding the following change. Care to add a "reviewed-by" for t

Re: [PATCH] objtool: Be lenient about -Wundef

2019-06-27 Thread Josh Poimboeuf
On Wed, Jun 19, 2019 at 05:03:37AM -0700, Olof Johansson wrote: > Some libelf versions use undefined macros, which combined with newer GCC > makes for errors from system headers. This isn't overly useful to fail > compiling objtool for. > > Error as seen: > > cc1: all warnings being treated as

Re: [PATCH] ftrace: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()

2019-06-27 Thread Josh Poimboeuf
On Fri, Jun 28, 2019 at 01:09:08AM +0200, Thomas Gleixner wrote: > On Thu, 27 Jun 2019, Steven Rostedt wrote: > > On Thu, 27 Jun 2019 17:47:29 -0500 > > > Releasing the lock in a separate function seems a bit surprising and > > > fragile, would it be possible to do something like this instead? > >

Re: [PATCH] ftrace: Remove possible deadlock between register_kprobe() and ftrace_run_update_code()

2019-06-27 Thread Josh Poimboeuf
Thanks a lot for fixing this Petr. On Thu, Jun 27, 2019 at 10:13:34AM +0200, Petr Mladek wrote: > @@ -35,6 +36,7 @@ > > int ftrace_arch_code_modify_prepare(void) > { > + mutex_lock(_mutex); > set_kernel_text_rw(); > set_all_modules_text_rw(); > return 0; > @@ -44,6 +46,7

[tip:x86/urgent] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-27 Thread tip-bot for Josh Poimboeuf
Commit-ID: ae6a45a0868986f69039a2150d3b2b9ca294c378 Gitweb: https://git.kernel.org/tip/ae6a45a0868986f69039a2150d3b2b9ca294c378 Author: Josh Poimboeuf AuthorDate: Wed, 26 Jun 2019 19:33:55 -0500 Committer: Thomas Gleixner CommitDate: Fri, 28 Jun 2019 00:11:21 +0200 x86/unwind/orc

Re: [PATCH v3 2/4] objtool: Add support for C jump tables

2019-06-26 Thread Josh Poimboeuf
On Wed, Jun 26, 2019 at 10:44:47PM -0500, Josh Poimboeuf wrote: > > > How about the following approach instead? This is the only other way I > > > can think of to annotate a jump table so that objtool can distinguish > > > it: > > > > >

Re: [PATCH v3 2/4] objtool: Add support for C jump tables

2019-06-26 Thread Josh Poimboeuf
On Wed, Jun 26, 2019 at 07:54:08PM -0700, Alexei Starovoitov wrote: > On Wed, Jun 26, 2019 at 7:47 PM Josh Poimboeuf wrote: > > > > On Wed, Jun 26, 2019 at 06:42:40PM -0700, Alexei Starovoitov wrote: > > > > @@ -1035,9 +1038,18 @@ static struct rela *find_switch_table(s

Re: [PATCH v3 2/4] objtool: Add support for C jump tables

2019-06-26 Thread Josh Poimboeuf
On Wed, Jun 26, 2019 at 06:42:40PM -0700, Alexei Starovoitov wrote: > > @@ -1035,9 +1038,18 @@ static struct rela *find_switch_table(struct > > objtool_file *file, > > > > /* > > * Make sure the .rodata address isn't associated with a > > -*

Re: [PATCH v3 3/4] bpf: Fix ORC unwinding in non-JIT BPF code

2019-06-26 Thread Josh Poimboeuf
On Wed, Jun 26, 2019 at 06:22:48PM -0700, Alexei Starovoitov wrote: > On Wed, Jun 26, 2019 at 6:07 PM Josh Poimboeuf wrote: > > > > On Wed, Jun 26, 2019 at 05:57:08PM -0700, Alexei Starovoitov wrote: > > > On Wed, Jun 26, 2019 at 5:36 PM Josh Poimboeuf > > &g

Re: [PATCH v3 3/4] bpf: Fix ORC unwinding in non-JIT BPF code

2019-06-26 Thread Josh Poimboeuf
On Wed, Jun 26, 2019 at 05:57:08PM -0700, Alexei Starovoitov wrote: > On Wed, Jun 26, 2019 at 5:36 PM Josh Poimboeuf wrote: > > > > Objtool previously ignored ___bpf_prog_run() because it didn't > > understand the jump table. This resulted in the ORC unwinder not being >

[PATCH v3 1/4] perf/x86: Always store regs->ip in perf_callchain_kernel()

2019-06-26 Thread Josh Poimboeuf
hains work without CONFIG_FRAME_POINTER") Signed-off-by: Song Liu Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- arch/x86/events/core.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index b9c

[PATCH v3 2/4] objtool: Add support for C jump tables

2019-06-26 Thread Josh Poimboeuf
for C jump tables is easy. It just needs to be able to find the tables and distinguish them from other data. To allow the jump tables to be found, create a standard: objtool will automatically recognize any static local jump table named "jump_table". Signed-off-by: Josh Poimboeuf Acked

[PATCH v3 0/4] x86: bpf unwinder fixes

2019-06-26 Thread Josh Poimboeuf
if anybody wants to try interacting with the maintainer. - Split the objtool jump table detection feature into a separate patch to clarify that it's a generic objtool feature. Josh Poimboeuf (3): objtool: Add support for C jump tables bpf: Fix ORC unwinding in non-JIT BPF code x86/unwind

[PATCH v3 4/4] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-26 Thread Josh Poimboeuf
) then this will allow ORC to unwind through most generated code despite there being no corresponding ORC entries. Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER") Reported-by: Song Liu Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) ---

[PATCH v3 3/4] bpf: Fix ORC unwinding in non-JIT BPF code

2019-06-26 Thread Josh Poimboeuf
so objtool can recognize it. Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER") Reported-by: Song Liu Signed-off-by: Josh Poimboeuf --- kernel/bpf/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/core.c

Re: [PATCH 1/3] module: Fix livepatch/ftrace module text permissions race

2019-06-26 Thread Josh Poimboeuf
On Wed, Jun 26, 2019 at 04:44:45PM +0200, Thomas Gleixner wrote: > On Wed, 26 Jun 2019, Petr Mladek wrote: > > On Wed 2019-06-26 10:22:45, Miroslav Benes wrote: > > It is similar problem that has been solved by 2d1e38f56622b9bb5af8 > > ("kprobes: Cure hotplug lock ordering issues"). This commit

Re: [PATCH 1/3] notifier: Fix broken error handling pattern

2019-06-25 Thread Josh Poimboeuf
On Tue, Jun 25, 2019 at 09:38:21AM +0200, Peter Zijlstra wrote: > > > @@ -156,43 +169,30 @@ int atomic_notifier_chain_unregister(str > > > } > > > EXPORT_SYMBOL_GPL(atomic_notifier_chain_unregister); > > > > > > -/** > > > - * __atomic_notifier_call_chain - Call functions in an atomic >

Re: [PATCH] Revert "x86/module: Detect and skip invalid relocations"

2019-06-24 Thread Josh Poimboeuf
On Mon, Jun 24, 2019 at 12:00:33PM +0200, Miroslav Benes wrote: > On Sat, 22 Jun 2019, Thomas Gleixner wrote: > > > Miroslav, > > > > On Thu, 20 Jun 2019, Miroslav Benes wrote: > > > On Thu, 20 Jun 2019, Cheng Jian wrote: > > > > > > > This reverts commit

Re: NMI hardlock stacktrace deadlock [was Re: Linux 5.2-rc5]

2019-06-24 Thread Josh Poimboeuf
On Wed, Jun 19, 2019 at 01:42:53PM -0700, Linus Torvalds wrote: > On Wed, Jun 19, 2019 at 12:19 PM Chris Wilson > wrote: > > > > > Do you have the oops itself at all? > > > > An example at > > https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6310/fi-kbl-x1275/dmesg0.log > >

Re: [PATCH 1/3] notifier: Fix broken error handling pattern

2019-06-24 Thread Josh Poimboeuf
On Mon, Jun 24, 2019 at 11:18:44AM +0200, Peter Zijlstra wrote: > The current notifiers have the following error handling pattern all > over the place: > > int nr; > > ret = __foo_notifier_call_chain(, val_up, v, -1, ); > if (err & NOTIFIER_STOP_MASK) s/err/ret/ >

Re: [RFC 0/5] livepatch: new API to track system state changes

2019-06-15 Thread Josh Poimboeuf
On Tue, Jun 11, 2019 at 03:56:22PM +0200, Petr Mladek wrote: > Hi, > > this is another piece in the puzzle that helps to maintain more > livepatches. > > Especially pre/post (un)patch callbacks might change a system state. > Any newly installed livepatch has to somehow deal with system state >

Re: [PATCH v4 0/3] livepatch: Cleanup of reliable stacktrace warnings

2019-06-15 Thread Josh Poimboeuf
- > 2 files changed, 7 insertions(+), 9 deletions(-) Thanks Miroslav for wrapping this up, and thanks to Petr for his previous work on this. Acked-by: Josh Poimboeuf -- Josh

Re: [PATCH v2 4/5] x86/bpf: Fix 64-bit JIT frame pointer usage

2019-06-15 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 10:16:53PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 9:27 PM Josh Poimboeuf wrote: > > > > On Fri, Jun 14, 2019 at 05:02:36PM -0700, Alexei Starovoitov wrote: > > > On Fri, Jun 14, 2019 at 4:54 PM Josh Poimboeuf > > >

Re: [PATCH v2 4/5] x86/bpf: Fix 64-bit JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 05:02:36PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 4:54 PM Josh Poimboeuf wrote: > > The previous patch you posted has my patch description, push/pop and > > comment changes, with no credit: > > > > https://lkml.kernel.org/r/2

Re: [PATCH v2 2/5] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 04:30:15PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 4:17 PM Josh Poimboeuf wrote: > > > > On Fri, Jun 14, 2019 at 02:22:59PM -0700, Alexei Starovoitov wrote: > > > On Fri, Jun 14, 2019 at 2:19 PM Josh

Re: [PATCH v2 4/5] x86/bpf: Fix 64-bit JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 04:23:41PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 4:13 PM Josh Poimboeuf wrote: > > > > On Fri, Jun 14, 2019 at 02:27:30PM -0700, Alexei Starovoitov wrote: > > > On Fri, Jun 14, 2019 at 2:19 PM Josh Poimboeuf > > > w

Re: [PATCH v2 2/5] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 02:22:59PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 2:19 PM Josh Poimboeuf wrote: > > > > > > > > > > > > +#define JUMP_TABLE_SYM_PREFIX "jump_table." > > > > > > &

Re: [PATCH v2 4/5] x86/bpf: Fix 64-bit JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 02:27:30PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 2:19 PM Josh Poimboeuf wrote: > > > > On Fri, Jun 14, 2019 at 02:05:56PM -0700, Alexei Starovoitov wrote: > > > Have you tested it ? > > > I really doubt, since in

Re: [PATCH v2 4/5] x86/bpf: Fix 64-bit JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 02:05:56PM -0700, Alexei Starovoitov wrote: > Have you tested it ? > I really doubt, since in my test both CONFIG_UNWINDER_ORC and > CONFIG_UNWINDER_FRAME_POINTER failed to unwind through such odd frame. Hm, are you seeing selftest failures? They seem to work for me. >

Re: [PATCH v2 2/5] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 02:09:25PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 2:07 PM Josh Poimboeuf wrote: > > > > On Fri, Jun 14, 2019 at 01:58:42PM -0700, Alexei Starovoitov wrote: > > > On Fri, Jun 14, 2019 at 12:56:41PM -0500, Josh Poimboeuf wrote: &

Re: [PATCH v2 2/5] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 01:58:42PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 12:56:41PM -0500, Josh Poimboeuf wrote: > > Objtool currently ignores ___bpf_prog_run() because it doesn't > > understand the jump table. This results in the ORC unwinder not being >

Re: [PATCH v2 1/5] perf/x86: Always store regs->ip in perf_callchain_kernel()

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 01:56:15PM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 12:56:40PM -0500, Josh Poimboeuf wrote: > > From: Song Liu > > > > The stacktrace_map_raw_tp BPF selftest is failing because the RIP saved > > by perf_arch_fetch_caller

Re: [PATCH 3/3] module: Improve module __ro_after_init handling

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 04:14:53PM +0200, Petr Mladek wrote: > > -void __module_enable_ro(const struct module *mod, bool after_init) > > +static void __module_enable_ro(const struct module *mod) > > { > > if (!rodata_enabled) > > return; > > @@ -1973,15 +1973,15 @@ void

Re: [PATCH 2/3] module: Add text_mutex lockdep assertions for page attribute changes

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 04:04:57PM +0200, Petr Mladek wrote: > On Thu 2019-06-13 20:07:23, Josh Poimboeuf wrote: > > External callers of the module page attribute change functions now need > > to have the text_mutex. Enforce that with lockdep assertions. > > > > dif

[PATCH v2 5/5] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-14 Thread Josh Poimboeuf
) then this will allow ORC to unwind through most generated code despite there being no corresponding ORC entries. Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER") Reported-by: Song Liu Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) ---

[PATCH v2 0/5] x86/bpf: unwinder fixes

2019-06-14 Thread Josh Poimboeuf
to argue about whether code readability is a good thing. - I can do the 32-bit version of the fix when I get back. It should be easy enough. v1 is here: https://lkml.kernel.org/r/cover.1560431531.git.jpoim...@redhat.com Josh Poimboeuf (4): objtool: Fix ORC unwinding in non-JIT BPF generated

[PATCH v2 1/5] perf/x86: Always store regs->ip in perf_callchain_kernel()

2019-06-14 Thread Josh Poimboeuf
hains work without CONFIG_FRAME_POINTER") Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- arch/x86/events/core.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index f0e4804515d8..6a7cfcadfc1

[PATCH v2 2/5] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-14 Thread Josh Poimboeuf
support for reading any static local jump table array named "jump_table", and rename the BPF variable accordingly, so objtool can generate ORC data for ___bpf_prog_run(). Fixes: d15d356887e7 ("perf/x86: Make perf callchains work without CONFIG_FRAME_POINTER") Reported-by: Song Liu

[PATCH v2 4/5] x86/bpf: Fix 64-bit JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
, simplify the BPF JIT prologue such that it more closely resembles a typical compiler-generated prologue. This also reduces the prologue size quite a bit overall. Suggested-by: David Laight Signed-off-by: Josh Poimboeuf --- arch/x86/net/bpf_jit_comp.c | 106

[PATCH v2 3/5] x86/bpf: Move epilogue generation to a dedicated function

2019-06-14 Thread Josh Poimboeuf
Improve code readability by moving the BPF JIT function epilogue generation code to a dedicated emit_epilogue() function, analagous to the existing emit_prologue() function. Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) --- arch/x86/net/bpf_jit_comp.c | 37

Re: [PATCH 6/9] x86/bpf: Fix JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 01:58:21PM +, David Laight wrote: > From: Josh Poimboeuf > > Sent: 14 June 2019 14:44 > > > > On Fri, Jun 14, 2019 at 10:50:23AM +, David Laight wrote: > > > On Thu, Jun 13, 2019 at 08:21:03AM -0500, Josh Poimboeuf wrote: > &g

Re: [PATCH 2/9] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-14 Thread Josh Poimboeuf
: > > > > On Thu, Jun 13, 2019 at 08:20:30PM -0500, Josh Poimboeuf wrote: > > > > > On Thu, Jun 13, 2019 at 01:57:11PM -0700, Alexei Starovoitov wrote: > > > > > > > > > > and to patches 8 and 9. > > > > > > > > > >

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 08:31:53AM -0700, Alexei Starovoitov wrote: > On Fri, Jun 14, 2019 at 6:34 AM Josh Poimboeuf wrote: > > > > On Thu, Jun 13, 2019 at 11:00:09PM -0700, Alexei Starovoitov wrote: > > > > +

Re: [PATCH 6/9] x86/bpf: Fix JIT frame pointer usage

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 10:50:23AM +, David Laight wrote: > On Thu, Jun 13, 2019 at 08:21:03AM -0500, Josh Poimboeuf wrote: > > The BPF JIT code clobbers RBP. This breaks frame pointer convention and > > thus prevents the FP unwinder from unwinding through JIT generated co

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-14 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 11:00:09PM -0700, Alexei Starovoitov wrote: > > + if (src_reg == BPF_REG_FP) { > > + /* > > +* If the value was copied from RBP (real frame pointer), > > +* adjust it to the BPF program's frame pointer value. > > +* > > +

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-14 Thread Josh Poimboeuf
On Fri, Jun 14, 2019 at 09:41:37AM +0200, Peter Zijlstra wrote: > On Thu, Jun 13, 2019 at 11:00:09PM -0700, Alexei Starovoitov wrote: > > > There is something wrong with > > commit d15d356887e7 ("perf/x86: Make perf callchains work without > > CONFIG_FRAME_POINTER") > > It assumes we can always

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 09:28:48PM -0500, Josh Poimboeuf wrote: > On Thu, Jun 13, 2019 at 08:58:48PM -0500, Josh Poimboeuf wrote: > > On Thu, Jun 13, 2019 at 06:42:45PM -0700, Alexei Starovoitov wrote: > > > On Thu, Jun 13, 2019 at 08:30:51PM -0500, Josh Poimboeuf wrote: >

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 08:58:48PM -0500, Josh Poimboeuf wrote: > On Thu, Jun 13, 2019 at 06:42:45PM -0700, Alexei Starovoitov wrote: > > On Thu, Jun 13, 2019 at 08:30:51PM -0500, Josh Poimboeuf wrote: > > > On Thu, Jun 13, 2019 at 03:00:55PM -0700, Alexei Starovoitov wrote: &

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 06:42:45PM -0700, Alexei Starovoitov wrote: > On Thu, Jun 13, 2019 at 08:30:51PM -0500, Josh Poimboeuf wrote: > > On Thu, Jun 13, 2019 at 03:00:55PM -0700, Alexei Starovoitov wrote: > > > > @@ -392,8 +402,16 @@ bool unwind_next_frame(struc

Re: [PATCH 6/9] x86/bpf: Fix JIT frame pointer usage

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 06:39:05PM -0700, Alexei Starovoitov wrote: > On Thu, Jun 13, 2019 at 08:22:48PM -0500, Josh Poimboeuf wrote: > > On Thu, Jun 13, 2019 at 02:58:09PM -0700, Alexei Starovoitov wrote: > > > On Thu, Jun 13, 2019 at 08:21:03AM -0500, Josh Poimboeuf wrote: &

Re: [PATCH 2/9] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 06:37:21PM -0700, Alexei Starovoitov wrote: > On Thu, Jun 13, 2019 at 08:20:30PM -0500, Josh Poimboeuf wrote: > > On Thu, Jun 13, 2019 at 01:57:11PM -0700, Alexei Starovoitov wrote: > > > On Thu, Jun 13, 2019 at 08:20:59AM -0500, Josh Poimboeuf wrot

Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers for generated code

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 03:00:55PM -0700, Alexei Starovoitov wrote: > > @@ -392,8 +402,16 @@ bool unwind_next_frame(struct unwind_state *state) > > * calls and calls to noreturn functions. > > */ > > orc = orc_find(state->signal ? state->ip : state->ip - 1); > > - if (!orc) > > -

Re: [PATCH 6/9] x86/bpf: Fix JIT frame pointer usage

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 02:58:09PM -0700, Alexei Starovoitov wrote: > On Thu, Jun 13, 2019 at 08:21:03AM -0500, Josh Poimboeuf wrote: > > The BPF JIT code clobbers RBP. This breaks frame pointer convention and > > thus prevents the FP unwinder from unwinding through JIT

Re: [PATCH 2/9] objtool: Fix ORC unwinding in non-JIT BPF generated code

2019-06-13 Thread Josh Poimboeuf
On Thu, Jun 13, 2019 at 01:57:11PM -0700, Alexei Starovoitov wrote: > On Thu, Jun 13, 2019 at 08:20:59AM -0500, Josh Poimboeuf wrote: > > Objtool currently ignores ___bpf_prog_run() because it doesn't > > understand the jump table. This results in the ORC unwinder not being >

[PATCH 3/3] module: Improve module __ro_after_init handling

2019-06-13 Thread Josh Poimboeuf
and instead make __module_enable_ro() smart enough to only frob the __ro_after_init section after the module has gone live. Reported-by: Petr Mladek Signed-off-by: Josh Poimboeuf --- arch/arm64/kernel/ftrace.c | 2 +- include/linux/module.h | 4 ++-- kernel/livepatch/core.c| 4

[PATCH 0/3] module: Livepatch/ftrace fixes

2019-06-13 Thread Josh Poimboeuf
Patch 1 fixes a module loading race between livepatch and ftrace. Patch 2 adds lockdep assertions assocated with patch 1. Patch 3 fixes a theoretical bug in the module __ro_after_init section handling. Josh Poimboeuf (3): module: Fix livepatch/ftrace module text permissions race module: Add

[PATCH 2/3] module: Add text_mutex lockdep assertions for page attribute changes

2019-06-13 Thread Josh Poimboeuf
External callers of the module page attribute change functions now need to have the text_mutex. Enforce that with lockdep assertions. Signed-off-by: Josh Poimboeuf --- kernel/module.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/kernel

[PATCH 1/3] module: Fix livepatch/ftrace module text permissions race

2019-06-13 Thread Josh Poimboeuf
hanges -- are protected by the text_mutex. Reported-by: Johannes Erdfelt Fixes: 444d13ff10fb ("modules: add ro_after_init support") Signed-off-by: Josh Poimboeuf Acked-by: Jessica Yu Reviewed-by: Petr Mladek Reviewed-by: Miroslav Benes --- kernel/livepatch/core.c | 6 ++ kerne

<    4   5   6   7   8   9   10   11   12   13   >