From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12528 Path: news.gmane.org!.POSTED!not-for-mail From: Nicholas Wilson Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Possible patch for __syscall_cp Date: Wed, 21 Feb 2018 10:47:47 +0000 Message-ID: References: <20180213144955.GB4418@port70.net> ,<20180221020357.GA1436@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1519209966 4222 195.159.176.226 (21 Feb 2018 10:46:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 21 Feb 2018 10:46:06 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-12544-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 21 11:46:02 2018 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 1eoRuT-0000qA-7b for gllmg-musl@m.gmane.org; Wed, 21 Feb 2018 11:46:01 +0100 Original-Received: (qmail 14145 invoked by uid 550); 21 Feb 2018 10:48:05 -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 14119 invoked from network); 21 Feb 2018 10:48:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realvnc.onmicrosoft.com; s=selector1-realvnc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=A11m6AvT1amzOaVgw0XRQT59N6ZvSeZdkCo8AZldlbo=; b=Dv2A5qC7B+tbqYXVfM6IvlijhLkaH2AHoOadm1dTT+5tdYaOrI2jjw38AHYSej7KdVWhHsI3hTeo7glAQH0k4ywFKjmgm+QDLt0loaZJ0i+TOuE0Vmeb2YNmecrH1mDOHkQRv9yFSbeoJwSoQe3i29FU1u2J5TgBQ/A7bqbTwIg= Thread-Topic: [musl] [PATCH] Possible patch for __syscall_cp Thread-Index: AQHTpNXbVh8lNvkSFEaYm+ClO4dw96OiaiaAgAFkCGSAClicgIAAkLr2 In-Reply-To: <20180221020357.GA1436@brightrain.aerifal.cx> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2a02:390:a001:192:d6be:d9ff:fe9c:1892] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR0502MB2965;7:d/eyvaB6bfLhdX035g63pfOljZcC60tdpbx5nWDJHLjkmaswZpmKK7uuqcac3mxLIvzbOUMr2+AryUTxCr1cBRYJe0+cNx+1nRXY2Sz9rJKZpYQArihqigulJVDF4kj+WXlDJyZQw8ozVyfnFwOm+3XU51MZtSZ+9tLn7wj2vopUTCeS7QUui4trIhFaEWoO6+ZEjm9khFc/3z+qaS0eHl3frZRtmrbWnokgMYXQDyyns0SAvCVLsfNLPK0kjDmv x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 4c133566-6dd1-4a6c-3259-08d579188bfe x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(7021125)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);SRVR:DB6PR0502MB2965; x-ms-traffictypediagnostic: DB6PR0502MB2965: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(166708455590820); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231101)(944501161)(6041288)(2016111802025)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(6043046)(201708071742011);SRVR:DB6PR0502MB2965;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0502MB2965; x-forefront-prvs: 0590BBCCBC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39840400004)(366004)(396003)(39380400002)(376002)(346002)(51444003)(51914003)(189003)(199004)(229853002)(81166006)(6246003)(2900100001)(6506007)(6306002)(76176011)(33656002)(102836004)(53546011)(53936002)(966005)(3280700002)(6346003)(86362001)(3660700001)(93886005)(14454004)(2351001)(105586002)(478600001)(9686003)(55016002)(5660300001)(6116002)(6916009)(6436002)(8676002)(7696005)(1730700003)(99286004)(81156014)(8936002)(186003)(7736002)(316002)(74316002)(305945005)(2950100002)(25786009)(5640700003)(5250100002)(97736004)(68736007)(106356001)(2501003)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0502MB2965;H:DB6PR0502MB3016.eurprd05.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: realvnc.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=nicholas.wilson@realvnc.com; x-microsoft-antispam-message-info: DWupZ/nwMY/3fdzpaSf6Hs+anxeBr2gMzRRF4vEDY2IKHGcEiK0aoepxfkD+LX2AvnMWsQXKh7TFPCjT4Jy3MqOr9Tb1I6tJOjwwSmr7AX1jbmIkXsKe69Lq8UBltlc7wLdqwPpauMuzvAgQYjsmcHDS3NTPWRHa/T9lQLeX574= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM X-MS-Exchange-CrossTenant-Network-Message-Id: 4c133566-6dd1-4a6c-3259-08d579188bfe X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2018 10:47:47.6255 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9ad766d3-c6a5-4458-8c58-244e7c118728 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB2965 X-OriginatorOrg: realvnc.com Xref: news.gmane.org gmane.linux.lib.musl.general:12528 Archived-At: On 21 February 2018 02:03, Rich Felker wrote: > The macro suppression is intentional so that the stub version of > __syscall_cp (only used in static linking without thread cancellation > linked) is just a tail call to __syscall rather than a bunch of > register shuffling. Being that the whole point of the stub version is > to avoid the size cost of cancellation logic in small static linked > programs, it doesn't make sense to make a change here. OK, that makes sense. Thanks! > musl ports should define an external (but hidden) function __syscall > replacing (the empty) src/internal/syscall.c. Perhaps that file should > actually be non-empty and look like the above, which would work > (albeit suboptimally) for any arch that doesn't make an external call > for __syscall6. > > Unfortunately there are some messy questions about how many arguments > __syscall is called with and whether it's actually valid for it to be > defined with a C function using va_arg rather than in asm. These are > independent of whether we apply your patch or not, I think, and they > should probably be fixed by ensuring that any place where the external > __syscall is called actually passes 6 arguments, by adding dummy zero > arguments to the __syscallN macros in the SYSCALL_NO_INLINE case, and > in the syscall_arch.h files that use it. I think that makes sense to me too. I've added the required stub to the Was= m port in this commit: https://github.com/NWilson/musl/commit/7cd91fc86358076e601783144f242824afd9= 84ec I guess it makes sense for Wasm to provide this stub itself, since other ar= ches won't be using it, and it's not likely to be useful to many other arch= es either. Regarding passing the six args to __syscall, I think that does work already= ; __syscall_cp is the only place where __syscall is used with macro suppres= sion, and it does use six args. All the other places go via the macros whic= h are able pad the arguments to the correct length. I'm happy with things staying as they are then in upstream Musl. Thanks for the help, Nick