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, 16 Jan 2008 09:05:46 -0800
From:	Jeremy Fitzhardinge <jeremy@...p.org>
To:	Ingo Molnar <mingo@...e.hu>
CC:	Jan Beulich <jbeulich@...ell.com>, Andi Kleen <ak@...e.de>,
	Glauber de Oliveira Costa <glommer@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0 of 4] x86: some more patches

Ingo Molnar wrote:
> * Jan Beulich <jbeulich@...ell.com> wrote:
>
>   
>>> Yes, but if you cast to long the result will be 32bit again. Or do 
>>> you rely on it being always used in 64bit signed context with sign 
>>> extension? While that might work it would seem rather fragile to me, 
>>> just asking for similar future bugs.
>>>       
>> Even if conversion is to 64-bit unsigned, the value (being signed) 
>> will be sign-extended first (to preserve its value modulo 2**<target 
>> type width>).
>>     
>
> yes. It would be nice if Andi could test my fix instead of arguing why 
> he thinks it's unlikely to work ;-)
>
> (i've got the cleanup patch below as well ontop of today's x86.git which 
> includes the first fix, but it's an RFC as it has wider impact and might 
> break stuff.)
>
> 	Ingo
>
> --------------->
> Subject: x86: PAGE_MASK cleanup
> From: Ingo Molnar <mingo@...e.hu>
>
> Signed-off-by: Ingo Molnar <mingo@...e.hu>
> ---
>  include/asm-x86/page.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-x86.q/include/asm-x86/page.h
> ===================================================================
> --- linux-x86.q.orig/include/asm-x86/page.h
> +++ linux-x86.q/include/asm-x86/page.h
> @@ -6,12 +6,12 @@
>  /* PAGE_SHIFT determines the page size */
>  #define PAGE_SHIFT	12
>  #define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
> -#define PAGE_MASK	(~(PAGE_SIZE-1))
> +#define PAGE_MASK	(_AT(phys_addr_t, ~(PAGE_SIZE-1)))
>   

Hm, this seems fairly wide-ranging.  How about just making it signed?  
In fact, all these masks which are of the form "all high bits set, some 
low bits clear" (or perhaps "all set except some") should be signed, so 
that the "all high bits set" property is maintained when its extended to 
larger types.

Also, Andi, do you want to get rid of the PHYSICAL_MASK stuff?

    J
--
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