From patchwork Fri Jan 19 08:56:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1888336 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=SjRqbHzW; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=DYlz44vI; 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=CT8ns9MW; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=B4TYyls5; 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 4TGYPs1tGfz1yPV for ; Fri, 19 Jan 2024 19:56:32 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 67BD33CC870 for ; Fri, 19 Jan 2024 09:56:29 +0100 (CET) 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 6E46A3CBE8F for ; Fri, 19 Jan 2024 09:56:25 +0100 (CET) Authentication-Results: in-2.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.de (client-ip=195.135.223.130; helo=smtp-out1.suse.de; envelope-from=andrea.cervesato@suse.de; receiver=lists.linux.it) 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-2.smtp.seeweb.it (Postfix) with ESMTPS id 4E77960073E for ; Fri, 19 Jan 2024 09:56:24 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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 F228921B54; Fri, 19 Jan 2024 08:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705654584; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lcV3OK8TMFKenbllCXWyNHlhZ4Smo6Inng1iqeB8cOU=; b=SjRqbHzW4ih54ihXzpr0VpMFIAcb5xaOLk0s0ec6kPkSEqvxuIjFDKzc0cP8WFnnmlWiRs WqvPI8X+2CYFgjTJBBp9CGPdc4ffMyrx5COfZ057YKon8VX1vnGmiVAok9suqBOpYw5RlH 3IdeFaNZ49OBP2cTzHxuIfhGhvGj1ss= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705654584; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lcV3OK8TMFKenbllCXWyNHlhZ4Smo6Inng1iqeB8cOU=; b=DYlz44vIxWnNofP6WBqFifu1tnd0H6PdH87hwAA13k2cw5hJMMoT824MMZCPEZd4hVj2oV xNcK4KcwW2B86mAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1705654583; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lcV3OK8TMFKenbllCXWyNHlhZ4Smo6Inng1iqeB8cOU=; b=CT8ns9MWwD+NM8wpliIfaPyVtp1xCG+wfy2WZgIDiQJuo5TOAfxkyzkzxt44u1sv10POj/ CI1wp+dwBHLw+4AFmNt31215PUAc1j5WmVvuIbslJJcGgaOyjQoHvj1UFintAUA/ai92fZ C4KhCRQxLcChAWYTyQ9DCOUXF8V54t8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1705654583; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lcV3OK8TMFKenbllCXWyNHlhZ4Smo6Inng1iqeB8cOU=; b=B4TYyls5g2KSZ/fQilgzZVZEIDuA6Y9Wsn6Sdie90X93GCE5KjfVVEO/SR2txxrhfNviTa EO1h282uwldD2pCw== 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 BE6B8136F5; Fri, 19 Jan 2024 08:56:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8tenKzc5qmX9SQAAD6G6ig (envelope-from ); Fri, 19 Jan 2024 08:56:23 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Fri, 19 Jan 2024 09:56:22 +0100 Message-Id: <20240119085622.10743-1-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [4.90 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: 4.90 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, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v1] Add rmdir04 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 This test has been extracted from symlink01 test and it verifies rmdir() syscall functionalities on symlink generated file. Signed-off-by: Andrea Cervesato --- runtest/syscalls | 2 +- testcases/kernel/syscalls/rmdir/.gitignore | 1 + testcases/kernel/syscalls/rmdir/rmdir04.c | 30 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 testcases/kernel/syscalls/rmdir/rmdir04.c diff --git a/runtest/syscalls b/runtest/syscalls index 6e2407879..2c82a7f98 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1187,7 +1187,7 @@ request_key05 request_key05 rmdir01 rmdir01 rmdir02 rmdir02 rmdir03 rmdir03 -rmdir03A symlink01 -T rmdir03 +rmdir04 rmdir04 rt_sigaction01 rt_sigaction01 rt_sigaction02 rt_sigaction02 diff --git a/testcases/kernel/syscalls/rmdir/.gitignore b/testcases/kernel/syscalls/rmdir/.gitignore index 1a1e18066..c68c174dc 100644 --- a/testcases/kernel/syscalls/rmdir/.gitignore +++ b/testcases/kernel/syscalls/rmdir/.gitignore @@ -1,3 +1,4 @@ /rmdir01 /rmdir02 /rmdir03 +/rmdir04 diff --git a/testcases/kernel/syscalls/rmdir/rmdir04.c b/testcases/kernel/syscalls/rmdir/rmdir04.c new file mode 100644 index 000000000..4c8f11d50 --- /dev/null +++ b/testcases/kernel/syscalls/rmdir/rmdir04.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * Author: David Fenner + * Copilot: Jon Hendrickson + * Copyright (C) 2024 Andrea Cervesato andrea.cervesato@suse.com + */ + +/*\ + * [Description] + * + * This test verifies that rmdir() can't overwrite symlink() generated files. + */ + +#include "tst_test.h" + +static void run(void) +{ + char *symname = "my_symlink0"; + + SAFE_SYMLINK(tst_get_tmpdir(), symname); + TST_EXP_FAIL(rmdir(symname), ENOTDIR); + + SAFE_UNLINK(symname); +} + +static struct tst_test test = { + .test_all = run, + .needs_tmpdir = 1, +};