Skip to content

PIE applications using "optarg" do not work on newer gcc #689

@nyh

Description

@nyh

Trying to run the memcached application (scripts/build image=memcached; scripts/run.py) no longer works. This is on the same Fedora 22 machine which used to run this correctly, so it appears to be a regression. The output shows a page fault in the kernel, with gdb reporting the following stack trace:

#8  <signal handler called>
#9  0x00000000004658fc in atoi (s=0x0) at musl/src/stdlib/atoi.c:7
#10 0x0000100000c16860 in main ()
#11 0x000000000040c863 in osv::application::run_main (
    this=this@entry=0xffffa00002df2710, path="/memcached", argc=argc@entry=5, 
    argv=argv@entry=0xffffa00002d91200) at core/app.cc:293
#12 0x000000000040f159 in osv::application::run_main (
    this=this@entry=0xffffa00002df2710) at core/app.cc:310
#13 0x000000000020c6f7 in osv::application::main (this=0xffffa00002df2710)
    at core/app.cc:238

So apparently, something we recently changed (in command line arguments? environment variables?) caused memcached's main() function (unfortunately, no line number information, but it's the main() function of memcached) to do an atoi on a null string.

To add insult to injury, I also see this:

$ scripts/run.py -e "memcached -u root"
OSv v0.24-21-g522f1da
eth0: 192.168.122.15
Memcached for OSV, based on Memcached 1.4.21
can't run as root without the -u switch

So something appears to be broken with the command line processing?

Also note I can reproduce the first problem (a crash) by using the command line

scripts/run.py -e "memcached -t 1"

(so it is not limited to the default command line).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions