From patchwork Tue Oct 7 06:46:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146392 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=sden8rZC; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ZjgUszVN; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=zKy4paDK; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=412Ud6NI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (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 4cgmsd3Y3cz1yGd for ; Tue, 7 Oct 2025 17:47:33 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7E7933CE2DF for ; Tue, 7 Oct 2025 08:47:31 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id F04B63CE2C6 for ; Tue, 7 Oct 2025 08:47:12 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 in-2.smtp.seeweb.it (Postfix) with ESMTPS id 88E3064787E for ; Tue, 7 Oct 2025 08:47:12 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E5B401F7A2; Tue, 7 Oct 2025 06:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T457ECOyFH9FGPlpeq6ng/WILkC+Gc18DwyIXtktEKI=; b=sden8rZCxUADyh8pK7yGCeLRZB/+ymPUrmYzRvAHoHP09rQi8118P0x+7XimJRmg+nleZF 4+TUTHIqEbspPs//dsCnyHCXimwJ5afF8VLcjsMMZ/UNbZYAvcxIouxWRtdocUHd1Gwfbt kWDX7xDGKFfgS2z1u4l/7CaXCsS/hZA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T457ECOyFH9FGPlpeq6ng/WILkC+Gc18DwyIXtktEKI=; b=ZjgUszVNtuSbeG9WRRVdVJdIkiMSyZAzp+J9NaLh+Wp+5emNXiRoE3Dx/rxuBmpq1SLRhY RplyxkJ4w2svbjAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=zKy4paDK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=412Ud6NI DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T457ECOyFH9FGPlpeq6ng/WILkC+Gc18DwyIXtktEKI=; b=zKy4paDKvYISRmdnU/oTug5PtuFTpiPwGKj7XL6aU6pXaGpEFTB6U7MspYl01Ie3K8LpXg EFI3WG06g0FmPGv+NUq7b1J3DPPQcajUmMFfx7g7UJSN0GFY9lXOMeNMFXkmhp3+RRmUd2 QkkpchomDz/6UdtSeSFjhANyB1P2zjA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T457ECOyFH9FGPlpeq6ng/WILkC+Gc18DwyIXtktEKI=; b=412Ud6NIKw8Tp5I17km1rfEOlCLvj1b4uV14RyiOm2wUHe/6eZ2sjLRzBZZhsGXAyqlkRW wBz326MTUL9YS5AA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 43F3413AAC; Tue, 7 Oct 2025 06:47:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oCNEAmy35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:08 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:53 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-1-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=1792; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=7RPPbMhhtkTtCTsNOZsZEmqHQTa2qMO0g3hV2ZnisyM=; b=yehifjnQzSwTH8TwM4kfZkhgN6maxiMl7X+ICNQkS6+pE9x9jNws/C2NXWJ2KBXZuIzaHA40E So+Mp7hJj6KCWWXv8llQOVLGmQJ+pTKTMQpGRTHm7NvBm7n1IEwjW+v X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[configure.ac:url,suse.com:mid,suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Level: X-Rspamd-Queue-Id: E5B401F7A2 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 01/10] lapi: add struct xattr_args fallback X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- configure.ac | 2 ++ include/lapi/xattr.h | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/configure.ac b/configure.ac index 0480f46ca..c32d9992c 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,7 @@ AC_CHECK_HEADERS_ONCE([ \ linux/tty.h \ linux/types.h \ linux/userfaultfd.h \ + linux/xattr.h \ netinet/sctp.h \ pthread.h \ sys/epoll.h \ @@ -266,6 +267,7 @@ AC_CHECK_TYPES([struct mnt_id_req],,,[#include ]) AC_CHECK_TYPES([struct statmount],,,[#include ]) AC_CHECK_MEMBERS([struct statmount.mnt_ns_id],,,[#include #include ]) +AC_CHECK_TYPES([struct xattr_args],,,[#include ]) AC_CHECK_TYPES([struct pidfd_info],,,[#include ]) AC_CHECK_TYPES([struct file_attr],,,[#include ]) diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h new file mode 100644 index 000000000..8bd2d45e4 --- /dev/null +++ b/include/lapi/xattr.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2025 Linux Test Project + */ + +#ifndef LAPI_XATTR_H__ +#define LAPI_XATTR_H__ + +#include +#include "config.h" + +#ifdef HAVE_LINUX_XATTR_H +# include +#endif + +#ifndef XATTR_CREATE +# define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ +#endif + +#ifndef XATTR_REPLACE +# define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ +#endif + +#ifndef HAVE_STRUCT_XATTR_ARGS +struct xattr_args { + uint64_t value; + uint32_t size; + uint32_t flags; +}; +#endif + +#endif /* LAPI_XATTR_H__ */ From patchwork Tue Oct 7 06:46:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146394 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GkUagnyf; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=6vdISgCU; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GkUagnyf; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=6vdISgCU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmtL4FVgz1yGd for ; Tue, 7 Oct 2025 17:48:10 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 9C6213CE2F0 for ; Tue, 7 Oct 2025 08:48:08 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id AECF23CE338 for ; Tue, 7 Oct 2025 08:47:16 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (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 in-5.smtp.seeweb.it (Postfix) with ESMTPS id 152EC600858 for ; Tue, 7 Oct 2025 08:47:15 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E376E1F452; Tue, 7 Oct 2025 06:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hc0aKrvD3knkoPTDf/th42K3CBJI+lK3o1HH4HyZp/A=; b=GkUagnyfCN8f56pJ18ZZybOC3tj1wa/Q2elmD+h5D+3rTOFBzpSQ90A10I95aZZdhTwPL0 DI9VdVUU/MyA5y0gWk38ntYjoshP6Wk7BwfIJV2fi7dKXkiyHUuVaRKm0unC6huTM455qx dh20fGQtoNDLT+J7vR4xfwWsSOELXhA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hc0aKrvD3knkoPTDf/th42K3CBJI+lK3o1HH4HyZp/A=; b=6vdISgCUKaRBtDH1QAdvWifcLtWNzCMIbVrRS3WcETDea17eDc2Thn9TikqVy0RAVixb1c czuOQ0EziIQa1lBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GkUagnyf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=6vdISgCU DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hc0aKrvD3knkoPTDf/th42K3CBJI+lK3o1HH4HyZp/A=; b=GkUagnyfCN8f56pJ18ZZybOC3tj1wa/Q2elmD+h5D+3rTOFBzpSQ90A10I95aZZdhTwPL0 DI9VdVUU/MyA5y0gWk38ntYjoshP6Wk7BwfIJV2fi7dKXkiyHUuVaRKm0unC6huTM455qx dh20fGQtoNDLT+J7vR4xfwWsSOELXhA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819629; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hc0aKrvD3knkoPTDf/th42K3CBJI+lK3o1HH4HyZp/A=; b=6vdISgCUKaRBtDH1QAdvWifcLtWNzCMIbVrRS3WcETDea17eDc2Thn9TikqVy0RAVixb1c czuOQ0EziIQa1lBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4482313AAC; Tue, 7 Oct 2025 06:47:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SAOtAm235Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:09 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:54 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-2-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=1216; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=Aff1lzVM7dRbresLhMElOXZj2kaoDXZXUg/9gCvwWUY=; b=XDZBBFfXymL1dlt54dvc/gpUOTqeTC8ByYYBxDJg3PSRuPaNeN7cVmLaqG694+xBADki7NKX7 QDSPV7S5cfZCJ4A8ypxqNqyDpBYggcyJvI1aBrSLsa83DAK37va3A1F X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spam-Level: X-Rspamd-Queue-Id: E376E1F452 X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,configure.ac:url,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.com:email,suse.com:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 02/10] lapi: add setxattrat() fallback definition X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- configure.ac | 1 + include/lapi/xattr.h | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index c32d9992c..827a8e6eb 100644 --- a/configure.ac +++ b/configure.ac @@ -157,6 +157,7 @@ AC_CHECK_FUNCS_ONCE([ \ sendmmsg \ sethostid \ setns \ + setxattrat \ sigpending \ splice \ statx \ diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h index 8bd2d45e4..8ab7e51d5 100644 --- a/include/lapi/xattr.h +++ b/include/lapi/xattr.h @@ -7,7 +7,9 @@ #define LAPI_XATTR_H__ #include +#include #include "config.h" +#include "lapi/syscalls.h" #ifdef HAVE_LINUX_XATTR_H # include @@ -29,4 +31,14 @@ struct xattr_args { }; #endif +#ifndef HAVE_FUNC_SETXATTRAT +static inline int setxattrat(int dfd, const char *pathname, + unsigned int at_flags, const char *name, + const struct xattr_args *uargs, size_t usize) +{ + return tst_syscall(__NR_setxattrat, dfd, pathname, at_flags, name, + uargs, usize); +} +#endif + #endif /* LAPI_XATTR_H__ */ From patchwork Tue Oct 7 06:46:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146396 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=bfEIangO; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=DmNv9GJ8; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=L6ApMCIM; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=9BcsW5VR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmv73my4z1yGd for ; Tue, 7 Oct 2025 17:48:51 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 635033CE338 for ; Tue, 7 Oct 2025 08:48:49 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 12C113CE1DE for ; Tue, 7 Oct 2025 08:47:21 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (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 in-7.smtp.seeweb.it (Postfix) with ESMTPS id 8FC3F20096B for ; Tue, 7 Oct 2025 08:47:20 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EE1441F7A8; Tue, 7 Oct 2025 06:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SWhXnkxWXF9e7ui8TAd0K8GokYu1WUkz0X6s6OKn+QM=; b=bfEIangOcPrMlGq2LBxV+AejTA0Z9DBB4RHCM+7G8DzOW9O/I42TCQUhxNTdiL5q0788ww 16msmCcI+6UNy+ohsJgC+RBQNHLr1cjqTJPVCvEoaC7pimw/DcMER3DhfLuThJ7vKJshhM mB8jH9Y/lGcITzduQ3/qW1gyir90lO8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SWhXnkxWXF9e7ui8TAd0K8GokYu1WUkz0X6s6OKn+QM=; b=DmNv9GJ83F/n0DHuX8byrk5HkkQW5N46zGf/MAUWcx36wRbDD9ZjkuqR74mpC9c3l6l0Th q1zEEBDU2aEJESAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=L6ApMCIM; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9BcsW5VR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819630; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SWhXnkxWXF9e7ui8TAd0K8GokYu1WUkz0X6s6OKn+QM=; b=L6ApMCIMC0/ba4k7Xjp9y5uKFEc89BqWRhlqkxg+rB+KA8wuid7NXTXTabuywq4zQsOerd rhZuO4yVXLQtG0upeDzToGuKCgMJxS/DcW9l6XNp/j+Ib2hmWy0CitXr/IPqjmmZ08B+p2 oCi89GotqsB1Ah79HdN0WgyNsr5k6qE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819630; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SWhXnkxWXF9e7ui8TAd0K8GokYu1WUkz0X6s6OKn+QM=; b=9BcsW5VRdEj/kHa1zhMQuUop6GpGE54/BfxNdsTbTIpPPRBOiz9XhUylDE17xTO4eFTwQk ZhOv3tGxhxVG1PBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 4B61B13AAC; Tue, 7 Oct 2025 06:47:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id UMU7BG635Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:10 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:55 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-3-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=4004; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=W/4LpRoxh/p7yA7zgwPTCGmagbelal2WTurTWtobBr8=; b=HUDHGaCI91Qe2qhv0Pfe3FHzqaBpZxE03Lb/cCncH5xrJ4K82oIftL0pHQ/X7XQjgAMFI5Wlk btLBGpbO3eXCNqjeCjZ3MOm6p8LELfzYWt5pe6HeHVPqzaje5ogjq22 X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.com:mid,suse.com:email,suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Level: X-Rspamd-Queue-Id: EE1441F7A8 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 03/10] setxattr01: add setxattrat variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- testcases/kernel/syscalls/setxattr/setxattr01.c | 61 +++++++++++++++++++------ 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/testcases/kernel/syscalls/setxattr/setxattr01.c b/testcases/kernel/syscalls/setxattr/setxattr01.c index a405bf42e..ade405f37 100644 --- a/testcases/kernel/syscalls/setxattr/setxattr01.c +++ b/testcases/kernel/syscalls/setxattr/setxattr01.c @@ -20,6 +20,10 @@ */ #include "config.h" +#include "tst_test.h" + +#ifdef HAVE_SYS_XATTR_H + #include #include #include @@ -30,12 +34,9 @@ #include #include #include -#ifdef HAVE_SYS_XATTR_H -# include -#endif -#include "tst_test.h" +#include "lapi/xattr.h" +#include -#ifdef HAVE_SYS_XATTR_H #define XATTR_NAME_MAX 255 #define XATTR_NAME_LEN (XATTR_NAME_MAX + 2) #define XATTR_SIZE_MAX 65536 @@ -43,11 +44,13 @@ #define XATTR_TEST_VALUE "this is a test value" #define XATTR_TEST_VALUE_SIZE 20 #define MNTPOINT "mntpoint" -#define FNAME MNTPOINT"/setxattr01testfile" +#define FNAME_REL "setxattr01testfile" +#define FNAME MNTPOINT"/"FNAME_REL static char long_key[XATTR_NAME_LEN]; static char *long_value; static char *xattr_value = XATTR_TEST_VALUE; +static int mnt_fd = -1; struct test_case { char *key; @@ -126,44 +129,64 @@ struct test_case tc[] = { static void verify_setxattr(unsigned int i) { + char *sysname; + /* some tests might require existing keys for each iteration */ if (tc[i].keyneeded) { SAFE_SETXATTR(FNAME, tc[i].key, *tc[i].value, tc[i].size, XATTR_CREATE); } - TEST(setxattr(FNAME, tc[i].key, *tc[i].value, tc[i].size, tc[i].flags)); + if (tst_variant) { + sysname = "setxattrat"; + + struct xattr_args args = { + .value = (uint64_t)tc[i].value, + .size = tc[i].size, + .flags = tc[i].flags, + }; + + TEST(setxattrat(mnt_fd, FNAME_REL, AT_SYMLINK_NOFOLLOW, + tc[i].key, &args, sizeof(args))); + } else { + sysname = "setxattr"; + + TEST(setxattr( + FNAME, + tc[i].key, *tc[i].value, tc[i].size, + tc[i].flags)); + } if (TST_RET == -1 && TST_ERR == EOPNOTSUPP) - tst_brk(TCONF, "setxattr(2) not supported"); + tst_brk(TCONF, "%s(2) not supported", sysname); /* success */ if (!tc[i].exp_err) { if (TST_RET) { tst_res(TFAIL | TTERRNO, - "setxattr(2) failed with %li", TST_RET); + "%s(2) failed with %li", sysname, TST_RET); return; } /* this is needed for subsequent iterations */ SAFE_REMOVEXATTR(FNAME, tc[i].key); - tst_res(TPASS, "setxattr(2) passed"); + tst_res(TPASS, "%s(2) passed", sysname); return; } if (TST_RET == 0) { - tst_res(TFAIL, "setxattr(2) passed unexpectedly"); + tst_res(TFAIL, "%s(2) passed unexpectedly", sysname); return; } /* error */ if (tc[i].exp_err != TST_ERR) { - tst_res(TFAIL | TTERRNO, "setxattr(2) should fail with %s", - tst_strerrno(tc[i].exp_err)); + tst_res(TFAIL | TTERRNO, "%s(2) should fail with %s", + sysname, tst_strerrno(tc[i].exp_err)); return; } @@ -171,7 +194,7 @@ static void verify_setxattr(unsigned int i) if (tc[i].keyneeded) SAFE_REMOVEXATTR(FNAME, tc[i].key); - tst_res(TPASS | TTERRNO, "setxattr(2) failed"); + tst_res(TPASS | TTERRNO, "%s(2) failed", sysname); } static void setup(void) @@ -192,12 +215,22 @@ static void setup(void) if (!tc[i].key) tc[i].key = tst_get_bad_addr(NULL); } + + mnt_fd = SAFE_OPEN(MNTPOINT, O_DIRECTORY); +} + +static void cleanup(void) +{ + if (mnt_fd != -1) + SAFE_CLOSE(mnt_fd); } static struct tst_test test = { .setup = setup, + .cleanup = cleanup, .test = verify_setxattr, .tcnt = ARRAY_SIZE(tc), + .test_variants = 2, .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, From patchwork Tue Oct 7 06:46:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146398 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Lebe5Rfc; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XsuRJEC7; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Lebe5Rfc; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XsuRJEC7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmvx4BcPz1yGd for ; Tue, 7 Oct 2025 17:49:33 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 354FA3CE2E7 for ; Tue, 7 Oct 2025 08:49:31 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id E4ACA3CE187 for ; Tue, 7 Oct 2025 08:47:24 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (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 in-2.smtp.seeweb.it (Postfix) with ESMTPS id 42911600824 for ; Tue, 7 Oct 2025 08:47:23 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 086F51F7B4; Tue, 7 Oct 2025 06:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3XNRnbcuSBvk5rGjlMAC4jL5NExR4BoCDB/Ew2b2cqA=; b=Lebe5Rfcz9LsHUePvabeFyt/gSKduCKQPviyuHtN0zlSbPBwDFAr+FYIiDpT0SVNsc02yn Bjhgacqksp8tt4OAkkFUx7RYFBzFIMb1ZXHyDWYLGoE0I44Xi7VuGX7EIefyJ750meWZ/3 joqd4C/nQBG3/5bnFq1XrimhQ0C4JmM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3XNRnbcuSBvk5rGjlMAC4jL5NExR4BoCDB/Ew2b2cqA=; b=XsuRJEC72wJzx5Z6f4cYfnTSiLiSgxbPXuR8Y6HX92uKP9NzoOu8sGocK75oai+uTNRALu eyd3Ky9Qdx7OfrDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3XNRnbcuSBvk5rGjlMAC4jL5NExR4BoCDB/Ew2b2cqA=; b=Lebe5Rfcz9LsHUePvabeFyt/gSKduCKQPviyuHtN0zlSbPBwDFAr+FYIiDpT0SVNsc02yn Bjhgacqksp8tt4OAkkFUx7RYFBzFIMb1ZXHyDWYLGoE0I44Xi7VuGX7EIefyJ750meWZ/3 joqd4C/nQBG3/5bnFq1XrimhQ0C4JmM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819632; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3XNRnbcuSBvk5rGjlMAC4jL5NExR4BoCDB/Ew2b2cqA=; b=XsuRJEC72wJzx5Z6f4cYfnTSiLiSgxbPXuR8Y6HX92uKP9NzoOu8sGocK75oai+uTNRALu eyd3Ky9Qdx7OfrDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 49BCD13AAC; Tue, 7 Oct 2025 06:47:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SKDpBW+35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:11 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:56 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-4-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=4461; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=oEZLSD98+Ukqv7Dl3jt+EtC5ExA2B8QPJDDv0d4KHhY=; b=sMmD88NTWrTNRNRlk2HYiHmbXo/lzme3b+i+d/2Do1hh49OKP3/fd3d4IgpHL2zC+R3LqyKOd M/tqUEhx3Z9Dus5xuboVOai6cUDKto1LxxzXqm+8BYL8vAeEeaVPu7f X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.com:mid, suse.com:email] X-Spam-Level: X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 04/10] setxattr02: add setxattrat variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato --- testcases/kernel/syscalls/setxattr/setxattr02.c | 79 +++++++++++++++++++------ 1 file changed, 60 insertions(+), 19 deletions(-) diff --git a/testcases/kernel/syscalls/setxattr/setxattr02.c b/testcases/kernel/syscalls/setxattr/setxattr02.c index 9f5f998da..b5042a0df 100644 --- a/testcases/kernel/syscalls/setxattr/setxattr02.c +++ b/testcases/kernel/syscalls/setxattr/setxattr02.c @@ -19,6 +19,10 @@ */ #include "config.h" +#include "tst_test.h" + +#ifdef HAVE_SYS_XATTR_H + #include #include #include @@ -30,12 +34,10 @@ #include #include #include -#ifdef HAVE_SYS_XATTR_H -# include -#endif -#include "tst_test.h" +#include "lapi/xattr.h" +#include "lapi/fcntl.h" +#include -#ifdef HAVE_SYS_XATTR_H #define XATTR_TEST_KEY "user.testkey" #define XATTR_TEST_VALUE "this is a test value" #define XATTR_TEST_VALUE_SIZE 20 @@ -49,6 +51,8 @@ #define BLK "setxattr02blk" #define SOCK "setxattr02sock" +static int tmpdir_fd = -1; + struct test_case { char *fname; char *key; @@ -120,39 +124,58 @@ static struct test_case tc[] = { static void verify_setxattr(unsigned int i) { + char *sysname; + /* some tests might require existing keys for each iteration */ if (tc[i].needskeyset) { SAFE_SETXATTR(tc[i].fname, tc[i].key, tc[i].value, tc[i].size, - XATTR_CREATE); + XATTR_CREATE); } - TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value, tc[i].size, - tc[i].flags)); + if (tst_variant) { + sysname = "setxattrat"; + + struct xattr_args args = { + .value = (uint64_t)tc[i].value, + .size = tc[i].size, + .flags = tc[i].flags, + }; + + int at_flags = tc[i].needskeyset ? 0 : AT_SYMLINK_NOFOLLOW; + + TEST(setxattrat(tmpdir_fd, tc[i].fname, at_flags, + tc[i].key, &args, sizeof(args))); + } else { + sysname = "setxattr"; + + TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value, tc[i].size, + tc[i].flags)); + } if (TST_RET == -1 && TST_ERR == EOPNOTSUPP) - tst_brk(TCONF, "setxattr(2) not supported"); + tst_brk(TCONF, "%s(2) not supported", sysname); /* success */ if (!tc[i].exp_err) { if (TST_RET) { tst_res(TFAIL | TTERRNO, - "setxattr(2) on %s failed with %li", - tc[i].fname + OFFSET, TST_RET); + "%s(2) on %s failed with %li", + sysname, tc[i].fname + OFFSET, TST_RET); return; } /* this is needed for subsequent iterations */ SAFE_REMOVEXATTR(tc[i].fname, tc[i].key); - tst_res(TPASS, "setxattr(2) on %s passed", - tc[i].fname + OFFSET); + tst_res(TPASS, "%s(2) on %s passed", + sysname, tc[i].fname + OFFSET); return; } if (TST_RET == 0) { - tst_res(TFAIL, "setxattr(2) on %s passed unexpectedly", - tc[i].fname + OFFSET); + tst_res(TFAIL, "%s(2) on %s passed unexpectedly", + sysname, tc[i].fname + OFFSET); return; } @@ -160,8 +183,8 @@ static void verify_setxattr(unsigned int i) if (tc[i].exp_err != TST_ERR) { tst_res(TFAIL | TTERRNO, - "setxattr(2) on %s should have failed with %s", - tc[i].fname + OFFSET, + "%s(2) on %s should have failed with %s", + sysname, tc[i].fname + OFFSET, tst_strerrno(tc[i].exp_err)); return; } @@ -170,8 +193,8 @@ static void verify_setxattr(unsigned int i) if (tc[i].needskeyset) SAFE_REMOVEXATTR(tc[i].fname, tc[i].key); - tst_res(TPASS | TTERRNO, "setxattr(2) on %s failed", - tc[i].fname + OFFSET); + tst_res(TPASS | TTERRNO, "%s(2) on %s failed", + sysname, tc[i].fname + OFFSET); } static void setup(void) @@ -185,12 +208,30 @@ static void setup(void) SAFE_MKNOD(CHR, S_IFCHR | 0777, dev); SAFE_MKNOD(BLK, S_IFBLK | 0777, 0); SAFE_MKNOD(SOCK, S_IFSOCK | 0777, 0); + + tmpdir_fd = SAFE_OPEN(tst_tmpdir_path(), O_DIRECTORY); +} + +static void cleanup(void) +{ + if (tmpdir_fd != -1) + SAFE_CLOSE(tmpdir_fd); + + SAFE_UNLINK(FILENAME); + SAFE_RMDIR(DIRNAME); + SAFE_UNLINK(SYMLINK); + SAFE_UNLINK(FIFO); + SAFE_UNLINK(CHR); + SAFE_UNLINK(BLK); + SAFE_UNLINK(SOCK); } static struct tst_test test = { .setup = setup, + .cleanup = cleanup, .test = verify_setxattr, .tcnt = ARRAY_SIZE(tc), + .test_variants = 2, .needs_tmpdir = 1, .needs_root = 1, }; From patchwork Tue Oct 7 06:46:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146399 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=O5JoZaHg; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SqE+0Yb0; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=O5JoZaHg; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SqE+0Yb0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmwG39gkz1yGd for ; Tue, 7 Oct 2025 17:49:50 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6E99F3CE388 for ; Tue, 7 Oct 2025 08:49:48 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B512B3CE2CF for ; Tue, 7 Oct 2025 08:47:34 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (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 in-3.smtp.seeweb.it (Postfix) with ESMTPS id B19891A007FD for ; Tue, 7 Oct 2025 08:47:33 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0B1361F789; Tue, 7 Oct 2025 06:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819633; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCft9HLV8aIZHQtSwH3pZRxU3OZ1zthE2sKm1iyEPH0=; b=O5JoZaHgoZtMjuG3+niWp6hkncdyNxsdBRgogypXK8e2aTDBTQkf9ksfpbxPgP4nynkIC6 sEeOXjvwJ3zgRLPMxIhn6UvtB1CwxeoqKusoka90bB5cHtvrq6I6hxBCY0z1g6BDFJlVZ9 YtOhFs3UMx1rZ2DAmvcZuynefHA/3Hk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819633; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCft9HLV8aIZHQtSwH3pZRxU3OZ1zthE2sKm1iyEPH0=; b=SqE+0Yb01/8pTK0cxt3XmGpHT1pSC1pg1aKuIU/F3eprAT8qa/rwaGW0/szbp3/PDEg8tf hpGuVqItFEs3+1AA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819633; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCft9HLV8aIZHQtSwH3pZRxU3OZ1zthE2sKm1iyEPH0=; b=O5JoZaHgoZtMjuG3+niWp6hkncdyNxsdBRgogypXK8e2aTDBTQkf9ksfpbxPgP4nynkIC6 sEeOXjvwJ3zgRLPMxIhn6UvtB1CwxeoqKusoka90bB5cHtvrq6I6hxBCY0z1g6BDFJlVZ9 YtOhFs3UMx1rZ2DAmvcZuynefHA/3Hk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819633; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCft9HLV8aIZHQtSwH3pZRxU3OZ1zthE2sKm1iyEPH0=; b=SqE+0Yb01/8pTK0cxt3XmGpHT1pSC1pg1aKuIU/F3eprAT8qa/rwaGW0/szbp3/PDEg8tf hpGuVqItFEs3+1AA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 5309013AAC; Tue, 7 Oct 2025 06:47:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +BJRCHC35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:12 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:57 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-5-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=2466; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=x26N36qcvMOVwqwJ9qEH7fT7/LcHo5acj6KWImN/s/A=; b=jerTbaiPSiX3+2ziUL2vXyBtSLwNo9PT/6BZEm14yx1SoO53nFtHDIerFQowUnSDSss0Kv/dZ ijcnCaw40aGBkk00Lv5B4QZ2WNyX7deTrmvSN5YGmzRf0rf3F3IBBz5 X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.com:email, suse.com:mid] X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 05/10] setxattr03: add setxattrat variant X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato --- testcases/kernel/syscalls/setxattr/setxattr03.c | 35 +++++++++++++++++++------ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/testcases/kernel/syscalls/setxattr/setxattr03.c b/testcases/kernel/syscalls/setxattr/setxattr03.c index 0b5b48a55..2465edd69 100644 --- a/testcases/kernel/syscalls/setxattr/setxattr03.c +++ b/testcases/kernel/syscalls/setxattr/setxattr03.c @@ -12,7 +12,12 @@ */ #define _GNU_SOURCE + #include "config.h" +#include "tst_test.h" + +#ifdef HAVE_SYS_XATTR_H + #include #include #include @@ -24,14 +29,10 @@ #include #include #include -#ifdef HAVE_SYS_XATTR_H -# include -#endif #include "lapi/fs.h" +#include "lapi/xattr.h" +#include -#include "tst_test.h" - -#if defined HAVE_SYS_XATTR_H #define XATTR_TEST_KEY "user.testkey" #define XATTR_TEST_VALUE "this is a test value" #define XATTR_TEST_VALUE_SIZE (sizeof(XATTR_TEST_VALUE) - 1) @@ -76,11 +77,23 @@ static struct test_case tc[] = { static int immu_fd; static int append_fd; +static int tmpdir_fd = -1; static void verify_setxattr(unsigned int i) { - TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value, tc[i].size, - tc[i].flags)); + if (tst_variant) { + struct xattr_args args = { + .value = (uint64_t)tc[i].value, + .size = tc[i].size, + .flags = tc[i].flags, + }; + + TEST(setxattrat(tmpdir_fd, tc[i].fname, AT_SYMLINK_NOFOLLOW, + tc[i].key, &args, sizeof(args))); + } else { + TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value, tc[i].size, + tc[i].flags)); + } if (!TST_RET) { tst_res(TFAIL, "%s succeeded unexpectedly", tc[i].desc); @@ -143,10 +156,15 @@ static void setup(void) if (set_append_on(append_fd)) tst_brk(TBROK | TERRNO, "Set %s append-only failed", APPEND_FILE); + + tmpdir_fd = SAFE_OPEN(tst_tmpdir_path(), O_DIRECTORY); } static void cleanup(void) { + if (tmpdir_fd != -1) + SAFE_CLOSE(tmpdir_fd); + if ((immu_fd > 0) && set_immutable_off(immu_fd)) tst_res(TWARN | TERRNO, "Unset %s immutable failed", IMMU_FILE); @@ -167,6 +185,7 @@ static struct tst_test test = { .cleanup = cleanup, .test = verify_setxattr, .tcnt = ARRAY_SIZE(tc), + .test_variants = 2, .needs_tmpdir = 1, .needs_root = 1, }; From patchwork Tue Oct 7 06:46:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146393 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Dlcsaexh; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=/MdH8x4I; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Dlcsaexh; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=/MdH8x4I; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmt06J30z1yGd for ; Tue, 7 Oct 2025 17:47:52 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id E1ACB3CE29F for ; Tue, 7 Oct 2025 08:47:50 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 975303CE32D for ; Tue, 7 Oct 2025 08:47:15 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (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 in-4.smtp.seeweb.it (Postfix) with ESMTPS id 5F2BA10007D8 for ; Tue, 7 Oct 2025 08:47:15 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1B9EE22B7B; Tue, 7 Oct 2025 06:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNlG2Qsq/LxVhuxbCCWOAi53UlMlXr0DepvoFzAu4s4=; b=Dlcsaexhn93WapKVGMyRvQ8jjg0BypmgYt/FjR7FFqkjOuEI3hiLkQfhf98wM5fvlOLxZv lVi1V4qzU/oiz/+6DJiDwzUG8mYtlqvdU/mJJ4RVHLEPR2wQIO7giTQ8H17u6Oo3/9Oq4t WLarRJt6Jv/pePA2qXOsPGTaejiaQGc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNlG2Qsq/LxVhuxbCCWOAi53UlMlXr0DepvoFzAu4s4=; b=/MdH8x4IR6cj9cWB/ZPE6vfN245w38VOWv6lRNLdC14ZpK2pwSF0rdEkvE/J7eZa2tZoze bad6+ojTkw7Y2kBw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Dlcsaexh; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="/MdH8x4I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNlG2Qsq/LxVhuxbCCWOAi53UlMlXr0DepvoFzAu4s4=; b=Dlcsaexhn93WapKVGMyRvQ8jjg0BypmgYt/FjR7FFqkjOuEI3hiLkQfhf98wM5fvlOLxZv lVi1V4qzU/oiz/+6DJiDwzUG8mYtlqvdU/mJJ4RVHLEPR2wQIO7giTQ8H17u6Oo3/9Oq4t WLarRJt6Jv/pePA2qXOsPGTaejiaQGc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pNlG2Qsq/LxVhuxbCCWOAi53UlMlXr0DepvoFzAu4s4=; b=/MdH8x4IR6cj9cWB/ZPE6vfN245w38VOWv6lRNLdC14ZpK2pwSF0rdEkvE/J7eZa2tZoze bad6+ojTkw7Y2kBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7400413AAC; Tue, 7 Oct 2025 06:47:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uCbgDnG35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:13 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:58 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-6-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=1058; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=HBxF9EUGlom8M/sDsYYyRtwci8TiAZnB2+lqufC0SnE=; b=0JufKcFj+/t1saOiGGn2wu8TroTpyw6OrDIFqm0rgTeaS0ty15VVBDGSdLavLHjvw1F8JNyzA N2r+XXXsaajDTYMGqI2tfAhuTyH1lr21CrG+neRvnRgjCwKq2fo9g3Z X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[configure.ac:url,suse.com:mid,suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Level: X-Rspamd-Queue-Id: 1B9EE22B7B X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 06/10] lapi: add getxattrat() fallback X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- configure.ac | 1 + include/lapi/xattr.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 827a8e6eb..e43e631ab 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,7 @@ AC_CHECK_FUNCS_ONCE([ \ getcpu \ getdents \ getdents64 \ + getxattrat \ io_pgetevents \ io_uring_setup \ io_uring_register \ diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h index 8ab7e51d5..3b664e4e6 100644 --- a/include/lapi/xattr.h +++ b/include/lapi/xattr.h @@ -41,4 +41,14 @@ static inline int setxattrat(int dfd, const char *pathname, } #endif +#ifndef HAVE_FUNC_GETXATTRAT +static inline int getxattrat(int dfd, const char *pathname, + unsigned int at_flags, const char *name, + void *value, size_t size) +{ + return tst_syscall(__NR_getxattrat, dfd, pathname, at_flags, name, + value, size); +} +#endif + #endif /* LAPI_XATTR_H__ */ From patchwork Tue Oct 7 06:46:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146395 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=gxutHOsn; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=irSH241B; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=gxutHOsn; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=irSH241B; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmtp3Y7Jz1yGd for ; Tue, 7 Oct 2025 17:48:34 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3074F3CE33B for ; Tue, 7 Oct 2025 08:48:32 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 8ACBE3CE2E7 for ; Tue, 7 Oct 2025 08:47:19 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 in-7.smtp.seeweb.it (Postfix) with ESMTPS id 35E2D20096B for ; Tue, 7 Oct 2025 08:47:19 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 395CF22B6D; Tue, 7 Oct 2025 06:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UDVfx1Nz9ffD0KmyvFLMLzfrftPffljoVllUFu3AYwU=; b=gxutHOsnfAheThs9lrIvnMxhqHzj1BTkSz23RzbrfNAy1/v7EzB2KGlO8gSpC+BXDRCN4P SrCFMvP5sJ/VhuYijlOsRMhIo3bCKRUEMvC7mP/9JXG6TajXKo5h4pvelWEgxpws1aeZY6 J5u04nqkH5cVOlZkGSRP38FEleGBKqc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UDVfx1Nz9ffD0KmyvFLMLzfrftPffljoVllUFu3AYwU=; b=irSH241BLtvoEHOdAiEcSvjKr638mvMHEvC3eM7NhWHC74BcuHgOg6WMcAb04QbAiffMaC wVbzH3UCVTtGdXCg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gxutHOsn; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=irSH241B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UDVfx1Nz9ffD0KmyvFLMLzfrftPffljoVllUFu3AYwU=; b=gxutHOsnfAheThs9lrIvnMxhqHzj1BTkSz23RzbrfNAy1/v7EzB2KGlO8gSpC+BXDRCN4P SrCFMvP5sJ/VhuYijlOsRMhIo3bCKRUEMvC7mP/9JXG6TajXKo5h4pvelWEgxpws1aeZY6 J5u04nqkH5cVOlZkGSRP38FEleGBKqc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819635; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UDVfx1Nz9ffD0KmyvFLMLzfrftPffljoVllUFu3AYwU=; b=irSH241BLtvoEHOdAiEcSvjKr638mvMHEvC3eM7NhWHC74BcuHgOg6WMcAb04QbAiffMaC wVbzH3UCVTtGdXCg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9289413AAC; Tue, 7 Oct 2025 06:47:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uDt0FXK35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:14 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:46:59 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-7-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=994; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=VEf0ux4UfsGrjQty0n0CmD2w8oV39zusnz25HxhCeQs=; b=jd92tzId8+o3JRWKYWxB8lbo1GNWQtOi3MrlG0iV8Kh/XY2/27ItUma7ynuHx9RozsmrFo5pd kONht2FGWntDdn1tebDDiVQyzMrYl7qZX0H0F/qOmPRkSKsc5HGpjWt X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[configure.ac:url,suse.de:dkim,suse.com:mid,suse.com:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Level: X-Rspamd-Queue-Id: 395CF22B6D X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -4.51 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 07/10] lapi: add removexattrat() fallback X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Signed-off-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- configure.ac | 1 + include/lapi/xattr.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index e43e631ab..e77377a60 100644 --- a/configure.ac +++ b/configure.ac @@ -153,6 +153,7 @@ AC_CHECK_FUNCS_ONCE([ \ quotactl_fd \ rand_r \ recvmmsg \ + removexattrat \ renameat2 \ sched_getcpu \ sendmmsg \ diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h index 3b664e4e6..2ca05c787 100644 --- a/include/lapi/xattr.h +++ b/include/lapi/xattr.h @@ -51,4 +51,12 @@ static inline int getxattrat(int dfd, const char *pathname, } #endif +#ifndef HAVE_FUNC_REMOVEXATTRAT +static inline int removexattrat(int dfd, const char *pathname, + unsigned int at_flags, const char *name) +{ + return tst_syscall(__NR_removexattrat, dfd, pathname, at_flags, name); +} +#endif + #endif /* LAPI_XATTR_H__ */ From patchwork Tue Oct 7 06:47:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146400 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fHHpEO/h; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=t9Qng9u1; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=fHHpEO/h; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=t9Qng9u1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmwc3Bmqz1yGS for ; Tue, 7 Oct 2025 17:50:08 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 758F23CE392 for ; Tue, 7 Oct 2025 08:50:06 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id CD4853CE187 for ; Tue, 7 Oct 2025 08:47:38 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (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 in-4.smtp.seeweb.it (Postfix) with ESMTPS id 5491C10007C5 for ; Tue, 7 Oct 2025 08:47:38 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3F3D71F7A2; Tue, 7 Oct 2025 06:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819636; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4fMlDQi9uKxVSOlIGyLiHOpDLKve/eubWxwt6X7eyk8=; b=fHHpEO/hZ5u25ewhfVIvS3+2kgFVMCuFnN31foAxnShlrrpPiOv/wp+LmmrNXOt3PaSNop zaZwAwxhIHyrhB2t5RmOOiIzY9lpMzsGu2Wwi2exlBoki1vdMY2Xr4R255Gr5iAZmd4m8Z omqMj6AB53k08HBwPraG7xNUPugT6QQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819636; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4fMlDQi9uKxVSOlIGyLiHOpDLKve/eubWxwt6X7eyk8=; b=t9Qng9u1dT00f0EpGiERwi5WfR7PgpHI+HBshvNYb8udsp7NmCrk6y2A5fXGhMeboPRXf9 R5G4R64ks2UBxZCQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819636; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4fMlDQi9uKxVSOlIGyLiHOpDLKve/eubWxwt6X7eyk8=; b=fHHpEO/hZ5u25ewhfVIvS3+2kgFVMCuFnN31foAxnShlrrpPiOv/wp+LmmrNXOt3PaSNop zaZwAwxhIHyrhB2t5RmOOiIzY9lpMzsGu2Wwi2exlBoki1vdMY2Xr4R255Gr5iAZmd4m8Z omqMj6AB53k08HBwPraG7xNUPugT6QQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819636; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4fMlDQi9uKxVSOlIGyLiHOpDLKve/eubWxwt6X7eyk8=; b=t9Qng9u1dT00f0EpGiERwi5WfR7PgpHI+HBshvNYb8udsp7NmCrk6y2A5fXGhMeboPRXf9 R5G4R64ks2UBxZCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9519013AAC; Tue, 7 Oct 2025 06:47:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ELhDF3O35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:15 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:47:00 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-8-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=3396; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=5FAQYGR2ElRl9Hsy3wCMnyL6CjVcWkj1h5SQ6BX79MQ=; b=1FlIOL8hNdWEGhBsR/psiuTJbqmLsE4k022TJ4gHeV1O8sEUcS673oB68G60f5tfp6u8PWcG+ UfeD4s7yEeYC5QnsPFDwg/zUl7s+KK33lArjpIHL2FzMlB0QC8SW6mJ X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email, suse.com:mid, imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 08/10] lapi: add safe *xattrat macros X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Introduce the following new safe macros: - SAFE_SETXATTRAT - SAFE_GETXATTRAT - SAFE_REMOVEXATTRAT Signed-off-by: Andrea Cervesato Reviewed-by: Cyril Hrubis --- include/lapi/xattr.h | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h index 2ca05c787..cfd1cca40 100644 --- a/include/lapi/xattr.h +++ b/include/lapi/xattr.h @@ -59,4 +59,98 @@ static inline int removexattrat(int dfd, const char *pathname, } #endif +int safe_setxattrat(const char *file, const int lineno, + int dfd, const char *path, int at_flags, + const char *key, struct xattr_args *args, size_t size) +{ + int rval; + + rval = setxattrat(dfd, path, at_flags, key, args, size); + + if (rval == -1) { + if (errno == ENOTSUP) { + tst_brk_(file, lineno, TCONF, + "no xattr support in fs, mounted without user_xattr option " + "or invalid namespace/name format"); + return rval; + } + + tst_brk_(file, lineno, TBROK | TERRNO, + "setxattrat(%d, %s, %d, %s, %p, %zu) failed", + dfd, path, at_flags, key, args, size); + } else if (rval) { + tst_brk_(file, lineno, TBROK | TERRNO, + "Invalid setxattrat(%d, %s, %d, %s, %p, %zu) return value %d", + dfd, path, at_flags, key, args, size, rval); + } + + return rval; +} + +#define SAFE_SETXATTRAT(dfd, path, at_flags, key, args, size) \ + safe_setxattrat(__FILE__, __LINE__, \ + (dfd), (path), (at_flags), (key), (args), (size)) + +int safe_getxattrat(const char *file, const int lineno, + int dfd, const char *path, int at_flags, + const char *key, struct xattr_args *args, size_t size) +{ + int rval; + + rval = getxattrat(dfd, path, at_flags, key, args, size); + + if (rval == -1) { + if (errno == ENOTSUP) { + tst_brk_(file, lineno, TCONF, + "no xattr support in fs, mounted without user_xattr option " + "or invalid namespace/name format"); + return rval; + } + + tst_brk_(file, lineno, TBROK | TERRNO, + "getxattrat(%d, %s, %d, %s, %p, %zu) failed", + dfd, path, at_flags, key, args, size); + } else if (rval < 0) { + tst_brk_(file, lineno, TBROK | TERRNO, + "Invalid getxattrat(%d, %s, %d, %s, %p, %zu) return value %d", + dfd, path, at_flags, key, args, size, rval); + } + + return rval; +} + +#define SAFE_GETXATTRAT(dfd, path, at_flags, key, args, size) \ + safe_getxattrat(__FILE__, __LINE__, \ + (dfd), (path), (at_flags), (key), (args), (size)) + +int safe_removexattrat(const char *file, const int lineno, + int dfd, const char *path, int at_flags, const char *name) +{ + int rval; + + rval = removexattrat(dfd, path, at_flags, name); + + if (rval == -1) { + if (errno == ENOTSUP) { + tst_brk_(file, lineno, TCONF, + "no xattr support in fs or mounted without user_xattr option"); + return rval; + } + + tst_brk_(file, lineno, TBROK | TERRNO, + "removexattrat(%d, %s, %d, %s) failed", + dfd, path, at_flags, name); + } else if (rval) { + tst_brk_(file, lineno, TBROK | TERRNO, + "Invalid removexattrat(%d, %s, %d, %s) return value %d", + dfd, path, at_flags, name, rval); + } + + return rval; +} + +#define SAFE_REMOVEXATTRAT(dfd, path, at_flags, name) \ + safe_removexattrat(__FILE__, __LINE__, \ + (dfd), (path), (at_flags), (name)) + #endif /* LAPI_XATTR_H__ */ From patchwork Tue Oct 7 06:47:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146397 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=iPd1wraE; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=h3SeREKJ; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=iPd1wraE; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=h3SeREKJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (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 4cgmvT6shCz1yGd for ; Tue, 7 Oct 2025 17:49:09 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id AD56A3CE2E4 for ; Tue, 7 Oct 2025 08:49:07 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id F152E3CE32E for ; Tue, 7 Oct 2025 08:47:22 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 in-7.smtp.seeweb.it (Postfix) with ESMTPS id 7B808200979 for ; Tue, 7 Oct 2025 08:47:22 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4917222B9A; Tue, 7 Oct 2025 06:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CmuVbbEQ4JiKo4Lb0tYMBPvzmR1CtKSs4YMVA380d0=; b=iPd1wraEyAE2By+VfwjvPg/2RM2R+A0HsEA8VpXF2YWFCXp3kXpKHM8dX3q9sk6B98RPni N0MidxWQtdT7RfbrBGLanQiCGSBom5uy92Mw0xkedGMH/msM4uN1r4D2xAtEyxFBSsXHIs uADE9A9rIQuUBM0Y0y4mBZxLoDjvAIo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CmuVbbEQ4JiKo4Lb0tYMBPvzmR1CtKSs4YMVA380d0=; b=h3SeREKJirl39Gd1gtAh5/chELofr9XB5gXFDRnd68blPVpMFJQ3NXlVtWW3Rj4Wk7CHRc 80Jlw3BQ7oPjeYBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CmuVbbEQ4JiKo4Lb0tYMBPvzmR1CtKSs4YMVA380d0=; b=iPd1wraEyAE2By+VfwjvPg/2RM2R+A0HsEA8VpXF2YWFCXp3kXpKHM8dX3q9sk6B98RPni N0MidxWQtdT7RfbrBGLanQiCGSBom5uy92Mw0xkedGMH/msM4uN1r4D2xAtEyxFBSsXHIs uADE9A9rIQuUBM0Y0y4mBZxLoDjvAIo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819637; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CmuVbbEQ4JiKo4Lb0tYMBPvzmR1CtKSs4YMVA380d0=; b=h3SeREKJirl39Gd1gtAh5/chELofr9XB5gXFDRnd68blPVpMFJQ3NXlVtWW3Rj4Wk7CHRc 80Jlw3BQ7oPjeYBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9185913AAC; Tue, 7 Oct 2025 06:47:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qKrGGHS35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:16 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:47:01 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-9-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=5071; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=xIPpk6YGKbWopjs6IlAEM0eg2ApJqHMc4eGpzbWnvsI=; b=OJg0JdYXDrG0okRx0nNBJt1nS9A6UNCtiK3ozWb7qdKWWPGAS901WKtpxffujADAsw2JASORB nSGmzNpYJC1BKQp+lkd19stSPclISMAqtLfQMwwHFRE4QX1KVfooDR0 X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.com:email, suse.com:mid] X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 09/10] Add setxattrat01 test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Test if setxattrat() syscall is correctly following symlink, setting a xattr on a file. Signed-off-by: Andrea Cervesato --- testcases/kernel/syscalls/setxattrat/.gitignore | 1 + testcases/kernel/syscalls/setxattrat/Makefile | 8 ++ .../kernel/syscalls/setxattrat/setxattrat01.c | 150 +++++++++++++++++++++ 3 files changed, 159 insertions(+) diff --git a/testcases/kernel/syscalls/setxattrat/.gitignore b/testcases/kernel/syscalls/setxattrat/.gitignore new file mode 100644 index 000000000..e636401d7 --- /dev/null +++ b/testcases/kernel/syscalls/setxattrat/.gitignore @@ -0,0 +1 @@ +setxattrat01 diff --git a/testcases/kernel/syscalls/setxattrat/Makefile b/testcases/kernel/syscalls/setxattrat/Makefile new file mode 100644 index 000000000..e582f727d --- /dev/null +++ b/testcases/kernel/syscalls/setxattrat/Makefile @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2025 SUSE LLC + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/kernel/syscalls/setxattrat/setxattrat01.c b/testcases/kernel/syscalls/setxattrat/setxattrat01.c new file mode 100644 index 000000000..86ad7503f --- /dev/null +++ b/testcases/kernel/syscalls/setxattrat/setxattrat01.c @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2025 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] + * + * Test if setxattrat() syscall is correctly following symlink, setting a + * xattr on a file. + * + * [Algorithm] + * + * - create a file and the symlink pointing to it + * - run setxattrat() on the symlink following the pointing file + * - verify that file xattr has been set + * - verify that symlink xattr has not been set + * - run setxattrat() on the symlink with AT_SYMLINK_NOFOLLOW + * - verify that file xattr has not been set + * - verify that symlink xattr has been set + */ + +#include "tst_test.h" +#include "lapi/xattr.h" + +#include + +#define FNAME "ltp_file" +#define SNAME "ltp_symbolic_file" +#define XATTR_TEST_KEY "trusted.ltptestkey" +#define XATTR_TEST_VALUE "ltprulez" +#define XATTR_TEST_VALUE_SIZE 8 + +static struct xattr_args *args; +static int tmpdir_fd = -1; + +static struct tcase { + char *dst_set; + char *dst_noset; + int at_flags; +} tcases[] = { + { + .dst_set = FNAME, + .dst_noset = SNAME, + .at_flags = 0, + }, + { + .dst_set = SNAME, + .dst_noset = FNAME, + .at_flags = AT_SYMLINK_NOFOLLOW, + } +}; + +static void expect_xattr(const char *fname) +{ + int ret; + char buff[XATTR_TEST_VALUE_SIZE]; + + tst_res(TINFO, "Check if %s has xattr", fname); + + memset(args, 0, sizeof(*args)); + memset(buff, 0, XATTR_TEST_VALUE_SIZE); + + args->value = (uint64_t)buff; + args->size = XATTR_TEST_VALUE_SIZE; + + ret = SAFE_GETXATTRAT(tmpdir_fd, fname, AT_SYMLINK_NOFOLLOW, + XATTR_TEST_KEY, args, sizeof(*args)); + + TST_EXP_EQ_LI(ret, XATTR_TEST_VALUE_SIZE); + TST_EXP_EQ_LI(args->size, XATTR_TEST_VALUE_SIZE); + TST_EXP_EQ_LI(args->flags, 0); + TST_EXP_EQ_STRN((char *)args->value, XATTR_TEST_VALUE, XATTR_TEST_VALUE_SIZE); +} + +static void expect_no_xattr(const char *fname) +{ + char buff[XATTR_TEST_VALUE_SIZE]; + + tst_res(TINFO, "Check if %s has no xattr", fname); + + memset(args, 0, sizeof(*args)); + memset(buff, 0, XATTR_TEST_VALUE_SIZE); + + args->value = (uint64_t)buff; + args->size = 0; + + TST_EXP_FAIL(tst_syscall(__NR_getxattrat, tmpdir_fd, fname, + AT_SYMLINK_NOFOLLOW, XATTR_TEST_KEY, args, sizeof(*args)), + ENODATA); + + TST_EXP_EQ_LI(args->size, 0); + TST_EXP_EQ_LI(args->flags, 0); + TST_EXP_EQ_STRN((char *)args->value, "\0", 1); +} + +static void run(unsigned int i) +{ + struct tcase *tc = &tcases[i]; + + args->value = (uint64_t)XATTR_TEST_VALUE; + args->size = XATTR_TEST_VALUE_SIZE; + args->flags = XATTR_CREATE; + + tst_res(TINFO, "Setting xattr '%s' in %s (flags=%s)", + XATTR_TEST_KEY, SNAME, + !tc->at_flags ? "0" : "AT_SYMLINK_NOFOLLOW"); + + SAFE_SETXATTRAT(tmpdir_fd, SNAME, tc->at_flags, XATTR_TEST_KEY, + args, sizeof(*args)); + + expect_xattr(tc->dst_set); + expect_no_xattr(tc->dst_noset); + + SAFE_REMOVEXATTRAT(tmpdir_fd, tc->dst_set, tc->at_flags, + XATTR_TEST_KEY); +} + +static void setup(void) +{ + char *tmpdir; + + tmpdir = tst_tmpdir_path(); + tmpdir_fd = SAFE_OPEN(tmpdir, O_DIRECTORY); + + SAFE_TOUCH(FNAME, 0777, NULL); + SAFE_SYMLINK(FNAME, SNAME); +} + +static void cleanup(void) +{ + if (tmpdir_fd != -1) + SAFE_CLOSE(tmpdir_fd); + + SAFE_UNLINK(SNAME); + SAFE_UNLINK(FNAME); +} + +static struct tst_test test = { + .test = run, + .setup = setup, + .cleanup = cleanup, + .needs_tmpdir = 1, + .needs_root = 1, + .tcnt = ARRAY_SIZE(tcases), + .bufs = (struct tst_buffers []) { + {&args, .size = sizeof(struct xattr_args)}, + {}, + } +}; From patchwork Tue Oct 7 06:47:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 2146401 X-Patchwork-Delegate: andrea.cervesato@suse.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=dhWx3adc; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=WVCyjUll; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=dhWx3adc; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=WVCyjUll; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4cgmwz3LCwz1y1V for ; Tue, 7 Oct 2025 17:50:27 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6515C3CE377 for ; Tue, 7 Oct 2025 08:50:24 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (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 picard.linux.it (Postfix) with ESMTPS id D90A93CE1B5 for ; Tue, 7 Oct 2025 08:47:42 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 in-5.smtp.seeweb.it (Postfix) with ESMTPS id 46356600850 for ; Tue, 7 Oct 2025 08:47:41 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5A1711F452; Tue, 7 Oct 2025 06:47:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yu7Xx0y3ulwlUyIZn5mX08gpbbX4O+AqgBjCWlrASDg=; b=dhWx3adc5ypdD16rYJ1IqBdI20k7QLxkp9Gp4YHBgflzDjFl+bnkf7MnfgDBmrDSeiPOsz runQMvgu647fzOUztbAimlEs2zWQWVAiug3ULPc2V3rGgGpJ6YjkedzoF4aFBtMfl1Zqcu PcT1UFaLFe8Cd7p8f5Mvi78ZZcBHeSA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yu7Xx0y3ulwlUyIZn5mX08gpbbX4O+AqgBjCWlrASDg=; b=WVCyjUllzmqJtMQEEfIV+hvlIJm/JpZfDepibgY6UYb1D8QHFqFD1ti7HJun5GrYHaGSIH hn05NSjajWZ0HXBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1759819638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yu7Xx0y3ulwlUyIZn5mX08gpbbX4O+AqgBjCWlrASDg=; b=dhWx3adc5ypdD16rYJ1IqBdI20k7QLxkp9Gp4YHBgflzDjFl+bnkf7MnfgDBmrDSeiPOsz runQMvgu647fzOUztbAimlEs2zWQWVAiug3ULPc2V3rGgGpJ6YjkedzoF4aFBtMfl1Zqcu PcT1UFaLFe8Cd7p8f5Mvi78ZZcBHeSA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1759819638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yu7Xx0y3ulwlUyIZn5mX08gpbbX4O+AqgBjCWlrASDg=; b=WVCyjUllzmqJtMQEEfIV+hvlIJm/JpZfDepibgY6UYb1D8QHFqFD1ti7HJun5GrYHaGSIH hn05NSjajWZ0HXBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A15C913AAC; Tue, 7 Oct 2025 06:47:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MAtGGnW35Gj1GgAAD6G6ig (envelope-from ); Tue, 07 Oct 2025 06:47:17 +0000 From: Andrea Cervesato Date: Tue, 07 Oct 2025 08:47:02 +0200 MIME-Version: 1.0 Message-Id: <20251007-xattrat-v2-10-bf458fa66358@suse.com> References: <20251007-xattrat-v2-0-bf458fa66358@suse.com> In-Reply-To: <20251007-xattrat-v2-0-bf458fa66358@suse.com> To: ltp@lists.linux.it X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759819626; l=3691; i=andrea.cervesato@suse.com; s=20250922; h=from:subject:message-id; bh=Us3bCmZjvBWr/V8P/hfsa6t9V52h7BCLzMmRW+LZYIs=; b=8fz6c2Ok4Ly1Qi2Jz+AxBwOL4lksUb7NnRQZ3wMYWr52zMQ0hpQNHI3XIwuQB0BsLdPxLoUN8 0XnqAxF2ID7DjqCpq05YFjXoPmJedHajqMmX74pfeinZp8gT/m1Nqkp X-Developer-Key: i=andrea.cervesato@suse.com; a=ed25519; pk=+8M3XgViLdcdNBM+Jdd90m3pV4jCw2tNsGCy5Rd+qHk= X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email, suse.com:mid, imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -4.30 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.7 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v2 10/10] Add setxattrat02 test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Andrea Cervesato Test if setxattrat() syscall is correctly raising errors when giving invalid inputs. Signed-off-by: Andrea Cervesato --- testcases/kernel/syscalls/setxattrat/.gitignore | 1 + .../kernel/syscalls/setxattrat/setxattrat02.c | 126 +++++++++++++++++++++ 2 files changed, 127 insertions(+) diff --git a/testcases/kernel/syscalls/setxattrat/.gitignore b/testcases/kernel/syscalls/setxattrat/.gitignore index e636401d7..9d007a44d 100644 --- a/testcases/kernel/syscalls/setxattrat/.gitignore +++ b/testcases/kernel/syscalls/setxattrat/.gitignore @@ -1 +1,2 @@ setxattrat01 +setxattrat02 diff --git a/testcases/kernel/syscalls/setxattrat/setxattrat02.c b/testcases/kernel/syscalls/setxattrat/setxattrat02.c new file mode 100644 index 000000000..8092fef26 --- /dev/null +++ b/testcases/kernel/syscalls/setxattrat/setxattrat02.c @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2025 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] + * + * Test if setxattrat() syscall is correctly raising errors when giving invalid + * inputs. + */ + +#include "tst_test.h" +#include "lapi/xattr.h" +#include "lapi/syscalls.h" + +#include + +#define FNAME "ltp_file" +#define XATTR_TEST_KEY "trusted.ltptestkey" +#define XATTR_TEST_VALUE "ltprulez" +#define XATTR_TEST_VALUE_SIZE 8 + +static struct xattr_args *args; +static struct xattr_args *null_args; +static int invalid_fd = -1; +static int tmpdir_fd = -1; + +static struct tcase { + int *dfd; + int at_flags; + struct xattr_args **args; + size_t args_size; + int exp_errno; + char *reason; +} tcases[] = { + { + .dfd = &invalid_fd, + .args = &args, + .args_size = sizeof(struct xattr_args), + .exp_errno = EBADF, + .reason = "Invalid directory file descriptor", + }, + { + .dfd = &tmpdir_fd, + .at_flags = -1, + .args = &args, + .args_size = sizeof(struct xattr_args), + .exp_errno = EINVAL, + .reason = "Invalid AT flags", + }, + { + .dfd = &tmpdir_fd, + .at_flags = AT_SYMLINK_NOFOLLOW + 1, + .args = &args, + .args_size = sizeof(struct xattr_args), + .exp_errno = EINVAL, + .reason = "Out of bound AT flags", + }, + { + .dfd = &tmpdir_fd, + .args = &null_args, + .args_size = sizeof(struct xattr_args), + .exp_errno = EINVAL, + .reason = "Invalid arguments", + }, + { + .dfd = &tmpdir_fd, + .args = &args, + .args_size = SIZE_MAX, + .exp_errno = E2BIG, + .reason = "Arguments size is too big", + }, + { + .dfd = &tmpdir_fd, + .args = &args, + .args_size = sizeof(struct xattr_args) - 1, + .exp_errno = EINVAL, + .reason = "Invalid arguments size", + }, +}; + +static void run(unsigned int i) +{ + struct tcase *tc = &tcases[i]; + + args->flags = XATTR_CREATE; + args->value = (uint64_t)XATTR_TEST_VALUE; + args->size = XATTR_TEST_VALUE_SIZE; + + TST_EXP_FAIL(tst_syscall(__NR_setxattrat, + tc->dfd, FNAME, tc->at_flags, XATTR_TEST_KEY, + tc->args, tc->args_size), + tc->exp_errno, "%s", tc->reason); +} + +static void setup(void) +{ + char *tmpdir; + + tmpdir = tst_tmpdir_path(); + tmpdir_fd = SAFE_OPEN(tmpdir, O_DIRECTORY); + + SAFE_TOUCH(FNAME, 0777, NULL); +} + +static void cleanup(void) +{ + if (tmpdir_fd != -1) + SAFE_CLOSE(tmpdir_fd); + + SAFE_UNLINK(FNAME); +} + +static struct tst_test test = { + .test = run, + .setup = setup, + .cleanup = cleanup, + .tcnt = ARRAY_SIZE(tcases), + .needs_root = 1, + .needs_tmpdir = 1, + .bufs = (struct tst_buffers []) { + {&args, .size = sizeof(struct xattr_args)}, + {}, + } +};