From patchwork Tue Jul 9 15:00:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1958489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VUGqHDMO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WJPMH5H5Gz1xpd for ; Wed, 10 Jul 2024 01:01:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E13AC386D60A for ; Tue, 9 Jul 2024 15:01:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C8446386182A for ; Tue, 9 Jul 2024 15:00:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8446386182A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C8446386182A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720537257; cv=none; b=ThEetHngdjARPtwCAAMvgWEG8ug7FGm7e0/UtsTBilXhTF/emnE5Zo1VZBMNll7aH49HqnOrVjDQhyuhhyAMesGCK55K/rA892glW019BfR5hb3NRZp1+BIEA7l7iXXDaRTlII8HRwOkI3StYAxrD1ziXEz+ktAddHFJm5MGSqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720537257; c=relaxed/simple; bh=OZk1rBn/rSXG3+wKFOikB+fSrZhgzI6b1MCq6ki7sY0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rF//kvnEkiFWGFVz92L0VuzYRQ+TvGXyUjP1WVeCGutCAmm3QywB5VjuGwmRqTIYcDqa6ibHfASz94P2GbdR0L+A3EJsFiD/ifE7eYRpZPuKH2ULJGxp0CmwlaUxi0O66R5+QS0qnE/zkKQhJmF6AEyMHC5rzkLVNwsTkU1ucOo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720537255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=JIaDPcxXeSMWLqWNDxbYS0bmEX9R/PhqAVGj/LFNVEY=; b=VUGqHDMOr8qGNFaoLtND5fPz3TeQKQCb+apZoiFODBa9wdJUh2OoyFVntCzIHmFpSgmZ1E yGB5Knt+m2weui2mW6ywTDoRTF6DXT/W4DOd4xOxgxJv8VKuEwLJR40AMMoq5FkkmIy1Br ChQ8qVRQOJHtEECvDCgVoyKBEMOllJU= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-pVfxSKTQO_OrFQN11KWxLA-1; Tue, 09 Jul 2024 11:00:53 -0400 X-MC-Unique: pVfxSKTQO_OrFQN11KWxLA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D33171955F42 for ; Tue, 9 Jul 2024 15:00:52 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.224.64]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0AEC119560AE for ; Tue, 9 Jul 2024 15:00:51 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] Revert "linux: Implement mremap in C" (bug 31968) Date: Tue, 09 Jul 2024 17:00:49 +0200 Message-ID: <87msmqzk2m.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This reverts commit 5b3e31e3124bf89710e5c25176c70fdf66c2a212. The C implementation processes the optional argument based on flags. Linux 5.7 added MREMAP_DONTUNMAP, which needs the optional argument just like MREMAP_FIXED. Rather than creating a continuous maintenance task, revert back to the assembler implementation. There does not seem to be a need for the C implementation (unlike what we saw with prctl on x86-64 x32): Tested on x86_64-linux-gnu. --- sysdeps/unix/sysv/linux/Makefile | 1 - sysdeps/unix/sysv/linux/mremap.c | 41 ----------------------------------- sysdeps/unix/sysv/linux/syscalls.list | 1 + 3 files changed, 1 insertion(+), 42 deletions(-) base-commit: 9fc639f654dc004736836613be703e6bed0c36a8 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 097b5a26fc..e8dd4518d9 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -82,7 +82,6 @@ sysdep_routines += \ lxstat \ lxstat64 \ mlock2 \ - mremap \ open_by_handle_at \ personality \ pkey_get \ diff --git a/sysdeps/unix/sysv/linux/mremap.c b/sysdeps/unix/sysv/linux/mremap.c deleted file mode 100644 index 4f770799c4..0000000000 --- a/sysdeps/unix/sysv/linux/mremap.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Remap a virtual memory address. Linux specific syscall. - Copyright (C) 2021-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - -void * -__mremap (void *addr, size_t old_len, size_t new_len, int flags, ...) -{ - va_list va; - void *new_addr = NULL; - - if (flags & MREMAP_FIXED) - { - va_start (va, flags); - new_addr = va_arg (va, void *); - va_end (va); - } - - return (void *) INLINE_SYSCALL_CALL (mremap, addr, old_len, new_len, flags, - new_addr); -} -libc_hidden_def (__mremap) -weak_alias (__mremap, mremap) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 9ac42c3436..2fff680964 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -39,6 +39,7 @@ mlockall - mlockall i:i mlockall mount EXTRA mount i:sssUp __mount mount mount_setattr EXTRA mount_setattr i:isUpU mount_setattr move_mount EXTRA move_mount i:isisU move_mount +mremap EXTRA mremap b:aUUip __mremap mremap munlock - munlock i:aU munlock munlockall - munlockall i: munlockall nfsservctl EXTRA nfsservctl i:ipp __compat_nfsservctl nfsservctl@GLIBC_2.0:GLIBC_2.28