This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"segfault at 0 ip (null) .." at when using LD_PRELOAD on tty7 (GUI)


Has anyone encounter a situation like this:
I use a script to export the LD_PRELOAD environment variable at system startup:

    # /etc/profile.d/
    export LD_PRELOAD=/path/to/my/

Inside "", there are three wrapper: open/read/write, which I
use as hooks of the open/read/write system calls. I was hoping that
after setting LD_PRELOAD to point to "" at system startup,
every program, when executing, will load the ""
automatically and when they invoke open/read/write, my hooks will get
invoked instead.

This work fine, except that it does not work for most GUI programs,
that is, those program running on tty7. I just cannot start those GUI
programs. I find in /var/log/kern.log and /var/log/syslog something

    "...program name... segfault at 0 ip null sp... error 14"

for every GUI program I try to execute.

Those "segfault at 0 ip null..." looks very weird to me because I can
find anywhere in my code any use of NULL pointer. And my code work
find for every other program when I explicitly set LD_PRELOAD instead
of setting it at system startup.

The most strange thing is: I move to other tty (say tty4) and rm
"/path/to/my/", and go back to tty7, all GUI programs work
fine, as expected. And then I cp another "" to
"/path/to/my/", those GUI programs still work fine and all my hooks
get invoked correctly!

I don't understand, why would I get "segfault at 0 ip (null) ..." if I
set LD_PRELOAD=/path/to/my/ at system startup, while it
works fine if I set it lately, after system startup.

I think this might be a linkage bug/feature of the dynamic linker
which I don't knows. Hopefully anyone who know it can provide some

FYI, I am using a Ubuntu 16.04, and tty7 is used for GUI. And it seems
that the kernel provides no core file for this situation...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]