Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 31 Oct 2019 02:48:32 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: libc-test regression/syscall-sign-extend.c

* Rich Felker <dalias@...c.org> [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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.