From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 079F7C63798 for ; Tue, 17 Nov 2020 18:41:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7DCC223C7 for ; Tue, 17 Nov 2020 18:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729637AbgKQSlS (ORCPT ); Tue, 17 Nov 2020 13:41:18 -0500 Received: from gate.crashing.org ([63.228.1.57]:47183 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbgKQSlS (ORCPT ); Tue, 17 Nov 2020 13:41:18 -0500 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 0AHIas0V021424; Tue, 17 Nov 2020 12:36:54 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 0AHIaqNQ021421; Tue, 17 Nov 2020 12:36:52 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 17 Nov 2020 12:36:52 -0600 From: Segher Boessenkool To: Florian Weimer Cc: Andy Lutomirski , Linux API , Peter Oskolkov , Mathieu Desnoyers , Peter Zijlstra , linux-toolchains@vger.kernel.org Subject: Re: Is adding an argument to an existing syscall okay? Message-ID: <20201117183652.GD2672@gate.crashing.org> References: <87k0uj6h03.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k0uj6h03.fsf@mid.deneb.enyo.de> User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Tue, Nov 17, 2020 at 06:16:28PM +0100, Florian Weimer wrote: > * Andy Lutomirski: > > > Linux 5.10 contains this patch: > > > > commit 2a36ab717e8fe678d98f81c14a0b124712719840 > > Author: Peter Oskolkov > > Date: Wed Sep 23 16:36:16 2020 -0700 > > > > rseq/membarrier: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ > > > > This adds an argument to an existing syscall. Before the patch, > > membarrier had 2 parameters; now it has 3. Is this really okay? At > > least the patch is careful and ignores the third parameter unless a > > previously unused flag bit is set. > > It's really iffy. It's hard to break this in system call wrappers on > x86-64, where we just load %eax and call into the kernel. But on > architectures which require argument shuffling, it will break. > > If there were a system call wrapper in glibc (my patch was rejected > due to lack of documentation fo the semantics, so we got lucky there), > we'd have to add a new symbol version for this. It happened before in > the dark ages, repeatedly, but it's a bit disappointing to be in this > situation again. > > In general the main problem I see is the poor source code > compatibility. We really, really don't want variadic system call > wrappers, and we specifically do not want to introduce them > retroactively. (Changing an implementation from non-variadic to > variadic is not an ABI-safe change on POWER and probably other > targets.) But this isn't variadic in the sense of "..." -- on Power that always passes the unspecified arguments in memory, while in this case it just passes in either two or three registers. I don't know any arg where that would not work, given the Linux system call restrictions. This is similar to the "open" system call. > So we'd require that from now on, the programmer has to > pass the zero argument explicitly. Porting is simpler than the recent > futex_time64 breakage, but the downside is that immediately impacts > all targets. > > Cc: linux-toolchains for ABI impact. It certainly would simplify matters if this was simply not done ;-) Segher