lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220419201435.GY2731@worktop.programming.kicks-ass.net>
Date:   Tue, 19 Apr 2022 22:14:35 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Josh Poimboeuf <jpoimboe@...hat.com>, linux-kernel@...r.kernel.org,
        x86@...nel.org, Miroslav Benes <mbenes@...e.cz>
Subject: Re: [PATCH v2] scripts: Create objdump-func helper script

On Tue, Apr 19, 2022 at 09:50:01PM +0200, Borislav Petkov wrote:
> On Tue, Apr 19, 2022 at 09:12:23AM -0700, Josh Poimboeuf wrote:
> > Add a simple script which disassembles a single function from an object
> > file.  Comes in handy for objtool warnings and kernel stack traces.
> > 
> > Originally-by: Peter Zijlstra <peterz@...radead.org>
> > Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> > ---
> > v2:
> > - require gawk
> > 
> >  scripts/objdump-func | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> >  create mode 100755 scripts/objdump-func
> 
> Was that supposed to be user-friendly too?
> 
> $ ./scripts/objdump-func -h
> ./scripts/objdump-func: line 16: $1: unbound variable
> 
> :-)
> 
> 
> It works tho:
> 
> $ ./scripts/objdump-func vmlinux rewind_stack_and_make_dead
> 0000 ffffffff81001c00 <rewind_stack_and_make_dead>:
> 0000 ffffffff81001c00:  31 ed                   xor    %ebp,%ebp
> 0000 ffffffff81001c02:  65 48 8b 04 25 d0 ec 01 00      mov    %gs:0x1ecd0,%rax
> 0000 ffffffff81001c0b:  48 8d a0 58 ff ff ff    lea    -0xa8(%rax),%rsp
> 0000 ffffffff81001c12:  e8 39 24 07 00          call   ffffffff81074050 <make_task_dead>
> ^^^^
> 
> I guess those zeros at the beginning are supposed to mean something...

Use the .o file and it'll work:

$ ./objdump-func.sh defconfig-build/vmlinux.o rewind_stack_and_make_dead
0000 0000000000001380 <rewind_stack_and_make_dead>:
0000     1380:  31 ed                   xor    %ebp,%ebp
0002     1382:  65 48 8b 04 25 00 00 00 00      mov    %gs:0x0,%rax     1387: R_X86_64_32S      cpu_current_top_of_stack
000b     138b:  48 8d a0 58 ff ff ff    lea    -0xa8(%rax),%rsp
0012     1392:  e8 00 00 00 00          call   1397 <preempt_schedule_thunk>    1393: R_X86_64_PLT32    make_task_dead-0x4


Now the first coloumn is the symbol relative offset, while the second
column is the section relative offset objdump normally gives you.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ