Disable lazy binding on tests for minimal signal handler

Message ID CAMe9rOpvURR17iWf+YJYa10PwL2A73PH8of8OnnPST15Cw81dQ@mail.gmail.com
State New
Headers show
Series
  • Disable lazy binding on tests for minimal signal handler
Related show

Commit Message

H.J. Lu Jan. 18, 2019, 5:22 p.m.
On Fri, Jan 18, 2019 at 8:40 AM Carlos O'Donell <carlos@redhat.com> wrote:
>

> On 1/18/19 9:53 AM, H.J. Lu wrote:

> > On Thu, Jan 17, 2019 at 7:12 PM Zack Weinberg <zackw@panix.com> wrote:

> >>

> >> On Wed, Jan 16, 2019 at 10:31 PM H.J. Lu <hjl.tools@gmail.com> wrote:

> >>>

> >>> The new tests failed on AVX512 machines:

> >>>

> >>> Program received signal SIGUSR1, User defined signal 1.

> >>> __GI_raise (sig=sig@entry=10) at ../sysdeps/unix/sysv/linux/raise.c:50

> >>> 50   return ret;

> >>> (gdb) c

> >>> Continuing.

> >>>

> >>> Program received signal SIGSEGV, Segmentation fault.

> >>> _dl_runtime_resolve_xsavec () at ../sysdeps/x86_64/dl-trampoline.h:93

> >>> 93 movq %rax, REGISTER_SAVE_RAX(%rsp)

> >>> (gdb) bt

> >>> #0  _dl_runtime_resolve_xsavec () at ../sysdeps/x86_64/dl-trampoline.h:93

> >>> #1  0x0040248d in handler (unused=<optimized out>) at tst-minsigstksz-4.c:44

> >>> #2  <signal handler called>

> >>> #3  __GI_raise (sig=sig@entry=10) at ../sysdeps/unix/sysv/linux/raise.c:50

> >>> #4  0x004024da in do_test () at tst-minsigstksz-4.c:59

> >>> #5  0x00402cd6 in support_test_main (argc=1, argv=0xffffcef8,

> >>>     config=config@entry=0xffffcdf0) at support_test_main.c:350

> >>> #6  0x00402348 in main (argc=<optimized out>, argv=<optimized out>)

> >>>     at ../support/test-driver.c:168

> >>> (gdb)

> >>>

> >>> AVX512 needs 2560 bytes to save processor state.

> >>

> >> Well, this is the problem that we knew existed and can't fix quickly.

> >> If I'm reading http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html

> >> correctly, we can't introduce new sysconf constants unilaterally

> >> (there is no license to define system-specific _SC_* symbols).

> >>

> >> I wonder if this test passes if you run it with LD_BIND_NOW=t in the

> >> environment.  Forcing -z now for these tests might be the best we can

> >> do for 2.29.

> >>

> >

> > This works:

> >

> > diff --git a/signal/Makefile b/signal/Makefile

> > index 9597287bca..9c65c26887 100644

> > --- a/signal/Makefile

> > +++ b/signal/Makefile

> > @@ -59,3 +59,9 @@ CFLAGS-sigwait.c += -fexceptions -fasynchronous-unwind-tables

> >  CFLAGS-sigwaitinfo.c += -fexceptions -fasynchronous-unwind-tables

> >

> >  CFLAGS-sigreturn.c += $(no-stack-protector)

> > +

>

> OK with comment:

>

> # We don't want to test the lazy resolution stack usage

> # just the execution of the handler and the functions

> > +LDFLAGS-tst-minsigstksz-1 = -Wl,-z,now

> > +LDFLAGS-tst-minsigstksz-2 = -Wl,-z,now

> > +LDFLAGS-tst-minsigstksz-3 = -Wl,-z,now

> > +LDFLAGS-tst-minsigstksz-3a = -Wl,-z,now

> > +LDFLAGS-tst-minsigstksz-4 = -Wl,-z,now

> >

>

> I'd say this is OK for master.

>

> Reviewed-by: Carlos O'Donell <carlos@redhat.com>

>

> All of this raises an interesting point. Should MINSIGSTKSZ

> have included enough space for the lazy resolution to happen?

> I think we have to, because you're never going to have already

> called abort, quick_exit, or _exit, so they will all go through

> lazy binding resolution if you're not BIND_NOW. Which means we

> need an average estimate from all arches about the lazy binding

> stack usage.

>


This is the patch I am checking in.

Thanks.

-- 
H.J.

Patch

From 562f43620dc4fd06e4d7abc7cd03c05cd8ea98ae Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 18 Jan 2019 08:56:51 -0800
Subject: [PATCH] Disable lazy binding on tests for minimal signal handler

Since MINSIGSTKSZ may not have sufficent stack space to allow lazy
binding, build tests for minimal signal handler with -Wl,-z,now to
disable lazy binding.

	* signal/Makefile (LDFLAGS-tst-minsigstksz-1): New.  Set to
	-Wl,-z,now.
	(LDFLAGS-tst-minsigstksz-2): Likewise.
	(LDFLAGS-tst-minsigstksz-3): Likewise.
	(LDFLAGS-tst-minsigstksz-3a): Likewise.
	(LDFLAGS-tst-minsigstksz-4): Likewise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
---
 ChangeLog       | 9 +++++++++
 signal/Makefile | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 1b13e62e88..59d8b83289 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@ 
+2019-01-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* signal/Makefile (LDFLAGS-tst-minsigstksz-1): New.  Set to
+	-Wl,-z,now.
+	(LDFLAGS-tst-minsigstksz-2): Likewise.
+	(LDFLAGS-tst-minsigstksz-3): Likewise.
+	(LDFLAGS-tst-minsigstksz-3a): Likewise.
+	(LDFLAGS-tst-minsigstksz-4): Likewise.
+
 2019-01-18  TAMUKI Shoichi  <tamuki@linet.gr.jp>
 
 	* manual/time.texi (strftime): Fix the wording to "alternative" rather
diff --git a/signal/Makefile b/signal/Makefile
index 9597287bca..06034fee8e 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -59,3 +59,11 @@  CFLAGS-sigwait.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-sigwaitinfo.c += -fexceptions -fasynchronous-unwind-tables
 
 CFLAGS-sigreturn.c += $(no-stack-protector)
+
+# We don't want to test the lazy resolution stack usage, just the
+# execution of the handler and the functions.
+LDFLAGS-tst-minsigstksz-1 = -Wl,-z,now
+LDFLAGS-tst-minsigstksz-2 = -Wl,-z,now
+LDFLAGS-tst-minsigstksz-3 = -Wl,-z,now
+LDFLAGS-tst-minsigstksz-3a = -Wl,-z,now
+LDFLAGS-tst-minsigstksz-4 = -Wl,-z,now
-- 
2.20.1