From: Sebastian Gottschall <s.gottschall@dd-wrt.com>
To: musl@lists.openwall.com
Subject: stable 1.1.9 & current GIT broken on mips
Date: Tue, 2 Jun 2015 17:57:23 +0200 [thread overview]
Message-ID: <556DD263.5070800@dd-wrt.com> (raw)
In-Reply-To: <1433246655.2010.22.camel@xiaoka.com>
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;
}
}
next prev parent reply other threads:[~2015-06-02 15:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 9:09 time.h define NULL Tomasz Sterna
2015-06-02 9:35 ` Szabolcs Nagy
2015-06-02 9:38 ` Daniel Cegiełka
2015-06-02 9:41 ` Szabolcs Nagy
2015-06-02 11:16 ` Tomasz Sterna
2015-06-02 11:24 ` Szabolcs Nagy
2015-06-02 12:04 ` Tomasz Sterna
2015-06-02 15:57 ` Sebastian Gottschall [this message]
2015-06-02 17:19 ` stable 1.1.9 & current GIT broken on mips Rich Felker
2015-06-02 17:52 ` Sebastian Gottschall
2015-06-02 19:11 ` Rich Felker
2015-06-02 19:59 ` Sebastian Gottschall
2015-06-04 4:04 ` Rich Felker
2015-06-04 8:29 ` Sebastian Gottschall
2015-06-04 12:14 ` Sebastian Gottschall
2015-06-04 16:07 ` Rich Felker
2015-06-06 15:42 ` Anthony G. Basile
2015-06-06 15:59 ` Anthony G. Basile
2015-06-02 11:32 ` time.h define NULL Jens Gustedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=556DD263.5070800@dd-wrt.com \
--to=s.gottschall@dd-wrt.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).