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: <d729234f-1565-4513-9ccb-93e78c82647c@kernel.org>
Date: Wed, 24 Jan 2024 07:53:13 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: David Laight <David.Laight@...LAB.COM>,
 'Chris Down' <chris@...isdown.name>, "H. Peter Anvin" <hpa@...or.com>
Cc: Peter Zijlstra <peterz@...radead.org>, David Howells
 <dhowells@...hat.com>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "pinskia@...il.com" <pinskia@...il.com>
Subject: Re: RE: [PATCH 00/45] C++: Convert the kernel to C++

On 11. 01. 24, 20:40, David Laight wrote:
> I've seen the same issue with some C++ code that was like:
> (Pardon my C++ :-)
> 	foo = new();
> 	try {
> 		add_foo_to_list(foo);



> 	} except {
> 		free(foo);
> 	}
> The problem is that you have no idea whether the exception was
> thrown before or after 'foo' was saved.
> Since pretty much everything can 'throw' you really can't tell.

I don't follow, you can catch() specific (e.g. ENotAdded) exceptions.

> OTOH if add_foo_to_list() returns an error code you can know
> (and check) that zero is returned iff the pointer has been saved.

There is no difference between throwing exceptions (you can as well 
embed an error code in a generic exception, if you want) and throwing 
error numbers directly.

A different question is whether we want exceptions (RTTI) in the kernel 
at all. Not sure about gcc, but for example LLVM does not.

regards,
-- 
js
suse labs


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ