From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) by sourceware.org (Postfix) with ESMTPS id 9246B38B97C0 for ; Thu, 6 Jun 2024 19:38:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9246B38B97C0 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 9246B38B97C0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::f36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717702723; cv=none; b=OpCVKoGYWWG/ye7j/JIeMPKTkAXfYiY2MkpBRTPLYHFhBOCYcrjGZY3F0Z0IiKZVTR6G44iJ0IoK3bo5zuz+MLArAvcs9eZE7E6sc/ZVWdjpizvq2kQ/b1iYkxHtlI9BczIanxBdAI23sEMb+u5JHlrhDSXRXl2voJayT4ooyUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717702723; c=relaxed/simple; bh=prRImSA5fY+pVY7jveZUv3vsMpJIfCERPpfRQjJ/GHg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=G1OR3B139/EMKeTedN1tXbDtVyZIii81JMnmWf3+LzcLbN0NOdwN37Dnq0ajLz5d7x2GTX4Su68/gLvCmTi+Xl7qPIaOyyFNGqVvrFWFzlHtw9CHhT8dQ55oW8chrJBOh/lSLO9L13w91Xvae1EVx1ctW0u62hm9dT5FVo17KAQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-6afc61f9a2eso10911196d6.0 for ; Thu, 06 Jun 2024 12:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717702721; x=1718307521; 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=Y732LWO8ISEMPWpsNLsVnDs93ojwNSwCKatFCDGr8dU=; b=EvMNvTgasB77mkridaulcBjGFxIqgpjZUr5YOrsy3Xq4u1d5B5qau5/pdPad5bEvwW Mx8ff49B5bAy7fHBT1nuZDRK9GyE6uI2PCUScJW7RSExF1Tb6a5SafeXZVtDlnZryqQx 3xtcMfXD1De+5P4DYGJBi7u2lrzD88bixi6wwQEV5NNNYm01xUgi2Z/nn5u11I4AkFXn 71uTinARTuerMrK58hnyBcTdy3HsgmMN7kLxoUQ84VXIAIEAeOpUCpwte+xt6BC+5m0w /IWEflwVmh3cUx9nl0A/ehSZRyz4F0dgLjWAlHaK2ogo/rFeBehiEjIDVCqXLn+lETQU ZF4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717702721; x=1718307521; 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=Y732LWO8ISEMPWpsNLsVnDs93ojwNSwCKatFCDGr8dU=; b=Mdo7vZ0UE/RWawVCYQFdBKVqW+7wMvz7b9RtFk+O2QQSzuG+7Wm53eYP3hXBA6IjPy faKpXhWtDVOsPfmmcB+A0lDTjzR2YU1npJ99B0wZgjz8BwOZ3w2J4pgyCcVIY1/SRpG5 sqfPIUuofaWoOHm1tGnAvf/4QBK1JhZP6paUdhNBqssY2Z7vHYzrtb1VSRs37SlcSleJ +C18nNJh071YczLRq3NLR5jiImdDppfYxcpI4kN9589zUow07Ln0mcg7jABFZAyDEDdB Bhbq6UpOhzcdfCHmW5VtH5mtHYVlFWTALHoMwHljSUIY+1VCX+IH+fbYuPqb47+4adFa EGXw== X-Gm-Message-State: AOJu0YymGXOmjX2R30Ueh1GaODXbm2wZXtuOLAg60HLn+TNIiSh5jXqi tWyEGiG6g4p0FPA7Ob/IL54ngnthbRASOMun89pSVH0ZbiZj8xN6BLX1oiKygCkzpZDOwVfaYvA Uy57HBoRwd0ByUhoRat2MKxINrdC/5VRn59mX X-Google-Smtp-Source: AGHT+IGh1hPX5chfEVHJGZ0MFMz3UImAseVGIhcI8TsddogGSvdhkMfQaNmdHSiMhLt36luPG9VUGghEYns5wjHamCE= X-Received: by 2002:ad4:5942:0:b0:6ad:77f3:f004 with SMTP id 6a1803df08f44-6b04bed9d02mr70073976d6.6.1717702720539; Thu, 06 Jun 2024 12:38:40 -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: From: enh Date: Thu, 6 Jun 2024 15:38:25 -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.5 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 12:01=E2=80=AFPM enh wrote: > > 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 jus= t > > mremap. These pointers are generally not marked as U, for which we hav= e > > 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. is it possible to use MREMAP_DONTUNMAP with a destination address without also setting MREMAP_FIXED? the kernel selftests don't seem to _test_ that case if so... the glibc header comment also claims that MREMAP_FIXED is necessary. > 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 > >