label: rework label_fix() implementations (#8583)
This reworks the SELinux and SMACK label fixing calls in a number of ways: 1. The two separate boolean arguments of these functions are converted into a flags type LabelFixFlags. 2. The operations are now implemented based on O_PATH. This should resolve TTOCTTOU races between determining the label for the file system object and applying it, as it it allows to pin the object while we are operating on it. 3. When changing a label fails we'll query the label previously set, and if matches what we want to set anyway we'll suppress the error. Also, all calls to label_fix() are now (void)ified, when we ignore the return values. Fixes: #8566
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
ffb3c2bd70
commit
08c849815c
@@ -850,7 +850,7 @@ static int fd_set_perms(Item *i, int fd, const struct stat *st) {
|
||||
}
|
||||
|
||||
shortcut:
|
||||
return label_fix(path, false, false);
|
||||
return label_fix(path, 0);
|
||||
}
|
||||
|
||||
static int path_set_perms(Item *i, const char *path) {
|
||||
|
||||
Reference in New Issue
Block a user