From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12193 Path: news.gmane.org!.POSTED!not-for-mail From: bluemoon Newsgroups: gmane.linux.lib.musl.general Subject: Problems that emerged when trying to port dosemu2 Date: Sun, 3 Dec 2017 11:50:34 +0100 Message-ID: <4b3b4442-af00-6134-b284-8699dddb35ea@mailbox.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1512298252 22372 195.159.176.226 (3 Dec 2017 10:50:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Dec 2017 10:50:52 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-12209-gllmg-musl=m.gmane.org@lists.openwall.com Sun Dec 03 11:50:48 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eLRrC-0005Ri-KS for gllmg-musl@m.gmane.org; Sun, 03 Dec 2017 11:50:46 +0100 Original-Received: (qmail 17627 invoked by uid 550); 3 Dec 2017 10:50:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 17590 invoked from network); 3 Dec 2017 10:50:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-transfer-encoding:content-language:content-type :content-type:mime-version:date:date:message-id:subject:subject :from:from:received; s=mail20150812; t=1512298234; bh=KMy2bDnDz8 O8+6S6PdkwtsTF6cDg2gtrwIkvwse02Dw=; b=Mfyne86kiV6a0b52z89IWxVSxi /mjSS81sSrQIOyCDNbpI1WEaWogqEb81vNDEjgLvAONMgmQqBMCInNtSiuW9la15 oMBwiAMwMejZZbK47pnQGxQqYchESPs+d17enAwCHTHdw1F5aclasYwdectwgZSa pLHxL53AECBFA/FylJa7VMZ5XuyOiP6Z0a8UpfG8l4BQZ/V+2EDM3qSQL/zTQv30 ChJZEP4jH0TrY1kiJmkEVjLbclK56r3HX0n3eyrM0vXGW8j889g2nrncebBPwhYm dBx82ookYdiATc73ukFZjTl4MGCEROaPPfU5KTZB/Swz6jEyvrzUe3MHjfew== X-Virus-Scanned: amavisd-new at heinlein-support.de Content-Language: de-DE Xref: news.gmane.org gmane.linux.lib.musl.general:12193 Archived-At: Hi, I was trying to build dosemu2 (https://github.com/stsp/dosemu2) and ran into some problems which I reported to the developer of dosemu2. He found two issues which might be relevant to musl itself so I’d like to report them. The starting point was that dosemu2 crashed when trying to use DPMI to run protected mode DOS programs. The Issue was discussed here: https://github.com/stsp/dosemu2/issues/537 The last comments are the ones of relevance. My knowledge of the matter is too limited to explain it in my own words, but he summarized what’s going on here (patches are below): https://github.com/stsp/dosemu2/issues/537#issuecomment-346177776 > The checks that you remove, are nonsense: > they check for "ss_size" and return ENOMEM > even for SS_DISABLE. They check for ~SS_DISABLE > and return error for SS_AUTODISARM, even > though it is defined in their headers. Overall > they try to check the syscall parameters - > something they should never do simply because > libc does not understand the syscall parameters. > It should just call the syscall - not more, not less. > syscall understands its parameters, so it will > check them correctly and return error as appropriate. > Check from musl should be removed, and I think > it would be good to try to submit that change. > > Stack-protector problem is a kernel mis-feature, > and a very unfortunate one. We should pester > Andy Lutomirski (@amluto) to finally fix it. :) > I don't know if musl can accept this patch, maybe > it can if the attribute is put under #ifdef __GNUC__ > check. To make it work the following two patches were applied: --- src/misc/syscall.c.orig 2017-10-31 20:13:58.000000000 +0100 +++ src/misc/syscall.c 2017-11-21 18:36:38.912082672 +0100 @@ -3,7 +3,7 @@ #undef syscall -long syscall(long n, ...) +__attribute__((optimize("no-stack-protector"))) long syscall(long n, ...) { va_list ap; syscall_arg_t a,b,c,d,e,f; --- src/signal/sigaltstack.c.orig 2017-10-31 20:13:58.000000000 +0100 +++ src/signal/sigaltstack.c 2017-11-21 20:56:59.740814704 +0100 @@ -4,15 +4,5 @@ int sigaltstack(const stack_t *restrict ss, stack_t *restrict old) { - if (ss) { - if (ss->ss_size < MINSIGSTKSZ) { - errno = ENOMEM; - return -1; - } - if (ss->ss_flags & ~SS_DISABLE) { - errno = EINVAL; - return -1; - } - } return syscall(SYS_sigaltstack, ss, old); }