lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0j0Vj9DSL0PH+quZAnO5Ns3CxxC2qncM4xHmjsNWehM1A@mail.gmail.com>
Date:   Mon, 19 Sep 2016 13:46:29 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Chen Yu <yu.c.chen@...el.com>
Cc:     Linux PM <linux-pm@...r.kernel.org>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Pavel Machek <pavel@....cz>, Lee Chun-Yi <jlee@...e.com>,
        Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH][v10] PM / hibernate: Verify the consistent of e820 memory
 map by md5 digest

On Fri, Sep 9, 2016 at 2:21 PM, Chen Yu <yu.c.chen@...el.com> wrote:
> On some platforms, there is occasional panic triggered when trying to
> resume from hibernation, a typical panic looks like:

[cut]

> @@ -211,10 +292,15 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size)
>   */
>  int arch_hibernation_header_restore(void *addr)
>  {
> +       bool e820_mismatch = false;

The extra local variable can be avoided if you structure the code
slightly differently.

>         struct restore_data_record *rdr = addr;
>
>         restore_jump_address = rdr->jump_address;
>         jump_address_phys = rdr->jump_address_phys;
>         restore_cr3 = rdr->cr3;
> -       return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL;
> +
> +       e820_mismatch = hibernation_e820_mismatch(rdr->e820_digest);

Also calling hibernation_e820_mismatch() before checking rdr->magic
may not be useful at all.

> +
> +       return (rdr->magic == RESTORE_MAGIC) ?
> +               (e820_mismatch ? -ENODEV : 0) : -EINVAL;

So what about:

if (rdr->magic != RESTORE_MAGIC)
        return -EINVAL;

if (hibernation_e820_mismatch(rdr->e820_digest))
        return -ENODEV;

return 0;


>  }
> --

Thanks,
Rafael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ