Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [day] [month] [year] [list]
Date: Thu, 15 Aug 2019 12:08:13 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: libc-test regression/syscall-sign-extend.c

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.

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

Your e-mail address:

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