~ubuntu-branches/ubuntu/vivid/musl/vivid

« back to all changes in this revision

Viewing changes to src/process/fork.c

  • Committer: Package Import Robot
  • Author(s): Kevin Bortis
  • Date: 2014-05-26 22:45:52 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20140526224552-qrtsct934q29xo0x
Tags: 1.1.4-1
* Import upstream version 1.1.4. (Closes: #754758)
* Fixes possible stack-based buffer overflow CVE-2014-3484 (Closes: #750815) 
* Includes fix for build regression on armhf and armel

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <unistd.h>
2
2
#include <string.h>
 
3
#include <signal.h>
3
4
#include "syscall.h"
4
5
#include "libc.h"
5
6
#include "pthread_impl.h"
16
17
        sigset_t set;
17
18
        __fork_handler(-1);
18
19
        __block_all_sigs(&set);
 
20
#ifdef SYS_fork
19
21
        ret = syscall(SYS_fork);
 
22
#else
 
23
        ret = syscall(SYS_clone, SIGCHLD, 0);
 
24
#endif
20
25
        if (libc.has_thread_pointer && !ret) {
21
26
                pthread_t self = __pthread_self();
22
 
                self->tid = self->pid = __syscall(SYS_getpid);
 
27
                self->tid = __syscall(SYS_gettid);
23
28
                memset(&self->robust_list, 0, sizeof self->robust_list);
24
29
                libc.threads_minus_1 = 0;
25
30
        }