All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] tools/nolibc: always disable stack protector for tests
@ 2023-03-19 13:50 Willy Tarreau
  2023-03-19 13:51 ` [PATCH 1/1] " Willy Tarreau
  2023-03-19 18:05 ` [PATCH 0/1] " Paul E. McKenney
  0 siblings, 2 replies; 7+ messages in thread
From: Willy Tarreau @ 2023-03-19 13:50 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: linux, linux-kernel, Willy Tarreau

Hello Paul,

Thomas noticed that nolibc-test fails to build on compilers that enable
stack protectors by default. Passing -fno-stack-protector when supported
addresses the problem.

I verified that all supported archs continue to work after his patch is
applied, and that it applies without conflict (and works) both on top of
your latest dev tree and on top of Linus' master branch. Thus I think it
can make sense to queue it with your next series of fixes and have it for
6.3 given that it addresses build issues for some developers.

Thanks!
Willy
---
Thomas Weißschuh (1):
  tools/nolibc: always disable stack protector for tests

 tools/testing/selftests/nolibc/Makefile | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.17.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/1] tools/nolibc: always disable stack protector for tests
  2023-03-19 13:50 [PATCH 0/1] tools/nolibc: always disable stack protector for tests Willy Tarreau
@ 2023-03-19 13:51 ` Willy Tarreau
  2023-03-19 18:05 ` [PATCH 0/1] " Paul E. McKenney
  1 sibling, 0 replies; 7+ messages in thread
From: Willy Tarreau @ 2023-03-19 13:51 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: linux, linux-kernel, Willy Tarreau

From: Thomas Weißschuh <linux@weissschuh.net>

Stack protectors need support from libc.
This support is not provided by nolibc which leads to compiler errors
when stack protectors are enabled by default in a compiler:

      CC      nolibc-test
    /usr/bin/ld: /tmp/ccqbHEPk.o: in function `stat':
    nolibc-test.c:(.text+0x1d1): undefined reference to `__stack_chk_fail'
    /usr/bin/ld: /tmp/ccqbHEPk.o: in function `poll.constprop.0':
    nolibc-test.c:(.text+0x37b): undefined reference to `__stack_chk_fail'
    /usr/bin/ld: /tmp/ccqbHEPk.o: in function `vfprintf.constprop.0':
    nolibc-test.c:(.text+0x712): undefined reference to `__stack_chk_fail'
    /usr/bin/ld: /tmp/ccqbHEPk.o: in function `pad_spc.constprop.0':
    nolibc-test.c:(.text+0x80d): undefined reference to `__stack_chk_fail'
    /usr/bin/ld: /tmp/ccqbHEPk.o: in function `printf':
    nolibc-test.c:(.text+0x8c4): undefined reference to `__stack_chk_fail'
    /usr/bin/ld: /tmp/ccqbHEPk.o:nolibc-test.c:(.text+0x12d4): more undefined references to `__stack_chk_fail' follow
    collect2: error: ld returned 1 exit status

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 tools/testing/selftests/nolibc/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 8fe61d3e3cce..874d141da8c4 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for nolibc tests
 include ../../../scripts/Makefile.include
+# We need this for the "cc-option" macro.
+include ../../../build/Build.include
 
 # we're in ".../tools/testing/selftests/nolibc"
 ifeq ($(srctree),)
@@ -72,6 +74,7 @@ endif
 
 CFLAGS_s390 = -m64
 CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables $(CFLAGS_$(ARCH))
+CFLAGS  += $(call cc-option,-fno-stack-protector)
 LDFLAGS := -s
 
 help:
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] tools/nolibc: always disable stack protector for tests
  2023-03-19 13:50 [PATCH 0/1] tools/nolibc: always disable stack protector for tests Willy Tarreau
  2023-03-19 13:51 ` [PATCH 1/1] " Willy Tarreau
@ 2023-03-19 18:05 ` Paul E. McKenney
  2023-03-19 20:11   ` Willy Tarreau
  1 sibling, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2023-03-19 18:05 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux, linux-kernel

On Sun, Mar 19, 2023 at 02:50:59PM +0100, Willy Tarreau wrote:
> Hello Paul,
> 
> Thomas noticed that nolibc-test fails to build on compilers that enable
> stack protectors by default. Passing -fno-stack-protector when supported
> addresses the problem.
> 
> I verified that all supported archs continue to work after his patch is
> applied, and that it applies without conflict (and works) both on top of
> your latest dev tree and on top of Linus' master branch. Thus I think it
> can make sense to queue it with your next series of fixes and have it for
> 6.3 given that it addresses build issues for some developers.

Queued and pushed, thank you both!

Just to make sure I understand, you would like me to add this to the
serieses from Vincent, yourself, and Feiyang that are set up to go into
the next merge window, correct?

If you instead would like me to push it to Linus directly into the v6.3
release as a regression fix late this coming week, please let me know.

							Thanx, Paul

> Thanks!
> Willy
> ---
> Thomas Weißschuh (1):
>   tools/nolibc: always disable stack protector for tests
> 
>  tools/testing/selftests/nolibc/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
> 
> -- 
> 2.17.5
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] tools/nolibc: always disable stack protector for tests
  2023-03-19 18:05 ` [PATCH 0/1] " Paul E. McKenney
@ 2023-03-19 20:11   ` Willy Tarreau
  2023-03-19 23:54     ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Willy Tarreau @ 2023-03-19 20:11 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: linux, linux-kernel

Hi Paul,

On Sun, Mar 19, 2023 at 11:05:15AM -0700, Paul E. McKenney wrote:
> Queued and pushed, thank you both!

Thank you!

> Just to make sure I understand, you would like me to add this to the
> serieses from Vincent, yourself, and Feiyang that are set up to go into
> the next merge window, correct?
> 
> If you instead would like me to push it to Linus directly into the v6.3
> release as a regression fix late this coming week, please let me know.

It would indeed be preferable for 6.3 as it fixes issues, but it's not
critical at all, just an annoyance for some developers. So if you have a
series of fixes pending to be sent soon, it would be nice to add it there.

Thanks!
Willy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] tools/nolibc: always disable stack protector for tests
  2023-03-19 20:11   ` Willy Tarreau
@ 2023-03-19 23:54     ` Paul E. McKenney
  2023-03-20  3:05       ` Willy Tarreau
  0 siblings, 1 reply; 7+ messages in thread
From: Paul E. McKenney @ 2023-03-19 23:54 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux, linux-kernel

On Sun, Mar 19, 2023 at 09:11:19PM +0100, Willy Tarreau wrote:
> Hi Paul,
> 
> On Sun, Mar 19, 2023 at 11:05:15AM -0700, Paul E. McKenney wrote:
> > Queued and pushed, thank you both!
> 
> Thank you!
> 
> > Just to make sure I understand, you would like me to add this to the
> > serieses from Vincent, yourself, and Feiyang that are set up to go into
> > the next merge window, correct?
> > 
> > If you instead would like me to push it to Linus directly into the v6.3
> > release as a regression fix late this coming week, please let me know.
> 
> It would indeed be preferable for 6.3 as it fixes issues, but it's not
> critical at all, just an annoyance for some developers. So if you have a
> series of fixes pending to be sent soon, it would be nice to add it there.

Very well, here is what I currently have for nolibc, from newest to
oldest:

7712ec32cbda selftests/nolibc: Adjust indentation for Makefile
96218cfc79eb selftests/nolibc: Add support for LoongArch
cab6bbd00f2a tools/nolibc: Add support for LoongArch
496921e4724c tools/nolibc: Add statx() and make stat() rely on statx() if necessary
97a15c47b98c tools/nolibc: Include linux/fcntl.h and remove duplicate code
de06f2fe1aac tools/nolibc: check for S_I* macros before defining them
7fb54b517d44 selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
296659c6e551 tools/nolibc: add getuid() and geteuid()
bd9a87d64994 tools/nolibc: add tests for the integer limits in stdint.h
2d1813a7ef67 tools/nolibc: enlarge column width of tests
5dbcbb2da574 tools/nolibc: add integer types and integer limit macros
111bb94f67eb tools/nolibc: add stdint.h
2dbf8575b2da tools/nolibc: Add gitignore to avoid git complaints about sysroot

I will take the new commit, rebase it to precede the first of the above,
so that the stack will look like this:

7712ec32cbda selftests/nolibc: Adjust indentation for Makefile
96218cfc79eb selftests/nolibc: Add support for LoongArch
cab6bbd00f2a tools/nolibc: Add support for LoongArch
496921e4724c tools/nolibc: Add statx() and make stat() rely on statx() if necessary
97a15c47b98c tools/nolibc: Include linux/fcntl.h and remove duplicate code
de06f2fe1aac tools/nolibc: check for S_I* macros before defining them
7fb54b517d44 selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
296659c6e551 tools/nolibc: add getuid() and geteuid()
bd9a87d64994 tools/nolibc: add tests for the integer limits in stdint.h
2d1813a7ef67 tools/nolibc: enlarge column width of tests
5dbcbb2da574 tools/nolibc: add integer types and integer limit macros
111bb94f67eb tools/nolibc: add stdint.h
2dbf8575b2da tools/nolibc: Add gitignore to avoid git complaints about sysroot
???????????? tools/nolibc: always disable stack protector for tests

Then if tests, -next, and kernel test robot are kind, I will send a
pull request to Linus for the "always disable stack protector for tests"
commit.  The rest I send for the upcoming merge window.

Please let me know if I am missing something.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] tools/nolibc: always disable stack protector for tests
  2023-03-19 23:54     ` Paul E. McKenney
@ 2023-03-20  3:05       ` Willy Tarreau
  2023-03-20 16:41         ` Paul E. McKenney
  0 siblings, 1 reply; 7+ messages in thread
From: Willy Tarreau @ 2023-03-20  3:05 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: linux, linux-kernel

On Sun, Mar 19, 2023 at 04:54:53PM -0700, Paul E. McKenney wrote:
> On Sun, Mar 19, 2023 at 09:11:19PM +0100, Willy Tarreau wrote:
> > Hi Paul,
> > 
> > On Sun, Mar 19, 2023 at 11:05:15AM -0700, Paul E. McKenney wrote:
> > > Queued and pushed, thank you both!
> > 
> > Thank you!
> > 
> > > Just to make sure I understand, you would like me to add this to the
> > > serieses from Vincent, yourself, and Feiyang that are set up to go into
> > > the next merge window, correct?
> > > 
> > > If you instead would like me to push it to Linus directly into the v6.3
> > > release as a regression fix late this coming week, please let me know.
> > 
> > It would indeed be preferable for 6.3 as it fixes issues, but it's not
> > critical at all, just an annoyance for some developers. So if you have a
> > series of fixes pending to be sent soon, it would be nice to add it there.
> 
> Very well, here is what I currently have for nolibc, from newest to
> oldest:
> 
> 7712ec32cbda selftests/nolibc: Adjust indentation for Makefile
> 96218cfc79eb selftests/nolibc: Add support for LoongArch
> cab6bbd00f2a tools/nolibc: Add support for LoongArch
> 496921e4724c tools/nolibc: Add statx() and make stat() rely on statx() if necessary
> 97a15c47b98c tools/nolibc: Include linux/fcntl.h and remove duplicate code
> de06f2fe1aac tools/nolibc: check for S_I* macros before defining them
> 7fb54b517d44 selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
> 296659c6e551 tools/nolibc: add getuid() and geteuid()
> bd9a87d64994 tools/nolibc: add tests for the integer limits in stdint.h
> 2d1813a7ef67 tools/nolibc: enlarge column width of tests
> 5dbcbb2da574 tools/nolibc: add integer types and integer limit macros
> 111bb94f67eb tools/nolibc: add stdint.h
> 2dbf8575b2da tools/nolibc: Add gitignore to avoid git complaints about sysroot
> 
> I will take the new commit, rebase it to precede the first of the above,
> so that the stack will look like this:
> 
> 7712ec32cbda selftests/nolibc: Adjust indentation for Makefile
> 96218cfc79eb selftests/nolibc: Add support for LoongArch
> cab6bbd00f2a tools/nolibc: Add support for LoongArch
> 496921e4724c tools/nolibc: Add statx() and make stat() rely on statx() if necessary
> 97a15c47b98c tools/nolibc: Include linux/fcntl.h and remove duplicate code
> de06f2fe1aac tools/nolibc: check for S_I* macros before defining them
> 7fb54b517d44 selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
> 296659c6e551 tools/nolibc: add getuid() and geteuid()
> bd9a87d64994 tools/nolibc: add tests for the integer limits in stdint.h
> 2d1813a7ef67 tools/nolibc: enlarge column width of tests
> 5dbcbb2da574 tools/nolibc: add integer types and integer limit macros
> 111bb94f67eb tools/nolibc: add stdint.h
> 2dbf8575b2da tools/nolibc: Add gitignore to avoid git complaints about sysroot
> ???????????? tools/nolibc: always disable stack protector for tests
> 
> Then if tests, -next, and kernel test robot are kind, I will send a
> pull request to Linus for the "always disable stack protector for tests"
> commit.  The rest I send for the upcoming merge window.
> 
> Please let me know if I am missing something.

This is perfect, thank you very much, Paul!

Willy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] tools/nolibc: always disable stack protector for tests
  2023-03-20  3:05       ` Willy Tarreau
@ 2023-03-20 16:41         ` Paul E. McKenney
  0 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2023-03-20 16:41 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: linux, linux-kernel

On Mon, Mar 20, 2023 at 04:05:02AM +0100, Willy Tarreau wrote:
> On Sun, Mar 19, 2023 at 04:54:53PM -0700, Paul E. McKenney wrote:
> > On Sun, Mar 19, 2023 at 09:11:19PM +0100, Willy Tarreau wrote:
> > > Hi Paul,
> > > 
> > > On Sun, Mar 19, 2023 at 11:05:15AM -0700, Paul E. McKenney wrote:
> > > > Queued and pushed, thank you both!
> > > 
> > > Thank you!
> > > 
> > > > Just to make sure I understand, you would like me to add this to the
> > > > serieses from Vincent, yourself, and Feiyang that are set up to go into
> > > > the next merge window, correct?
> > > > 
> > > > If you instead would like me to push it to Linus directly into the v6.3
> > > > release as a regression fix late this coming week, please let me know.
> > > 
> > > It would indeed be preferable for 6.3 as it fixes issues, but it's not
> > > critical at all, just an annoyance for some developers. So if you have a
> > > series of fixes pending to be sent soon, it would be nice to add it there.
> > 
> > Very well, here is what I currently have for nolibc, from newest to
> > oldest:
> > 
> > 7712ec32cbda selftests/nolibc: Adjust indentation for Makefile
> > 96218cfc79eb selftests/nolibc: Add support for LoongArch
> > cab6bbd00f2a tools/nolibc: Add support for LoongArch
> > 496921e4724c tools/nolibc: Add statx() and make stat() rely on statx() if necessary
> > 97a15c47b98c tools/nolibc: Include linux/fcntl.h and remove duplicate code
> > de06f2fe1aac tools/nolibc: check for S_I* macros before defining them
> > 7fb54b517d44 selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
> > 296659c6e551 tools/nolibc: add getuid() and geteuid()
> > bd9a87d64994 tools/nolibc: add tests for the integer limits in stdint.h
> > 2d1813a7ef67 tools/nolibc: enlarge column width of tests
> > 5dbcbb2da574 tools/nolibc: add integer types and integer limit macros
> > 111bb94f67eb tools/nolibc: add stdint.h
> > 2dbf8575b2da tools/nolibc: Add gitignore to avoid git complaints about sysroot
> > 
> > I will take the new commit, rebase it to precede the first of the above,
> > so that the stack will look like this:
> > 
> > 7712ec32cbda selftests/nolibc: Adjust indentation for Makefile
> > 96218cfc79eb selftests/nolibc: Add support for LoongArch
> > cab6bbd00f2a tools/nolibc: Add support for LoongArch
> > 496921e4724c tools/nolibc: Add statx() and make stat() rely on statx() if necessary
> > 97a15c47b98c tools/nolibc: Include linux/fcntl.h and remove duplicate code
> > de06f2fe1aac tools/nolibc: check for S_I* macros before defining them
> > 7fb54b517d44 selftests/nolibc: skip the chroot_root and link_dir tests when not privileged
> > 296659c6e551 tools/nolibc: add getuid() and geteuid()
> > bd9a87d64994 tools/nolibc: add tests for the integer limits in stdint.h
> > 2d1813a7ef67 tools/nolibc: enlarge column width of tests
> > 5dbcbb2da574 tools/nolibc: add integer types and integer limit macros
> > 111bb94f67eb tools/nolibc: add stdint.h
> > 2dbf8575b2da tools/nolibc: Add gitignore to avoid git complaints about sysroot
> > ???????????? tools/nolibc: always disable stack protector for tests
> > 
> > Then if tests, -next, and kernel test robot are kind, I will send a
> > pull request to Linus for the "always disable stack protector for tests"
> > commit.  The rest I send for the upcoming merge window.
> > 
> > Please let me know if I am missing something.
> 
> This is perfect, thank you very much, Paul!

Done!

							Thanx, Paul

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-20 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-19 13:50 [PATCH 0/1] tools/nolibc: always disable stack protector for tests Willy Tarreau
2023-03-19 13:51 ` [PATCH 1/1] " Willy Tarreau
2023-03-19 18:05 ` [PATCH 0/1] " Paul E. McKenney
2023-03-19 20:11   ` Willy Tarreau
2023-03-19 23:54     ` Paul E. McKenney
2023-03-20  3:05       ` Willy Tarreau
2023-03-20 16:41         ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.