SIGSEGV when trying to run dce-bash-simple

90 views
Skip to first unread message

Hans van den Bogert

unread,
Jul 1, 2014, 10:01:07 AM7/1/14
to ns-3-...@googlegroups.com
I'm trying to run the example of running bash under DCE, so:

1. I've compiled bash 4.1 (and 4.3, but 4.1 seems to have been the one originally used in the examples) with the needed -fPIC and -pie flags
  using the hints given in the example/bash/dce-bash-simple.cc
2. Checked if the executable is now dynamic, using readelf

3. run the example: './waf --run dce-bash-simple --command-template="gdb --args %s "' but a sigsegv is given:


GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/gandalf/src/ns3/source/ns-3-dce/build/bin/dce-bash-simple...done.
(gdb) handle SIGUSR1 nostop
Signal        Stop    Print    Pass to program    Description
SIGUSR1       No    Yes    Yes        User defined signal 1
(gdb) run
Starting program: /home/gandalf/src/ns3/source/ns-3-dce/build/bin/dce-bash-simple
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGUSR1, User defined signal 1.
[New Thread 0x7ffff46f4700 (LWP 31024)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff46f4700 (LWP 31024)]
0x00007fffef45f7f0 in initialize_shell_variables (env=0x3, privmode=0) at variables.c:318
318      for (string_index = 0; string = env[string_index++]; )

4. I've also checked the bash binary if it could be run directly and yes, it shows no errors in that case.

Does someone understand this issue?

Hajime Tazaki

unread,
Jul 1, 2014, 11:28:58 AM7/1/14
to ns-3-...@googlegroups.com
I think I may need to reproduce the bug you pointed out by myself. Please let me know which version of DCE are you using, and the distribution of Linux that you're using. 

-- Hajime
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Hans van den Bogert

unread,
Jul 1, 2014, 4:37:13 PM7/1/14
to ns-3-...@googlegroups.com
Tested on (k)ubuntu 14.04, kernel 3.13.0-30-generic

I’ve downloaded DCE using bake, configured with:
'bake.py configure -e dce-ns3-dev’

  Hans

You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/w__FyRKm564/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

Hajime Tazaki

unread,
Jul 1, 2014, 11:15:31 PM7/1/14
to ns-3-...@googlegroups.com
Thanks. I will let you know when I spotted the one. 

-- Hajime

Hajime Tazaki

unread,
Jul 16, 2014, 11:15:59 AM7/16/14
to ns-3-...@googlegroups.com

sorry to be late.

I have fixed this issue and already included in the latest
ns-3-dce. and also added bakeconf.xml so that bake can build
bash-4.1 for DCE.

the reason is DCE didn't pass envp argument for main
function, making bash program crash by accessing
uninitialized memory area.

I don't know why the script (dce-bash-simple) was working
before though, it should be working now.

you can try to update bake (hg pull under bake directory)
and bake configure -e dce-ns3-dev should give you bash
program without manual build and placement.

let me know if you faced further trouble. thanks.

-- Hajime

At Wed, 2 Jul 2014 05:15:24 +0200,
Hajime Tazaki wrote:
>
> [1 <text/plain; shift_jis (quoted-printable)>]
> [2 <text/html; utf-8 (quoted-printable)>]
>

Hans van den Bogert

unread,
Jul 23, 2014, 8:08:23 AM7/23/14
to ns-3-...@googlegroups.com
Ok thanks, seems to be working. 

Do you mean with envp, the pointer to the 
array of parameters e.g. given parameters to an application on the 
commandline? If so, how come this wouldn't go wrong with simple programs like 
wget or ping?

Regards,

Hans

Hajime Tazaki

unread,
Jul 23, 2014, 10:45:27 AM7/23/14
to ns-3-...@googlegroups.com

At Wed, 23 Jul 2014 14:09:20 +0200,
Hans van den Bogert wrote:
>
> [1 <text/plain; ISO-8859-1 (7bit)>]
> Ok thanks, seems to be working.
>
> Do you mean with envp, the pointer to the
> array of parameters e.g. given parameters to an application on the
> commandline? If so, how come this wouldn't go wrong with simple programs like
> wget or ping?

Yes, I meant the 3rd parameter of main.

int main (int argc, char *argv[], char *envp[]);

as for the other signatures of main (), it should work.

since the stack pushes 3rd argument at the highest address,
the function (main) will only read 2 of them IF a program is
started with 'int main (argc, argv)', and simply ignore the
3rd one.

http://programmers.stackexchange.com/questions/188970/main-function-prototypes/188985#188985

I believe this is also how glibc handles main symbol.

-- Hajime
> [2 <text/html; ISO-8859-1 (quoted-printable)>]
>
Reply all
Reply to author
Forward
0 new messages