Skip to content

Commit 29cf5f5

Browse files
feat(redirfs-lite): hide_from_root policy (default on)
Default behavior is now: redirect for everyone EXCEPT root (EUID=0). Aligns with the SUSFS/ZeroMount model where the privileged 'inside' view is the real fs and the 'outside' view (apps, system, shell) sees the rule-table. Implementation: - static bool rfl_hide_from_root = true (module_param 0644) - rfl_rule_lookup() bails early if hide_from_root && uid_eq(uid, ROOT) - rfl_rule_lookup_by_dst() same symmetric guard - Toggleable at runtime: echo 0 > /sys/module/redirfs_lite/parameters/hide_from_root Per-rule UID/GID filter still works on top — useful to scope a rule to a single non-root UID (e.g. one banking app) while leaving other apps unaffected. Webui: 'Toggle hide_from_root' button in the Module state section, flips the sysfs parameter and refreshes the diag pane. Docs: rules.conf.example explains the new default.
1 parent 27fef7d commit 29cf5f5

3 files changed

Lines changed: 466 additions & 15 deletions

File tree

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# /data/adb/redirfs/rules.conf
22
#
3+
# Default policy: every non-root caller sees the rule-table view; root sees
4+
# real filesystem state. This is enforced by the `hide_from_root` module
5+
# parameter (default ON; toggle with
6+
# `echo 0 > /sys/module/redirfs_lite/parameters/hide_from_root`).
7+
#
38
# Lines applied to /proc/redirfs/rules at every boot via post-fs-data.sh.
49
# Grammar (one command per line; blank lines and '#' comments ignored):
510
#
@@ -9,19 +14,20 @@
914
# audit on|off
1015
#
1116
# <src> and <dst> must be absolute paths (start with /).
12-
# <uid> = numeric UID for the rule to match, or * for any.
13-
# <gid> = same for GID.
17+
# <uid> / <gid>: usually leave as '*' (any non-root caller). Specify a
18+
# concrete value to scope the rule to a single app, e.g. only redirect when
19+
# the banking app (uid 10042) does the open.
1420
#
15-
# Examples:
21+
# Examples (with default hide_from_root=on):
1622
#
17-
# # Redirect a specific banking-app-detected path for only that app (uid 10042):
18-
# # add /system/etc/some_path /data/local/tmp/shimmed_path 10042 *
23+
# # Hide a path from every app, every shell, every system process EXCEPT root:
24+
# # add /system/etc/sentinel /data/local/tmp/shim * *
1925
#
20-
# # Make /system/xbin/su read-only-redirect to a no-op stub for unprivileged uids
21-
# # add /system/xbin/su /data/local/tmp/empty * *
26+
# # Hide ONLY for the banking app (uid 10042) — other apps see the real file:
27+
# # add /system/etc/sentinel /data/local/tmp/shim 10042 *
2228
#
23-
# # Disable audit logging in dmesg
29+
# # Stop logging redirect events to dmesg (audit is on by default):
2430
# # audit off
2531

26-
# (Smoke-test rule from initial bring-up. Safe to delete.)
32+
# Smoke-test rule from initial bring-up. Safe to delete.
2733
add /data/local/tmp/src_test /data/local/tmp/dst_test * *

0 commit comments

Comments
 (0)