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]
Date:	Mon, 27 Jul 2015 11:31:34 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Dave Young <dyoung@...hat.com>
Cc:	Baoquan He <bhe@...hat.com>, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jiri Kosina <jkosina@...e.cz>, Vivek Goyal <vgoyal@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] Do not reserve crashkernel high memory if crashkernel
 low memory reserving failed

On Tue, Jul 21, 2015 at 12:31 AM, Dave Young <dyoung@...hat.com> wrote:
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index 80f874b..36aeac3 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -513,7 +513,7 @@ static void __init memblock_x86_reserve_range_setup_data(void)
>>  # define CRASH_KERNEL_ADDR_HIGH_MAX  MAXMEM
>>  #endif
>>
>> -static void __init reserve_crashkernel_low(void)
>> +static int __init reserve_crashkernel_low(void)
>>  {
>>  #ifdef CONFIG_X86_64
>>       const unsigned long long alignment = 16<<20;    /* 16M */
>> @@ -542,7 +542,7 @@ static void __init reserve_crashkernel_low(void)
>>       } else {
>>               /* passed with crashkernel=0,low ? */
>>               if (!low_size)
>> -                     return;
>> +                     return 0;
>>       }
>>
>>       low_base = memblock_find_in_range(low_size, (1ULL<<32),
>> @@ -552,7 +552,7 @@ static void __init reserve_crashkernel_low(void)
>>               if (!auto_set)
>>                       pr_info("crashkernel low reservation failed - No suitable area found.\n");
>>
>> -             return;
>> +             return -EINVAL;
>>       }
>>
>>       memblock_reserve(low_base, low_size);
>> @@ -564,6 +564,7 @@ static void __init reserve_crashkernel_low(void)
>>       crashk_low_res.end   = low_base + low_size - 1;
>>       insert_resource(&iomem_resource, &crashk_low_res);
>>  #endif
>> +     return 0;
>>  }
>>
>>  static void __init reserve_crashkernel(void)
>> @@ -613,6 +614,10 @@ static void __init reserve_crashkernel(void)
>>                       return;
>>               }
>>       }
>> +
>> +     if (crash_base >= (1ULL<<32) && reserve_crashkernel_low())
>> +             return;
>> +
>>       memblock_reserve(crash_base, crash_size);
>>
>>       printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
>> @@ -624,9 +629,6 @@ static void __init reserve_crashkernel(void)
>>       crashk_res.start = crash_base;
>>       crashk_res.end   = crash_base + crash_size - 1;
>>       insert_resource(&iomem_resource, &crashk_res);
>> -
>> -     if (crash_base >= (1ULL<<32))
>> -             reserve_crashkernel_low();
>>  }
>>  #else
>>  static void __init reserve_crashkernel(void)

No, you can not move the calling position for reserve_crashkernel_low().

old sequence:

memblock_find_in_range  for high
memblock_reserve for high
memblock_find_in_range  for low
memblock_reserve for low

now you change to:
memblock_find_in_range  for high
memblock_find_in_range  for low
memblock_reserve for low
memblock_reserve for high

during memblock_reserve, we would double the memblock reserve array.
So there is possibility that new membock reserve array is overlapped with
range for  crashdump high.

so you should keep the old sequence, and if reserve_crashkernel_low fail,
just call memblock_free to free high range that is reserved before.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ