How to fix "dmesg: klogctl: Permission denied" for normal user on Android? I have a rooted Samsung device(system-as-root). When I open adb shell and run the dmesg  then it behaves differently for su and normal user. It throws 


  dmesg: klogctl: Permission denied


error when I run it without su shell.

Please suggest how can I fix this?
dmesg calls C library's klogctl wrapper function for kernel's syslog syscall which reads kernel's ring buffer by accessing /dev/kmsg character device. adb shell dmesg returns permissions denied error because adbd which runs with context u:r:shell:s0 is not allowed by SELinux to read kernel log. You need to explicitly allow it (requires root):

~# supolicy --live 'allow shell kernel system syslog_read'


If property ro.logd.kernel is set to true (default on debuggable builds), Android's logging daemon (logd) writes kernel messages to a separate buffer named kernel, which can be read using logcat (doesn't require root):

~$ logcat -b kernel