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: <20210518112932.GV12395@shell.armlinux.org.uk>
Date:   Tue, 18 May 2021 12:29:32 +0100
From:   "Russell King (Oracle)" <linux@...linux.org.uk>
To:     Yanfei Xu <yanfei.xu@...driver.com>
Cc:     rppt@...nel.org, ardb@...nel.org, linus.walleij@...aro.org,
        akpm@...ux-foundation.org, carver4lio@....com,
        tiantao6@...ilicon.com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm: make the size of vmalloc in cmdline and meminfo
 uniform

On Tue, May 18, 2021 at 07:12:54PM +0800, Yanfei Xu wrote:
> The value of "vmalloc=" set in cmdline is always 8M more than the value
> of "VmallocTotal" in meminfo. When use the "vmalloc=" parameter, user
> expect to get the size what they input, and no need to consider the 8M
> "hole" hided in codes. This commit make real vmalloc size equal to value
> of "vmalloc=" in cmdline.
> 
> Also, the commit will reduce the size of vmalloc printed in boot message
> by 8M when the size set in cmdline is irrational.

Hi,

I think I'd like to do several cleanups with this:

1. change vmalloc_min to be an unsigned long.
2. exclude VMALLOC_OFFSET from vmalloc_min, moving it into
   adjust_lowmem_bounds where vmalloc_min is used.
3. rename vmalloc_min to be vmalloc_start
4. enforce vmalloc_start to be a multiple of 2MiB
5. in early_vmalloc(), calculate vmalloc_max as:
	VMALLOC_END - (PAGE_OFFSET + SZ_32M + VMALLOC_OFFSET)
   and use that to set the upper bound of vmalloc_reserve (which is
   something your patch doesn't do, which I think is a bug.

Thoughts?

> 
> Signed-off-by: Yanfei Xu <yanfei.xu@...driver.com>
> ---
>  arch/arm/mm/mmu.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index c1e12aab67b8..287c5115af4d 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -1133,19 +1133,20 @@ static int __init early_vmalloc(char *arg)
>  {
>  	unsigned long vmalloc_reserve = memparse(arg, NULL);
>  
> -	if (vmalloc_reserve < SZ_16M) {
> -		vmalloc_reserve = SZ_16M;
> +	vmalloc_reserve = ALIGN_DOWN(vmalloc_reserve, SZ_8M);
> +	if (vmalloc_reserve < SZ_8M) {
> +		vmalloc_reserve = SZ_8M;
>  		pr_warn("vmalloc area too small, limiting to %luMB\n",
>  			vmalloc_reserve >> 20);
>  	}
>  
>  	if (vmalloc_reserve > VMALLOC_END - (PAGE_OFFSET + SZ_32M)) {
> -		vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M);
> +		vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M + VMALLOC_OFFSET);
>  		pr_warn("vmalloc area is too big, limiting to %luMB\n",
>  			vmalloc_reserve >> 20);
>  	}
>  
> -	vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
> +	vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve - VMALLOC_OFFSET);
>  	return 0;
>  }
>  early_param("vmalloc", early_vmalloc);
> -- 
> 2.27.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ