Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 27 Mar 2018 12:00:55 +0000
From: "Uecker, Martin" <Martin.Uecker@....uni-goettingen.de>
To: "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
	"keescook@...omium.org" <keescook@...omium.org>
CC: "mingo@...nel.org" <mingo@...nel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "rdunlap@...radead.org"
	<rdunlap@...radead.org>, "abbotti@....co.uk" <abbotti@....co.uk>,
	"linux@...musvillemoes.dk" <linux@...musvillemoes.dk>,
	"miguel.ojeda.sandonis@...il.com" <miguel.ojeda.sandonis@...il.com>,
	"jpoimboe@...hat.com" <jpoimboe@...hat.com>, "akpm@...ux-foundation.org"
	<akpm@...ux-foundation.org>, "kernel-hardening@...ts.openwall.com"
	<kernel-hardening@...ts.openwall.com>, "David.Laight@...lab.com"
	<David.Laight@...lab.com>
Subject: Re: [PATCH v6] kernel.h: Retain constant expression output for
 max()/min()


To give credit where credit is due, this hack was inspired by 
an equally insane (but different) use of the ?: operator to choose 
the right return type for type-generic macros in tgmath.h.

https://sourceware.org/git/?p=glibc.git;a=blob;f=math/tgmath.h;h=a709a5
9d0fa1168ef03349561169fc5bd27d65aa;hb=d8742dd82f6a00601155c69bad3012e90
5591e1f

(recommendation: don't look)

Martin


Am Montag, den 26.03.2018, 14:52 -1000 schrieb Linus Torvalds:
> On Mon, Mar 26, 2018 at 12:15 PM, Kees Cook <keescook@...omium.org>
> wrote:
> > 
> > This patch updates the min()/max() macros to evaluate to a constant
> > expression when called on constant expression arguments.
> 
> Ack.
> 
> I'm of two minds whether that "__is_constant()" macro should be
> explained or not.
> 
> A small voice in my head says "that wants a comment".
> 
> But a bigger voice disagrees.
> 
> It is a work of art, and maybe the best documentation is just the
> name. It does what it says it does.
> 
> Art shouldn't be explained. It should be appreciated.
> 
> Nobody sane really should care about how it works, and if somebody
> cares it is "left as an exercise to the reader".
> 
>       Linus

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.