diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-01-03 12:34:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-03 12:34:55 +0100 |
| commit | 1dac8c7a01e2bdd35cb04eb4901ddb157291ac2d (patch) | |
| tree | e08c7d36d9d9c85b6cb0695a4fd8ea775b284e35 /pkg/csource/generated.go | |
| parent | f0036e181e274023235289be91e334cb7507eaa6 (diff) | |
executor: better prevent the panic on ext4 errors (#3604)
We already suppress them, but the current approach fails if syzkaller
slightly corrupts the options string. Do the check more rigorously.
Diffstat (limited to 'pkg/csource/generated.go')
| -rw-r--r-- | pkg/csource/generated.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 8c8fa8d22..955d7c971 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -6799,7 +6799,14 @@ static long syz_mount_image( if (strcmp(fs, "iso9660") == 0) { flags |= MS_RDONLY; } else if (strncmp(fs, "ext", 3) == 0) { - if (strstr(opts, "errors=panic") || strstr(opts, "errors=remount-ro") == 0) + bool has_remount_ro = false; + char* remount_ro_start = strstr(opts, "errors=remount-ro"); + if (remount_ro_start != NULL) { + char after = *(remount_ro_start + strlen("errors=remount-ro")); + char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1); + has_remount_ro = ((before == '\0' || before == ',') && (after == '\0' || after == ',')); + } + if (strstr(opts, "errors=panic") || !has_remount_ro) strcat(opts, ",errors=continue"); } else if (strcmp(fs, "xfs") == 0) { strcat(opts, ",nouuid"); |
