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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 6 Jul 2010 20:30:40 +0400
From:	Dan Kruchinin <dkruchinin@....org>
To:	Steffen Klassert <steffen.klassert@...unet.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Herbert Xu <herbert@...dor.apana.org.au>
Subject: Re: [PATCH 1/3] padata: separate serial and parallel cpumasks

On Tue, Jul 6, 2010 at 5:28 PM, Steffen Klassert
<steffen.klassert@...unet.com> wrote:
> On Tue, Jul 06, 2010 at 12:31:21PM +0400, Dan Kruchinin wrote:
>>
>> Would't it be the same as with a pointer to cpumask_var_t? I mean:
>
> Using a pointer to cpumask_var_t is a bit problematic because
> you don't know a priori about the type of cpumask_var_t.
> The type depends whether the cpumasks are on/off stack.
> So the easiest thing is to embed it to a struct, then you don't
> need to care about the type. If you allocate a struct of type
> pcrypt_cpumask you get what you want to have.

Oh, I meant pointer to pointer of course. Anyway you're probably right.
I modified my patches according to the results of our discussion. So
I'm waiting for your fixes.

>
>> struct pcrypt {
>>   ...
>>   struct pcrypt_cpumask *mask;
>>   ...
>> } pencrypt;
>>
>> To assign a pointer via RCU:
>>
>> int cpumask_change_nitify(...) {
>>    ...
>>   struct pcrypt_cpumask *new_mask = kmalloc(sizeof(*mask), GFP);
>>   struct pcrypt_cpumask *old_mask = pencrypt.mask;
>>
>>   if (!new_mask)
>>      error();
>>   if (!alloc_cpumask_var(&new_mask->smask, GFP_KERNEL))
>>      error();
>>
>>   get_serial_cpumask_from_padata(new_mask->mask);
>>   rcu_assign_pointer(pencrypt.mask, new_mask);
>>   synchronize_rcu_bh();
>>
>>   free_cpumask_var(old_mask->smask);
>>   kfree(old_mask);
>>   ...
>> }
>>
>> It's a bit hard to read this code because at the first sight it
>> appears unclear and odd why we allocate the structure with only one
>> member.
>>
>
> We can easily add a code comment if this appears to be unclear :)
>



-- 
W.B.R.
Dan Kruchinin
--
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