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]
Date:	Wed, 11 Apr 2012 23:32:21 +0300
From:	"Rémi Denis-Courmont" <remi@...lab.net>
To:	Mauro Carvalho Chehab <mchehab@...hat.com>
Cc:	mchehab@...radead.org, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org, Alan Cox <alan@...rguk.ukuu.org.uk>,
	Hans Verkuil <hverkuil@...all.nl>
Subject: Re: [RFC] [PATCH] v4l2: use unsigned rather than enums in ioctl() structs

Le mercredi 11 avril 2012 22:53:23 Mauro Carvalho Chehab, vous avez écrit :
> > But you have been royally ignoring that rule when it
> > comes to extending existing enumerations:
> The existing enumerations can be extended, by adding new values for unused
> values, otherwise API functionality can't be extended.

Yes. That's why they should be some unsigned type.

> Yet, except
> for a gcc bug (or weird optimize option), I fail to see why this would
> break the ABI.

>From the perspective of the compiler, this is a feature not a bug. In C and 
C++, loading or storing a value in an enumerated variable whereby the value is 
not a member of the enumeration is undefined. In other words, the compiler can 
assume that this does not happen, and optimize it away.

> If this is all about some gcc optimization with newer gcc versions, then
> maybe the solution may be to add some pragmas at the code to disable such
> optimization when compiling the structs with enum's at videodev2.h.

Maybe the Linux kernel could be specifically compiled to prevent GCC from 
range-optimizing enumerations. But as -fno-jump-table only disables one of 
several potential range optimizations, I doubt this is even possible.

Regardless, you cannot require all of Linux userspace to rely on an hypothetic 
non-standard GNU C extension. Thus extending enums remains a silent userspace 
ABI break in any case.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ