From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793826585; b=LE6bE0c+8HKUzXtGnBS71EWKoWtx0kjAAIXUe/Uy1o6LpVKXg+c4zRQnheiR5jkgZPtG J2vj2eI+q+/QSGB0T8bpVWFyuQSAxc+fq1kMSJDYdtRVt9yl7nIyZxJ9B9IIfoT9HrBlJ XSrLWNcMqEuVncGC4ByoPvil5HIMXk38kQuzD36oabIrFJQvehpeF2LOjeZu+36QjZOW3 jjMGzS69kFQP6LaqlUyGt57wN7l1ZMs/w3Z6iFT738FbRvS+8x7XWmEPTBZnRWeHct/VD EWx4f9FN1JIkwQnUgPVI/K5954qXqhrUnwd3mBePnboP7I0OYzm81wn1DPHq7eZ330Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793826585; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=iDRVFy6I1yy3Vo/9vdN843HKbuRZWWjAxcnOm4/lGYs=; b=Ki0K+IEOoeY+2znu7z9CltyN7lFCZ62dhHWcJdVOTJBceXozkGbs6wNA2orsB5urNAiG aqf89G/MLCOdIrGRhmRfEtJ1+oBZEk6xEI0n+6gMUAjYuytLcoCXci0ZNq24K2tigeq61 Y/yse+S02MJtCX/DDfOhg9pteG/8+dEGdHZwiiC7zrvqETaoaiZZp5iKWkjmdojHY+1Z1 xMUECVS7SaAcGgcSvzO44nqgr1kiqKDZDjCrLy/wRdGquq/HFNyA1M90DanSadvB3Is+p lf95ocWsBTQylLOPo1O7zIH19K5ao3UKfUZBA+JAWGZ5QQNJHw9GdgFK1/NDIwGpzMQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YN0v5xCT; arc=none smtp.remote-ip=209.85.128.49 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 559B3607B9E0 for ; Wed, 4 Nov 2026 21:09:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 559B3607B9E0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YN0v5xCT Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-49d05d51553so7486995e9.2 for ; Wed, 04 Nov 2026 13:09:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793826584; x=1794431384; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iDRVFy6I1yy3Vo/9vdN843HKbuRZWWjAxcnOm4/lGYs=; b=YN0v5xCTD9eqYjRDrox9B7A61G1+SFMIUYQay/ymlVUEBzD+kVNRzZ7FlEgvOJVqyW Xy82e6XV0cd+AV6K5WT238vjhOrRtDiq6vPygR4889jEbICVmf1w1bDKHwPfTLME7Quj BwhZqF0rAVrNbnHOFyAL9cOwIXM40H6qOtSOWsB5yjPWJYQIZeomuTgT130NUsQuwbu2 Pbqs8VQqOKBQEd/H4ynbiTvnPlphdVumQpxeCPSLMskleBloYrVLj48dpS9euGOu4d6R GDgF81LTbZo2O+Y+nKqU1HWH3B/V38lsGwkJy4NxGq3Z3VSbu7u3sc2JVPsHahRzoFZS G/iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793826584; x=1794431384; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=iDRVFy6I1yy3Vo/9vdN843HKbuRZWWjAxcnOm4/lGYs=; b=nhTSc77zi8JpKtH58hEEFkzXbZNXpVcomLQU46K4ERIimM+OblahIkMi/NKzCCw5Jj NUhmP9xDGLA3D3mpbX3kRl2pI1fuaoA3CsxQe8BPcE4xpWEzPwsHUGVxOeGRnrX7NHAd HM14+mssuP23YXvCICmigQLr3hQKXr0K9y2NGxgiZSy48QzVr6rfaEP7cLoYVIFyBRik eI1ZAdVn3VqXe6GvuLMAC75M2fPrMi60G2No+2FVN8X4yp79fPyJNzfG9xtDGBFEzHPE psgd4+GxwZrh6In87ErL5tvjfYlFzhsv21A48WElebbfpjU9ZfnH2iPZQid6Of58nCdg mIzg== X-Forwarded-Encrypted: i=1; AKwUvBzVsbMtiXZ8H+GRyHZxcw3bz2NAuDQtxbwTA4oSPgwtmTLQIjN/fn0x+YIqEU9B7fENd5embwGRH/w1uCk=@vger.kernel.org X-Gm-Message-State: APuU4Z+IFSXoT0XXKe/5Em+33wrRZVvyXF1cgTgvKoHHNvLDEydUaCx5 dARxxhKAvwaNJwSoB40VcPCqOHwIB2fApmj2lgHTzVlSED9IYJ0QPwWf X-Gm-Gg: AYBFou0ve+GF6X9yfeBSb+zXimfApOWIPS+z7xfaUBhaEAEhtpFPwiSvSbdlLqVo5Xo rI6x0uAw1RTqPUaiI3yUnHnzrH8zVKaxKOEguXjjU83FQsS8wPLH7ti0NmIksZxpioBvnzbG2Vh dOOTH1rtSTH8DY5eG4uqHYwd7rGt1Bz5ysxhsBgKZaL++nBAeIhVyVzmJ5SzCQiilCmsqRr3ml0 K5OAfgbJA61ri+J7IJtVxIm203JsuLHeiRENeOHaxrS+ZOStouo6ZzmOW4NWaO3iu03sCJ2Xuhs dDTsvKfqHl6/0wtCNNlRuv56ht95NGq38Zmqe4SY23gfuXYc+hF85p6ftKQw8Jl15EcO9B+mH1t Vd7nVpGfcViAu7iQLGz9ix+ALqxodctxDZMivPJ8V6DwCzHIaM9Ts2G5udnTL44vqXcW6RssEMk JS7NcTui1gsQJH2b3HWaHbqWMFg9b36j4xMIygJZrQak8bF5cpUhM8fZheIbHtYg2XxUKNuP8SJ du9wBQ65orOTmyMsifmLQVW5eECBcEISkgLPmsJ1QOB5bgv7Tev+2JM4cLTBMT+1YebqAqkE7uX GnbkytulphO3PJtFAiMDyf1YDkq1f1as2NjRF7Q1wL+PS1727vPJTjiU4IUmkqBYyItKDDq6lRA = X-Received: by 2002:a05:600c:4e50:b0:4a1:7d9b:d4ae with SMTP id 5b1f17b1804b1-4ac16fa3523mr400681945e9.5.1793826583655; Wed, 04 Nov 2026 13:09:43 -0800 (PST) Received: from localhost (ip87-106-108-193.pbiaas.com. [87.106.108.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4b4532916f2sm84724225e9.5.2026.11.04.13.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 13:09:43 -0800 (PST) From: =?utf-8?q?G=C3=BCnther_Noack?= Date: Wed, 04 Nov 2026 22:09:08 +0100 Subject: [PATCH v2 22/27] selftests/landlock: Fix messages and comments in helper programs X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261104-selftests-refactor-v2-22-c52f23f7ce33@gmail.com> References: <20261104-selftests-refactor-v2-0-c52f23f7ce33@gmail.com> In-Reply-To: <20261104-selftests-refactor-v2-0-c52f23f7ce33@gmail.com> To: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , =?utf-8?q?G=C3=BCnther_Noack?= , Shuah Khan Cc: linux-security-module@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?G=C3=BCnther_Noack?= X-Mailer: b4 0.15.2 * sandbox-and-launch: Describe the actual argument order. * sandbox-and-launch, wait-pipe, wait-pipe-sandbox: Report failed read(2) calls as read failures, not write failures. * wait-pipe-sandbox: Terminate error messages with a newline, and fix comments naming "." instead of the opened "/". Signed-off-by: Günther Noack --- tools/testing/selftests/landlock/sandbox-and-launch.c | 6 +++--- tools/testing/selftests/landlock/wait-pipe-sandbox.c | 16 ++++++++-------- tools/testing/selftests/landlock/wait-pipe.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/landlock/sandbox-and-launch.c b/tools/testing/selftests/landlock/sandbox-and-launch.c index 3e32e1a51ac5..8b33ddadc63e 100644 --- a/tools/testing/selftests/landlock/sandbox-and-launch.c +++ b/tools/testing/selftests/landlock/sandbox-and-launch.c @@ -25,8 +25,8 @@ int main(int argc, char *argv[]) char buf; /* - * The first argument must be the file descriptor number of a pipe. - * The second argument must be the program to execute. + * The first argument must be the program to execute. The second and + * third arguments must be the file descriptor numbers of two pipes. */ if (argc != 4) { fprintf(stderr, "Wrong number of arguments (not three)\n"); @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) /* Waits for the parent to try to umount. */ if (read(pipe_parent, &buf, 1) != 1) { - perror("Failed to write to the third argument"); + perror("Failed to read from the third argument"); return 1; } diff --git a/tools/testing/selftests/landlock/wait-pipe-sandbox.c b/tools/testing/selftests/landlock/wait-pipe-sandbox.c index 87dbc9164430..dbc0c2747e9f 100644 --- a/tools/testing/selftests/landlock/wait-pipe-sandbox.c +++ b/tools/testing/selftests/landlock/wait-pipe-sandbox.c @@ -31,7 +31,7 @@ static int sync_with(int pipe_child, int pipe_parent) /* Waits for the parent do its test. */ if (read(pipe_parent, &buf, 1) != 1) { - perror("Failed to write to the second argument"); + perror("Failed to read from the second argument"); return 1; } @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) /* Tries to send a signal, denied by layer1. */ if (!kill(getppid(), 0)) { - fprintf(stderr, "Successfully sent a signal to the parent"); + fprintf(stderr, "Successfully sent a signal to the parent\n"); return 1; } @@ -88,13 +88,13 @@ int main(int argc, char *argv[]) /* Tries to send a signal, denied by layer1. */ if (!kill(getppid(), 0)) { - fprintf(stderr, "Successfully sent a signal to the parent"); + fprintf(stderr, "Successfully sent a signal to the parent\n"); return 1; } - /* Tries to open ., denied by layer2. */ + /* Tries to open /, denied by layer2. */ if (open("/", O_RDONLY | O_DIRECTORY | O_CLOEXEC) >= 0) { - fprintf(stderr, "Successfully opened /"); + fprintf(stderr, "Successfully opened /\n"); return 1; } @@ -115,15 +115,15 @@ int main(int argc, char *argv[]) } close(ruleset_fd); - /* Tries to open ., denied by layer2. */ + /* Tries to open /, denied by layer2. */ if (open("/", O_RDONLY | O_DIRECTORY | O_CLOEXEC) >= 0) { - fprintf(stderr, "Successfully opened /"); + fprintf(stderr, "Successfully opened /\n"); return 1; } /* Tries to send a signal, denied by layer3. */ if (!kill(getppid(), 0)) { - fprintf(stderr, "Successfully sent a signal to the parent"); + fprintf(stderr, "Successfully sent a signal to the parent\n"); return 1; } diff --git a/tools/testing/selftests/landlock/wait-pipe.c b/tools/testing/selftests/landlock/wait-pipe.c index 0dbcd260a0fa..3cfa4dce5f35 100644 --- a/tools/testing/selftests/landlock/wait-pipe.c +++ b/tools/testing/selftests/landlock/wait-pipe.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) /* Waits for the parent do its test. */ if (read(pipe_parent, &buf, 1) != 1) { - perror("Failed to write to the second argument"); + perror("Failed to read from the second argument"); return 1; } -- 2.56.0