Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit eef06fd8 authored by Abhishek Gadewar's avatar Abhishek Gadewar
Browse files

dumpstate: fix retention of CAP_SYSLOG after dropping root

Summary: Prior to dumping, dumpstate drops its root privileges.It sets its "keep capabilities" flag via PR_SET_KEEPCAPS in an attempt to maintain CAP_SYSLOG if the capability was present before dropping root. However, the "keep capabilities" flag applies to the permitted set, not the effective set. The effective set is cleared after a UID change regardless of the flag.
See: https://linux.die.net/man/2/prctl


Thus, the presence check should be done against the permitted set instead. This change is needed so that dumpstate has the capability required to directly read the kernel buffer,in order to add the ability to perform a dmesg dump.

Test: adb shell mkdir /data/nativetest64
mmm -j frameworks/native/cmds/dumpstate/ && adb push ${OUT}/data/nativetest64/dumpstate_* /data/nativetest64 && adb shell /data/nativetest64/dumpstate_test/dumpstate_test
&& stack

Change-Id: I521ee146a46fe1495e46343de0c9c45ffcf9ea5e
Signed-off-by: default avatarAbhishek Gadewar <abhishekgadewar@meta.com>
parent d66c39a2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment