Skip to content

Commit d20b92a

Browse files
committed
userns: Teach trace to use from_kuid
- When tracing capture the kuid. - When displaying the data to user space convert the kuid into the user namespace of the process that opened the report file. Cc: Steven Rostedt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
1 parent f8f3d4d commit d20b92a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

init/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,6 @@ config UIDGID_CONVERTED
927927
# Features
928928
depends on IMA = n
929929
depends on EVM = n
930-
depends on TRACING = n
931930
depends on FS_POSIX_ACL = n
932931
depends on QUOTA = n
933932
depends on QUOTACTL = n

kernel/trace/trace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,8 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter)
20602060
seq_puts(m, "# -----------------\n");
20612061
seq_printf(m, "# | task: %.16s-%d "
20622062
"(uid:%d nice:%ld policy:%ld rt_prio:%ld)\n",
2063-
data->comm, data->pid, data->uid, data->nice,
2063+
data->comm, data->pid,
2064+
from_kuid_munged(seq_user_ns(m), data->uid), data->nice,
20642065
data->policy, data->rt_priority);
20652066
seq_puts(m, "# -----------------\n");
20662067

kernel/trace/trace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct trace_array_cpu {
147147
unsigned long skipped_entries;
148148
cycle_t preempt_timestamp;
149149
pid_t pid;
150-
uid_t uid;
150+
kuid_t uid;
151151
char comm[TASK_COMM_LEN];
152152
};
153153

0 commit comments

Comments
 (0)