Package: libc
Version: glibc
Severity: important

The following code either (compiled with either gcc 4.2 or 4.3) dies with 
EFAULT 
(bad address) or spits out some random garbage after the "hello world!".

#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdio.h>

int main(){
  pid_t cpid;

  cpid = fork();
  if (0 == cpid) {  // Child
    execl("/bin/echo","/bin/echo","hello world!");
    perror("execution of /bin/echo failed in "__FILE__);
  }
  else              // Parent
    waitpid(cpid,0,0);

  return 0;
}

Tracing it with strace -f reveals that execl is internally passing a third 
garbage pointer to execve.

....
6368  clone(child_stack=0, 
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7f187a700770) = 6369
6368  wait4(6369,  <unfinished ...>
6369  execve("/bin/echo", ["/bin/echo", "hello world!", 0xffffffffffffffff], 
[/* 
42 vars */]) = -1 EFAULT (Bad address)
....


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to