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:   Wed, 18 Nov 2020 10:41:51 -0800
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Liu Xiang <liu.xiang@...ngsmart.com>, linux-mm@...ck.org
Cc:     akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
        liuxiang_1999@....com, Pan Jiagen <pan.jiagen@...ngsmart.com>
Subject: Re: [PATCH] mm: hugetlb: fix type of delta parameter in
 gather_surplus_pages()

On 11/18/20 5:14 AM, Liu Xiang wrote:
> On 64-bit machine, delta variable in hugetlb_acct_memory() may be larger
> than 0xffffffff, but gather_surplus_pages() can only use the low 32-bit
> value now.
> 
> Reported-by: Ma Chenggong <ma.chenggong@...ngsmart.com>
> Signed-off-by: Liu Xiang <liu.xiang@...ngsmart.com>
> Signed-off-by: Pan Jiagen <pan.jiagen@...ngsmart.com>
> ---
>  mm/hugetlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 37f15c3..293b36d 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1943,7 +1943,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
>   * Increase the hugetlb pool such that it can accommodate a reservation
>   * of size 'delta'.
>   */
> -static int gather_surplus_pages(struct hstate *h, int delta)
> +static int gather_surplus_pages(struct hstate *h, long delta)
>  	__must_hold(&hugetlb_lock)
>  {
>  	struct list_head surplus_list;

Thank you for noticing the type difference.

However, if the parameter delta is changed to long then we should also change
the local variables in gather_surplus_pages that are used with delta.
Specifically, the local variables 'needed', 'allocated' and 'i' should also be
of type long.
-- 
Mike Kravetz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ