From patchwork Wed Apr 3 06:04:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 1919047 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=HSmR0xTB; 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 4V8Z3Y0vr0z23tl for ; Wed, 3 Apr 2024 17:05:13 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 504A0385843E for ; Wed, 3 Apr 2024 06:05:11 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 771953858CDA for ; Wed, 3 Apr 2024 06:04:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 771953858CDA 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 771953858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712124296; cv=none; b=BbDJa3xsDVeipixAOhnC3HIdmQ5B8ZFisJzq3JzdqjiArhA9auUqE4h7dRKDMNN2HTMLrp9Y1WTwf405p52UkGMb9gDiMMFUm62fUExg9jWRV/55CFtaWioxWYtiL9h24dDAk7IrVdvlFrcOcjoqJvRcZCOgSwYbMhdMGafv6Sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712124296; c=relaxed/simple; bh=HVQPiAAi+ueCaJepBkh441M9yGJuf1I0b+kAfKbKRfE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DhqkDkND/QT/Hn28Tn9HIQYp+lQioQL5LcEQlC0zspKSsCXUEN5Bg+4XoRS3LLHERVNTkDoK/gKRFKVxG4RC1RwslqslVTf7aUgvsWLZDCecM/n5mkrjgUwziv73lz8apXTwtAiuzGzxERedQA5phvD7IrvoHKx8nhMkRaZovDw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-515c198e835so6955396e87.3 for ; Tue, 02 Apr 2024 23:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712124292; x=1712729092; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xQQ3IXzHEKuKHSHOJWTmGv9qgcVs15oPCpU47SwyhNs=; b=HSmR0xTBFytyskqEpIq7VK+Q6kCnIvZipIzvMoX4pMS9jcCD7NZA2GB/Me7K4s7Gqs i9W1Bw7epr/s0Gpj7BouDHx0tNNqNAcolmK27rFnGXW8e/p0FELrd0oMIDVPbPzCCjnn iOJFFBBrTC7UOn7vkYOzqIsICWagkaSbL10sTURMD9vD0BcoXON6iBGC+Sj4tML9R4gj zmygiXDiMt6u0sTAyzuD1RNFqFGLHV6H4ZaYiN0LKfrZgB86gZaCMU9C+uCWE7m5dFH0 QSgVPWX5qmUa4E47209pXX/qaUCYjgB2OZg6sl7/SOZT3+N0UIh86fl8EIAYJcpNE0hT 7Yrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712124292; x=1712729092; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xQQ3IXzHEKuKHSHOJWTmGv9qgcVs15oPCpU47SwyhNs=; b=IxvWsZNdLXlP8AuXcg+UecCrkc4B9M6NN1v28Ho1KdUMVX3JVePB2ibiGlpf2kVb5W YzUv1q18J5eLEsW0WopyNyGEpYFTjG7aNEn1iD76gcMZNbonfsZ/bAQjN1UvDkrxQEYy G+VNWzKqI74J5MnY5JRnfyLNp/RDeoPnivSw4JePQG0dRVMwUYrPYWmoe2My81LY3ryr 7e6yTMCuplo8BeujdHeWgLc7/WSjqrxEmyd28fZSN5x6R/EiZcCm5t1bsmsEupnBWqLl JZuoD5ljsamUp77UAkv5PwOIWdIpdKoOyo0+jHmVU03/k9EJirrTv24Xf5UXOxa6qrWh QMXA== X-Gm-Message-State: AOJu0YytJm9wcXLRGQWuhMbXW+p17Wg4XqBa5gv2Yq//jvXuornn5EwZ tk5Qqgi1QWGa8lie6zvDKj8uZOTKXuNkReZJcZ1W9rFy2ntlOmTBOcdksWqbii4= X-Google-Smtp-Source: AGHT+IHN5pEiTEVYdy2+gj+TmgfyexVovGs4bfPhpZ2KygRsZoW5fW9zCyO8JeeKMacAfwVc9n2+jA== X-Received: by 2002:ac2:5b8f:0:b0:516:7739:3554 with SMTP id o15-20020ac25b8f000000b0051677393554mr7177360lfn.59.1712124291257; Tue, 02 Apr 2024 23:04:51 -0700 (PDT) Received: from localhost (cpc1-brnt4-2-0-cust862.4-2.cable.virginm.net. [86.9.131.95]) by smtp.gmail.com with ESMTPSA id bk5-20020a0560001d8500b003418364032asm16319639wrb.112.2024.04.02.23.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 23:04:49 -0700 (PDT) From: Stafford Horne To: GLIBC patches Cc: Adhemerval Zanella , Stafford Horne Subject: [PATCH] misc: Add support Linux uio.h RWF_NOAPPEND flag Date: Wed, 3 Apr 2024 07:04:37 +0100 Message-ID: <20240403060437.3193600-1-shorne@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 In Linux 6.9 a new flag is added to allow for Per-io operations to disable append mode even if a file was opened with the flag O_APPEND. This is done with the new RWF_NOAPPEND flag. This caused two test failures as these tests expected the flag 0x00000020 to be unused. Adding the flag definition now fixes these tests on Linux 6.9 (v6.9-rc1). FAIL: misc/tst-preadvwritev2 FAIL: misc/tst-preadvwritev64v2 This patch adds the flag, adjusts the test and adds details to documentation. Link: https://lore.kernel.org/all/20200831153207.GO3265@brightrain.aerifal.cx/ --- Cc: Adhemerval Zanella Netto As he mentioned he would be looking into it when this was mentioned in the LoongArch TLS patch. https://sourceware.org/pipermail/libc-alpha/2024-March/155323.html This also was encountered during OpenRISC testing, and I found a fix. This has been found before Linux 6.9 is actually released. I guess we should not merge it to glibc until 6.9 is official. What is the policy on this? manual/llio.texi | 5 +++++ misc/tst-preadvwritev2-common.c | 5 ++++- sysdeps/unix/sysv/linux/bits/uio-ext.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/manual/llio.texi b/manual/llio.texi index 0b61d491f5..e858e038ae 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -1341,6 +1341,11 @@ will fail and set @code{errno} to @code{EAGAIN} if the operation would block. Per-IO synchronization as if the file was opened with @code{O_APPEND} flag. @end vtable +@item RWF_NOAPPEND +This flag allows an offset to be honored, even if the file was opened with +@code{O_APPEND} flag. +@end vtable + When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the @code{preadv2} function is in fact @code{preadv64v2} and the type @code{off_t} has 64 bits, which makes it possible to handle files up to diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c index b5f19f002c..8e04ff7282 100644 --- a/misc/tst-preadvwritev2-common.c +++ b/misc/tst-preadvwritev2-common.c @@ -34,8 +34,11 @@ #ifndef RWF_APPEND # define RWF_APPEND 0 #endif +#ifndef RWF_NOAPPEND +# define RWF_NOAPPEND 0 +#endif #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \ - | RWF_APPEND) + | RWF_APPEND | RWF_NOAPPEND) /* Generic uio_lim.h does not define IOV_MAX. */ #ifndef IOV_MAX diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h index 7854cccef3..ead7a09156 100644 --- a/sysdeps/unix/sysv/linux/bits/uio-ext.h +++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h @@ -47,6 +47,7 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, #define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */ #define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */ #define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */ +#define RWF_NOAPPEND 0x00000020 /* per-IO negation of O_APPEND */ __END_DECLS