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: <98cc9d27-6e96-48b7-93ea-6705aeba4759@schaufler-ca.com>
Date: Tue, 3 Sep 2024 18:24:07 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: Paul Moore <paul@...l-moore.com>, linux-security-module@...r.kernel.org
Cc: jmorris@...ei.org, serge@...lyn.com, keescook@...omium.org,
 john.johansen@...onical.com, penguin-kernel@...ove.sakura.ne.jp,
 stephen.smalley.work@...il.com, linux-kernel@...r.kernel.org,
 selinux@...r.kernel.org, mic@...ikod.net, audit@...r.kernel.org,
 Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [PATCH v2 5/13] LSM: Use lsmblob in security_ipc_getsecid

On 9/3/2024 5:18 PM, Paul Moore wrote:
> On Aug 29, 2024 Casey Schaufler <casey@...aufler-ca.com> wrote:
>> There may be more than one LSM that provides IPC data for auditing.
>> Change security_ipc_getsecid() to fill in a lsmblob structure instead
>> of the u32 secid.  Change the name to security_ipc_getlsmblob() to
>> reflect the change.  The audit data structure containing the secid
>> will be updated later, so there is a bit of scaffolding here.
> I think that last sentence needs to be updated based on the current
> ordering in the patchset.

Agreed. Thanks for noticing it.

>> Signed-off-by: Casey Schaufler <casey@...aufler-ca.com>
>> Cc: audit@...r.kernel.org
>> Cc: linux-security-module@...r.kernel.org
>> Cc: selinux@...r.kernel.org
>> ---
>>  include/linux/lsm_hook_defs.h |  4 ++--
>>  include/linux/security.h      | 18 +++++++++++++++---
>>  kernel/auditsc.c              |  3 +--
>>  security/security.c           | 14 +++++++-------
>>  security/selinux/hooks.c      |  9 ++++++---
>>  security/smack/smack_lsm.c    | 17 ++++++++++-------
>>  6 files changed, 41 insertions(+), 24 deletions(-)
>>
>> diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
>> index 3e5f6baa7b9f..c3ffc3f98343 100644
>> --- a/include/linux/lsm_hook_defs.h
>> +++ b/include/linux/lsm_hook_defs.h
>> @@ -253,8 +253,8 @@ LSM_HOOK(void, LSM_RET_VOID, task_to_inode, struct task_struct *p,
>>  	 struct inode *inode)
>>  LSM_HOOK(int, 0, userns_create, const struct cred *cred)
>>  LSM_HOOK(int, 0, ipc_permission, struct kern_ipc_perm *ipcp, short flag)
>> -LSM_HOOK(void, LSM_RET_VOID, ipc_getsecid, struct kern_ipc_perm *ipcp,
>> -	 u32 *secid)
>> +LSM_HOOK(void, LSM_RET_VOID, ipc_getlsmblob, struct kern_ipc_perm *ipcp,
>> +	 struct lsmblob *blob)
>>  LSM_HOOK(int, 0, msg_msg_alloc_security, struct msg_msg *msg)
>>  LSM_HOOK(void, LSM_RET_VOID, msg_msg_free_security, struct msg_msg *msg)
>>  LSM_HOOK(int, 0, msg_queue_alloc_security, struct kern_ipc_perm *perm)
>> diff --git a/include/linux/security.h b/include/linux/security.h
>> index a0b23b6e8734..ebe8edaae953 100644
>> --- a/include/linux/security.h
>> +++ b/include/linux/security.h
>> @@ -290,6 +290,17 @@ static inline bool lsmblob_is_set(struct lsmblob *blob)
>>  	return !!memcmp(blob, &empty, sizeof(*blob));
>>  }
>>  
>> +/**
>> + * lsmblob_init - initialize a lsmblob structure
>> + * @blob: Pointer to the data to initialize
>> + *
>> + * Set all secid for all modules to the specified value.
>> + */
>> +static inline void lsmblob_init(struct lsmblob *blob)
>> +{
>> +	memset(blob, 0, sizeof(*blob));
>> +}
>> +
>>  #ifdef CONFIG_SECURITY
> Once again, I think we may want a !CONFIG_SECURITY variant too.

I expect so. This is a scaffolding function, but compiles need to work.

> --
> paul-moore.com
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ