From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7859 Path: news.gmane.org!not-for-mail From: Sebastian Gottschall Newsgroups: gmane.linux.lib.musl.general Subject: stable 1.1.9 & current GIT broken on mips Date: Tue, 2 Jun 2015 17:57:23 +0200 Message-ID: <556DD263.5070800@dd-wrt.com> References: <1433236180.2010.17.camel@xiaoka.com> <20150602093553.GA10927@port70.net> <1433243791.2010.21.camel@xiaoka.com> <20150602112410.GC10927@port70.net> <1433246655.2010.22.camel@xiaoka.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1433260666 19021 80.91.229.3 (2 Jun 2015 15:57:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Jun 2015 15:57:46 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7872-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jun 02 17:57:36 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YzoZL-0004Hp-Nu for gllmg-musl@m.gmane.org; Tue, 02 Jun 2015 17:57:35 +0200 Original-Received: (qmail 17879 invoked by uid 550); 2 Jun 2015 15:57:34 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 17848 invoked from network); 2 Jun 2015 15:57:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dd-wrt.com; s=mikd; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To; bh=p434jWW4eq9iuDSlMjTWGYEUNe/C+ZBX2+A65dzpJHI=; b=hTYa46TI8Aa2jh0r/WpMg982EYWOEPp1Kk91dLJk3HYfisP2yHUBEVMZNYubdEML/gYaBwJHeI4povzOCfvsGYN8b/zOSSXjGL3Un7YtmdtUxWXXQPXzyX0qEW6mKEQ9cmpMnq2mPczo2DfpCo3euLwrt2ALKwI9vFhRRwuK7xM=; User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0 In-Reply-To: <1433246655.2010.22.camel@xiaoka.com> X-SA-Exim-Connect-IP: 93.195.29.228 X-SA-Exim-Mail-From: s.gottschall@dd-wrt.com X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on webmail.newmedia-net.de X-Spam-Level: X-Spam-Status: No, score=-2.5 required=4.0 tests=ALL_TRUSTED,BAYES_00, DNS_FROM_AHBL_RHSBL,RATWARE_GECKO_BUILD autolearn=no version=3.1.9, No X-SA-Exim-Version: 4.2.1 (built Thu, 26 May 2011 15:22:33 +0200) X-SA-Exim-Scanned: Yes (on webmail.newmedia-net.de) X-NMN-MailScanner-Information: Please contact the ISP for more information X-NMN-MailScanner-ID: 1YzoYy-0000D9-6Z X-NMN-MailScanner: Found to be clean X-NMN-MailScanner-From: s.gottschall@dd-wrt.com X-Received: from [93.195.29.228] (helo=[10.88.193.128]) by webmail.newmedia-net.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.72) (envelope-from ) id 1YzoYy-0000D9-6Z for musl@lists.openwall.com; Tue, 02 Jun 2015 17:57:12 +0200 Xref: news.gmane.org gmane.linux.lib.musl.general:7859 Archived-At: 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 */ if (path) { flags = O_WRONLY | O_CREAT; if (!strncmp(path, ">>", 2)) { /* * append to */ flags |= O_APPEND; path += 2; } else if (!strncmp(path, ">", 1)) { /* * overwrite */ 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; } }