Commit 8278569
setfiles: Add -A option to disable SELINUX_RESTORECON_ADD_ASSOC
SELINUX_RESTORECON_ADD_ASSOC tracks conflicts between inodes with
multiple hard links or bind mounts that have differing contexts.
However doing this involves building a large internal hashtable that
stores the full path of every file examined by setfiles. For
filesystems that have very large numbers of files or long pathnames,
this uses a lot of memory, which makes SELinux relabelling in
constrained memory environments infeasible.
This adds a new setfiles -A option that disables this tracking.
For example, using setfiles to relabel a filesystem with 15 million
files took 3.7GB of RAM. Using this option, the same filesystem can
be relabelled in 121MB (albeit with no warnings or errors possible for
conflicting labels, but for our use case we don't care about that.)
Fixes: https://issues.redhat.com/browse/RHEL-111505
Signed-off-by: Richard W.M. Jones <[email protected]>
Acked-by: Stephen Smalley <[email protected]>1 parent cc8c4a5 commit 8278569
2 files changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
190 | 195 | | |
191 | 196 | | |
192 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
378 | 381 | | |
379 | 382 | | |
380 | 383 | | |
| |||
0 commit comments