mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-06 19:30:08 +00:00
apparmor: don't try to mmap empty files
In case empty profile files linger somehow (eg. powerloss or oom killer etc. between creating and writing the file) we tried to use mmap() with a length of 0 which is invalid. Let's treat this as if it did not exist. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
706ee25cda
commit
3754e803fd
@ -973,6 +973,7 @@ static int load_apparmor_profile(struct lsm_ops *ops, struct lxc_conf *conf, con
|
||||
goto out;
|
||||
}
|
||||
old_len = profile_sb.st_size;
|
||||
if (old_len) {
|
||||
old_content = lxc_strmmap(NULL, old_len, PROT_READ,
|
||||
MAP_PRIVATE, profile_fd, 0);
|
||||
if (old_content == MAP_FAILED) {
|
||||
@ -980,6 +981,7 @@ static int load_apparmor_profile(struct lsm_ops *ops, struct lxc_conf *conf, con
|
||||
profile_path);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
} else if (errno != ENOENT) {
|
||||
SYSERROR("Error reading old profile from %s", profile_path);
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user