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: <1647850610.961i89najm.naveen@linux.ibm.com>
Date:   Mon, 21 Mar 2022 13:49:28 +0530
From:   "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To:     Christophe Leroy <christophe.leroy@...roup.eu>,
        "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
        Sathvika Vasireddy <sv@...ux.ibm.com>
Cc:     "aik@...abs.ru" <aik@...abs.ru>,
        "jpoimboe@...hat.com" <jpoimboe@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>
Subject: Re: [RFC PATCH 2/3] objtool: Enable and implement 'mcount' subcommand

Christophe Leroy wrote:
> 
> 
> Le 18/03/2022 à 11:51, Sathvika Vasireddy a écrit :
>> This patch adds 'mcount' as a subcommand to objtool, and enables
>> the same for x86. objtool is built if CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>> is selected. Additionally, architectures can select HAVE_NOP_MCOUNT
>> if they choose to nop out mcount call sites. If that config option is
>> selected, then --mnop is passed as an option to 'objtool mcount'
>> 
>> Signed-off-by: Sathvika Vasireddy <sv@...ux.ibm.com>
>> ---
>>   Makefile                                |   6 ++
>>   arch/x86/Kconfig                        |   3 +-
>>   scripts/Makefile.build                  |  12 +++
>>   tools/objtool/Build                     |   2 +
>>   tools/objtool/Makefile                  |   4 +-
>>   tools/objtool/builtin-mcount.c          |  74 +++++++++++++
>>   tools/objtool/include/objtool/builtin.h |   4 +-
>>   tools/objtool/include/objtool/objtool.h |   1 +
>>   tools/objtool/mcount.c                  | 138 ++++++++++++++++++++++++
>>   tools/objtool/objtool.c                 |   1 +
>>   tools/objtool/weak.c                    |   5 +
>>   11 files changed, 247 insertions(+), 3 deletions(-)
>>   create mode 100644 tools/objtool/builtin-mcount.c
>>   create mode 100644 tools/objtool/mcount.c
>> 
>> diff --git a/Makefile b/Makefile
>> index 55a30ca69350..316f7d08b30a 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -846,7 +846,9 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
>>     endif
>>   endif
>>   ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>> + ifdef CONFIG_HAVE_NOP_MCOUNT
>>     CC_FLAGS_USING	+= -DCC_USING_NOP_MCOUNT
>> + endif
>>   endif
>>   ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
>>     ifdef CONFIG_HAVE_C_RECORDMCOUNT
>> @@ -1303,6 +1305,10 @@ ifdef CONFIG_STACK_VALIDATION
>>   prepare: tools/objtool
>>   endif
>>   
>> +ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>> +prepare: tools/objtool
>> +endif
> 
> I don't think that will work for powerpc.
> 
> See arch/powerpc/Makefile
> 
> powerpc builds the VDSO under prepare: , and powerpc has 
> CONFIG_HAVE_GENERIC_VDSO so there are some C files in that step that 
> seem to use objtool, allthough that looks odd to me. Must be something 
> to fix somewhere.
> 
>    powerpc64-linux-gcc 
> -Wp,-MMD,arch/powerpc/kernel/vdso/.vgettimeofday-64.o.d -nostdinc 
> -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include 
> -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi 
> -I./include/uapi -I./include/generated/uapi -include 
> ./include/linux/compiler-version.h -include ./include/linux/kconfig.h 
> -include ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc 
> -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -Wall -Wundef 
> -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing 
> -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration 
> -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 
> -mbig-endian -m64 -msoft-float -pipe -mtraceback=no -mabi=elfv1 
> -mcall-aixdesc -mcmodel=medium -mno-pointers-to-nested-functions 
> -mtune=power7 -mcpu=power5 -mno-altivec -mno-vsx 
> -fno-asynchronous-unwind-tables -mno-string -Wa,-maltivec -Wa,-mpower4 
> -Wa,-many -mabi=elfv1 -mcall-aixdesc -mbig-endian 
> -mstack-protector-guard=tls -mstack-protector-guard-reg=r13 
> -fno-delete-null-pointer-checks -Wno-frame-address 
> -Wno-format-truncation -Wno-format-overflow 
> -Wno-address-of-packed-member -O2 -fno-allow-store-data-races 
> -Wframe-larger-than=2048 -fstack-protector-strong 
> -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable 
> -Wno-unused-const-variable -fno-stack-clash-protection 
> -Wdeclaration-after-statement -Wvla -Wno-pointer-sign 
> -Wcast-function-type -Wno-stringop-truncation -Wno-zero-length-bounds 
> -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict 
> -Wno-maybe-uninitialized -Wno-alloc-size-larger-than 
> -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time 
> -Werror=incompatible-pointer-types -Werror=designated-init 
> -Wno-packed-not-aligned -mstack-protector-guard-offset=3200 -shared 
> -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both -include 
> /home/chleroy/linux-powerpc/lib/vdso/gettimeofday.c -fno-stack-protector 
> -DDISABLE_BRANCH_PROFILING -ffreestanding -fasynchronous-unwind-tables 
> -ffixed-r30 
> -DKBUILD_MODFILE='"arch/powerpc/kernel/vdso/vgettimeofday-64"' 
> -DKBUILD_BASENAME='"vgettimeofday_64"' 
> -DKBUILD_MODNAME='"vgettimeofday_64"' 
> -D__KBUILD_MODNAME=kmod_vgettimeofday_64 -c -o 
> arch/powerpc/kernel/vdso/vgettimeofday-64.o 
> arch/powerpc/kernel/vdso/vgettimeofday.c  ; ./tools/objtool/objtool 
> mcount arch/powerpc/kernel/vdso/vgettimeofday-64.o

We don't enable ftrace for vdso, so I suspect objtool run above will be 
a no-op. This needs to be confirmed, of course.


- Naveen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ