Re: [PATCH] drm/ttm: use designated initializers

From: Kees Cook
Date: Tue Dec 20 2016 - 14:56:54 EST


On Sun, Dec 18, 2016 at 10:53 PM, Alexander Stein
<alexander.stein@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Hello Kees,
>
> While understanding what your patches (I've seen the other ones as well) do
> themself, I still don't get what your intention is, e.g. why you need this?
> Apart from a better readability.
>
> On Friday 16 December 2016 16:59:29, Kees Cook wrote:
>> Prepare to mark sensitive kernel structures for randomization by making
>> sure they're using designated initializers.
>
> Can you please elaborate what you mean with that sentence?

Hi! Sure: the coming (and optional) gcc plugin "randstruct" performs
structure layout randomization, which means that static initializers
cannot be "ordered" (they must be "designated"), since the place were
layout randomization occurs happens separate from how static
initializers are applied.

This change from ordered to designated is just to help the compiler do
the right thing.

-Kees

--
Kees Cook
Nexus Security