All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/EFI: properly init-annotate BGRT code
@ 2012-11-23 16:30 Jan Beulich
  2013-01-24 20:34 ` [tip:x86/debug] x86/EFI: Properly " tip-bot for Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2012-11-23 16:30 UTC (permalink / raw)
  To: mjg; +Cc: mingo, tglx, linux-kernel, hpa

These items are only ever referenced from initialization code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

---
 arch/x86/platform/efi/efi-bgrt.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- 3.7-rc6/arch/x86/platform/efi/efi-bgrt.c
+++ 3.7-rc6-x86-BGRT-init/arch/x86/platform/efi/efi-bgrt.c
@@ -11,20 +11,21 @@
  * published by the Free Software Foundation.
  */
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/efi.h>
 #include <linux/efi-bgrt.h>
 
 struct acpi_table_bgrt *bgrt_tab;
-void *bgrt_image;
-size_t bgrt_image_size;
+void *__initdata bgrt_image;
+size_t __initdata bgrt_image_size;
 
 struct bmp_header {
 	u16 id;
 	u32 size;
 } __packed;
 
-void efi_bgrt_init(void)
+void __init efi_bgrt_init(void)
 {
 	acpi_status status;
 	void __iomem *image;




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip:x86/debug] x86/EFI: Properly init-annotate BGRT code
  2012-11-23 16:30 [PATCH] x86/EFI: properly init-annotate BGRT code Jan Beulich
@ 2013-01-24 20:34 ` tip-bot for Jan Beulich
  2013-01-24 22:28   ` Josh Triplett
  0 siblings, 1 reply; 7+ messages in thread
From: tip-bot for Jan Beulich @ 2013-01-24 20:34 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, mjg, hpa, mingo, jbeulich, JBeulich, tglx

Commit-ID:  13f0e4d2b9e2209f13d5a4122478eb79e6136870
Gitweb:     http://git.kernel.org/tip/13f0e4d2b9e2209f13d5a4122478eb79e6136870
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Fri, 23 Nov 2012 16:30:07 +0000
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 24 Jan 2013 17:12:18 +0100

x86/EFI: Properly init-annotate BGRT code

These items are only ever referenced from initialization code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: <mjg@redhat.com>
Link: http://lkml.kernel.org/r/50AFB29F02000078000AAE8E@nat28.tlf.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/platform/efi/efi-bgrt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index d9c1b95..7145ec6 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -11,20 +11,21 @@
  * published by the Free Software Foundation.
  */
 #include <linux/kernel.h>
+#include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/efi.h>
 #include <linux/efi-bgrt.h>
 
 struct acpi_table_bgrt *bgrt_tab;
-void *bgrt_image;
-size_t bgrt_image_size;
+void *__initdata bgrt_image;
+size_t __initdata bgrt_image_size;
 
 struct bmp_header {
 	u16 id;
 	u32 size;
 } __packed;
 
-void efi_bgrt_init(void)
+void __init efi_bgrt_init(void)
 {
 	acpi_status status;
 	void __iomem *image;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [tip:x86/debug] x86/EFI: Properly init-annotate BGRT code
  2013-01-24 20:34 ` [tip:x86/debug] x86/EFI: Properly " tip-bot for Jan Beulich
@ 2013-01-24 22:28   ` Josh Triplett
  2013-01-25  7:45     ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Josh Triplett @ 2013-01-24 22:28 UTC (permalink / raw)
  To: mingo, hpa, mjg, linux-kernel, JBeulich, tglx

On Thu, Jan 24, 2013 at 12:34:21PM -0800, tip-bot for Jan Beulich wrote:
> Commit-ID:  13f0e4d2b9e2209f13d5a4122478eb79e6136870
> Gitweb:     http://git.kernel.org/tip/13f0e4d2b9e2209f13d5a4122478eb79e6136870
> Author:     Jan Beulich <JBeulich@suse.com>
> AuthorDate: Fri, 23 Nov 2012 16:30:07 +0000
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Thu, 24 Jan 2013 17:12:18 +0100
> 
> x86/EFI: Properly init-annotate BGRT code
> 
> These items are only ever referenced from initialization code.

Not true, and this patch will break the BGRT code.  bgrt_init, which
does indeed have an __init annotation, stores bgrt_image and
bgrt_image_size into the .private and .size fields of a sysfs
bin_attribute, which does *not* have an __initdata annotation, and which
will get read whenever the user reads the corresponding sysfs attribute.

> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Cc: <mjg@redhat.com>
> Link: http://lkml.kernel.org/r/50AFB29F02000078000AAE8E@nat28.tlf.novell.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>  arch/x86/platform/efi/efi-bgrt.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> index d9c1b95..7145ec6 100644
> --- a/arch/x86/platform/efi/efi-bgrt.c
> +++ b/arch/x86/platform/efi/efi-bgrt.c
> @@ -11,20 +11,21 @@
>   * published by the Free Software Foundation.
>   */
>  #include <linux/kernel.h>
> +#include <linux/init.h>
>  #include <linux/acpi.h>
>  #include <linux/efi.h>
>  #include <linux/efi-bgrt.h>
>  
>  struct acpi_table_bgrt *bgrt_tab;
> -void *bgrt_image;
> -size_t bgrt_image_size;
> +void *__initdata bgrt_image;
> +size_t __initdata bgrt_image_size;
>  
>  struct bmp_header {
>  	u16 id;
>  	u32 size;
>  } __packed;
>  
> -void efi_bgrt_init(void)
> +void __init efi_bgrt_init(void)
>  {
>  	acpi_status status;
>  	void __iomem *image;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/debug] x86/EFI: Properly init-annotate BGRT code
  2013-01-24 22:28   ` Josh Triplett
@ 2013-01-25  7:45     ` Jan Beulich
  2013-01-25 16:03       ` Josh Triplett
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2013-01-25  7:45 UTC (permalink / raw)
  To: Josh Triplett; +Cc: mingo, tglx, mjg, linux-kernel, hpa

>>> On 24.01.13 at 23:28, Josh Triplett <josh@joshtriplett.org> wrote:
> On Thu, Jan 24, 2013 at 12:34:21PM -0800, tip-bot for Jan Beulich wrote:
>> Commit-ID:  13f0e4d2b9e2209f13d5a4122478eb79e6136870
>> Gitweb:     
> http://git.kernel.org/tip/13f0e4d2b9e2209f13d5a4122478eb79e6136870 
>> Author:     Jan Beulich <JBeulich@suse.com>
>> AuthorDate: Fri, 23 Nov 2012 16:30:07 +0000
>> Committer:  Ingo Molnar <mingo@kernel.org>
>> CommitDate: Thu, 24 Jan 2013 17:12:18 +0100
>> 
>> x86/EFI: Properly init-annotate BGRT code
>> 
>> These items are only ever referenced from initialization code.
> 
> Not true, and this patch will break the BGRT code.  bgrt_init, which
> does indeed have an __init annotation, stores bgrt_image and
> bgrt_image_size into the .private and .size fields of a sysfs
> bin_attribute, which does *not* have an __initdata annotation, and which
> will get read whenever the user reads the corresponding sysfs attribute.

Copying init-only data into a sysfs structure is no problem at all
- that structure obviously is non-__initdata and hence can be
read at any time. It was a different thing if .private and/or .size
stored _pointers_ to one of the two variables in question.

Jan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/debug] x86/EFI: Properly init-annotate BGRT code
  2013-01-25  7:45     ` Jan Beulich
@ 2013-01-25 16:03       ` Josh Triplett
  2013-01-25 18:36         ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Josh Triplett @ 2013-01-25 16:03 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, tglx, mjg, linux-kernel, hpa

On Fri, Jan 25, 2013 at 07:45:42AM +0000, Jan Beulich wrote:
> >>> On 24.01.13 at 23:28, Josh Triplett <josh@joshtriplett.org> wrote:
> > On Thu, Jan 24, 2013 at 12:34:21PM -0800, tip-bot for Jan Beulich wrote:
> >> Commit-ID:  13f0e4d2b9e2209f13d5a4122478eb79e6136870
> >> Gitweb:     
> > http://git.kernel.org/tip/13f0e4d2b9e2209f13d5a4122478eb79e6136870 
> >> Author:     Jan Beulich <JBeulich@suse.com>
> >> AuthorDate: Fri, 23 Nov 2012 16:30:07 +0000
> >> Committer:  Ingo Molnar <mingo@kernel.org>
> >> CommitDate: Thu, 24 Jan 2013 17:12:18 +0100
> >> 
> >> x86/EFI: Properly init-annotate BGRT code
> >> 
> >> These items are only ever referenced from initialization code.
> > 
> > Not true, and this patch will break the BGRT code.  bgrt_init, which
> > does indeed have an __init annotation, stores bgrt_image and
> > bgrt_image_size into the .private and .size fields of a sysfs
> > bin_attribute, which does *not* have an __initdata annotation, and which
> > will get read whenever the user reads the corresponding sysfs attribute.
> 
> Copying init-only data into a sysfs structure is no problem at all
> - that structure obviously is non-__initdata and hence can be
> read at any time. It was a different thing if .private and/or .size
> stored _pointers_ to one of the two variables in question.

Ah, I see; the data itself gets kmalloc'd, and you just want to discard
the original pointer and size.  Fair enough.  Sorry for the false alarm.

- Josh Triplett

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/debug] x86/EFI: Properly init-annotate BGRT code
  2013-01-25 16:03       ` Josh Triplett
@ 2013-01-25 18:36         ` Ingo Molnar
  2013-01-25 19:18           ` Josh Triplett
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2013-01-25 18:36 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Jan Beulich, tglx, mjg, linux-kernel, hpa


* Josh Triplett <josh@joshtriplett.org> wrote:

> On Fri, Jan 25, 2013 at 07:45:42AM +0000, Jan Beulich wrote:
> > >>> On 24.01.13 at 23:28, Josh Triplett <josh@joshtriplett.org> wrote:
> > > On Thu, Jan 24, 2013 at 12:34:21PM -0800, tip-bot for Jan Beulich wrote:
> > >> Commit-ID:  13f0e4d2b9e2209f13d5a4122478eb79e6136870
> > >> Gitweb:     
> > > http://git.kernel.org/tip/13f0e4d2b9e2209f13d5a4122478eb79e6136870 
> > >> Author:     Jan Beulich <JBeulich@suse.com>
> > >> AuthorDate: Fri, 23 Nov 2012 16:30:07 +0000
> > >> Committer:  Ingo Molnar <mingo@kernel.org>
> > >> CommitDate: Thu, 24 Jan 2013 17:12:18 +0100
> > >> 
> > >> x86/EFI: Properly init-annotate BGRT code
> > >> 
> > >> These items are only ever referenced from initialization code.
> > > 
> > > Not true, and this patch will break the BGRT code.  bgrt_init, which
> > > does indeed have an __init annotation, stores bgrt_image and
> > > bgrt_image_size into the .private and .size fields of a sysfs
> > > bin_attribute, which does *not* have an __initdata annotation, and which
> > > will get read whenever the user reads the corresponding sysfs attribute.
> > 
> > Copying init-only data into a sysfs structure is no problem at all
> > - that structure obviously is non-__initdata and hence can be
> > read at any time. It was a different thing if .private and/or .size
> > stored _pointers_ to one of the two variables in question.
> 
> Ah, I see; the data itself gets kmalloc'd, and you just want 
> to discard the original pointer and size.  Fair enough.  Sorry 
> for the false alarm.

Ok - thanks for the clarification - I'll keep the commit as-is, 
agreed?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [tip:x86/debug] x86/EFI: Properly init-annotate BGRT code
  2013-01-25 18:36         ` Ingo Molnar
@ 2013-01-25 19:18           ` Josh Triplett
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Triplett @ 2013-01-25 19:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Jan Beulich, tglx, mjg, linux-kernel, hpa

On Fri, Jan 25, 2013 at 07:36:57PM +0100, Ingo Molnar wrote:
> 
> * Josh Triplett <josh@joshtriplett.org> wrote:
> 
> > On Fri, Jan 25, 2013 at 07:45:42AM +0000, Jan Beulich wrote:
> > > >>> On 24.01.13 at 23:28, Josh Triplett <josh@joshtriplett.org> wrote:
> > > > On Thu, Jan 24, 2013 at 12:34:21PM -0800, tip-bot for Jan Beulich wrote:
> > > >> Commit-ID:  13f0e4d2b9e2209f13d5a4122478eb79e6136870
> > > >> Gitweb:     
> > > > http://git.kernel.org/tip/13f0e4d2b9e2209f13d5a4122478eb79e6136870 
> > > >> Author:     Jan Beulich <JBeulich@suse.com>
> > > >> AuthorDate: Fri, 23 Nov 2012 16:30:07 +0000
> > > >> Committer:  Ingo Molnar <mingo@kernel.org>
> > > >> CommitDate: Thu, 24 Jan 2013 17:12:18 +0100
> > > >> 
> > > >> x86/EFI: Properly init-annotate BGRT code
> > > >> 
> > > >> These items are only ever referenced from initialization code.
> > > > 
> > > > Not true, and this patch will break the BGRT code.  bgrt_init, which
> > > > does indeed have an __init annotation, stores bgrt_image and
> > > > bgrt_image_size into the .private and .size fields of a sysfs
> > > > bin_attribute, which does *not* have an __initdata annotation, and which
> > > > will get read whenever the user reads the corresponding sysfs attribute.
> > > 
> > > Copying init-only data into a sysfs structure is no problem at all
> > > - that structure obviously is non-__initdata and hence can be
> > > read at any time. It was a different thing if .private and/or .size
> > > stored _pointers_ to one of the two variables in question.
> > 
> > Ah, I see; the data itself gets kmalloc'd, and you just want 
> > to discard the original pointer and size.  Fair enough.  Sorry 
> > for the false alarm.
> 
> Ok - thanks for the clarification - I'll keep the commit as-is, 
> agreed?
> 
> Thanks,

Yeah.  In fact:

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-25 19:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-23 16:30 [PATCH] x86/EFI: properly init-annotate BGRT code Jan Beulich
2013-01-24 20:34 ` [tip:x86/debug] x86/EFI: Properly " tip-bot for Jan Beulich
2013-01-24 22:28   ` Josh Triplett
2013-01-25  7:45     ` Jan Beulich
2013-01-25 16:03       ` Josh Triplett
2013-01-25 18:36         ` Ingo Molnar
2013-01-25 19:18           ` Josh Triplett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.