From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14889 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: libc-test regression/syscall-sign-extend.c Date: Thu, 31 Oct 2019 02:48:32 +0100 Message-ID: <20191031014832.GA4396@port70.net> References: <20190815160813.GU9017@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="22163"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: musl@lists.openwall.com Original-X-From: musl-return-14905-gllmg-musl=m.gmane.org@lists.openwall.com Thu Oct 31 02:48:47 2019 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.89) (envelope-from ) id 1iPzZu-0005fV-VI for gllmg-musl@m.gmane.org; Thu, 31 Oct 2019 02:48:47 +0100 Original-Received: (qmail 29994 invoked by uid 550); 31 Oct 2019 01:48:44 -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 29972 invoked from network); 31 Oct 2019 01:48:44 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20190815160813.GU9017@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:14889 Archived-At: * Rich Felker [2019-08-15 12:08:13 -0400]: > libc-test has one test regression/syscall-sign-extend.c whose purpose > is testing an x32 bug whereby pointers passed to syscall() got > sign-extended, fixed by 5f95f965e933c5b155db75520ac27c92ddbcf400 > (albeit with a nasty hack). > > However it's using SYS_clock_gettime as the test, which means it will > break on 32-bit archs when time_t changes to 64-bit and the old > syscall no longer matches the libc ABI types. > > (It also doesn't seem to be doing anything to ensure that the pointer > is "negative" in a sign-extension case; it just assumes the stack is > at the top of memory. But this probably doesn't matter in practice.) > > I think we should find a different syscall to test that's immune to > kernel/libc disagreements over types or macro values. The simplest > example might be SYS_read - opening a pipe, writing a byte to it with > write(), and confirming that syscall(SYS_read, ...) reads it back. ok changed the test to use SYS_read. thanks. > > Alternatively clock_gettime could be tested just to modify the > pointed-to memory (e.g. by pre-filling it with 0xff) without assuming > it matches struct timespec layout, but that also assumes the CLOCK_* > macros map directly to syscall API. > > Rich