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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 Apr 2019 10:58:28 +0800
From:   Pingfan Liu <kernelfans@...il.com>
To:     Baoquan He <bhe@...hat.com>
Cc:     x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Will Deacon <will.deacon@....com>,
        Nicolas Pitre <nico@...aro.org>,
        Chao Fan <fanc.fnst@...fujitsu.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv3] x86/boot/KASLR: skip the specified crashkernel region

On Tue, Apr 2, 2019 at 4:08 PM Baoquan He <bhe@...hat.com> wrote:
>
> > +/* handle crashkernel=x@y or =range1:size1[,range2:size2,...]@offset options */
> > +static void mem_avoid_specified_crashkernel_region(char *option)
> > +{
> > +     unsigned long long crash_size, crash_base = 0;
> > +     char    *first_colon, *first_space, *cur = option;
> > +
>
> Another thing which need be noticed is that you may only need to handle
> when '@' is found. Otherwise just let it go. Right?
>
According to kernel's behavior, only the last "crashkernel=" option
takes effect. Hence if no '@', then clearing mem_avoid

> > +     first_colon = strchr(option, ':');
> > +     first_space = strchr(option, ' ');
> > +     /* if contain ":" */
> > +     if (first_colon && (!first_space || first_colon < first_space)) {
> > +             int i;
> > +             u64 total_sz = 0;
> > +             struct boot_e820_entry *entry;
> > +
> > +             for (i = 0; i < boot_params->e820_entries; i++) {
> > +                     entry = &boot_params->e820_table[i];
> > +                     /* Skip non-RAM entries. */
> > +                     if (entry->type != E820_TYPE_RAM)
> > +                             continue;
> > +                     total_sz += entry->size;
> > +             }
> > +             handle_crashkernel_mem(option, total_sz, &crash_size,
> > +                     &crash_base);
> > +     } else {
> > +             crash_size = memparse(option, &cur);
> > +             if (option == cur)
> > +                     return;
> > +             while (*cur && *cur != ' ' && *cur != '@')
> > +                     cur++;
> > +             if (*cur == '@') {
> > +                     option = cur + 1;
> > +                     crash_base = memparse(option, &cur);
> > +             }
> > +     }
> > +     if (crash_base) {
> > +             mem_avoid[MEM_AVOID_CRASHKERNEL].start = crash_base;
> > +             mem_avoid[MEM_AVOID_CRASHKERNEL].size = crash_size;
> > +     } else {
> > +             /*
> > +              * Clearing mem_avoid if no offset is given. This is consistent
> > +              * with kernel, which uses the last crashkernel= option.
> > +              */
> > +             mem_avoid[MEM_AVOID_CRASHKERNEL].start = 0;
> > +             mem_avoid[MEM_AVOID_CRASHKERNEL].size = 0;
> > +     }
> > +}

Powered by blists - more mailing lists