Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't let plugins fail due to read-only fs #3239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions plugins/fsverity.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ static rpmRC fsverity_fsm_file_prepare(rpmPlugin plugin, rpmfi fi, int fd,

/*
* Enable fsverity on the file.
* fsverity not supported by file system (ENOTTY) and fsverity not
* enabled on file system are expected and not considered
* errors. Every other non-zero error code will result in the
* installation failing.
* fsverity not supported by file system (ENOTTY), fsverity not enabled on
* file system and read-only file system are expected and not considered
* errors. Every other non-zero error code will result in the installation
* failing.
*/
if (ioctl(fd, FS_IOC_ENABLE_VERITY, &arg) != 0) {
switch(errno) {
Expand Down Expand Up @@ -142,6 +142,10 @@ static rpmRC fsverity_fsm_file_prepare(rpmPlugin plugin, rpmfi fi, int fd,
rpmlog(RPMLOG_DEBUG, "fsverity not enabled on file system for %s\n",
path);
break;
case EROFS:
rpmlog(RPMLOG_DEBUG, "fsverity not applicable on read-only "
"file system for %s\n", path);
break;
default:
rpmlog(RPMLOG_DEBUG, "failed to enable verity (errno %i) for %s\n",
errno, path);
Expand Down
8 changes: 7 additions & 1 deletion plugins/ima.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ static rpmRC ima_fsm_file_prepare(rpmPlugin plugin, rpmfi fi, int fd,
else
xx = lsetxattr(path, XATTR_NAME_IMA, fsig, len, 0);
if (xx < 0) {
int is_err = errno != EOPNOTSUPP;
int is_err = 1;
switch (errno) {
case EOPNOTSUPP:
case EROFS:
is_err = 0;
break;
}

rpmlog(is_err?RPMLOG_ERR:RPMLOG_DEBUG,
"ima: could not apply signature on '%s': %s\n",
Expand Down
10 changes: 9 additions & 1 deletion plugins/selinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,16 @@ static rpmRC selinux_fsm_file_prepare(rpmPlugin plugin, rpmfi fi, int fd,
else
conrc = lsetfilecon(path, scon);

if (conrc == 0 || (conrc < 0 && errno == EOPNOTSUPP))
if (conrc == 0)
rc = RPMRC_OK;
else if (conrc < 0) {
switch (errno) {
case EOPNOTSUPP:
case EROFS:
rc = RPMRC_OK;
break;
}
}

rpmlog(loglvl(rc != RPMRC_OK), "lsetfilecon: (%d %s, %s) %s\n",
fd, path, scon, (conrc < 0 ? strerror(errno) : ""));
Expand Down
Loading