From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id E3F7538E9DB5 for ; Thu, 6 Jun 2024 16:01:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3F7538E9DB5 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E3F7538E9DB5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717689708; cv=none; b=AzhMaH3w4uKEQRFw+/+XC3Rx7uHQgRs9zAJkrqJWKe99Oc1xTvzaq9KO2s1/oY4cAUIuUKqOYTlx7eOR4KMbL+1VEdfFCYCHff8MQwFxbWu2Uz8m7MYTCiUfO7vvZU0QUrNDNzU37hmtEsQJ48mnRAUbFsbDEySQL+TrB95iqRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717689708; c=relaxed/simple; bh=i82Kzrs29VBdR7O5nb3EqYwX5aCUN5b9Ss7bps+du5g=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=DHPRuiCZnBge0LJPSU55iaHAryEhIiiXj0U7+K89gY3HL1VSQ9ALzluEXl5a82s7U7DhdgxLRXr2E7qNHL/t8fOd0DZ9rPPs4hsuCHmCy4uZmH3w50uqcIqrDI5UcOm4Ki4qKKkigSd7qIsYAkVG+5Jxo3r636Uk4GApl6SwIT4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-656d8b346d2so792543a12.2 for ; Thu, 06 Jun 2024 09:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717689705; x=1718294505; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=blU18TfzGgyjRbE/Baq86jzLABvHo0I7BL/DMTO8sf8=; b=o/sOuZFIAdUdQZ8bXYGh92SJpkM0iPC9UjUg5L6XjtA4RylPqpvKipQVzhnAOPaFbv SiCQNV76veuiDv7n9VNrAFBM/yjHk/LWP1sHFx8rEe5IaMm2nqnhuE+v0Y4DwBB7fLGw aZazAIIQLuOYOjUA1TW+FdTQxfw76v8M4FmTv1qyddU5F5Vktx91X37K7BAqyj0SXMQZ RiWj39anoHSmCD8FGMUDZbtkeXY0OXrAwAX32L3KwsmPPcaePcwqpWaAaHh6JBiLcWDD X5i54K0uyRrUiJ3db8rU9i9VF8Ds1jukdMDtNmg714W9rw82dvywjiwawxYbUITQc4hD 9qFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717689705; x=1718294505; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=blU18TfzGgyjRbE/Baq86jzLABvHo0I7BL/DMTO8sf8=; b=ufEvY9MvtuYZvYbXlXBvHlUmULz0Xk/64lzsZyuk51EA3L06Sh7QzVI4Fz+fa4T/ub uEjgPB/f4TydsJH4E28YzIzaHEwzVxtfGrFF7NaR6A82GBgLVHTH/X8od5GGBdN+BXXS dc+OOnJBWF6+zif2Z6GtgsrVsfVWtrRN0afWzKShCm+CSas/x07HRJ2MqVSkCEB22SgH 7RmaSRJAa9cpiTJ+GsRvgeAGHyDER6LSWEzezfrVA5tlwVX/QaxgkxdX+blfhHO9g0CO 8584/U8jfJV2HR1cJ+KHdfZImNB+cFAIiitVqU/QsG5tHeHNLByDA/Gj2uaPPIokmkCd BKzg== X-Gm-Message-State: AOJu0YwbxNu9bSjSsp0mr6+XpbdfN4p5NQqJbQsSQ7KHjlU9waK9CmHt ZdswZ+pTsesRDFbblFpMNOmbM69+HFUJXZbGbAf81GHAIVpDfg/9jLtaSXXoUDTwJqd4h5dgJSP P2FEuicWDA3E8mS1VK2OJ/LQBFtEOrCVlMFoOLlNu/sJWUx/ds9Km X-Google-Smtp-Source: AGHT+IHW3KBK/P6RjyGB0YRyBKxRNMUobkhWW3OlqFiyFRGEFr2ZdW4UuQq0YdHL/HSb/D+I7SIieCYOyAMFdQ7mueE= X-Received: by 2002:a17:90a:f0d2:b0:2c2:4f7:522 with SMTP id 98e67ed59e1d1-2c27db5617emr6885939a91.36.1717689703514; Thu, 06 Jun 2024 09:01:43 -0700 (PDT) MIME-Version: 1.0 References: <20211122185437.1934590-1-adhemerval.zanella@linaro.org> <20211122185437.1934590-4-adhemerval.zanella@linaro.org> <87y17iqf07.fsf@oldenburg3.str.redhat.com> In-Reply-To: <87y17iqf07.fsf@oldenburg3.str.redhat.com> From: enh Date: Thu, 6 Jun 2024 12:01:30 -0400 Message-ID: Subject: Re: [PATCH 3/6] linux: Implement mremap in C To: Florian Weimer Cc: Adhemerval Zanella via Libc-alpha , Stafford Horne , Adhemerval Zanella Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.7 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Jun 6, 2024 at 11:15=E2=80=AFAM Florian Weimer = wrote: > > * Adhemerval Zanella via Libc-alpha: > > > Variadic function calls in syscalls.list does not work for all ABIs > > (for instance where the argument are passed on the stack instead of > > registers) and might have underlying issues depending of the variadic > > type (for instance if a 64-bit argument is used). > > > > Checked on x86_64-linux-gnu. > > Where exactly does this break? > > If the syscall generator cannot handle pointer arguments, we should fix > that. As far as I can tell, we currently assume that the kernel can > handle sign-extended pointers. I don't see any special code for > processing a/p/s pointers, for example. That impacts far more than just > mremap. These pointers are generally not marked as U, for which we have > special processing. > > Conditional varargs processing for system calls is very bad. It causes > an ongoing maintenance headache, and weird application issues. For > example, Linux 5.7 added MREMAP_DONTUNMAP, and it can use the address > argument just like MREMAP_FIXED. But the current mremap implementation > always passes NULL as a system call argument. yeah, bionic and musl have this same bug, for the same reason of having been written before MREMAP_DONTUNMAP was added, and not having been updated since. bionic and musl both have a PTRDIFF_MAX check that glibc doesn't have, though, so although i think using assembler instead of C would be a no-op for glibc, it would be an observable change for bionic and musl (albeit only on ILP32). > Then there's the issue where varargs functions have more stringent ABI > requirements than non-varargs functions, as we recently saw with prctl. > > I think we should just revert this change, to be honest. > > Thanks, > Florian >