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, 16 Jul 2018 07:28:38 -0700
From:   Dave Hansen <dave.hansen@...ux.intel.com>
To:     Jiang Biao <jiang.biao2@....com.cn>, tglx@...utronix.de,
        mingo@...hat.com
Cc:     luto@...nel.org, hpa@...or.com, x86@...nel.org, albcamus@...il.com,
        linux-kernel@...r.kernel.org, zhong.weidong@....com.cn
Subject: Re: [PATCH 1/5] x86/pti: check the return value of
 pti_user_pagetable_walk_p4d

On 07/15/2018 09:03 PM, Jiang Biao wrote:
> diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
> index 4d418e7..be9e5bc 100644
> --- a/arch/x86/mm/pti.c
> +++ b/arch/x86/mm/pti.c
> @@ -195,8 +195,10 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address)
>  static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)
>  {
>  	gfp_t gfp = (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO);
> -	p4d_t *p4d = pti_user_pagetable_walk_p4d(address);
>  	pud_t *pud;
> +	p4d_t *p4d = pti_user_pagetable_walk_p4d(address);
> +	if (WARN_ON(!p4d))
> +		return NULL;

First of all, I don't think we need the (new) warning here.
pti_user_pagetable_walk_p4d() only returns NULL if you try it on a
userspace _address_ or the page allocation fails.  It already warns on
the address case.

If you think the allocation path needs a warning, please do it as close
as possible to the _source_ of the warning (the failed allocation), not
in the caller.

This goes for all the variations on this that you have in the set.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ