From patchwork Wed Jul 17 07:59:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1961462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=IPWJM4+G; 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 4WP7d06l1Mz20FF for ; Wed, 17 Jul 2024 17:59:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 209743839166 for ; Wed, 17 Jul 2024 07:59:31 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by sourceware.org (Postfix) with ESMTPS id 7511D385C6C3 for ; Wed, 17 Jul 2024 07:59:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7511D385C6C3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7511D385C6C3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721203152; cv=none; b=bmt/hbaxtYBxg1PjQGl5YeZHwweHiEYJggFrtVQ7ZDo9Xy0ZKMBEhzml/B4OpVazg7dlN9MmBrWazpnLv/MEntcGzU86UbIiiynoT2sTzQL3oilzj4lkcms003YbiEnqT4CqSgMQxAuBGgd9mmCtbBd5RwbHW54hd2/pNyZ51K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721203152; c=relaxed/simple; bh=Zu51omCGYa9Q7mvyj6ocs8k/b8xyWVLvHdv5ZbBHlaY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nlfPFER7v0tv5k6oQpifsz+KVAiedoT7MF5UVkY+acOfyEQ4UJUMfFGHoBl42xep1oxb2PiizHEPCcvBSpxtC6v9ywahtQ+ikf+PNOf3dmy6ooGIXaLuKkmekNoDyu9v6eC8rgB2I6YoskRbJelN9F62td6BX7trObLb0t9YWrU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-6634f0afe05so20068617b3.0 for ; Wed, 17 Jul 2024 00:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721203149; x=1721807949; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=T/bX/i6ThNZSiZTMLtZaME1BwtSSh5hNCWESnJqRxU0=; b=IPWJM4+GHzAOVRsxOfBNeArRsXN8llglFYgw61L1iMLf6ZCdqGlzJw1zizTaTu2s10 fBdVwwaqUERqhTltlHKyZ+EmFUeTJyf6j67M2UNvnRKF5dFikWm8a8yeMiLQU1QqXQ7U /8RH8grdn+K4FUtP9xhMQ8XUvAn4UavJE5EBuxceumNNTXXaHCImAtiWH5HyOZjtqHdM dAu7lssbAnOdi5Rr9ncDs/a2YomuxNfJYy5gDg0iUX/X10ECRtIOEcQ4rbYL27vAaHky 6/tOfLrNLS59dFbmdmCWzfMNVc2zzK/v2uiGkaeJyiKRg2ncFlMHrtkcyjequixnVCvv VKRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721203149; x=1721807949; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T/bX/i6ThNZSiZTMLtZaME1BwtSSh5hNCWESnJqRxU0=; b=N6bjk5mgYqhGY1MKVQRnVNWGSIM/q6yDRvn6RD3sExm8THWwZWRsp0S88tTCru0QAG 966Y22Le1KQZNgugEIk0So3PvA6AzCjwYki/GpVUCoIPmphdKyJjHfF0VCu76Wthzvgt FrQpmve/hRLYHly0sgfvtYdn+QX2fP/oLmQa7xbph6hDkTx7FMAx1R23e/B889PTioUq VDbeAnJY2FNDtgPp807SbtSAbw0XRNjg+al/FqObOLUj6A2olXry3yYyyCLwN7hxMZSg n/AXJ3Umw3shXgyZWrXLQkG+uifVAFUm1/s4SIhJHe06rAcKhZwJT8uHAP3BvAey7zG2 MtcA== X-Gm-Message-State: AOJu0YzI/fcATf8XbV0OzuN+t7I0jKTaq08IhNp8zjybGsPUScwjjPFS 7Ln+XjFZQfp+88ftgYX8NstrrAfspSDjLaiQaHVc0ugroiXCZIAV4sfvGumBWMAS6w== X-Google-Smtp-Source: AGHT+IGMigB6bcoSD0MTxoLKO/OoaHeyxd6zgjZiOqeXmviPxSLvTRZfU6l4ZpboRnGV2aU8CFu09A== X-Received: by 2002:a05:690c:dca:b0:65f:e113:bb7e with SMTP id 00721157ae682-664fe74300dmr14200127b3.25.1721203149540; Wed, 17 Jul 2024 00:59:09 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.30.168]) by smtp.gmail.com with ESMTPSA id 00721157ae682-65fc3f78233sm14638357b3.83.2024.07.17.00.59.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 00:59:09 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 098E8C00A0 for ; Wed, 17 Jul 2024 00:59:05 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH v3 0/3] linux: Update the mremap C implementation [BZ #31968] Date: Wed, 17 Jul 2024 00:59:01 -0700 Message-ID: <20240717075904.2365688-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-3011.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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 Changes in v3: 1. Since MREMAP_FIXED was added to Linux kernel 2.3.31 and MREMAP_DONTUNMAP was added to Linux kernel 5.7, mark test failure if MREMAP_FIXED and MREMAP_DONTUNMAP tests fail on supported Linux kernel. Changes in v2: 1. Update mremap manual entry. 2. Remove linux-support.h. 3. Split a single mremap test into 3 separate tests. --- 1. Update the mremap C implementation to support the optional argument for MREMAP_DONTUNMAP added in Linux 5.7 since it may not always be correct to implement a variadic function as a non-variadic function on all Linux targets. Return MAP_FAILED and set errno to EINVAL for unknown flag bits. 2. Update mremap manual entry. 3. Add tests for MREMAP_MAYMOVE and MREMAP_FIXED. On Linux, also test MREMAP_DONTUNMAP. H.J. Lu (3): linux: Update the mremap C implementation [BZ #31968] mremap: Update manual entry Add mremap tests manual/llio.texi | 41 +++++++++--- misc/Makefile | 2 + misc/tst-mremap1.c | 46 ++++++++++++++ misc/tst-mremap2.c | 54 ++++++++++++++++ sysdeps/generic/mremap-failure.h | 26 ++++++++ sysdeps/unix/sysv/linux/Makefile | 9 +++ .../unix/sysv/linux/linux-kernel-version.c | 62 ++++++++++++++++++ sysdeps/unix/sysv/linux/linux-support.h | 38 +++++++++++ sysdeps/unix/sysv/linux/mremap-failure.h | 47 ++++++++++++++ sysdeps/unix/sysv/linux/mremap.c | 14 ++++- sysdeps/unix/sysv/linux/tst-linux-mremap1.c | 63 +++++++++++++++++++ 11 files changed, 394 insertions(+), 8 deletions(-) create mode 100644 misc/tst-mremap1.c create mode 100644 misc/tst-mremap2.c create mode 100644 sysdeps/generic/mremap-failure.h create mode 100644 sysdeps/unix/sysv/linux/linux-kernel-version.c create mode 100644 sysdeps/unix/sysv/linux/linux-support.h create mode 100644 sysdeps/unix/sysv/linux/mremap-failure.h create mode 100644 sysdeps/unix/sysv/linux/tst-linux-mremap1.c