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] [day] [month] [year] [list]
Message-ID: <55AC6A94.5070700@intel.com>
Date:	Mon, 20 Jul 2015 11:27:16 +0800
From:	Pan Xinhui <xinhuix.pan@...el.com>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	linux-kernel@...r.kernel.org, mingo@...hat.com, hpa@...or.com,
	x86@...nel.org, bp@...e.de, jgross@...e.com, mcgrof@...e.com,
	decui@...rosoft.com, ross.zwisler@...ux.intel.com,
	sfr@...b.auug.org.au, toshi.kani@...com,
	"mnipxh@....com" <mnipxh@....com>
Subject: Re: [PATCH] x86/mm/pat: let level meaningful even NULL return in,
 lookup_address_in_pgd

hi, tglx
	thanks for your reply.

On 2015年07月17日 22:50, Thomas Gleixner wrote:
> On Tue, 14 Jul 2015, Pan Xinhui wrote:
>> If pmd or pud is not set, we may set a wrong page mapping level.
> 
> No. The behaviour is simply undefined, if the return value of the
> function is NULL.
> 
> So what you are trying to do is to make the level information accurate
> even for the failure case.
>  
yes. it's good to report level information. then we can handle some errors.


>> We know *address* belongs to *pud*, however for some reasons *pmd* is
>> NULL. For example, this address has no physical pages mapped. What we
>> could benefit from this patch are below:
>> 1) We can walk memory range easier.
>> If addressA passed to lookup_address(), and NULL returned. We can pass
>> addressA + level_to_size(level) to lookup_address() in next loop.
>> ...
>> if (!pte) {
>> 	/* level_to_size has not been implemented in upstream*/
>> 	address += level_to_size(level);
>> 	continue;
>> }
> 
> This example is completely useless because we do not see how the loop
> itself looks like and how that improves anything. The proper way to do
> this is to post:
> 
>      - the patch which changes the function
>      - another patch which makes use of the change 
> 
> But so far I cannot see any reason why we want to change it.
> 
sorry for that. There are some debug patches protected. I will try to make a simple example in other mails.

>> ...
>> 2) keep same behavior because level is set to PG_LEVEL_4K even when pte
>> is NULL.
> 
> And what's the actual benefit of #2? Keeping the same behaviour is a
> requirement if you don't want to break any users of that function.
> 
agree with you. :)
I did not explain it in correct ways.
When pte is NULL, lookup_address will return NULL on failure. however the level is correct and set to PG_LEVEL_4K.
So what I am trying to do is that if lookup_address return NULL on *pud* or *pmd* NULL failure, level is still correct or more correct.
A correct level information is very useful when we walk a large range of memory.

thanks
xinhui

> Thanks,
> 
> 	tglx
> 
--
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