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] [day] [month] [year] [list]
Message-Id: <20231113071942.35259-1-tanyuan@tinylab.org>
Date:   Mon, 13 Nov 2023 15:19:42 +0800
From:   Yuan Tan <tanyuan@...ylab.org>
To:     i@...kray.me
Cc:     arnd@...db.de, falcon@...ylab.org, linux-kernel@...r.kernel.org,
        linux-mips@...r.kernel.org, linux-riscv@...ts.infradead.org,
        linux-sparse@...r.kernel.org, linux@...ssschuh.net,
        luc.vanoostenryck@...il.com, palmer@...osinc.com,
        paul.walmsley@...ive.com, paulburton@...nel.org,
        paulmck@...nel.org, tanyuan@...ylab.org, tim.bird@...y.com,
        tsbogend@...ha.franken.de, w@....eu
Subject: Re: [PATCH v1 09/14] DCE/DSE: inhibit .size directive for SHF_GROUP

Hi, Fangrui

Thank you for your time :)

On 11/6/2023 4:50 AM, Fangrui Song wrote:
> On Fri, Nov 3, 2023 at 9:01 AM Yuan Tan <tanyuan@...ylab.org> wrote:
> >
> > .size directive fails in some functions with SHF_GROUP, this is not
> > really required for normal building, inhibit it to silence the compiling
> > failures with SHF_GROUP.
> >
> > Signed-off-by: Yuan Tan <tanyuan@...ylab.org>
> > Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
> > ---
> >  Makefile | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index a4e522b747cb..f67b6e8d2c45 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -936,6 +936,9 @@ endif
> >  # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0).
> >  ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
> >  KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
> > +ifdef CONFIG_SECTION_SHF_GROUP_SUPPORT
> > +KBUILD_CFLAGS_KERNEL += -finhibit-size-directive
> > +endif
> >  KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y
> >  LDFLAGS_vmlinux += --gc-sections
> >  ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION_DEBUG
> > --
> > 2.34.1
> >
> 
> Clang doesn't support -finhibit-size-directive, so this would break
> Clang builds.

Currently, Clang doesn't support LD_DEAD_CODE_DATA_ELIMINATION. So in this
patch series I didn't take much thought about clang.

> 
> GCC has had this option since 1992, but it is not used in the wild.
> https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-finhibit-size-directive
> says
> 
> > ... This option is used when compiling crtstuff.c; you should not need to use it for anything else.
> 
> What problem have you seen with .size directives (st_size field in
> symbol table entries)?

$ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- fs/ioctl.o
/tmp/ccy5E3wN.s: Error: .size expression for __riscv_sys_ioctl does not evaluate to a constant
make[3]: *** [scripts/Makefile.build:243: fs/ioctl.o] Error 1
make[2]: *** [scripts/Makefile.build:480: fs] Error 2
make[1]: *** [/home/tanyuan/projects/linux/Makefile:1916: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2

And the fs/ioctl.s is like
	.section	.text.__riscv_sys_ioctl,"ax",@progbits
	.align	1
	.globl	__riscv_sys_ioctl
	.type	__riscv_sys_ioctl, @function
__riscv_sys_ioctl:
        ...
        ...
	.size	__riscv_sys_ioctl, .-__riscv_sys_ioctl

I cannot understand this error and this option just solve the problem :)

> 
> % cat a.c
> int v;
> void f() {}
> % diff -u0 <(gcc -S a.c -o -) <(gcc -S -finhibit-size-directive a.c -o -)
> --- /proc/self/fd/11    2023-11-05 12:42:51.298618475 -0800
> +++ /proc/self/fd/15    2023-11-05 12:42:51.298618475 -0800
> @@ -7 +6,0 @@
> -       .size   v, 4
> @@ -27 +25,0 @@
> -       .size   f, .-f
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ