Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260724113258.GF3520958@port70.net>
Date: Fri, 24 Jul 2026 13:32:58 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: Jake Adamson <jakeadamson@...gle.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>, musl@...ts.openwall.com,
	Peter Oskolkov <posk@...gle.com>,
	Peter Zijlstra <peterz@...radead.org>,
	mathieu.desnoyers@...icios.com
Subject: Re: Question: number of arguments of musl's membarrier does not
 match Linux syscall

* Jake Adamson <jakeadamson@...gle.com> [2026-07-23 15:27:57 -0700]:
> * Szabolcs Nagy <nsz@...t70.net> [Thu, 23 Jul 2026 23:34:51 +0200]:
> >https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2a36ab717e8fe678d98f81c14a0b124712719840
> >good example why libc does not like wrapping new syscalls
> >(the contract is not documented and reasonable assumptions
> >get broken instead of using a new syscall number)
> >now it has to be var arg if we want backward compat.
> 
> Ah, that makes sense then. Thanks for pointing out the kernel commit.
> It seems like musl has MEMBARRIER_CMD_FLAG_CPU defined won't that break musl's
> membarrier function? The Linux man page says it checks the third
> argument if that flag is passed.

musl updates its headers to follow linux uapi, and
indeed the wrapper api issue was not noticed when
that flag was added:

https://git.musl-libc.org/cgit/musl/commit/?id=54ca1cc7f1bce1c19593c0176aead964a2534933

it would have been easier to catch at the man edit

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=d98b1454fc767b99e9e22f6240ace32c9474ee00

at least now the man page uses SYS_membarrier.

i think the options are: use 3 arg api (breaking
2 arg callers if any), or use var arg function
(bwcompat with 2 arg callers) or tell users to
use syscall. either way it requires coordination
with glibc (and bionic and man-pages).

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.