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: <29381ebc-0bf7-59c5-6d16-16958e2dfcb1@linux.ibm.com>
Date:   Wed, 15 Dec 2021 21:37:08 -0500
From:   Stefan Berger <stefanb@...ux.ibm.com>
To:     Mimi Zohar <zohar@...ux.ibm.com>, linux-integrity@...r.kernel.org
Cc:     serge@...lyn.com, christian.brauner@...ntu.com,
        containers@...ts.linux.dev, dmitry.kasatkin@...il.com,
        ebiederm@...ssion.com, krzysztof.struczynski@...wei.com,
        roberto.sassu@...wei.com, mpeters@...hat.com, lhinds@...hat.com,
        lsturman@...hat.com, puiterwi@...hat.com, jejb@...ux.ibm.com,
        jamjoom@...ibm.com, linux-kernel@...r.kernel.org,
        paul@...l-moore.com, rgb@...hat.com,
        linux-security-module@...r.kernel.org, jmorris@...ei.org,
        Mehmet Kayaalp <mkayaalp@...ux.vnet.ibm.com>
Subject: Re: [PATCH v6 02/17] ima: Define ns_status for storing namespaced
 iint data


On 12/15/21 16:12, Mimi Zohar wrote:
> Hi Stefan,
>
> On Fri, 2021-12-10 at 14:47 -0500, Stefan Berger wrote:
>> From: Mehmet Kayaalp <mkayaalp@...ux.vnet.ibm.com>
>>
>> This patch adds an rbtree to the IMA namespace structure that stores a
>> namespaced version of iint->flags in ns_status struct. Similar to the
>> integrity_iint_cache, both the iint ns_struct are looked up using the
>> inode pointer value. The lookup, allocate, and insertion code is also
>> similar, except ns_struct is not free'd when the inode is free'd.
>> Instead, the lookup verifies the i_ino and i_generation fields are also a
>> match.
>>
>> Signed-off-by: Mehmet Kayaalp <mkayaalp@...ux.vnet.ibm.com>
>> Signed-off-by: Stefan Berger <stefanb@...ux.ibm.com>
> Again, hopefully it isn't premature for generic comments:
>
> - Function/inline comments would be appreciated, especially when the
> code differs from the original code.  Example below.
>
>> diff --git a/security/integrity/ima/ima_init_ima_ns.c b/security/integrity/ima/ima_init_ima_ns.c
>> index f820686baf9f..08781a44f7bf 100644
>> --- a/security/integrity/ima/ima_init_ima_ns.c
>> +++ b/security/integrity/ima/ima_init_ima_ns.c
>> @@ -14,11 +14,18 @@
>>   #include <linux/user_namespace.h>
>>   #include <linux/ima.h>
>>   #include <linux/proc_ns.h>
>> +#include <linux/slab.h>
>>   
>>   #include "ima.h"
>>   
>>   int ima_init_namespace(struct ima_namespace *ns)
>>   {
>> +	ns->ns_status_tree = RB_ROOT;
>> +	rwlock_init(&ns->ns_status_lock);
>> +	ns->ns_status_cache = KMEM_CACHE(ns_status, SLAB_PANIC);
>> +	if (!ns->ns_status_cache)
>> +		return -ENOMEM;
>> +
> For example, using KMEM_CACHE() is probably correct here, at least for
> now, but it is different than the original code which uses
> kmem_cache_alloc() with init_once().  Memory cleanup is done on free,
> before it is re-used.

KMEM_CACHE + kmem_cache_alloc/zalloc() are pretty common. What kind of 
comment would be helpful here?

    Stefan

>
> thanks,
>
> Mimi
>
>>   	return 0;
>>   }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ