public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: don't clear olpc_ofw_header when sentinel is detected
@ 2013-07-13 16:26 Daniel Drake
  2013-07-13 21:48 ` Yinghai Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Drake @ 2013-07-13 16:26 UTC (permalink / raw)
  To: tglx, mingo, hpa, x86; +Cc: linux-kernel, pgf, dilinger

OpenFirmware doesn't quite follow the protocol described in boot.txt
and the kernel has detected this through use of the sentinel value
in boot_params. OFW does zero out almost all of the stuff that it should
do, but not the sentinel.

This causes the kernel to clear olpc_ofw_header, which breaks x86 OLPC
support.

We will fix OpenFirmware. However, it would be nice if we could maintain
Linux compatibility with old firmware versions. To do that, we just have
to avoid zeroing out olpc_ofw_header. 

OFW does not write to any other parts of the header that are being zapped
by the sentinel-detection code, and all users of olpc_ofw_header are
somewhat protected through checking for the OLPC_OFW_SIG magic value
before using it. So this should not cause any problems for anyone.

Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 arch/x86/include/asm/bootparam_utils.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
index 653668d..4a8cb8d 100644
--- a/arch/x86/include/asm/bootparam_utils.h
+++ b/arch/x86/include/asm/bootparam_utils.h
@@ -35,9 +35,9 @@ static void sanitize_boot_params(struct boot_params *boot_params)
 	 */
 	if (boot_params->sentinel) {
 		/* fields in boot_params are left uninitialized, clear them */
-		memset(&boot_params->olpc_ofw_header, 0,
+		memset(&boot_params->ext_ramdisk_image, 0,
 		       (char *)&boot_params->efi_info -
-			(char *)&boot_params->olpc_ofw_header);
+			(char *)&boot_params->ext_ramdisk_image);
 		memset(&boot_params->kbd_status, 0,
 		       (char *)&boot_params->hdr -
 		       (char *)&boot_params->kbd_status);
-- 
1.8.1.4


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

* Re: [PATCH] x86: don't clear olpc_ofw_header when sentinel is detected
  2013-07-13 16:26 [PATCH] x86: don't clear olpc_ofw_header when sentinel is detected Daniel Drake
@ 2013-07-13 21:48 ` Yinghai Lu
  0 siblings, 0 replies; 2+ messages in thread
From: Yinghai Lu @ 2013-07-13 21:48 UTC (permalink / raw)
  To: Daniel Drake
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	the arch/x86 maintainers, Linux Kernel Mailing List, pgf,
	Andres Salomon

On Sat, Jul 13, 2013 at 9:26 AM, Daniel Drake <dsd@laptop.org> wrote:
> OpenFirmware doesn't quite follow the protocol described in boot.txt
> and the kernel has detected this through use of the sentinel value
> in boot_params. OFW does zero out almost all of the stuff that it should
> do, but not the sentinel.
>
> This causes the kernel to clear olpc_ofw_header, which breaks x86 OLPC
> support.
>
> We will fix OpenFirmware. However, it would be nice if we could maintain
> Linux compatibility with old firmware versions. To do that, we just have
> to avoid zeroing out olpc_ofw_header.
>
> OFW does not write to any other parts of the header that are being zapped
> by the sentinel-detection code, and all users of olpc_ofw_header are
> somewhat protected through checking for the OLPC_OFW_SIG magic value
> before using it. So this should not cause any problems for anyone.
>
> Signed-off-by: Daniel Drake <dsd@laptop.org>
> ---
>  arch/x86/include/asm/bootparam_utils.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
> index 653668d..4a8cb8d 100644
> --- a/arch/x86/include/asm/bootparam_utils.h
> +++ b/arch/x86/include/asm/bootparam_utils.h
> @@ -35,9 +35,9 @@ static void sanitize_boot_params(struct boot_params *boot_params)
>          */
>         if (boot_params->sentinel) {
>                 /* fields in boot_params are left uninitialized, clear them */
> -               memset(&boot_params->olpc_ofw_header, 0,
> +               memset(&boot_params->ext_ramdisk_image, 0,
>                        (char *)&boot_params->efi_info -
> -                       (char *)&boot_params->olpc_ofw_header);
> +                       (char *)&boot_params->ext_ramdisk_image);
>                 memset(&boot_params->kbd_status, 0,
>                        (char *)&boot_params->hdr -
>                        (char *)&boot_params->kbd_status);
> --
> 1.8.1.4

Acked-by: Yinghai Lu <yinghai@kernel.org>

also need to
Cc: <stable@vger.kerne.org> v3.9+

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

end of thread, other threads:[~2013-07-13 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-13 16:26 [PATCH] x86: don't clear olpc_ofw_header when sentinel is detected Daniel Drake
2013-07-13 21:48 ` Yinghai Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox