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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CO1PR11MB5089A56FD7E08E9673021D23D67F2@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Wed, 9 Oct 2024 20:52:06 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: "Kitszel, Przemyslaw" <przemyslaw.kitszel@...el.com>, Vladimir Oltean
	<vladimir.oltean@....com>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>
Subject: RE: [PATCH net-next] lib: packing: catch kunit_kzalloc() failure in
 the pack() test



> -----Original Message-----
> From: Kitszel, Przemyslaw <przemyslaw.kitszel@...el.com>
> Sent: Wednesday, October 9, 2024 3:21 AM
> To: Keller, Jacob E <jacob.e.keller@...el.com>; Vladimir Oltean
> <vladimir.oltean@....com>
> Cc: David S. Miller <davem@...emloft.net>; Eric Dumazet
> <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni
> <pabeni@...hat.com>; linux-kernel@...r.kernel.org; netdev@...r.kernel.org
> Subject: Re: [PATCH net-next] lib: packing: catch kunit_kzalloc() failure in the pack()
> test
> 
> On 10/4/24 21:20, Keller, Jacob E wrote:
> >
> >
> >> -----Original Message-----
> >> From: Vladimir Oltean <vladimir.oltean@....com>
> >> Sent: Friday, October 4, 2024 4:00 AM
> >> To: netdev@...r.kernel.org
> >> Cc: David S. Miller <davem@...emloft.net>; Eric Dumazet
> >> <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni
> >> <pabeni@...hat.com>; Keller, Jacob E <jacob.e.keller@...el.com>; Kitszel,
> >> Przemyslaw <przemyslaw.kitszel@...el.com>; linux-kernel@...r.kernel.org
> >> Subject: [PATCH net-next] lib: packing: catch kunit_kzalloc() failure in the pack()
> >> test
> >>
> >> kunit_kzalloc() may fail. Other call sites verify that this is the case,
> >> either using a direct comparison with the NULL pointer, or the
> >> KUNIT_ASSERT_NOT_NULL() or KUNIT_ASSERT_NOT_ERR_OR_NULL().
> >>
> >> Pick KUNIT_ASSERT_NOT_NULL() as the error handling method that made most
> >> sense to me. It's an unlikely thing to happen, but at least we call
> >> __kunit_abort() instead of dereferencing this NULL pointer.
> >>
> >> Fixes: e9502ea6db8a ("lib: packing: add KUnit tests adapted from selftests")
> >> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> >> ---
> >>   lib/packing_test.c | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/lib/packing_test.c b/lib/packing_test.c
> >> index 015ad1180d23..b38ea43c03fd 100644
> >> --- a/lib/packing_test.c
> >> +++ b/lib/packing_test.c
> >> @@ -375,6 +375,7 @@ static void packing_test_pack(struct kunit *test)
> >>   	int err;
> >>
> >>   	pbuf = kunit_kzalloc(test, params->pbuf_size, GFP_KERNEL);
> >> +	KUNIT_ASSERT_NOT_NULL(test, pbuf);
> >>
> >>   	err = pack(pbuf, params->uval, params->start_bit, params->end_bit,
> >>   		   params->pbuf_size, params->quirks);
> >> --
> >> 2.43.0
> >
> > Oh good catch! I guess I had assumed that kunit_kzalloc would itself detect and
> fail instead of continuing....
> 
> that would be great
> 
> kunit_*alloc gives kunit-managed resources though

Yep, just a misunderstanding on my part 😊

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ