Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544042 > unrolled thread

[PATCH v2] x86/floppy: use designated initializers

Started byKees Cook <keescook@chromium.org>
First post2016-12-17 22:40 +0100
Last post2016-12-18 09:40 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] x86/floppy: use designated initializers Kees Cook <keescook@chromium.org> - 2016-12-17 22:40 +0100
    Re: [PATCH v2] x86/floppy: use designated initializers Ingo Molnar <mingo@kernel.org> - 2016-12-18 09:10 +0100
      Re: [PATCH v2] x86/floppy: use designated initializers Kees Cook <keescook@chromium.org> - 2016-12-20 18:10 +0100
    [tip:x86/urgent] x86/floppy: Use designated initializers tip-bot for Kees Cook <tipbot@zytor.com> - 2016-12-18 09:40 +0100

#1544042 — [PATCH v2] x86/floppy: use designated initializers

FromKees Cook <keescook@chromium.org>
Date2016-12-17 22:40 +0100
Subject[PATCH v2] x86/floppy: use designated initializers
Message-ID<sPuRY-6Fr-9@gated-at.bofh.it>
Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
v2:
 - aligned rhs of initializer, ingo
---
 arch/x86/include/asm/floppy.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index 1c7eefe32502..202fe3e1fae8 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -229,18 +229,18 @@ static struct fd_routine_l {
 	int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
 } fd_routine[] = {
 	{
-		request_dma,
-		free_dma,
-		get_dma_residue,
-		dma_mem_alloc,
-		hard_dma_setup
+		._request_dma =		request_dma,
+		._free_dma =		free_dma,
+		._get_dma_residue =	get_dma_residue,
+		._dma_mem_alloc =	dma_mem_alloc,
+		._dma_setup =		hard_dma_setup
 	},
 	{
-		vdma_request_dma,
-		vdma_nop,
-		vdma_get_dma_residue,
-		vdma_mem_alloc,
-		vdma_dma_setup
+		._request_dma =		vdma_request_dma,
+		._free_dma =		vdma_nop,
+		._get_dma_residue =	vdma_get_dma_residue,
+		._dma_mem_alloc =	vdma_mem_alloc,
+		._dma_setup =		vdma_dma_setup
 	}
 };
 
-- 
2.7.4


-- 
Kees Cook
Nexus Security

[toc] | [next] | [standalone]


#1544105

FromIngo Molnar <mingo@kernel.org>
Date2016-12-18 09:10 +0100
Message-ID<sPEHE-565-9@gated-at.bofh.it>
In reply to#1544042
* Kees Cook <keescook@chromium.org> wrote:

> Prepare to mark sensitive kernel structures for randomization by making
> sure they're using designated initializers. These were identified during
> allyesconfig builds of x86, arm, and arm64, with most initializer fixes
> extracted from grsecurity.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v2:
>  - aligned rhs of initializer, ingo
> ---
>  arch/x86/include/asm/floppy.h | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
> index 1c7eefe32502..202fe3e1fae8 100644
> --- a/arch/x86/include/asm/floppy.h
> +++ b/arch/x86/include/asm/floppy.h
> @@ -229,18 +229,18 @@ static struct fd_routine_l {
>  	int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
>  } fd_routine[] = {
>  	{
> -		request_dma,
> -		free_dma,
> -		get_dma_residue,
> -		dma_mem_alloc,
> -		hard_dma_setup
> +		._request_dma =		request_dma,
> +		._free_dma =		free_dma,
> +		._get_dma_residue =	get_dma_residue,
> +		._dma_mem_alloc =	dma_mem_alloc,
> +		._dma_setup =		hard_dma_setup
>  	},
>  	{
> -		vdma_request_dma,
> -		vdma_nop,
> -		vdma_get_dma_residue,
> -		vdma_mem_alloc,
> -		vdma_dma_setup
> +		._request_dma =		vdma_request_dma,
> +		._free_dma =		vdma_nop,
> +		._get_dma_residue =	vdma_get_dma_residue,
> +		._dma_mem_alloc =	vdma_mem_alloc,
> +		._dma_setup =		vdma_dma_setup

That's not how we organize named initializers, we do:

		._request_dma		= vdma_request_dma,
		._free_dma		= vdma_nop,
		._get_dma_residue	= vdma_get_dma_residue,
		._dma_mem_alloc		= vdma_mem_alloc,
		._dma_setup		= vdma_dma_setup

I have fixed up the patch.

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1545272

FromKees Cook <keescook@chromium.org>
Date2016-12-20 18:10 +0100
Message-ID<sQw5j-8nS-15@gated-at.bofh.it>
In reply to#1544105
On Sun, Dec 18, 2016 at 12:00 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Kees Cook <keescook@chromium.org> wrote:
>
>> Prepare to mark sensitive kernel structures for randomization by making
>> sure they're using designated initializers. These were identified during
>> allyesconfig builds of x86, arm, and arm64, with most initializer fixes
>> extracted from grsecurity.
>>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>> v2:
>>  - aligned rhs of initializer, ingo
>> ---
>>  arch/x86/include/asm/floppy.h | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
>> index 1c7eefe32502..202fe3e1fae8 100644
>> --- a/arch/x86/include/asm/floppy.h
>> +++ b/arch/x86/include/asm/floppy.h
>> @@ -229,18 +229,18 @@ static struct fd_routine_l {
>>       int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
>>  } fd_routine[] = {
>>       {
>> -             request_dma,
>> -             free_dma,
>> -             get_dma_residue,
>> -             dma_mem_alloc,
>> -             hard_dma_setup
>> +             ._request_dma =         request_dma,
>> +             ._free_dma =            free_dma,
>> +             ._get_dma_residue =     get_dma_residue,
>> +             ._dma_mem_alloc =       dma_mem_alloc,
>> +             ._dma_setup =           hard_dma_setup
>>       },
>>       {
>> -             vdma_request_dma,
>> -             vdma_nop,
>> -             vdma_get_dma_residue,
>> -             vdma_mem_alloc,
>> -             vdma_dma_setup
>> +             ._request_dma =         vdma_request_dma,
>> +             ._free_dma =            vdma_nop,
>> +             ._get_dma_residue =     vdma_get_dma_residue,
>> +             ._dma_mem_alloc =       vdma_mem_alloc,
>> +             ._dma_setup =           vdma_dma_setup
>
> That's not how we organize named initializers, we do:
>
>                 ._request_dma           = vdma_request_dma,
>                 ._free_dma              = vdma_nop,
>                 ._get_dma_residue       = vdma_get_dma_residue,
>                 ._dma_mem_alloc         = vdma_mem_alloc,
>                 ._dma_setup             = vdma_dma_setup
>
> I have fixed up the patch.

Ah-ha, thanks! When I did this patch, I first went looking through the
source but there didn't seem to be a consensus on where to put the
"=". :P Thanks for fixing it up!

-Kees

-- 
Kees Cook
Nexus Security

[toc] | [prev] | [next] | [standalone]


#1544107 — [tip:x86/urgent] x86/floppy: Use designated initializers

Fromtip-bot for Kees Cook <tipbot@zytor.com>
Date2016-12-18 09:40 +0100
Subject[tip:x86/urgent] x86/floppy: Use designated initializers
Message-ID<sPFaG-5gM-13@gated-at.bofh.it>
In reply to#1544042
Commit-ID:  ffc7dc8d838c6403a550021e4f28a737334d80a7
Gitweb:     http://git.kernel.org/tip/ffc7dc8d838c6403a550021e4f28a737334d80a7
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Sat, 17 Dec 2016 13:37:05 -0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 18 Dec 2016 09:25:38 +0100

x86/floppy: Use designated initializers

Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161217213705.GA1248@beast
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/floppy.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index 1c7eefe..7ec59ed 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -229,18 +229,18 @@ static struct fd_routine_l {
 	int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
 } fd_routine[] = {
 	{
-		request_dma,
-		free_dma,
-		get_dma_residue,
-		dma_mem_alloc,
-		hard_dma_setup
+		._request_dma		= request_dma,
+		._free_dma		= free_dma,
+		._get_dma_residue	= get_dma_residue,
+		._dma_mem_alloc		= dma_mem_alloc,
+		._dma_setup		= hard_dma_setup
 	},
 	{
-		vdma_request_dma,
-		vdma_nop,
-		vdma_get_dma_residue,
-		vdma_mem_alloc,
-		vdma_dma_setup
+		._request_dma		= vdma_request_dma,
+		._free_dma		= vdma_nop,
+		._get_dma_residue	= vdma_get_dma_residue,
+		._dma_mem_alloc		= vdma_mem_alloc,
+		._dma_setup		= vdma_dma_setup
 	}
 };
 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web