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]
Date:	Sun, 4 Jul 2010 07:54:16 -0400
From:	Chris Metcalf <cmetcalf@...era.com>
To:	Paul Mundt <lethal@...ux-sh.org>
CC:	<linux-kernel@...r.kernel.org>, <linux-arch@...r.kernel.org>,
	<arnd@...db.de>
Subject: Re: [PATCH] arch/tile: updates to hardwall code from community feedback.

On 7/3/2010 11:57 PM, Paul Mundt wrote:
> On Fri, Jul 02, 2010 at 11:45:18AM -0400, Chris Metcalf wrote:
>   
>>  #define for_each_hardwall_task_safe(pos, n, head) \
>> -	hardwall_for_each_entry_safe(pos, n, head, thread.hardwall_list)
>> +	list_for_each_entry_safe(pos, n, head, thread.hardwall_list)
>>  
>>     
> If you've killed off the rest of the wrappers due to them not really
> having to do anything special, you could do the same for this one, too.
>   

Good point, thanks.  Done.

>>  static struct hardwall_info *hardwall_create(
>> -	size_t size, const unsigned long __user *bits)
>> +	size_t size, const unsigned char __user *bits)
>>  {
>> [...]
>>  
>>     
> Does it even make any sense to accept > sizeof(struct cpumask) ? Your
> case below obviously handles this by making sure the rest of the bits are
> zeroed, but that still seems a bit excessive. If anything, the
> sizeof(struct cpumask) should be your worst case (or just rejected out of
> hand), and you could use cpumask_size() for everything else.
>   

Yes, it does make sense; see get_nodes() in mm/mempolicy.c for a similar
API philosophy.  The idea is that you don't want to tie userspace code
to the particular NR_CPUS that you happened to build your kernel with. 
So you let userspace use any reasonable value for its bitmask, and as
long as it's passing zeroes for the >NR_CPUS positions, that's OK.

cpumask_parse_user() won't help here, since we're not parsing an ASCII
string input.  The main flow is just a copy_from_user() for the bits in
the mask, then an optional memset() if the user specified fewer than
NR_CPUS cpus, or a scan to check for set bits if the user specified more
than NR_CPUS cpus.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com

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