Skip to content

Commit 0fcb346

Browse files
lucabyonghong-song
authored andcommitted
cc: remove a spurious check for UID 0
This drops an hardcoded check for the root user-ID before accessing `/proc/kallsyms`, in order to fix a bug which is preventing proper kernel symbols resolution by non-root users. The `/proc/kallsyms` file is generally available to non-privileged users: ``` > runuser -u nobody -- wc -l /proc/kallsyms 217514 /proc/kallsyms ``` Its content is further controlled by the `CAP_SYSLOG` capability through `/proc/sys/kernel/kptr_restrict`: https://man7.org/linux/man-pages/man7/capabilities.7.html As such, it is better to directly open it and rely on `fopen()` for privileges checking.
1 parent 6813fbc commit 0fcb346

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/cc/bcc_proc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,6 @@ int bcc_procutils_each_ksym(bcc_procutils_ksymcb callback, void *payload) {
262262
FILE *kallsyms;
263263
unsigned long long addr;
264264

265-
/* root is needed to list ksym addresses */
266-
if (geteuid() != 0)
267-
return -1;
268-
269265
kallsyms = fopen("/proc/kallsyms", "r");
270266
if (!kallsyms)
271267
return -1;

0 commit comments

Comments
 (0)