On Tue, 11 Nov 2014, Andi Kleen wrote: > Joseph Myers <jos...@codesourcery.com> writes: > > > On Tue, 11 Nov 2014, Ilya Enkovich wrote: > > > >> Hi, > >> > >> This patch integrates MPX runtime library into GCC source tree. MPX > >> runtime is responsible for initialization of MPX feature in HW, signal > >> handling, reporting etc. Library is linked to codes compiled with > >> -mmpx. > >> > >> Bootstrap is OK for x86_64-unknown-linux-gnu. OK for trunk? > > > > Please use symbol versioning to control the set of exports for the > > library; only symbols explicitly listed to be exported at a given symbol > > version should be exported. > > Also I think you need some user documentation on the implications of the > overriding of sigaction. If someone else wants to do similar tricks (and > I'm sure some do) there would be conflicts.
Indeed, I don't understand what the purpose of this overriding is. What goes wrong if you just use default signal handling in a program built with MPX, or don't handle any environment variables specially at all? That is, why does this need to be linked with all programs built with MPX at all, rather than being optional functionality in an independent library that people can choose to build and link with if they want that extra functionality? My starting point is that MPX provides functionality for detecting certain cases of undefined behavior in C that wouldn't otherwise be detected, and it should be possible to use with any C program (including ISO C ones that don't use POSIX interfaces such as sigaction and may use the sigaction identifier for some other purpose). Another issue: handle_sigsegv calls functions documented in the glibc manual as AS-unsafe, such as pthread_setspecific and (via do_exit) fprintf. You need to make sure everything called from a signal handler is AS-safe. -- Joseph S. Myers jos...@codesourcery.com