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: <67e1b2fe98de0_35010c2946f@willemb.c.googlers.com.notmuch>
Date: Mon, 24 Mar 2025 15:31:10 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>, 
 willemdebruijn.kernel@...il.com
Cc: davem@...emloft.net, 
 dsahern@...nel.org, 
 edumazet@...gle.com, 
 horms@...nel.org, 
 kuba@...nel.org, 
 kuni1840@...il.com, 
 kuniyu@...zon.com, 
 netdev@...r.kernel.org, 
 pabeni@...hat.com
Subject: Re: [PATCH v1 net 3/3] selftest: net: Check wraparounds for
 sk->sk_rmem_alloc.

Kuniyuki Iwashima wrote:
> From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
> Date: Mon, 24 Mar 2025 11:58:06 -0400
> > > +TEST_F(so_rcvbuf, rmem_max)
> > > +{
> > > +	char buf[16] = {};
> > > +	int ret, i;
> > > +
> > > +	create_socketpair(_metadata, self, variant);
> > > +
> > > +	ret = setsockopt(self->server, SOL_SOCKET, SO_RCVBUFFORCE,
> > > +			 &(int){INT_MAX}, sizeof(int));
> > > +	ASSERT_EQ(ret, 0);
> > > +
> > > +	ASSERT_EQ(get_prot_pages(_metadata, variant), 0);
> > > +
> > > +	for (i = 1; ; i++) {
> > > +		ret = send(self->client, buf, sizeof(buf), 0);
> > > +		ASSERT_EQ(ret, sizeof(buf));
> > > +
> > > +		if (i % 10000 == 0) {
> > > +			int pages = get_prot_pages(_metadata, variant);
> > > +
> > > +			/* sk_rmem_alloc wrapped around too much ? */
> > > +			ASSERT_LE(pages, *variant->max_pages);
> > > +
> > > +			if (pages == *variant->max_pages)
> > > +				break;
> > 
> > Does correctness depend here on max_pages being a multiple of 10K?
> 
> 10K may be too conservative, but at least we need to ensure
> that the size of accumulated skbs exceeds 1 PAGE_SIZE to
> fail on the ASSERT_LE(), otherwise we can't detect the multiple
> wraparounds even without patch 1.

Thanks. It took me some time to understand. Without overflow,
the pages counter will saturate at max_pages as the queue fills up.
 
> The later sleep for call_rcu() was dominant than this loop on
> my machine.

Ack.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ