a7fb095207
Incidentd needs to access /data/misc/logd to get persisted logs for debugging purposes. Relax permissions on /data/misc/logd to allow group (log) to access the dir and read its files. Effectively change to: drwxr-x--- logd log /data/misc/logd -rw-r----- logd log /data/misc/logd/logcat* Since this dir stores the past output of logcat, anyone that can run logcat can be granted access to this dir. Access to this dir is further guarded by SELinux. So it is safe. Bug: 147924172 Test: Build, flash, reboot. Verify that the files have the right permissions. Change-Id: I4d2aa9d5883d1ef14411b2b3902f0ca7c641dd7e
29 lines
780 B
Bash
Executable file
29 lines
780 B
Bash
Executable file
#! /system/bin/sh
|
|
|
|
# This is primarily meant to be used by logpersist. This script is run as an init service, which
|
|
# first reads the 'last' logcat to persistent storage with `-L` then run logcat again without
|
|
# `-L` to read the current logcat buffers to persistent storage.
|
|
|
|
# init sets the umask to 077 for forked processes. logpersist needs to create files that are group
|
|
# readable. So relax the umask to only disallow group wx and world rwx.
|
|
umask 037
|
|
|
|
has_last="false"
|
|
for arg in "$@"; do
|
|
if [ "$arg" == "-L" -o "$arg" == "--last" ]; then
|
|
has_last="true"
|
|
fi
|
|
done
|
|
|
|
if [ "$has_last" == "true" ]; then
|
|
logcat "$@"
|
|
fi
|
|
|
|
args_without_last=()
|
|
for arg in "$@"; do
|
|
if [ "$arg" != "-L" -a "$arg" != "--last" ]; then
|
|
ARGS+=("$arg")
|
|
fi
|
|
done
|
|
|
|
exec logcat "${ARGS[@]}"
|