bionic/libc/unistd
JP Abgrall 3884bfe966 libc: popen: work around data corruption
vfork() would not save the registers that the parent would expect
to have restored after execl() completed.
Specially that execl() would call execve() underneath, further messing
up the stack of the parent.
To avoid that, we fork() for now. Later we will revisit and cleanup
vfork()+execve() to actually have vfork() store all the register
that the parent expects to see, and not those left by execve().

In the original code, looking at the registers just before the call to
popen(), and after the call showed that r7 would get clobbered.
This would leave the caller with an invalid pointer, leading to all
kinds of data corruptions.
execve() is simpler that execl() in this case.


Bug: 5336252
Change-Id: I3bf718c0bb4c0439f6f2753f153cdea14175be9c
2011-09-17 15:22:21 -07:00
..
abort.c Hide the symbol of helper function __libc_android_abort 2010-09-27 22:20:59 +08:00
alarm.c libc: update alarm() implementation to return 0 on error. 2010-07-08 17:20:29 -07:00
brk.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
creat.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
daemon.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
eventfd.c libc: add <sys/eventfd.h> and corresponding implementations. 2010-09-28 09:20:37 +02:00
exec.c Add some missing includes. 2011-03-21 20:01:03 -07:00
fcntl.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
fnmatch.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
fstatfs.c libc: fix fstatfs() implementation. 2010-07-08 16:52:27 -07:00
ftime.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
ftok.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
getcwd.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
getdtablesize.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
gethostname.c Fix spurious DNS lookups in the C library. 2010-03-08 15:22:13 -08:00
getopt_long.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
getpgrp.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
getpriority.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
getpt.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
initgroups.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
isatty.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
issetugid.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
killpg.c Add killpg function 2010-01-15 16:27:04 -08:00
lseek64.c libc: make lseek64 proto be glibc compatible (loff_t -> off64_t) 2010-08-06 11:47:29 -07:00
mmap.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
nice.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
open.c enable support for large files (> 2G) 2011-07-05 15:36:43 +03:00
openat.c enable support for large files (> 2G) 2011-07-05 15:36:43 +03:00
opendir.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
pathconf.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
perror.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
popen.c libc: popen: work around data corruption 2011-09-17 15:22:21 -07:00
pread.c libc: Add ftruncate64 and improve 64-bit parameter syscall handling. 2010-12-16 17:04:41 +01:00
pselect.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
ptsname_r.c Fix ptsname_r(3) return type to match glibc 2010-01-12 12:58:12 -08:00
ptsname.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
pwrite.c libc: Add ftruncate64 and improve 64-bit parameter syscall handling. 2010-12-16 17:04:41 +01:00
raise.c raise: Send signal to current thread 2011-01-21 11:39:15 -08:00
reboot.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
recv.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
sbrk.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
send.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
setegid.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
seteuid.c Remove compiler warnings when building Bionic. 2010-06-22 17:51:41 -07:00
setpgrp.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
setresuid.c Remove compiler warnings when building Bionic. 2010-06-22 17:51:41 -07:00
setreuid.c Remove compiler warnings when building Bionic. 2010-06-22 17:51:41 -07:00
setuid.c Remove compiler warnings when building Bionic. 2010-06-22 17:51:41 -07:00
sigblock.c Use sigemptyset to initialise sigset_t values. 2011-03-14 12:15:22 -07:00
siginterrupt.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
siglist.c Add the BSD sys_signame array. 2009-11-05 15:50:05 -08:00
signal.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
signame.c Add the BSD sys_signame array. 2009-11-05 15:50:05 -08:00
sigsetmask.c Use sigemptyset to initialise sigset_t values. 2011-03-14 12:15:22 -07:00
sigsuspend.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
sigwait.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
sleep.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
socketcalls.c added syscalls for SuperH which automatically generate by gensyscalls.py 2009-07-01 15:35:27 +09:00
statfs.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strsignal.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
sysconf.c libc: Fix sem_post() implementation to wake up all waiting threads. 2010-07-02 15:09:57 -07:00
syslog.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
system.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
tcgetpgrp.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
tcsetpgrp.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
time.c am 2be3f09f: Merge "time: Improve C99 compliance" 2011-06-23 10:01:11 -07:00
umount.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
unlockpt.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
usleep.c Fix usleep(3) return type to be POSIX-compliant. 2009-12-14 17:07:19 -08:00
wait.c libc: Add missing waitid() implementation. 2010-09-28 09:18:26 +02:00