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:	Tue, 19 May 2015 01:37:40 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Dave Hansen <dave@...1.net>
cc:	linux-kernel@...r.kernel.org, x86@...nel.org,
	dave.hansen@...ux.intel.com
Subject: Re: [PATCH 16/19] x86, mpx: support 32-bit binaries on 64-bit
 kernel

On Mon, 18 May 2015, Dave Hansen wrote:
> On 05/18/2015 02:53 PM, Thomas Gleixner wrote:
> >> +/*
> >> + * Total size of the process's virtual address space
> >> + * Use a u64 because 4GB (for 32-bit) won't fit in a long.
> >> + *
> >> + * __VIRTUAL_MASK does not work here.  It only covers the
> >> + * user address space and the tables cover the *entire*
> >> + * virtual address space supported on the CPU.
> >> + */
> >> +static inline unsigned long long mm_virt_space(struct mm_struct *mm)
> >> +{
> >> +	if (is_64bit_mm(mm))
> >> +		return 1ULL << 48;
> > 
> > cpu_info->x86_phys_bits will tell you the proper value
> > 
> >> +	else
> >> +		return 1ULL << 32;
> > 
> > And for a 32bit kernel 32 might be wrong because with PAE you have 36
> > bits.
> 
> That's physical space.  I really do need virtual space here.

Stupid me

> >> +	/*
> >> +	 * The two return calls above are exact copies.  If we
> >> +	 * pull out a single copy and put it in here, gcc won't
> >> +	 * realize that we're doing a power-of-2 divide and use
> >> +	 * shifts.  It uses a real divide.  If we put them up
> >> +	 * there, it manages to figure it out (gcc 4.8.3).
> > 
> > Can't we provide the shift values from bd_entry_virt_space() so we
> > don't have to worry about gcc versions being more or less clever?
> 
> Yes, I could go back and rework all the math to be done with shifts
> instead of power-of-2 divides (which is what was done before).  But,
> it's very clear the way that it stands, minus this wart.  The code look
> a *lot* better this way.
> 
> This isn't super performance-sensitive code.  It's basically in the
> munmap() path.  I just really didn't like the idea of an actual integer
> divide in there.
> 
> So, if GCC breaks this, so be it.  I don't think we'll ever notice.  The
> optimization was just too obvious to completely ignore.

Fair enough.

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