Skip to content

Commit 4767af8

Browse files
committed
landlock: Log the TGID of the domain creator
As for other Audit's "pid" fields, Landlock should use the task's TGID instead of its TID. Fix this issue by keeping a reference to the TGID of the domain creator. Existing tests already check for the PID but only with the thread group leader, so always the TGID. A following patch adds dedicated tests for non-leader thread. Remove the current_real_cred() check which does not make sense because we only reference a struct pid, whereas a previous version did reference a struct cred instead. Cc: Christian Brauner <brauner@kernel.org> Cc: Paul Moore <paul@paul-moore.com> Reviewed-by: Günther Noack <gnoack3000@gmail.com> Link: https://lore.kernel.org/r/20250410171725.1265860-1-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
1 parent fe81536 commit 4767af8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/landlock/domain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/path.h>
1717
#include <linux/pid.h>
1818
#include <linux/sched.h>
19+
#include <linux/signal.h>
1920
#include <linux/uidgid.h>
2021

2122
#include "access.h"
@@ -99,8 +100,7 @@ static struct landlock_details *get_current_details(void)
99100
return ERR_PTR(-ENOMEM);
100101

101102
memcpy(details->exe_path, path_str, path_size);
102-
WARN_ON_ONCE(current_cred() != current_real_cred());
103-
details->pid = get_pid(task_pid(current));
103+
details->pid = get_pid(task_tgid(current));
104104
details->uid = from_kuid(&init_user_ns, current_uid());
105105
get_task_comm(details->comm, current);
106106
return details;

0 commit comments

Comments
 (0)