diff mbox series

[1/2] fast-reboot: don't back up old vectors upon fast reboot

Message ID 20191209104909.14903-1-npiggin@gmail.com
State Superseded
Headers show
Series [1/2] fast-reboot: don't back up old vectors upon fast reboot | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Nicholas Piggin Dec. 9, 2019, 10:49 a.m. UTC
Initial boot already saved original exception vectors to old_vectors,
copying again upon fast reboot will overwrite old_vectors with some
arbitrary vectors set up by the current OS.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 core/init.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Oliver O'Halloran Dec. 10, 2019, 12:01 a.m. UTC | #1
On Mon, Dec 9, 2019 at 9:50 PM Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Initial boot already saved original exception vectors to old_vectors,
> copying again upon fast reboot will overwrite old_vectors with some
> arbitrary vectors set up by the current OS.

What's this even needed for? Re-entering the previously booted kernel
image seems fundamentally sketch and we re-load the kernel anyway. The
only thing I can think of is fast-rebooting in mambo and I'm not sure
it'll work there either.

> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  core/init.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/core/init.c b/core/init.c
> index 339462e5d..1725639f8 100644
> --- a/core/init.c
> +++ b/core/init.c
> @@ -858,11 +858,6 @@ void copy_sreset_vector_fast_reboot(void)
>
>  void copy_exception_vectors(void)
>  {
> -       /* Backup previous vectors as this could contain a kernel
> -        * image.
> -        */
> -       memcpy_null(old_vectors, NULL, EXCEPTION_VECTORS_END);
> -
>         /* Copy from 0x100 to EXCEPTION_VECTORS_END, avoid below 0x100 as
>          * this is the boot flag used by CPUs still potentially entering
>          * skiboot.
> @@ -1020,6 +1015,11 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
>          */
>         clear_console();
>
> +       /* Backup previous vectors as this could contain a kernel
> +        * image.
> +        */
> +       memcpy_null(old_vectors, NULL, EXCEPTION_VECTORS_END);
> +
>         /*
>          * Some boot firmwares enter OPAL with MSR[ME]=1, as they presumably
>          * handle machine checks until we take over. As we overwrite the
> --
> 2.23.0
>
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Nicholas Piggin Dec. 10, 2019, 1:25 a.m. UTC | #2
Oliver O'Halloran's on December 10, 2019 10:01 am:
> On Mon, Dec 9, 2019 at 9:50 PM Nicholas Piggin <npiggin@gmail.com> wrote:
>>
>> Initial boot already saved original exception vectors to old_vectors,
>> copying again upon fast reboot will overwrite old_vectors with some
>> arbitrary vectors set up by the current OS.
> 
> What's this even needed for? Re-entering the previously booted kernel
> image seems fundamentally sketch and we re-load the kernel anyway. The
> only thing I can think of is fast-rebooting in mambo and I'm not sure
> it'll work there either.

Yeah I'm not too sure. Whatever it was for is definitely broken with
fast reboot. Fast reboot with a kernel at zero might still be broken
for other reasons, but it won't be for this at least :P

Thanks,
Nick
diff mbox series

Patch

diff --git a/core/init.c b/core/init.c
index 339462e5d..1725639f8 100644
--- a/core/init.c
+++ b/core/init.c
@@ -858,11 +858,6 @@  void copy_sreset_vector_fast_reboot(void)
 
 void copy_exception_vectors(void)
 {
-	/* Backup previous vectors as this could contain a kernel
-	 * image.
-	 */
-	memcpy_null(old_vectors, NULL, EXCEPTION_VECTORS_END);
-
 	/* Copy from 0x100 to EXCEPTION_VECTORS_END, avoid below 0x100 as
 	 * this is the boot flag used by CPUs still potentially entering
 	 * skiboot.
@@ -1020,6 +1015,11 @@  void __noreturn __nomcount main_cpu_entry(const void *fdt)
 	 */
 	clear_console();
 
+	/* Backup previous vectors as this could contain a kernel
+	 * image.
+	 */
+	memcpy_null(old_vectors, NULL, EXCEPTION_VECTORS_END);
+
 	/*
 	 * Some boot firmwares enter OPAL with MSR[ME]=1, as they presumably
 	 * handle machine checks until we take over. As we overwrite the