|
Message-ID: <556DD263.5070800@dd-wrt.com> Date: Tue, 2 Jun 2015 17:57:23 +0200 From: Sebastian Gottschall <s.gottschall@...wrt.com> To: musl@...ts.openwall.com Subject: stable 1.1.9 & current GIT broken on mips Hello i tested today the current 1.1.9 (and later also current git so see if its the same behaviour) build on a mipsr2 big endian target (atheros ar7xxx) based on my dd-wrt firmware. i found out that mips seems to be broken on musl right now. the behaviour is that a call using execvp will not result in calling the desired application. on a second call and a following return call, the userspace will lock up with no way todo anything anymore. for testing i used the same compiler, just recompiled musl with version 1.1.8 and overwrote the libc library and crt stuff. the result was, that it worked again without any issue it needs to be considered that parts of the code is compiled using -mips16 and -minterlink-mips16 if that matters bellow you will find a copy of the c function which caused that problem. this function is placed in a library which is linked to the main init process. the function is called from this init process its called in the following pseudo way _evalpid(commandlinearray,">/dev/console", 0 , NULL); Sebastian int _evalpid(char *const argv[], char *path, int timeout, int *ppid) { pid_t pid; int status; int fd; int flags; int sig; switch (pid = fork()) { case -1: /* error */ perror("fork"); return errno; case 0: /* child */ /* * Reset signal handlers set for parent process */ for (sig = 0; sig < (_NSIG - 1); sig++) signal(sig, SIG_DFL); /* * Clean up */ ioctl(0, TIOCNOTTY, 0); close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); setsid(); /* * We want to check the board if exist UART? , add by honor * 2003-12-04 */ if ((fd = open("/dev/console", O_RDWR)) < 0) { (void)open("/dev/null", O_RDONLY); (void)open("/dev/null", O_WRONLY); (void)open("/dev/null", O_WRONLY); } else { close(fd); (void)open("/dev/console", O_RDONLY); (void)open("/dev/console", O_WRONLY); (void)open("/dev/console", O_WRONLY); } /* * Redirect stdout to <path> */ if (path) { flags = O_WRONLY | O_CREAT; if (!strncmp(path, ">>", 2)) { /* * append to <path> */ flags |= O_APPEND; path += 2; } else if (!strncmp(path, ">", 1)) { /* * overwrite <path> */ flags |= O_TRUNC; path += 1; } if ((fd = open(path, flags, 0644)) < 0) perror(path); else { dup2(fd, STDOUT_FILENO); close(fd); } } /* * execute command */ setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1); alarm(timeout); execvp(argv[0], argv); perror(argv[0]); exit(errno); default: /* parent */ if (ppid) { *ppid = pid; return 0; } else { waitpid(pid, &status, 0); if (WIFEXITED(status)) return WEXITSTATUS(status); else return status; } }
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.