lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b01d1d06-9d7c-4081-b3e3-c2c0fea06fad@sirena.org.uk>
Date: Mon, 14 Jul 2025 14:28:50 +0100
From: Mark Brown <broonie@...nel.org>
To: wang lian <lianux.mm@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	David Hildenbrand <david@...hat.com>, SeongJae Park <sj@...nel.org>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
	Zi Yan <ziy@...dia.com>, linux-kernel@...r.kernel.org,
	Christian Brauner <brauner@...nel.org>,
	Jann Horn <jannh@...gle.com>,
	Liam Howlett <Liam.Howlett@...cle.com>,
	Shuah Khan <shuah@...nel.org>, Vlastimil Babka <vbabka@...e.cz>,
	gkwang <gkwang@...x-info.com>, p1ucky0923 <p1ucky0923@...il.com>,
	ryncsn <ryncsn@...il.com>,
	"zijing . zhang" <zijing.zhang@...ton.me>,
	linux-kselftest@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v5] selftests/mm: add process_madvise() tests

On Mon, Jul 14, 2025 at 08:25:33PM +0800, wang lian wrote:

> +TEST_F(process_madvise, remote_collapse)
> +{

> +	self->child_pid = fork();
> +	ASSERT_NE(self->child_pid, -1);

> +	ret = read(pipe_info[0], &info, sizeof(info));
> +	if (ret <= 0) {
> +		waitpid(self->child_pid, NULL, 0);
> +		SKIP(return, "Failed to read child info from pipe.\n");
> +	}
> +	ASSERT_EQ(ret, sizeof(info));

> +cleanup:
> +	/* Cleanup */
> +	kill(self->child_pid, SIGKILL);
> +	waitpid(self->child_pid, NULL, 0);
> +	if (pidfd >= 0)
> +		close(pidfd);

The cleanup here won't get run if we skip or assert, skipping will
return immediately (you could replace the return with a 'goto cleanup')
and the asserts will exit the test immediately.  This will mean we leak
the child.  This isn't an issue for things that are memory mapped or
tracked with file descriptors, the harness will for a new child for each
test so anything that's cleaned up with the process will be handled, but
that doesn't apply to child processes.

I think doing the child setup in a fixture should DTRT but I haven't
gone through in full detail to verify that this is the case.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ