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]
Message-ID: <d1c27478-a90c-359e-dc49-fc2d9eec3112@huawei.com>
Date:   Wed, 19 Jul 2023 09:45:09 +0800
From:   Gong Ruiqi <gongruiqi1@...wei.com>
To:     Paul Moore <paul@...l-moore.com>,
        Christian Göttsche <cgzones@...glemail.com>
CC:     Stephen Smalley <stephen.smalley.work@...il.com>,
        Eric Paris <eparis@...isplace.org>,
        Ondrej Mosnacek <omosnace@...hat.com>,
        <linux-kernel@...r.kernel.org>, <selinux@...r.kernel.org>
Subject: Re: [PATCH RFC 7/20] selinux: services: update type for umber of
 class permissions



On 2023/07/19 6:01, Paul Moore wrote:
> On Jul  6, 2023 Gong Ruiqi <gongruiqi1@...wei.com> wrote:
>>
>> Security classes have only up to 32 permissions, hence using an u16 is
>> sufficient (while improving padding).
> 
> Can you explain the improved padding comment?  

I think what Christian means is that struct selinux_mapping will occupy
less memory since num_perms is changed from uint (32 bits) to u16, which
saves 16 bits of space due to padding.

> [...]
>
>> diff --git a/security/selinux/ss/services.h b/security/selinux/ss/services.h
>> index 8a9b85f44b66..b6f99353301e 100644
>> --- a/security/selinux/ss/services.h
>> +++ b/security/selinux/ss/services.h
>> @@ -12,7 +12,7 @@
>>  /* Mapping for a single class */
>>  struct selinux_mapping {
>>  	u16 value; /* policy value for class */
>> -	unsigned int num_perms; /* number of permissions in class */
>> +	u16 num_perms; /* number of permissions in class */
>>  	u32 perms[sizeof(u32) * 8]; /* policy values for permissions */
>>  };

Check here.

>>  
>> -- 
>> 2.40.1
> 
> --
> paul-moore.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ