Skip to content

Commit 49804cf

Browse files
YHNdnzjkeszybz
authored andcommitted
gpt-auto: harden ESP/XBOOTLDR mounts with "noexec,nosuid,nodev"
When these partitions are probed by gpt-auto, they will always be hardened with such options. See also: systemd/systemd#25776 (comment) Closes #25776 (cherry picked from commit d708293)
1 parent 89e86ad commit 49804cf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/gpt-auto-generator/gpt-auto-generator.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,14 @@ static int add_automount(
414414
static const char *esp_or_xbootldr_options(const DissectedPartition *p) {
415415
assert(p);
416416

417-
/* if we probed vfat or have no idea about the file system then assume these file systems are vfat
418-
* and thus understand "umask=0077". If we detected something else then don't specify any options and
419-
* use kernel defaults. */
417+
/* Discoveried ESP and XBOOTLDR partition are always hardened with "noexec,nosuid,nodev".
418+
* If we probed vfat or have no idea about the file system then assume these file systems are vfat
419+
* and thus understand "umask=0077". */
420420

421421
if (!p->fstype || streq(p->fstype, "vfat"))
422-
return "umask=0077";
422+
return "umask=0077,noexec,nosuid,nodev";
423423

424-
return NULL;
424+
return "noexec,nosuid,nodev";
425425
}
426426

427427
static int add_partition_xbootldr(DissectedPartition *p) {

0 commit comments

Comments
 (0)