mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: libc-test regression/syscall-sign-extend.c
Date: Thu, 15 Aug 2019 12:08:13 -0400	[thread overview]
Message-ID: <20190815160813.GU9017@brightrain.aerifal.cx> (raw)

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


             reply	other threads:[~2019-08-15 16:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 16:08 Rich Felker [this message]
2019-10-31  1:48 ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190815160813.GU9017@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).