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]
Message-ID: <CAJn8CcFfXqT3dfKauNN_Jsq7uF3YyhzcBr91Dsd83xVtGObcDA@mail.gmail.com>
Date:	Tue, 6 Aug 2013 13:10:00 +0800
From:	Xiaotian Feng <xtfeng@...il.com>
To:	Rusty Russell <rusty@...tcorp.com.au>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpumask: fix cpumask leak in partition_sched_domains

On Tue, Aug 6, 2013 at 12:37 PM, Rusty Russell <rusty@...tcorp.com.au> wrote:
> Xiaotian Feng <xtfeng@...il.com> writes:
>> On Sat, Jul 27, 2013 at 3:26 PM, Xiaotian Feng <xtfeng@...il.com> wrote:
>>> If doms_new is NULL, partition_sched_domains() will reset ndoms_cur
>>> to 0, and free old sched domains with free_sched_domains(doms_cur, ndoms_cur).
>>> As ndoms_cur is 0, the cpumask will not be freed.
>>>
>>> Signed-off-by: Xiaotian Feng <xtfeng@...il.com>
>>> Cc: Ingo Molnar <mingo@...hat.com>
>>> Cc: Peter Zijlstra <peterz@...radead.org>
>>> Cc: linux-kernel@...r.kernel.org
>>
>> Any comments? Cc'ed Rusty.
>
> The code is a little convoluted, but your fix is logical.
>

Yes, it's quite convoluted :(

>>> ---
>>>  kernel/sched/core.c |    5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>>> index b7c32cb..3d6c57b 100644
>>> --- a/kernel/sched/core.c
>>> +++ b/kernel/sched/core.c
>>> @@ -6184,8 +6184,9 @@ match1:
>>>                 ;
>>>         }
>>>
>>> +       n= ndoms_cur;
>
> You're missing a ' ' here:
>         n = ndoms_cur;
>

I'll update this, thanks :)

>>>         if (doms_new == NULL) {
>>> -               ndoms_cur = 0;
>>> +               n = 0;
>>>                 doms_new = &fallback_doms;
>>>                 cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map);
>>>                 WARN_ON_ONCE(dattr_new);
>>> @@ -6193,7 +6194,7 @@ match1:
>>>
>>>         /* Build new domains */
>>>         for (i = 0; i < ndoms_new; i++) {
>>> -               for (j = 0; j < ndoms_cur && !new_topology; j++) {
>>> +               for (j = 0; j < n && !new_topology; j++) {
>>>                         if (cpumask_equal(doms_new[i], doms_cur[j])
>>>                             && dattrs_equal(dattr_new, i, dattr_cur, j))
>>>                                 goto match2;
>>> --
>>> 1.7.9.6 (Apple Git-31.1)
>>>
>
> Cheers,
> Rusty.
--
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