Skip to content

Commit 3b0f5f9

Browse files
authored
Merge pull request #169 from cgwalters/drop-signed-check
mount.composefs: Drop fs-verity signature verification
2 parents fb0295a + 4dc4428 commit 3b0f5f9

File tree

3 files changed

+0
-41
lines changed

3 files changed

+0
-41
lines changed

libcomposefs/lcfs-mount.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -250,41 +250,6 @@ static int lcfs_validate_verity_fd(struct lcfs_mount_state_s *state)
250250
char buf[MAX_DIGEST_SIZE];
251251
} buf;
252252
int res;
253-
bool require_signature;
254-
char sig_data[1];
255-
struct fsverity_read_metadata_arg read_metadata = { 0 };
256-
257-
require_signature = (state->options->flags &
258-
LCFS_MOUNT_FLAGS_REQUIRE_FSVERITY_SIGNATURE) != 0;
259-
if (require_signature) {
260-
/* First ensure fs-verity is enabled for the image,
261-
* the actual digest doesn't matter at this point. */
262-
buf.fsv.digest_size = MAX_DIGEST_SIZE;
263-
res = ioctl(state->fd, FS_IOC_MEASURE_VERITY, &buf.fsv);
264-
if (res == -1) {
265-
if (errno == ENODATA || errno == EOPNOTSUPP || errno == ENOTTY)
266-
return -ENOVERITY;
267-
return -errno;
268-
}
269-
270-
/* If the file has verity enabled, has a signature and
271-
* we were able to open it, then the kernel will have
272-
* verified it against the kernel keyring, making it
273-
* valid. So, we read just one byte of the signature,
274-
* to validate that a signature exist in the file */
275-
276-
read_metadata.metadata_type = FS_VERITY_METADATA_TYPE_SIGNATURE;
277-
read_metadata.offset = 0;
278-
read_metadata.length = sizeof(sig_data);
279-
read_metadata.buf_ptr = (size_t)&sig_data;
280-
281-
res = ioctl(state->fd, FS_IOC_READ_VERITY_METADATA, &read_metadata);
282-
if (res == -1) {
283-
if (errno == ENODATA)
284-
return -ENOSIGNATURE;
285-
return -errno;
286-
}
287-
}
288253

289254
if (state->expected_digest_len != 0) {
290255
buf.fsv.digest_size = MAX_DIGEST_SIZE;

libcomposefs/lcfs-mount.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ enum lcfs_mount_flags_t {
3535
LCFS_MOUNT_FLAGS_NONE = 0,
3636
LCFS_MOUNT_FLAGS_REQUIRE_VERITY = (1 << 0),
3737
LCFS_MOUNT_FLAGS_READONLY = (1 << 1),
38-
LCFS_MOUNT_FLAGS_REQUIRE_FSVERITY_SIGNATURE = (1 << 2),
3938
LCFS_MOUNT_FLAGS_IDMAP = (1 << 3),
4039
LCFS_MOUNT_FLAGS_DISABLE_VERITY = (1 << 4),
4140

tools/mountcomposefs.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ int main(int argc, char **argv)
117117
const char *opt_workdir = NULL;
118118
bool opt_verity = false;
119119
bool opt_noverity = false;
120-
bool opt_signed = false;
121120
bool opt_ro = false;
122121
int opt, fd, res, userns_fd;
123122

@@ -172,8 +171,6 @@ int main(int argc, char **argv)
172171
opt_verity = true;
173172
} else if (strcmp("noverity", key) == 0) {
174173
opt_noverity = true;
175-
} else if (strcmp("signed", key) == 0) {
176-
opt_signed = true;
177174
} else if (strcmp("upperdir", key) == 0) {
178175
if (value == NULL)
179176
printexit("No value specified for upperdir option\n");
@@ -239,8 +236,6 @@ int main(int argc, char **argv)
239236
options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_VERITY;
240237
if (opt_noverity)
241238
options.flags |= LCFS_MOUNT_FLAGS_DISABLE_VERITY;
242-
if (opt_signed)
243-
options.flags |= LCFS_MOUNT_FLAGS_REQUIRE_FSVERITY_SIGNATURE;
244239
if (opt_ro)
245240
options.flags |= LCFS_MOUNT_FLAGS_READONLY;
246241

0 commit comments

Comments
 (0)