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:	Thu, 13 Sep 2012 09:38:54 +0200
From:	Daniel Wagner <wagi@...om.org>
To:	Li Zefan <lizefan@...wei.com>
CC:	netdev@...r.kernel.org, cgroups@...r.kernel.org,
	Daniel Wagner <daniel.wagner@...-carit.de>,
	Gao feng <gaofeng@...fujitsu.com>,
	Jamal Hadi Salim <jhs@...atatu.com>,
	John Fastabend <john.r.fastabend@...el.com>,
	Neil Horman <nhorman@...driver.com>
Subject: Re: [PATCH v4 4/8] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT

Hi Li,

On 13.09.2012 09:14, Li Zefan wrote:
> On 2012/9/13 14:57, Daniel Wagner wrote:
>> Hi Li,
>>
>> On 13.09.2012 08:41, Li Zefan wrote:
>>>> @@ -1321,11 +1321,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
>>>>         * take duplicate reference counts on a subsystem that's already used,
>>>>         * but rebind_subsystems handles this case.
>>>>         */
>>>> -    for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
>>>> +    for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
>>>>            unsigned long bit = 1UL << i;
>>>>
>>>>            if (!(bit & opts->subsys_mask))
>>>>                continue;
>>>> +        if (!subsys[i]->module)
>>>> +            continue;
>>>
>>> This check is not necessary. If it's builtin, try_module_get() will just return 1, and
>>> we're fine.
>>
>> Yes, I didn't see the try_module_get. Although I think with leaving the test away it would change the behavior, e.g.
>>
>>          if (!subsys[i]->module)
>>              continue;
>>          if (!try_module_get(subsys[i]->module)) {
>>              module_pin_failed = true;
>>              break;
>>          }
>>
>> module_pin_failed would be set then and we would jump into the error code later.
>>
>
> no behavioral change. For a builtin subsys, we won't run into the if block and have module_pin_failed be set.

Ah, I understand.

>> This tests looks a bit ugly though I think leaving it away and relying on try_module_get() is not correct.
>>
>
> I don't think this is bad. The block layer code does the similar thing in elevator_get().
>
> And we call module_put() unconditionally in rebind_subsys().

Okay, then these tests really not needed. I'll have them removed now
and tested the result. All works fine.

>>>> @@ -1437,6 +1443,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
>>>>        INIT_LIST_HEAD(&cgrp->event_list);
>>>>        spin_lock_init(&cgrp->event_list_lock);
>>>>        simple_xattrs_init(&cgrp->xattrs);
>>>> +    memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
>>>
>>> This seems an unrelated change, and is redundant. Am I missing something?
>>
>> The reason why it is necessary to NULL all the entries in the array, is that task_cls_classid() and task_netprioidx() check the return pointer from task_subsys_state(). If it is NULL those function know that the subsystem is not ready to be used. Should I move this change to the next patch then?
>>
>
> It's already guaranteed the passing @cgrp is zeored. that's why cgrp->flags is not explicitly initialized here.

Stupid me, I didn't see the kzalloc. You are absolutely right.

Thanks for your review.

cheers,
daniel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ