public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Christian Brauner <brauner@kernel•org>,
	Al Viro <viro@zeniv•linux.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>
Subject: linux-next: manual merge of the vfs-brauner tree with the vfs-fixes tree
Date: Wed, 7 Aug 2024 10:04:33 +1000	[thread overview]
Message-ID: <20240807100433.16e92156@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 2938 bytes --]

Hi all,

Today's linux-next merge of the vfs-brauner tree got a conflict in:

  tools/testing/selftests/core/close_range_test.c

between commit:

  9a2fa1472083 ("fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE")

from the vfs-fixes tree and commit:

  b7fcee976159 ("selftests: add F_CREATED_QUERY tests")

from the vfs-brauner tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/core/close_range_test.c
index 12b4eb9d0434,3e829666281d..000000000000
--- a/tools/testing/selftests/core/close_range_test.c
+++ b/tools/testing/selftests/core/close_range_test.c
@@@ -589,39 -593,39 +593,74 @@@ TEST(close_range_cloexec_unshare_syzbot
  	EXPECT_EQ(close(fd3), 0);
  }
  
 +TEST(close_range_bitmap_corruption)
 +{
 +	pid_t pid;
 +	int status;
 +	struct __clone_args args = {
 +		.flags = CLONE_FILES,
 +		.exit_signal = SIGCHLD,
 +	};
 +
 +	/* get the first 128 descriptors open */
 +	for (int i = 2; i < 128; i++)
 +		EXPECT_GE(dup2(0, i), 0);
 +
 +	/* get descriptor table shared */
 +	pid = sys_clone3(&args, sizeof(args));
 +	ASSERT_GE(pid, 0);
 +
 +	if (pid == 0) {
 +		/* unshare and truncate descriptor table down to 64 */
 +		if (sys_close_range(64, ~0U, CLOSE_RANGE_UNSHARE))
 +			exit(EXIT_FAILURE);
 +
 +		ASSERT_EQ(fcntl(64, F_GETFD), -1);
 +		/* ... and verify that the range 64..127 is not
 +		   stuck "fully used" according to secondary bitmap */
 +		EXPECT_EQ(dup(0), 64)
 +			exit(EXIT_FAILURE);
 +		exit(EXIT_SUCCESS);
 +	}
 +
 +	EXPECT_EQ(waitpid(pid, &status, 0), pid);
 +	EXPECT_EQ(true, WIFEXITED(status));
 +	EXPECT_EQ(0, WEXITSTATUS(status));
 +}
 +
+ TEST(fcntl_created)
+ {
+ 	for (int i = 0; i < 101; i++) {
+ 		int fd;
+ 		char path[PATH_MAX];
+ 
+ 		fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
+ 		ASSERT_GE(fd, 0) {
+ 			if (errno == ENOENT)
+ 				SKIP(return,
+ 					   "Skipping test since /dev/null does not exist");
+ 		}
+ 
+ 		/* We didn't create "/dev/null". */
+ 		EXPECT_EQ(fcntl(fd, F_CREATED_QUERY, 0), 0);
+ 		close(fd);
+ 
+ 		sprintf(path, "aaaa_%d", i);
+ 		fd = open(path, O_CREAT | O_RDONLY | O_CLOEXEC, 0600);
+ 		ASSERT_GE(fd, 0);
+ 
+ 		/* We created "aaaa_%d". */
+ 		EXPECT_EQ(fcntl(fd, F_CREATED_QUERY, 0), 1);
+ 		close(fd);
+ 
+ 		fd = open(path, O_RDONLY | O_CLOEXEC);
+ 		ASSERT_GE(fd, 0);
+ 
+ 		/* We're opening it again, so no positive creation check. */
+ 		EXPECT_EQ(fcntl(fd, F_CREATED_QUERY, 0), 0);
+ 		close(fd);
+ 		unlink(path);
+ 	}
+ }
+ 
  TEST_HARNESS_MAIN

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2024-08-07  0:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07  0:04 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-02-17 13:39 linux-next: manual merge of the vfs-brauner tree with the vfs-fixes tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240807100433.16e92156@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=brauner@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=viro@zeniv$(echo .)linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox