| 0/0 |
2026/06/01 09:23 |
flow |
assessment-security |
54m
Results: map[DenialOfService:true Explanation:**Analysis of the Bug Report**
The bug is a `BUG_ON` assertion failure in `gfs2_jindex_free` located in
`fs/gfs2/super.c`. The assertion `BUG_ON(jd->jd_log_bio);` ensures that there
are no pending block I/O operations (bios) on the journal descriptor when the
journal index is being freed. The crash occurs when a crafted GFS2 filesystem
image is mounted and subsequently unmounted (or fails during the mount process
and cleans up), leaving a pending bio that triggers the assertion.
**Exploitability and Denial of Service:**
The `BUG_ON` macro expands to a trap instruction (e.g., `ud2` on x86) that
immediately halts kernel execution and causes a panic. Even if the kernel is
compiled with `CONFIG_BUG` disabled, it falls back to an infinite loop, hanging
the CPU. In either case, it prevents any further execution, meaning it does not
lead to memory corruption, out-of-bounds accesses, or privilege escalation.
Therefore, it is **not exploitable** for code execution, but it reliably causes
a **Denial of Service (DoS)**.
**Access and Triggers:**
To trigger this bug, an attacker must be able to mount a malicious GFS2
filesystem image.
- **Unprivileged / User Namespaces:** The GFS2 filesystem does not have the
`FS_USERNS_MOUNT` flag set. This means it cannot be mounted inside a user
namespace. Mounting it requires `CAP_SYS_ADMIN` in the initial user namespace.
Thus, it is **not accessible from unprivileged processes or user namespaces**.
- **Malicious Filesystem / Peripheral Trigger:** The bug is explicitly triggered
by parsing a malicious filesystem image. If a system (such as a Linux desktop)
is configured to auto-mount external media, an attacker could trigger this by
plugging in a malicious USB drive.
- **VM Host Trigger:** In a Confidential Computing context, an untrusted VM host
can provide a malicious block device (e.g., via virtio-blk) to the protected
guest. When the guest kernel attempts to mount the filesystem, the host can
trigger this bug to crash the guest.
- **Network / Remote / VM Guest:** The bug involves local filesystem mounting
and cannot be triggered directly over the network, via remote protocols, or by a
guest attacking the host (since hosts do not mount guest-provided filesystems).
**Conclusion:**
This is a local Denial of Service vulnerability caused by a malicious filesystem
image. It requires elevated privileges to trigger directly but can be exploited
via physical access (USB auto-mount) or by a malicious hypervisor in a
confidential computing environment. Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:true]
|
| 1/1 |
2026/06/01 09:23 |
action |
syz-repro-to-c-repro |
0m
Results: map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/loop.h>
#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif
static unsigned long long procid;
//% This code is derived from puff.{c,h}, found in the zlib development. The
//% original files come with the following copyright notice:
//% Copyright (C) 2002-2013 Mark Adler, all rights reserved
//% version 2.3, 21 Jan 2013
//% This software is provided 'as-is', without any express or implied
//% warranty. In no event will the author be held liable for any damages
//% arising from the use of this software.
//% Permission is granted to anyone to use this software for any purpose,
//% including commercial applications, and to alter it and redistribute it
//% freely, subject to the following restrictions:
//% 1. The origin of this software must not be misrepresented; you must not
//% claim that you wrote the original software. If you use this software
//% in a product, an acknowledgment in the product documentation would be
//% appreciated but is not required.
//% 2. Altered source versions must be plainly marked as such, and must not be
//% misrepresented as being the original software.
//% 3. This notice may not be removed or altered from any source distribution.
//% Mark Adler madler@alumni.caltech.edu
//% BEGIN CODE DERIVED FROM puff.{c,h}
#define MAXBITS 15
#define MAXLCODES 286
#define MAXDCODES 30
#define MAXCODES (MAXLCODES + MAXDCODES)
#define FIXLCODES 288
struct puff_state {
unsigned char* out;
unsigned long outlen;
unsigned long outcnt;
const unsigned char* in;
unsigned long inlen;
unsigned long incnt;
int bitbuf;
int bitcnt;
jmp_buf env;
};
static int puff_bits(struct puff_state* s, int need)
{
long val = s->bitbuf;
while (s->bitcnt < need) {
if (s->incnt == s->inlen)
longjmp(s->env, 1);
val |= (long)(s->in[s->incnt++]) << s->bitcnt;
s->bitcnt += 8;
}
s->bitbuf = (int)(val >> need);
s->bitcnt -= need;
return (int)(val & ((1L << need) - 1));
}
static int puff_stored(struct puff_state* s)
{
s->bitbuf = 0;
s->bitcnt = 0;
if (s->incnt + 4 > s->inlen)
return 2;
unsigned len = s->in[s->incnt++];
len |= s->in[s->incnt++] << 8;
if (s->in[s->incnt++] != (~len & 0xff) ||
s->in[s->incnt++] != ((~len >> 8) & 0xff))
return -2;
if (s->incnt + len > s->inlen)
return 2;
if (s->outcnt + len > s->outlen)
return 1;
for (; len--; s->outcnt++, s->incnt++) {
if (s->in[s->incnt])
s->out[s->outcnt] = s->in[s->incnt];
}
return 0;
}
struct puff_huffman {
short* count;
short* symbol;
};
static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
{
int first = 0;
int index = 0;
int bitbuf = s->bitbuf;
int left = s->bitcnt;
int code = first = index = 0;
int len = 1;
short* next = h->count + 1;
while (1) {
while (left--) {
code |= bitbuf & 1;
bitbuf >>= 1;
int count = *next++;
if (code - count < first) {
s->bitbuf = bitbuf;
s->bitcnt = (s->bitcnt - len) & 7;
return h->symbol[index + (code - first)];
}
index += count;
first += count;
first <<= 1;
code <<= 1;
len++;
}
left = (MAXBITS + 1) - len;
if (left == 0)
break;
if (s->incnt == s->inlen)
longjmp(s->env, 1);
bitbuf = s->in[s->incnt++];
if (left > 8)
left = 8;
}
return -10;
}
static int puff_construct(struct puff_huffman* h, const short* length, int n)
{
int len;
for (len = 0; len <= MAXBITS; len++)
h->count[len] = 0;
int symbol;
for (symbol = 0; symbol < n; symbol++)
(h->count[length[symbol]])++;
if (h->count[0] == n)
return 0;
int left = 1;
for (len = 1; len <= MAXBITS; len++) {
left <<= 1;
left -= h->count[len];
if (left < 0)
return left;
}
short offs[MAXBITS + 1];
offs[1] = 0;
for (len = 1; len < MAXBITS; len++)
offs[len + 1] = offs[len] + h->count[len];
for (symbol = 0; symbol < n; symbol++)
if (length[symbol] != 0)
h->symbol[offs[length[symbol]]++] = symbol;
return left;
}
static int puff_codes(struct puff_state* s,
const struct puff_huffman* lencode,
const struct puff_huffman* distcode)
{
static const short lens[29] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
static const short lext[29] = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
static const short dists[30] = {
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577};
static const short dext[30] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
12, 12, 13, 13};
int symbol;
do {
symbol = puff_decode(s, lencode);
if (symbol < 0)
return symbol;
if (symbol < 256) {
if (s->outcnt == s->outlen)
return 1;
if (symbol)
s->out[s->outcnt] = symbol;
s->outcnt++;
} else if (symbol > 256) {
symbol -= 257;
if (symbol >= 29)
return -10;
int len = lens[symbol] + puff_bits(s, lext[symbol]);
symbol = puff_decode(s, distcode);
if (symbol < 0)
return symbol;
unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
if (dist > s->outcnt)
return -11;
if (s->outcnt + len > s->outlen)
return 1;
while (len--) {
if (dist <= s->outcnt && s->out[s->outcnt - dist])
s->out[s->outcnt] = s->out[s->outcnt - dist];
s->outcnt++;
}
}
} while (symbol != 256);
return 0;
}
static int puff_fixed(struct puff_state* s)
{
static int virgin = 1;
static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
static struct puff_huffman lencode, distcode;
if (virgin) {
lencode.count = lencnt;
lencode.symbol = lensym;
distcode.count = distcnt;
distcode.symbol = distsym;
short lengths[FIXLCODES];
int symbol;
for (symbol = 0; symbol < 144; symbol++)
lengths[symbol] = 8;
for (; symbol < 256; symbol++)
lengths[symbol] = 9;
for (; symbol < 280; symbol++)
lengths[symbol] = 7;
for (; symbol < FIXLCODES; symbol++)
lengths[symbol] = 8;
puff_construct(&lencode, lengths, FIXLCODES);
for (symbol = 0; symbol < MAXDCODES; symbol++)
lengths[symbol] = 5;
puff_construct(&distcode, lengths, MAXDCODES);
virgin = 0;
}
return puff_codes(s, &lencode, &distcode);
}
static int puff_dynamic(struct puff_state* s)
{
static const short order[19] =
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
int nlen = puff_bits(s, 5) + 257;
int ndist = puff_bits(s, 5) + 1;
int ncode = puff_bits(s, 4) + 4;
if (nlen > MAXLCODES || ndist > MAXDCODES)
return -3;
short lengths[MAXCODES];
int index;
for (index = 0; index < ncode; index++)
lengths[order[index]] = puff_bits(s, 3);
for (; index < 19; index++)
lengths[order[index]] = 0;
short lencnt[MAXBITS + 1], lensym[MAXLCODES];
struct puff_huffman lencode = {lencnt, lensym};
int err = puff_construct(&lencode, lengths, 19);
if (err != 0)
return -4;
index = 0;
while (index < nlen + ndist) {
int symbol;
int len;
symbol = puff_decode(s, &lencode);
if (symbol < 0)
return symbol;
if (symbol < 16)
lengths[index++] = symbol;
else {
len = 0;
if (symbol == 16) {
if (index == 0)
return -5;
len = lengths[index - 1];
symbol = 3 + puff_bits(s, 2);
} else if (symbol == 17)
symbol = 3 + puff_bits(s, 3);
else
symbol = 11 + puff_bits(s, 7);
if (index + symbol > nlen + ndist)
return -6;
while (symbol--)
lengths[index++] = len;
}
}
if (lengths[256] == 0)
return -9;
err = puff_construct(&lencode, lengths, nlen);
if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
return -7;
short distcnt[MAXBITS + 1], distsym[MAXDCODES];
struct puff_huffman distcode = {distcnt, distsym};
err = puff_construct(&distcode, lengths + nlen, ndist);
if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
return -8;
return puff_codes(s, &lencode, &distcode);
}
static int puff(
unsigned char* dest,
unsigned long* destlen,
const unsigned char* source,
unsigned long sourcelen)
{
struct puff_state s = {
.out = dest,
.outlen = *destlen,
.outcnt = 0,
.in = source,
.inlen = sourcelen,
.incnt = 0,
.bitbuf = 0,
.bitcnt = 0,
};
int err;
if (setjmp(s.env) != 0)
err = 2;
else {
int last;
do {
last = puff_bits(&s, 1);
int type = puff_bits(&s, 2);
err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1));
if (err != 0)
break;
} while (!last);
}
*destlen = s.outcnt;
return err;
}
//% END CODE DERIVED FROM puff.{c,h}
#define ZLIB_HEADER_WIDTH 2
static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd)
{
if (sourcelen < ZLIB_HEADER_WIDTH)
return 0;
source += ZLIB_HEADER_WIDTH;
sourcelen -= ZLIB_HEADER_WIDTH;
const unsigned long max_destlen = 132 << 20;
void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0);
if (ret == MAP_FAILED)
return -1;
unsigned char* dest = (unsigned char*)ret;
unsigned long destlen = max_destlen;
int err = puff(dest, &destlen, source, sourcelen);
if (err) {
munmap(dest, max_destlen);
errno = -err;
return -1;
}
if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
munmap(dest, max_destlen);
return -1;
}
return munmap(dest, max_destlen);
}
static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p)
{
int err = 0, loopfd = -1;
int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
if (memfd == -1) {
err = errno;
goto error;
}
if (puff_zlib_to_file(data, size, memfd)) {
err = errno;
goto error_close_memfd;
}
loopfd = open(loopname, O_RDWR);
if (loopfd == -1) {
err = errno;
goto error_close_memfd;
}
if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
if (errno != EBUSY) {
err = errno;
goto error_close_loop;
}
ioctl(loopfd, LOOP_CLR_FD, 0);
usleep(1000);
if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
err = errno;
goto error_close_loop;
}
}
close(memfd);
*loopfd_p = loopfd;
return 0;
error_close_loop:
close(loopfd);
error_close_memfd:
close(memfd);
error:
errno = err;
return -1;
}
static void reset_loop_device(const char* loopname)
{
int loopfd = open(loopname, O_RDWR);
if (loopfd == -1) {
return;
}
if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
}
close(loopfd);
}
static long syz_mount_image(
volatile long fsarg,
volatile long dir,
volatile long flags,
volatile long optsarg,
volatile long change_dir,
volatile unsigned long size,
volatile long image)
{
unsigned char* data = (unsigned char*)image;
int res = -1, err = 0, need_loop_device = !!size;
char* mount_opts = (char*)optsarg;
char* target = (char*)dir;
char* fs = (char*)fsarg;
char* source = NULL;
char loopname[64];
if (need_loop_device) {
int loopfd;
memset(loopname, 0, sizeof(loopname));
snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
if (setup_loop_device(data, size, loopname, &loopfd) == -1)
return -1;
close(loopfd);
source = loopname;
}
mkdir(target, 0777);
char opts[256];
memset(opts, 0, sizeof(opts));
if (strlen(mount_opts) > (sizeof(opts) - 32)) {
}
strncpy(opts, mount_opts, sizeof(opts) - 32);
if (strcmp(fs, "iso9660") == 0) {
flags |= MS_RDONLY;
} else if (strncmp(fs, "ext", 3) == 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");
} else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
strcat(opts, ",errors=withdraw");
}
res = mount(source, target, fs, flags, opts);
if (res == -1) {
err = errno;
goto error_clear_loop;
}
res = open(target, O_RDONLY | O_DIRECTORY);
if (res == -1) {
err = errno;
goto error_clear_loop;
}
if (change_dir) {
res = chdir(target);
if (res == -1) {
err = errno;
}
}
error_clear_loop:
if (need_loop_device)
reset_loop_device(loopname);
errno = err;
return res;
}
uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// syz_mount_image$gfs2 arguments: [
// fs: ptr[in, buffer] {
// buffer: {67 66 73 32 00} (length 0x5)
// }
// dir: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
// }
// flags: mount_flags = 0x0 (8 bytes)
// opts: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {00} (length 0x1)
// }
// }
// }
// chdir: int8 = 0x1 (1 bytes)
// size: len = 0x12588 (8 bytes)
// img: ptr[in, buffer] {
// buffer: (compressed buffer with length 0x12588)
// }
// ]
// returns fd_dir
memcpy((void*)0x2000000124c0, "gfs2\000", 5);
memcpy((void*)0x200000012500, "./file0\000", 8);
memset((void*)0x200000000000, 0, 1);
memcpy((void*)0x200000024ac0, "... [truncated large byte array] ...", 75144);
syz_mount_image(/*fs=*/0x2000000124c0, /*dir=*/0x200000012500, /*flags=*/0, /*opts=*/0x200000000000, /*chdir=*/1, /*size=*/0x12588, /*img=*/0x200000024ac0);
// openat arguments: [
// fd: fd_dir (resource)
// file: ptr[in, buffer] {
// buffer: {2e 00} (length 0x2)
// }
// flags: open_flags = 0x0 (4 bytes)
// mode: open_mode = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000240, ".\000", 2);
res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000240ul, /*flags=*/0, /*mode=*/0);
if (res != -1)
r[0] = res;
// ioctl$FS_IOC_REMOVE_ENCRYPTION_KEY arguments: [
// fd: fd_dir (resource)
// cmd: const = 0x40086602 (4 bytes)
// arg: ptr[inout, fscrypt_remove_key_arg] {
// fscrypt_remove_key_arg {
// key_spec: union fscrypt_key_specifier {
// desc: fscrypt_key_specifier__by_descriptor {
// type: const = 0x4000 (4 bytes)
// reserved: const = 0x0 (4 bytes)
// descriptor: union fscrypt_key_descriptor {
// auto: buffer: {b8 f9 24 16 07 4d 38 48} (length 0x8)
// }
// reserved2: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x18)
// }
// }
// removal_status_flags: int32 = 0x0 (4 bytes)
// reserved: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x14)
// }
// }
// ]
*(uint32_t*)0x200000000980 = 0x4000;
*(uint32_t*)0x200000000984 = 0;
memcpy((void*)0x200000000988, "\xb8\xf9\x24\x16\x07\x4d\x38\x48", 8);
memset((void*)0x200000000990, 0, 24);
memset((void*)0x2000000009ac, 0, 20);
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40086602, /*arg=*/0x200000000980ul);
// open arguments: [
// file: ptr[in, buffer] {
// buffer: {2e 2f 62 75 73 00} (length 0x6)
// }
// flags: open_flags = 0x60041 (8 bytes)
// mode: open_mode = 0x96c1fa2a2d9f1dea (8 bytes)
// ]
// returns fd
memcpy((void*)0x200000000000, "./bus\000", 6);
res = syscall(__NR_open, /*file=*/0x200000000000ul, /*flags=O_NOFOLLOW|O_NOATIME|O_CREAT|O_WRONLY*/0x60041ul, /*mode=S_IWOTH|S_IXGRP|S_IRGRP|S_IXUSR|S_IWUSR|S_IRUSR|0x96c1fa2a2d9f1c00*/0x96c1fa2a2d9f1deaul);
if (res != -1)
r[1] = res;
// ftruncate arguments: [
// fd: fd (resource)
// len: intptr = 0xdfc5 (8 bytes)
// ]
syscall(__NR_ftruncate, /*fd=*/r[1], /*len=*/0xdfc5ul);
// write$dsp arguments: [
// fd: fd_dsp (resource)
// data: ptr[in, buffer] {
// buffer: {6e} (length 0x1)
// }
// len: bytesize = 0x1 (8 bytes)
// ]
memset((void*)0x200000000100, 110, 1);
syscall(__NR_write, /*fd=*/r[1], /*data=*/0x200000000100ul, /*len=*/1ul);
// getegid arguments: [
// ]
// returns gid
res = syscall(__NR_getegid);
if (res != -1)
r[2] = res;
// fchown arguments: [
// fd: fd (resource)
// uid: uid (resource)
// gid: gid (resource)
// ]
syscall(__NR_fchown, /*fd=*/r[0], /*uid=*/0, /*gid=*/r[2]);
// ioctl$SCSI_IOCTL_SEND_COMMAND arguments: [
// fd: fd_sg (resource)
// cmd: const = 0x1 (4 bytes)
// arg: ptr[in, scsi_ioctl_command] {
// scsi_ioctl_command {
// inlen: len = 0x0 (4 bytes)
// outlen: int32 = 0x9 (4 bytes)
// opcode: int32 = 0x3 (4 bytes)
// data: buffer: {} (length 0x0)
// }
// }
// ]
*(uint32_t*)0x200000000280 = 0;
*(uint32_t*)0x200000000284 = 9;
*(uint32_t*)0x200000000288 = 3;
syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/1, /*arg=*/0x200000000280ul);
// ioctl$XFS_IOC_SWAPEXT arguments: [
// fd: fd (resource)
// cmd: const = 0xc0c0586d (4 bytes)
// arg: ptr[in, xfs_swapext] {
// xfs_swapext {
// sx_version: const = 0x0 (8 bytes)
// sx_fdtarget: fd (resource)
// sx_fdtmp: fd (resource)
// sx_offset: int64 = 0x3 (8 bytes)
// sx_length: int64 = 0xfffffffffffffff8 (8 bytes)
// sx_pad: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// sx_stat: xfs_bstat {
// bs_ino: int64 = 0xaa6a (8 bytes)
// bs_mode: int16 = 0x2 (2 bytes)
// bs_nlink: int16 = 0x3660 (2 bytes)
// bs_uid: int32 = 0x3 (4 bytes)
// bs_gid: int32 = 0xffff (4 bytes)
// bs_rdev: int32 = 0x8280 (4 bytes)
// bs_blksize: int32 = 0xfff (4 bytes)
// pad = 0x0 (4 bytes)
// bs_size: int64 = 0x6 (8 bytes)
// bs_atime: xfs_bstime {
// tv_sec: intptr = 0xa (8 bytes)
// tv_nsec: int32 = 0x8 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// bs_mtime: xfs_bstime {
// tv_sec: intptr = 0x0 (8 bytes)
// tv_nsec: int32 = 0x2 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// bs_ctime: xfs_bstime {
// tv_sec: intptr = 0xfdd (8 bytes)
// tv_nsec: int32 = 0x9 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// bs_blocks: int64 = 0xb (8 bytes)
// bs_xflags: int32 = 0x6 (4 bytes)
// bs_extsize: int32 = 0x7fffffff (4 bytes)
// bs_extents: int32 = 0x2 (4 bytes)
// bs_gen: int32 = 0x9eb (4 bytes)
// bs_projid_lo: int16 = 0x5 (2 bytes)
// bs_forkoff: int16 = 0x9d (2 bytes)
// bs_projid_hi: int16 = 0x9 (2 bytes)
// bs_sick: int16 = 0x45c (2 bytes)
// bs_checked: int16 = 0xf000 (2 bytes)
// bs_pad: buffer: {00 00} (length 0x2)
// bs_cowextsize: int32 = 0x8 (4 bytes)
// bs_dmevmask: int32 = 0x8 (4 bytes)
// bs_dmstate: int16 = 0x8 (2 bytes)
// bs_aextents: int16 = 0x6 (2 bytes)
// }
// }
// }
// ]
*(uint64_t*)0x200000000140 = 0;
*(uint32_t*)0x200000000148 = r[0];
*(uint32_t*)0x20000000014c = -1;
*(uint64_t*)0x200000000150 = 3;
*(uint64_t*)0x200000000158 = 0xfffffffffffffff8;
memset((void*)0x200000000160, 0, 16);
*(uint64_t*)0x200000000170 = 0xaa6a;
*(uint16_t*)0x200000000178 = 2;
*(uint16_t*)0x20000000017a = 0x3660;
*(uint32_t*)0x20000000017c = 3;
*(uint32_t*)0x200000000180 = 0xffff;
*(uint32_t*)0x200000000184 = 0x8280;
*(uint32_t*)0x200000000188 = 0xfff;
*(uint64_t*)0x200000000190 = 6;
*(uint64_t*)0x200000000198 = 0xa;
*(uint32_t*)0x2000000001a0 = 8;
*(uint64_t*)0x2000000001a8 = 0;
*(uint32_t*)0x2000000001b0 = 2;
*(uint64_t*)0x2000000001b8 = 0xfdd;
*(uint32_t*)0x2000000001c0 = 9;
*(uint64_t*)0x2000000001c8 = 0xb;
*(uint32_t*)0x2000000001d0 = 6;
*(uint32_t*)0x2000000001d4 = 0x7fffffff;
*(uint32_t*)0x2000000001d8 = 2;
*(uint32_t*)0x2000000001dc = 0x9eb;
*(uint16_t*)0x2000000001e0 = 5;
*(uint16_t*)0x2000000001e2 = 0x9d;
*(uint16_t*)0x2000000001e4 = 9;
*(uint16_t*)0x2000000001e6 = 0x45c;
*(uint16_t*)0x2000000001e8 = 0xf000;
memset((void*)0x2000000001ea, 0, 2);
*(uint32_t*)0x2000000001ec = 8;
*(uint32_t*)0x2000000001f0 = 8;
*(uint16_t*)0x2000000001f4 = 8;
*(uint16_t*)0x2000000001f6 = 6;
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0xc0c0586d, /*arg=*/0x200000000140ul);
return 0;
}
]
|
| 2/1 |
2026/06/01 09:23 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/5b91b02ef83b234bb9462f3f62b8bd06b464863a]
|
| 3/1 |
2026/06/01 09:25 |
action |
kernel-builder |
30m
Results: map[KernelObj:/app/workdir/cache/build/86568be860ca24b71f621adf91854371d9877412]
|
| 4/1 |
2026/06/01 09:55 |
action |
codesearch-prepare |
20m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/06/01 10:15 |
agent |
expert |
1m
Model:
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:true]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption or elevated privileges.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
The kernel bug report is:
------------[ cut here ]------------
kernel BUG at fs/gfs2/super.c:76!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5452 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:gfs2_jindex_free+0x44e/0x450 fs/gfs2/super.c:76
Code: cc cc cc cc cc 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c e2 fd ff ff e8 c2 57 0c fe e9 d8 fd ff ff e8 98 9f 8a 07 e8 43 87 a0 fd 90 <0f> 0b 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 40 d6
RSP: 0018:ffffc90001f5fbc0 EFLAGS: 00010293
RAX: ffffffff842521cd RBX: dead000000000122 RCX: ffff888000e4c980
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 00000000ffffffff
RBP: ffffc90001f5fc80 R08: ffff888012200e37 R09: 1ffff110024401c6
R10: dffffc0000000000 R11: ffffed10024401c7 R12: ffff888012200908
R13: dffffc0000000000 R14: ffff888011bbc500 R15: ffff888011bbc578
FS: 000055557537c500(0000) GS:ffff88808ca58000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005623e4b72b68 CR3: 000000001f876000 CR4: 0000000000352ef0
Call Trace:
<TASK>
gfs2_put_super+0x7d9/0x860 fs/gfs2/super.c:638
generic_shutdown_super+0x13d/0x2d0 fs/super.c:646
kill_block_super+0x44/0x90 fs/super.c:1725
deactivate_locked_super+0xbc/0x130 fs/super.c:476
cleanup_mnt+0x437/0x4d0 fs/namespace.c:1312
task_work_run+0x1d9/0x270 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:67 [inline]
exit_to_user_mode_loop+0xed/0x480 kernel/entry/common.c:98
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:325 [inline]
do_syscall_64+0x32d/0xf80 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd8c019d9d7
Code: a2 c7 05 1c ed 24 00 00 00 00 00 eb 96 e8 e1 12 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007fffb35ab3a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 00007fd8c0231f90 RCX: 00007fd8c019d9d7
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007fffb35ab460
RBP: 00007fffb35ab460 R08: 00007fffb35ac460 R09: 00000000ffffffff
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffb35ac4f0
R13: 00007fd8c0231f90 R14: 000000000001f004 R15: 00007fffb35ac530
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:gfs2_jindex_free+0x44e/0x450 fs/gfs2/super.c:76
Code: cc cc cc cc cc 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c e2 fd ff ff e8 c2 57 0c fe e9 d8 fd ff ff e8 98 9f 8a 07 e8 43 87 a0 fd 90 <0f> 0b 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 40 d6
RSP: 0018:ffffc90001f5fbc0 EFLAGS: 00010293
RAX: ffffffff842521cd RBX: dead000000000122 RCX: ffff888000e4c980
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 00000000ffffffff
RBP: ffffc90001f5fc80 R08: ffff888012200e37 R09: 1ffff110024401c6
R10: dffffc0000000000 R11: ffffed10024401c7 R12: ffff888012200908
R13: dffffc0000000000 R14: ffff888011bbc500 R15: ffff888011bbc578
FS: 000055557537c500(0000) GS:ffff88808ca58000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005623e4b72b68 CR3: 000000001f876000 CR4: 0000000000352ef0
It is reproducible with the followint program.
Keep in mind that it may lack the precise threading, sandboxing, and some arguments of a working reproducer.
But it should give an idea of the involved syscalls.
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/loop.h>
#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif
static unsigned long long procid;
//% This code is derived from puff.{c,h}, found in the zlib development. The
//% original files come with the following copyright notice:
//% Copyright (C) 2002-2013 Mark Adler, all rights reserved
//% version 2.3, 21 Jan 2013
//% This software is provided 'as-is', without any express or implied
//% warranty. In no event will the author be held liable for any damages
//% arising from the use of this software.
//% Permission is granted to anyone to use this software for any purpose,
//% including commercial applications, and to alter it and redistribute it
//% freely, subject to the following restrictions:
//% 1. The origin of this software must not be misrepresented; you must not
//% claim that you wrote the original software. If you use this software
//% in a product, an acknowledgment in the product documentation would be
//% appreciated but is not required.
//% 2. Altered source versions must be plainly marked as such, and must not be
//% misrepresented as being the original software.
//% 3. This notice may not be removed or altered from any source distribution.
//% Mark Adler madler@alumni.caltech.edu
//% BEGIN CODE DERIVED FROM puff.{c,h}
#define MAXBITS 15
#define MAXLCODES 286
#define MAXDCODES 30
#define MAXCODES (MAXLCODES + MAXDCODES)
#define FIXLCODES 288
struct puff_state {
unsigned char* out;
unsigned long outlen;
unsigned long outcnt;
const unsigned char* in;
unsigned long inlen;
unsigned long incnt;
int bitbuf;
int bitcnt;
jmp_buf env;
};
static int puff_bits(struct puff_state* s, int need)
{
long val = s->bitbuf;
while (s->bitcnt < need) {
if (s->incnt == s->inlen)
longjmp(s->env, 1);
val |= (long)(s->in[s->incnt++]) << s->bitcnt;
s->bitcnt += 8;
}
s->bitbuf = (int)(val >> need);
s->bitcnt -= need;
return (int)(val & ((1L << need) - 1));
}
static int puff_stored(struct puff_state* s)
{
s->bitbuf = 0;
s->bitcnt = 0;
if (s->incnt + 4 > s->inlen)
return 2;
unsigned len = s->in[s->incnt++];
len |= s->in[s->incnt++] << 8;
if (s->in[s->incnt++] != (~len & 0xff) ||
s->in[s->incnt++] != ((~len >> 8) & 0xff))
return -2;
if (s->incnt + len > s->inlen)
return 2;
if (s->outcnt + len > s->outlen)
return 1;
for (; len--; s->outcnt++, s->incnt++) {
if (s->in[s->incnt])
s->out[s->outcnt] = s->in[s->incnt];
}
return 0;
}
struct puff_huffman {
short* count;
short* symbol;
};
static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
{
int first = 0;
int index = 0;
int bitbuf = s->bitbuf;
int left = s->bitcnt;
int code = first = index = 0;
int len = 1;
short* next = h->count + 1;
while (1) {
while (left--) {
code |= bitbuf & 1;
bitbuf >>= 1;
int count = *next++;
if (code - count < first) {
s->bitbuf = bitbuf;
s->bitcnt = (s->bitcnt - len) & 7;
return h->symbol[index + (code - first)];
}
index += count;
first += count;
first <<= 1;
code <<= 1;
len++;
}
left = (MAXBITS + 1) - len;
if (left == 0)
break;
if (s->incnt == s->inlen)
longjmp(s->env, 1);
bitbuf = s->in[s->incnt++];
if (left > 8)
left = 8;
}
return -10;
}
static int puff_construct(struct puff_huffman* h, const short* length, int n)
{
int len;
for (len = 0; len <= MAXBITS; len++)
h->count[len] = 0;
int symbol;
for (symbol = 0; symbol < n; symbol++)
(h->count[length[symbol]])++;
if (h->count[0] == n)
return 0;
int left = 1;
for (len = 1; len <= MAXBITS; len++) {
left <<= 1;
left -= h->count[len];
if (left < 0)
return left;
}
short offs[MAXBITS + 1];
offs[1] = 0;
for (len = 1; len < MAXBITS; len++)
offs[len + 1] = offs[len] + h->count[len];
for (symbol = 0; symbol < n; symbol++)
if (length[symbol] != 0)
h->symbol[offs[length[symbol]]++] = symbol;
return left;
}
static int puff_codes(struct puff_state* s,
const struct puff_huffman* lencode,
const struct puff_huffman* distcode)
{
static const short lens[29] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258};
static const short lext[29] = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
static const short dists[30] = {
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577};
static const short dext[30] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
12, 12, 13, 13};
int symbol;
do {
symbol = puff_decode(s, lencode);
if (symbol < 0)
return symbol;
if (symbol < 256) {
if (s->outcnt == s->outlen)
return 1;
if (symbol)
s->out[s->outcnt] = symbol;
s->outcnt++;
} else if (symbol > 256) {
symbol -= 257;
if (symbol >= 29)
return -10;
int len = lens[symbol] + puff_bits(s, lext[symbol]);
symbol = puff_decode(s, distcode);
if (symbol < 0)
return symbol;
unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
if (dist > s->outcnt)
return -11;
if (s->outcnt + len > s->outlen)
return 1;
while (len--) {
if (dist <= s->outcnt && s->out[s->outcnt - dist])
s->out[s->outcnt] = s->out[s->outcnt - dist];
s->outcnt++;
}
}
} while (symbol != 256);
return 0;
}
static int puff_fixed(struct puff_state* s)
{
static int virgin = 1;
static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
static struct puff_huffman lencode, distcode;
if (virgin) {
lencode.count = lencnt;
lencode.symbol = lensym;
distcode.count = distcnt;
distcode.symbol = distsym;
short lengths[FIXLCODES];
int symbol;
for (symbol = 0; symbol < 144; symbol++)
lengths[symbol] = 8;
for (; symbol < 256; symbol++)
lengths[symbol] = 9;
for (; symbol < 280; symbol++)
lengths[symbol] = 7;
for (; symbol < FIXLCODES; symbol++)
lengths[symbol] = 8;
puff_construct(&lencode, lengths, FIXLCODES);
for (symbol = 0; symbol < MAXDCODES; symbol++)
lengths[symbol] = 5;
puff_construct(&distcode, lengths, MAXDCODES);
virgin = 0;
}
return puff_codes(s, &lencode, &distcode);
}
static int puff_dynamic(struct puff_state* s)
{
static const short order[19] =
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
int nlen = puff_bits(s, 5) + 257;
int ndist = puff_bits(s, 5) + 1;
int ncode = puff_bits(s, 4) + 4;
if (nlen > MAXLCODES || ndist > MAXDCODES)
return -3;
short lengths[MAXCODES];
int index;
for (index = 0; index < ncode; index++)
lengths[order[index]] = puff_bits(s, 3);
for (; index < 19; index++)
lengths[order[index]] = 0;
short lencnt[MAXBITS + 1], lensym[MAXLCODES];
struct puff_huffman lencode = {lencnt, lensym};
int err = puff_construct(&lencode, lengths, 19);
if (err != 0)
return -4;
index = 0;
while (index < nlen + ndist) {
int symbol;
int len;
symbol = puff_decode(s, &lencode);
if (symbol < 0)
return symbol;
if (symbol < 16)
lengths[index++] = symbol;
else {
len = 0;
if (symbol == 16) {
if (index == 0)
return -5;
len = lengths[index - 1];
symbol = 3 + puff_bits(s, 2);
} else if (symbol == 17)
symbol = 3 + puff_bits(s, 3);
else
symbol = 11 + puff_bits(s, 7);
if (index + symbol > nlen + ndist)
return -6;
while (symbol--)
lengths[index++] = len;
}
}
if (lengths[256] == 0)
return -9;
err = puff_construct(&lencode, lengths, nlen);
if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
return -7;
short distcnt[MAXBITS + 1], distsym[MAXDCODES];
struct puff_huffman distcode = {distcnt, distsym};
err = puff_construct(&distcode, lengths + nlen, ndist);
if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
return -8;
return puff_codes(s, &lencode, &distcode);
}
static int puff(
unsigned char* dest,
unsigned long* destlen,
const unsigned char* source,
unsigned long sourcelen)
{
struct puff_state s = {
.out = dest,
.outlen = *destlen,
.outcnt = 0,
.in = source,
.inlen = sourcelen,
.incnt = 0,
.bitbuf = 0,
.bitcnt = 0,
};
int err;
if (setjmp(s.env) != 0)
err = 2;
else {
int last;
do {
last = puff_bits(&s, 1);
int type = puff_bits(&s, 2);
err = type == 0 ? puff_stored(&s) : (type == 1 ? puff_fixed(&s) : (type == 2 ? puff_dynamic(&s) : -1));
if (err != 0)
break;
} while (!last);
}
*destlen = s.outcnt;
return err;
}
//% END CODE DERIVED FROM puff.{c,h}
#define ZLIB_HEADER_WIDTH 2
static int puff_zlib_to_file(const unsigned char* source, unsigned long sourcelen, int dest_fd)
{
if (sourcelen < ZLIB_HEADER_WIDTH)
return 0;
source += ZLIB_HEADER_WIDTH;
sourcelen -= ZLIB_HEADER_WIDTH;
const unsigned long max_destlen = 132 << 20;
void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0);
if (ret == MAP_FAILED)
return -1;
unsigned char* dest = (unsigned char*)ret;
unsigned long destlen = max_destlen;
int err = puff(dest, &destlen, source, sourcelen);
if (err) {
munmap(dest, max_destlen);
errno = -err;
return -1;
}
if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
munmap(dest, max_destlen);
return -1;
}
return munmap(dest, max_destlen);
}
static int setup_loop_device(unsigned char* data, unsigned long size, const char* loopname, int* loopfd_p)
{
int err = 0, loopfd = -1;
int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
if (memfd == -1) {
err = errno;
goto error;
}
if (puff_zlib_to_file(data, size, memfd)) {
err = errno;
goto error_close_memfd;
}
loopfd = open(loopname, O_RDWR);
if (loopfd == -1) {
err = errno;
goto error_close_memfd;
}
if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
if (errno != EBUSY) {
err = errno;
goto error_close_loop;
}
ioctl(loopfd, LOOP_CLR_FD, 0);
usleep(1000);
if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
err = errno;
goto error_close_loop;
}
}
close(memfd);
*loopfd_p = loopfd;
return 0;
error_close_loop:
close(loopfd);
error_close_memfd:
close(memfd);
error:
errno = err;
return -1;
}
static void reset_loop_device(const char* loopname)
{
int loopfd = open(loopname, O_RDWR);
if (loopfd == -1) {
return;
}
if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
}
close(loopfd);
}
static long syz_mount_image(
volatile long fsarg,
volatile long dir,
volatile long flags,
volatile long optsarg,
volatile long change_dir,
volatile unsigned long size,
volatile long image)
{
unsigned char* data = (unsigned char*)image;
int res = -1, err = 0, need_loop_device = !!size;
char* mount_opts = (char*)optsarg;
char* target = (char*)dir;
char* fs = (char*)fsarg;
char* source = NULL;
char loopname[64];
if (need_loop_device) {
int loopfd;
memset(loopname, 0, sizeof(loopname));
snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
if (setup_loop_device(data, size, loopname, &loopfd) == -1)
return -1;
close(loopfd);
source = loopname;
}
mkdir(target, 0777);
char opts[256];
memset(opts, 0, sizeof(opts));
if (strlen(mount_opts) > (sizeof(opts) - 32)) {
}
strncpy(opts, mount_opts, sizeof(opts) - 32);
if (strcmp(fs, "iso9660") == 0) {
flags |= MS_RDONLY;
} else if (strncmp(fs, "ext", 3) == 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");
} else if (strncmp(fs, "gfs2", 4) == 0 && (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
strcat(opts, ",errors=withdraw");
}
res = mount(source, target, fs, flags, opts);
if (res == -1) {
err = errno;
goto error_clear_loop;
}
res = open(target, O_RDONLY | O_DIRECTORY);
if (res == -1) {
err = errno;
goto error_clear_loop;
}
if (change_dir) {
res = chdir(target);
if (res == -1) {
err = errno;
}
}
error_clear_loop:
if (need_loop_device)
reset_loop_device(loopname);
errno = err;
return res;
}
uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0x0};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// syz_mount_image$gfs2 arguments: [
// fs: ptr[in, buffer] {
// buffer: {67 66 73 32 00} (length 0x5)
// }
// dir: ptr[in, buffer] {
// buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
// }
// flags: mount_flags = 0x0 (8 bytes)
// opts: ptr[inout, array[ANYUNION]] {
// array[ANYUNION] {
// union ANYUNION {
// ANYBLOB: buffer: {00} (length 0x1)
// }
// }
// }
// chdir: int8 = 0x1 (1 bytes)
// size: len = 0x12588 (8 bytes)
// img: ptr[in, buffer] {
// buffer: (compressed buffer with length 0x12588)
// }
// ]
// returns fd_dir
memcpy((void*)0x2000000124c0, "gfs2\000", 5);
memcpy((void*)0x200000012500, "./file0\000", 8);
memset((void*)0x200000000000, 0, 1);
memcpy((void*)0x200000024ac0, "... [truncated large byte array] ...", 75144);
syz_mount_image(/*fs=*/0x2000000124c0, /*dir=*/0x200000012500, /*flags=*/0, /*opts=*/0x200000000000, /*chdir=*/1, /*size=*/0x12588, /*img=*/0x200000024ac0);
// openat arguments: [
// fd: fd_dir (resource)
// file: ptr[in, buffer] {
// buffer: {2e 00} (length 0x2)
// }
// flags: open_flags = 0x0 (4 bytes)
// mode: open_mode = 0x0 (2 bytes)
// ]
// returns fd
memcpy((void*)0x200000000240, ".\000", 2);
res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0x200000000240ul, /*flags=*/0, /*mode=*/0);
if (res != -1)
r[0] = res;
// ioctl$FS_IOC_REMOVE_ENCRYPTION_KEY arguments: [
// fd: fd_dir (resource)
// cmd: const = 0x40086602 (4 bytes)
// arg: ptr[inout, fscrypt_remove_key_arg] {
// fscrypt_remove_key_arg {
// key_spec: union fscrypt_key_specifier {
// desc: fscrypt_key_specifier__by_descriptor {
// type: const = 0x4000 (4 bytes)
// reserved: const = 0x0 (4 bytes)
// descriptor: union fscrypt_key_descriptor {
// auto: buffer: {b8 f9 24 16 07 4d 38 48} (length 0x8)
// }
// reserved2: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x18)
// }
// }
// removal_status_flags: int32 = 0x0 (4 bytes)
// reserved: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x14)
// }
// }
// ]
*(uint32_t*)0x200000000980 = 0x4000;
*(uint32_t*)0x200000000984 = 0;
memcpy((void*)0x200000000988, "\xb8\xf9\x24\x16\x07\x4d\x38\x48", 8);
memset((void*)0x200000000990, 0, 24);
memset((void*)0x2000000009ac, 0, 20);
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40086602, /*arg=*/0x200000000980ul);
// open arguments: [
// file: ptr[in, buffer] {
// buffer: {2e 2f 62 75 73 00} (length 0x6)
// }
// flags: open_flags = 0x60041 (8 bytes)
// mode: open_mode = 0x96c1fa2a2d9f1dea (8 bytes)
// ]
// returns fd
memcpy((void*)0x200000000000, "./bus\000", 6);
res = syscall(__NR_open, /*file=*/0x200000000000ul, /*flags=O_NOFOLLOW|O_NOATIME|O_CREAT|O_WRONLY*/0x60041ul, /*mode=S_IWOTH|S_IXGRP|S_IRGRP|S_IXUSR|S_IWUSR|S_IRUSR|0x96c1fa2a2d9f1c00*/0x96c1fa2a2d9f1deaul);
if (res != -1)
r[1] = res;
// ftruncate arguments: [
// fd: fd (resource)
// len: intptr = 0xdfc5 (8 bytes)
// ]
syscall(__NR_ftruncate, /*fd=*/r[1], /*len=*/0xdfc5ul);
// write$dsp arguments: [
// fd: fd_dsp (resource)
// data: ptr[in, buffer] {
// buffer: {6e} (length 0x1)
// }
// len: bytesize = 0x1 (8 bytes)
// ]
memset((void*)0x200000000100, 110, 1);
syscall(__NR_write, /*fd=*/r[1], /*data=*/0x200000000100ul, /*len=*/1ul);
// getegid arguments: [
// ]
// returns gid
res = syscall(__NR_getegid);
if (res != -1)
r[2] = res;
// fchown arguments: [
// fd: fd (resource)
// uid: uid (resource)
// gid: gid (resource)
// ]
syscall(__NR_fchown, /*fd=*/r[0], /*uid=*/0, /*gid=*/r[2]);
// ioctl$SCSI_IOCTL_SEND_COMMAND arguments: [
// fd: fd_sg (resource)
// cmd: const = 0x1 (4 bytes)
// arg: ptr[in, scsi_ioctl_command] {
// scsi_ioctl_command {
// inlen: len = 0x0 (4 bytes)
// outlen: int32 = 0x9 (4 bytes)
// opcode: int32 = 0x3 (4 bytes)
// data: buffer: {} (length 0x0)
// }
// }
// ]
*(uint32_t*)0x200000000280 = 0;
*(uint32_t*)0x200000000284 = 9;
*(uint32_t*)0x200000000288 = 3;
syscall(__NR_ioctl, /*fd=*/r[1], /*cmd=*/1, /*arg=*/0x200000000280ul);
// ioctl$XFS_IOC_SWAPEXT arguments: [
// fd: fd (resource)
// cmd: const = 0xc0c0586d (4 bytes)
// arg: ptr[in, xfs_swapext] {
// xfs_swapext {
// sx_version: const = 0x0 (8 bytes)
// sx_fdtarget: fd (resource)
// sx_fdtmp: fd (resource)
// sx_offset: int64 = 0x3 (8 bytes)
// sx_length: int64 = 0xfffffffffffffff8 (8 bytes)
// sx_pad: buffer: {00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x10)
// sx_stat: xfs_bstat {
// bs_ino: int64 = 0xaa6a (8 bytes)
// bs_mode: int16 = 0x2 (2 bytes)
// bs_nlink: int16 = 0x3660 (2 bytes)
// bs_uid: int32 = 0x3 (4 bytes)
// bs_gid: int32 = 0xffff (4 bytes)
// bs_rdev: int32 = 0x8280 (4 bytes)
// bs_blksize: int32 = 0xfff (4 bytes)
// pad = 0x0 (4 bytes)
// bs_size: int64 = 0x6 (8 bytes)
// bs_atime: xfs_bstime {
// tv_sec: intptr = 0xa (8 bytes)
// tv_nsec: int32 = 0x8 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// bs_mtime: xfs_bstime {
// tv_sec: intptr = 0x0 (8 bytes)
// tv_nsec: int32 = 0x2 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// bs_ctime: xfs_bstime {
// tv_sec: intptr = 0xfdd (8 bytes)
// tv_nsec: int32 = 0x9 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// bs_blocks: int64 = 0xb (8 bytes)
// bs_xflags: int32 = 0x6 (4 bytes)
// bs_extsize: int32 = 0x7fffffff (4 bytes)
// bs_extents: int32 = 0x2 (4 bytes)
// bs_gen: int32 = 0x9eb (4 bytes)
// bs_projid_lo: int16 = 0x5 (2 bytes)
// bs_forkoff: int16 = 0x9d (2 bytes)
// bs_projid_hi: int16 = 0x9 (2 bytes)
// bs_sick: int16 = 0x45c (2 bytes)
// bs_checked: int16 = 0xf000 (2 bytes)
// bs_pad: buffer: {00 00} (length 0x2)
// bs_cowextsize: int32 = 0x8 (4 bytes)
// bs_dmevmask: int32 = 0x8 (4 bytes)
// bs_dmstate: int16 = 0x8 (2 bytes)
// bs_aextents: int16 = 0x6 (2 bytes)
// }
// }
// }
// ]
*(uint64_t*)0x200000000140 = 0;
*(uint32_t*)0x200000000148 = r[0];
*(uint32_t*)0x20000000014c = -1;
*(uint64_t*)0x200000000150 = 3;
*(uint64_t*)0x200000000158 = 0xfffffffffffffff8;
memset((void*)0x200000000160, 0, 16);
*(uint64_t*)0x200000000170 = 0xaa6a;
*(uint16_t*)0x200000000178 = 2;
*(uint16_t*)0x20000000017a = 0x3660;
*(uint32_t*)0x20000000017c = 3;
*(uint32_t*)0x200000000180 = 0xffff;
*(uint32_t*)0x200000000184 = 0x8280;
*(uint32_t*)0x200000000188 = 0xfff;
*(uint64_t*)0x200000000190 = 6;
*(uint64_t*)0x200000000198 = 0xa;
*(uint32_t*)0x2000000001a0 = 8;
*(uint64_t*)0x2000000001a8 = 0;
*(uint32_t*)0x2000000001b0 = 2;
*(uint64_t*)0x2000000001b8 = 0xfdd;
*(uint32_t*)0x2000000001c0 = 9;
*(uint64_t*)0x2000000001c8 = 0xb;
*(uint32_t*)0x2000000001d0 = 6;
*(uint32_t*)0x2000000001d4 = 0x7fffffff;
*(uint32_t*)0x2000000001d8 = 2;
*(uint32_t*)0x2000000001dc = 0x9eb;
*(uint16_t*)0x2000000001e0 = 5;
*(uint16_t*)0x2000000001e2 = 0x9d;
*(uint16_t*)0x2000000001e4 = 9;
*(uint16_t*)0x2000000001e6 = 0x45c;
*(uint16_t*)0x2000000001e8 = 0xf000;
memset((void*)0x2000000001ea, 0, 2);
*(uint32_t*)0x2000000001ec = 8;
*(uint32_t*)0x2000000001f0 = 8;
*(uint16_t*)0x2000000001f4 = 8;
*(uint16_t*)0x2000000001f6 = 6;
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0xc0c0586d, /*arg=*/0x200000000140ul);
return 0;
}
Reply: **Analysis of the Bug Report**
The bug is a `BUG_ON` assertion failure in `gfs2_jindex_free` located in `fs/gfs2/super.c`. The assertion `BUG_ON(jd->jd_log_bio);` ensures that there are no pending block I/O operations (bios) on the journal descriptor when the journal index is being freed. The crash occurs when a crafted GFS2 filesystem image is mounted and subsequently unmounted (or fails during the mount process and cleans up), leaving a pending bio that triggers the assertion.
**Exploitability and Denial of Service:**
The `BUG_ON` macro expands to a trap instruction (e.g., `ud2` on x86) that immediately halts kernel execution and causes a panic. Even if the kernel is compiled with `CONFIG_BUG` disabled, it falls back to an infinite loop, hanging the CPU. In either case, it prevents any further execution, meaning it does not lead to memory corruption, out-of-bounds accesses, or privilege escalation. Therefore, it is **not exploitable** for code execution, but it reliably causes a **Denial of Service (DoS)**.
**Access and Triggers:**
To trigger this bug, an attacker must be able to mount a malicious GFS2 filesystem image.
- **Unprivileged / User Namespaces:** The GFS2 filesystem does not have the `FS_USERNS_MOUNT` flag set. This means it cannot be mounted inside a user namespace. Mounting it requires `CAP_SYS_ADMIN` in the initial user namespace. Thus, it is **not accessible from unprivileged processes or user namespaces**.
- **Malicious Filesystem / Peripheral Trigger:** The bug is explicitly triggered by parsing a malicious filesystem image. If a system (such as a Linux desktop) is configured to auto-mount external media, an attacker could trigger this by plugging in a malicious USB drive.
- **VM Host Trigger:** In a Confidential Computing context, an untrusted VM host can provide a malicious block device (e.g., via virtio-blk) to the protected guest. When the guest kernel attempts to mount the filesystem, the host can trigger this bug to crash the guest.
- **Network / Remote / VM Guest:** The bug involves local filesystem mounting and cannot be triggered directly over the network, via remote protocols, or by a guest attacking the host (since hosts do not mount guest-provided filesystems).
**Conclusion:**
This is a local Denial of Service vulnerability caused by a malicious filesystem image. It requires elevated privileges to trigger directly but can be exploited via physical access (USB auto-mount) or by a malicious hypervisor in a confidential computing environment.
|
| 6/2 |
2026/06/01 10:15 |
llm |
expert |
0m
Model:
Tokens:
input: 17938
output: 36
thoughts: 230
Thoughts: **GFS2 Filesystem Corruption Analysis**
Okay, I've got a kernel BUG report indicating a problem at `fs/gfs2/super.c:76`. The trigger appears to be a crafted GFS2 filesystem image during a mount attempt. This immediately raises a red flag; I need to understand the nature of this crafted image and how it's exploiting the kernel.
The call trace provides a critical starting point. Let me analyze it: the issue seems to be originating in `gfs2_put_super`, which is being called during the unmount process. Specifically: `gfs2_put_super+0x7d9/0x860`. From there, `generic_shutdown_super`, `kill_block_super`, `deactivate_locked_super`, `cleanup_mnt`, and finally `task_work_run` are being called in the trace. The trace suggests the problem lies in the filesystem unmounting.
My immediate focus will be on examining `fs/gfs2/super.c:76`. I'll need to dissect the code at that location within `gfs2_put_super` and see what's happening during the unmount that could lead to this bug. It is a critical path and I need to start from that point. I'll need to correlate the code at that line with the input from the crafted image to pinpoint the vulnerability. I'll need to reconstruct what's happening in the GFS2 super block's lifecycle to understand how the crafted image can be corrupting memory or causing a race condition during the unmount process.
|
| 7/2 |
2026/06/01 10:16 |
tool |
read-file |
0m
Args: map[File:fs/gfs2/super.c FirstLine:60 LineCount:40]
Results: map[Contents: 60: {
61: struct list_head list;
62: struct gfs2_jdesc *jd;
63:
64: spin_lock(&sdp->sd_jindex_spin);
65: list_add(&list, &sdp->sd_jindex_list);
66: list_del_init(&sdp->sd_jindex_list);
67: sdp->sd_journals = 0;
68: spin_unlock(&sdp->sd_jindex_spin);
69:
70: down_write(&sdp->sd_log_flush_lock);
71: sdp->sd_jdesc = NULL;
72: up_write(&sdp->sd_log_flush_lock);
73:
74: while (!list_empty(&list)) {
75: jd = list_first_entry(&list, struct gfs2_jdesc, jd_list);
76: BUG_ON(jd->jd_log_bio);
77: gfs2_free_journal_extents(jd);
78: list_del(&jd->jd_list);
79: iput(jd->jd_inode);
80: jd->jd_inode = NULL;
81: kfree(jd);
82: }
83: }
84:
85: static struct gfs2_jdesc *jdesc_find_i(struct list_head *head, unsigned int jid)
86: {
87: struct gfs2_jdesc *jd;
88:
89: list_for_each_entry(jd, head, jd_list) {
90: if (jd->jd_jid == jid)
91: return jd;
92: }
93: return NULL;
94: }
95:
96: struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid)
97: {
98: struct gfs2_jdesc *jd;
99:
]
|
| 8/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 19136
output: 33
thoughts: 278
Thoughts: **Analyzing a Kernel Panic: GFS2 Filesystem Bug**
Okay, so I've got this `BUG_ON` in `gfs2_jindex_free`, specifically `BUG_ON(jd->jd_log_bio);`. My immediate thought is, this is bad, *very* bad. It means there's a bio still pending on a journal descriptor during unmount. And that `BUG_ON` means a kernel panic, straight-up denial of service. The system goes down hard.
Now, the question is, is this exploitable? Normally, a `BUG_ON` *shouldn't* be directly exploitable for privilege escalation or memory corruption. It's a hard stop, unless there's some bizarre way to bypass the `BUG_ON` itself, and that's usually not the case. The prompt specifically calls out "BUG reports halts the kernel", so I can safely conclude that `Exploitable: false`.
So, the focus shifts to `DenialOfService: true`. Okay, that's still serious. Next question: how accessible is this DoS? Can an unprivileged process trigger it? The bug seems to trigger when mounting a GFS2 filesystem. Does unprivileged user even have access to this filesystem?
Mounting filesystems usually requires `CAP_SYS_ADMIN` in the initial user namespace. But, can an unprivileged user mount a GFS2 filesystem *within a user namespace*? Now *that's* the key question. I need to check if GFS2 sets the `FS_USERNS_MOUNT` flag. If it does, then the DoS is significantly more concerning. If not, it's still bad, but requires either root privileges or the ability to trick someone with root privileges into doing something.
|
| 9/2 |
2026/06/01 10:16 |
tool |
grepper |
0m
Error:
Args: map[Expression:FS_USERNS_MOUNT PathPrefix:fs/gfs2/]
Results:
|
| 10/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 19850
output: 60
thoughts: 725
Thoughts: **Analyzing the GFS2 Bug**
Okay, so GFS2 doesn't have `FS_USERNS_MOUNT`, meaning it can't be mounted within a user namespace. That's a key detail. This means an unprivileged user can't directly mount a GFS2 filesystem. But, hold on... what about a malicious USB drive? If a desktop environment's auto-mount feature recognizes GFS2, and the module is loaded, it *could* try to mount it. I need to confirm if auto-mount even *supports* GFS2; it usually handles vfat, exfat, ext4, ntfs, etc. But if it *does*, and someone plugs in a GFS2-formatted drive, that's a potential attack vector.
So, malicious filesystem trigger: yes. Peripheral trigger: yes, through the USB drive.
Now, let's revisit GFS2 in a user namespace. The reproducer leverages `syz_mount_image`, and it's mounting a GFS2 image. Because of that missing `FS_USERNS_MOUNT`, unprivileged mounting in a user namespace is impossible. So, unprivileged: no, user namespace: no.
Okay, let's consider other trigger possibilities. Networking? No, it's a local filesystem mount. VM Guest? Not directly, unless the guest provides a block device that the host mounts, in which case it is considered a malicious filesystem trigger. VM Host in Confidential Computing? If the host provides a block device to the guest, and the guest mounts it, then that falls under the malicious filesystem trigger scenario.
Let's review the questions systematically:
* Exploitable: No, it's a `BUG_ON`.
* Denial of Service: Yes, kernel panic.
* Unprivileged: No, needs `CAP_SYS_ADMIN` for GFS2 mount.
* UserNamespace: No, `FS_USERNS_MOUNT` is missing.
* VMGuestTrigger: No, unless the host mounts a guest-provided image, covered by the malicious filesystem trigger.
* VMHostTrigger: Yes, if the guest mounts a host-provided image, which is standard in confidential computing where the host isn't trusted. Yes, the guest mounts it, so the guest kernel crashes. So the host *can* trigger this in the guest.
* NetworkTrigger: No.
* RemoteTrigger: No.
* PeripheralTrigger: Yes, USB drive with a malicious GFS2 image.
* FilesystemTrigger: Yes.
Now, I need to verify that `BUG_ON(jd->jd_log_bio);` is indeed a hard `BUG_ON`. Yes, a `BUG_ON` macro expands to a trap instruction (like `ud2` on x86), causing an immediate kernel panic. The `BUG_ON` terminates all execution.
Let's check for other ways to reach `gfs2_jindex_free`. It's called from `gfs2_put_super` and `init_journal`. I'm satisfied now, this is a clear DoS vulnerability due to a hard kernel panic.
|
| 11/2 |
2026/06/01 10:16 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:fs/gfs2/super.c IncludeSnippetLines:0 Name:gfs2_jindex_free SourceTreePrefix:fs/gfs2/]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:gfs2_put_super SourceFile:fs/gfs2/super.c SourceLine:638] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:init_journal SourceFile:fs/gfs2/ops_fstype.c SourceLine:826]] TruncatedOutput:false]
|
| 12/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 21444
output: 33
thoughts: 136
Thoughts: **Analyzing GFS2 Filesystem Mount/Unmount Vulnerabilities**
Okay, so I'm thinking about the GFS2 filesystem and potential vulnerabilities related to its mount and unmount operations. My mind goes immediately to `gfs2_put_super`, which I know is called during the unmount process. On the flip side, we have `init_journal`, which is, of course, critical during the mount process.
A key point here is that `gfs2_jindex_free` seems to be the clean-up function. It gets called when either `init_journal` fails (during mount), or as a part of the unmount path. So, this operation is fundamentally tied to either mounting or unmounting a GFS2 filesystem.
The question then becomes: can an unprivileged user somehow trigger `gfs2_jindex_free` without actually mounting or unmounting the filesystem? Let's be clear, I don't see how. The code path for that function seems inextricably linked to the mount/unmount routines. It looks very unlikely.
Now, let's just make sure; I'll quickly check the relevant commits to see if there have been any recent modifications regarding `FS_USERNS_MOUNT` in GFS2, and see if there are any obvious attack vectors introduced around that.
|
| 13/2 |
2026/06/01 10:16 |
tool |
grepper |
0m
Error:
Args: map[Expression:FS_USERNS_MOUNT PathPrefix:fs/gfs2/]
Results:
|
| 14/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 21909
output: 36
thoughts: 358
Thoughts: **Trigger Analysis for Potential GFS2 Vulnerability**
Okay, so the initial hypothesis didn't pan out; the obvious isn't the problem. Time to systematically consider other attack vectors. Let's see... can a VM guest trigger this? What about a `VMGuestTrigger` scenario? The core issue is the host mounting a filesystem from a guest-provided block device. Typically, hosts don't do this directly. Therefore, I can rule out `VMGuestTrigger`.
Next, `VMHostTrigger`. In a Confidential Computing environment, where the guest kernel is protected from the host, the host *does* provide block devices, like virtio-blk, to the guest. Now, if the guest mounts a GFS2 filesystem from such a block device, the host could supply a malicious GFS2 image designed to trigger the crash. This scenario seems plausible, which means `VMHostTrigger` is a definite possibility.
Now, `PeripheralTrigger`. Could a user simply plug in a malicious USB drive with a GFS2 image and trigger the problem through auto-mounting? That's plausible depending on the system configuration. Auto-mounting behavior hinges on the desktop environment, and utilities like udisks2. udisks2 is generally safe and allows only known filesystem, but it might allow mounting *any* filesystem given physical access, which is a key caveat. GFS2 is a cluster filesystem, so it might not be automatically mounted by default, but it's not impossible. Therefore, I'll flag `PeripheralTrigger` as a potential vector as well.
And finally, `FilesystemTrigger` is essentially the obvious one. Yes, it's explicitly triggered by mounting a malicious filesystem image, so `FilesystemTrigger` is a definite "true".
Okay, now before I get too deep in the weeds with this, I need to check to see if there's any memory corruption before the `BUG_ON`. I need to review what's going on at `fs/gfs2/super.c:76` to figure that out.
|
| 15/2 |
2026/06/01 10:16 |
tool |
read-file |
0m
Args: map[File:fs/gfs2/super.c FirstLine:60 LineCount:25]
Results: map[Contents: 60: {
61: struct list_head list;
62: struct gfs2_jdesc *jd;
63:
64: spin_lock(&sdp->sd_jindex_spin);
65: list_add(&list, &sdp->sd_jindex_list);
66: list_del_init(&sdp->sd_jindex_list);
67: sdp->sd_journals = 0;
68: spin_unlock(&sdp->sd_jindex_spin);
69:
70: down_write(&sdp->sd_log_flush_lock);
71: sdp->sd_jdesc = NULL;
72: up_write(&sdp->sd_log_flush_lock);
73:
74: while (!list_empty(&list)) {
75: jd = list_first_entry(&list, struct gfs2_jdesc, jd_list);
76: BUG_ON(jd->jd_log_bio);
77: gfs2_free_journal_extents(jd);
78: list_del(&jd->jd_list);
79: iput(jd->jd_inode);
80: jd->jd_inode = NULL;
81: kfree(jd);
82: }
83: }
84:
]
|
| 16/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 23117
output: 33
thoughts: 157
Thoughts: **Analyzing a Potential Denial of Service**
Okay, so the code is going through journal descriptors, and it's checking `jd->jd_log_bio`. If `jd->jd_log_bio` isn't null, it immediately triggers a `BUG_ON`. This is pretty straightforward β it's a clear Denial of Service vulnerability. It's not leading to privilege escalation or memory corruption, because it just causes the kernel to halt.
My initial thought is to see if `jd->jd_log_bio` could be manipulated by an attacker, but it doesn't really matter. The kernel's just going to crash anyway with that `BUG_ON`.
But wait⦠something is nagging at me. What happens if the kernel is compiled *without* `CONFIG_BUG`? In that scenario, that `BUG_ON` could be a no-op, or maybe just a warning. We need to check the definition of `BUG_ON` to be certain.
|
| 17/2 |
2026/06/01 10:16 |
tool |
grepper |
0m
Args: map[Expression:define BUG_ON PathPrefix:include/asm-generic/bug.h]
Results: map[Output:include/asm-generic/bug.h=48=struct bug_entry {
--
include/asm-generic/bug.h-80-#ifndef HAVE_ARCH_BUG_ON
include/asm-generic/bug.h:81:#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
include/asm-generic/bug.h-82-#endif
--
include/asm-generic/bug.h=103=extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
--
include/asm-generic/bug.h-199-#ifndef HAVE_ARCH_BUG_ON
include/asm-generic/bug.h:200:#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
include/asm-generic/bug.h-201-#endif
]
|
| 18/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 23740
output: 34
thoughts: 41
Thoughts: Okay, here's my interpretation of that thought process, from an expert's perspective:
**Debugging When the Safeguards Are Off**
Alright, so I'm thinking about how the system handles critical errors β specifically, the `BUG()` macro. Under normal circumstances, with `CONFIG_BUG` enabled, `BUG()` likely triggers something robust, like a kernel panic or at least some informative error reporting. But, what happens when we're in a situation where `CONFIG_BUG` is *disabled*? That's the interesting bit. The implementation of `BUG()` in that scenario could range from being a complete null operation, effectively doing nothing, to being an infinite loop. Either of these outcomes is pretty precarious. It makes debugging much harder because a truly critical system error may not be explicitly flagged. My next step? I need to analyze the `BUG()` macro's behavior when `CONFIG_BUG` is turned off. I need to understand what the system *actually* does. I'll need to dig into the relevant code paths to verify the behavior.
|
| 19/2 |
2026/06/01 10:16 |
tool |
grepper |
0m
Args: map[Expression:define BUG\(\) PathPrefix:include/asm-generic/bug.h]
Results: map[Output:include/asm-generic/bug.h=48=struct bug_entry {
--
include/asm-generic/bug.h-72-#ifndef HAVE_ARCH_BUG
include/asm-generic/bug.h:73:#define BUG() do { \
include/asm-generic/bug.h-74- printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
--
include/asm-generic/bug.h=103=extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
--
include/asm-generic/bug.h-192-#ifndef HAVE_ARCH_BUG
include/asm-generic/bug.h:193:#define BUG() do { \
include/asm-generic/bug.h-194- do {} while (1); \
]
|
| 20/2 |
2026/06/01 10:16 |
llm |
expert |
0m
Model:
Tokens:
input: 24260
output: 66
thoughts: 1219
Thoughts: **Analysis of the GFS2 Bug**
Okay, let's break this down. First, even with `CONFIG_BUG` disabled, the `BUG()` macro effectively creates an infinite loop, resulting in a Denial of Service (DoS) β the system hangs. However, it's *not* exploitable in the sense of memory corruption or privilege escalation. So, `Exploitable: false`.
Now, reviewing the questions.
* Exploitable: false
* DenialOfService: true
* Unprivileged: false
* UserNamespace: false
* VMGuestTrigger: false
* VMHostTrigger: true
* NetworkTrigger: false
* RemoteTrigger: false
* PeripheralTrigger: true
* FilesystemTrigger: true
I have to confirm if the `jd->jd_log_bio` is used after this `BUG_ON`, if it's compiled out. Since the code after `BUG_ON` is unreachable, it's definitely not exploitable.
Can unprivileged users mount GFS2 in any way? No, it needs `CAP_SYS_ADMIN` in the initial namespace.
Regarding triggers, is it network-based? GFS2 is a clustered filesystem using DLM. Could malicious DLM messages somehow trigger this? The bug is in `gfs2_jindex_free`, called during mount/unmount. If DLM could force an unmount, maybe... but the root cause is a pending bio during journal free. This smells like an error path during the mount process. The reproducer mounts a crafted image, leading to an error, cleanup, and the `BUG_ON`. Definitely a `FilesystemTrigger`.
Let's look at the reproducer, again. It mounts a GFS2 image. Then, after some ioctls, the crash occurs in `gfs2_put_super`, during unmount or mount failure. The call trace includes `generic_shutdown_super`, `kill_block_super`, `deactivate_locked_super`, and `cleanup_mnt`. The `cleanup_mnt` confirms this is related to an unmount operation (when a mount namespace is destroyed or when a mount is lazily unmounted). The reproducer mounts, and then exits, causing the unmount. So, again, `FilesystemTrigger: true`.
Now, `VMHostTrigger` and `PeripheralTrigger`. Any bug triggered by mounting a malicious filesystem is also triggerable via a VM host providing a malicious block device (VMHostTrigger) or plugging in a malicious USB drive (PeripheralTrigger). So, `VMHostTrigger: true` and `PeripheralTrigger: true`.
Since GFS2 lacks `FS_USERNS_MOUNT`, it's not mountable in a user namespace, so `Unprivileged: false` and `UserNamespace: false`.
Re-confirming exploitability β the `BUG_ON` hangs the kernel, but it does not lead to memory corruption or privilege escalation, so `Exploitable: false`.
DoS? Yes, it crashes the kernel, so `DenialOfService: true`.
VM Guest Trigger? No, the host doesn't mount guest filesystems. `VMGuestTrigger: false`.
Network Trigger? No, requires a mount. `NetworkTrigger: false`.
Remote Trigger? No, same reason. `RemoteTrigger: false`.
|
| 21/2 |
2026/06/01 10:17 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:true]
Results: map[DenialOfService:true Exploitable:false FilesystemTrigger:true NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:true]
|
| 22/2 |
2026/06/01 10:17 |
llm |
expert |
0m
Model:
Tokens:
input: 26327
output: 570
thoughts: 481
Thoughts: **My Assessment of the GFS2 Filesystem Bug**
Okay, the results are in, and I've got a clear picture of this issue. Let me summarize my understanding for you, given the details I've gathered.
The core of the problem lies within the `gfs2_jindex_free` function during GFS2 filesystem unmounts. Specifically, a `BUG_ON` assertion failure, `BUG_ON(jd->jd_log_bio);`, is triggered. This assertion is there to ensure no journal bios are pending on a journal descriptor during the unmount process. The crux of the matter is that a specially crafted GFS2 image can bypass this check and cause a panic.
Now, while the impact is a system panic β a definite Denial of Service, which is never good β the good news is that itβs not exploitable in the traditional sense. It's a hard halt. There's no opportunity for memory corruption or privilege escalation because the kernel simply stops dead.
The attack vector is clear: a malicious GFS2 image. However, it's not as simple as a regular user exploiting it. GFS2 doesn't allow unprivileged mounts, which is good. It lacks the `FS_USERNS_MOUNT` flag, meaning even with user namespaces, it's not an entry point. So, a direct attack from a compromised user account is not likely.
Here's where things get interesting in terms of attack vectors:
* **Peripheral Trigger:** A malicious USB drive with a crafted GFS2 image becomes a viable threat if the system automatically mounts external media.
* **VM Host Trigger (Confidential Computing):** A compromised host providing a block device to a VM guest *is* a major concern, as the guest could mount the malicious image, triggering the bug.
I've determined that an Ethernet network trigger is unlikely, as are other remote triggers, and the classic VM guest initiating the mount will also not work.
Essentially, a compromised GFS2 image can cause a DoS, which has serious implications for auto-mounting systems, and more so for a compromised host serving block devices to a virtual guest.
|
| 23/1 |
2026/06/01 10:17 |
action |
format-explanation |
0m
Results: map[Explanation:**Analysis of the Bug Report**
The bug is a `BUG_ON` assertion failure in `gfs2_jindex_free` located in
`fs/gfs2/super.c`. The assertion `BUG_ON(jd->jd_log_bio);` ensures that there
are no pending block I/O operations (bios) on the journal descriptor when the
journal index is being freed. The crash occurs when a crafted GFS2 filesystem
image is mounted and subsequently unmounted (or fails during the mount process
and cleans up), leaving a pending bio that triggers the assertion.
**Exploitability and Denial of Service:**
The `BUG_ON` macro expands to a trap instruction (e.g., `ud2` on x86) that
immediately halts kernel execution and causes a panic. Even if the kernel is
compiled with `CONFIG_BUG` disabled, it falls back to an infinite loop, hanging
the CPU. In either case, it prevents any further execution, meaning it does not
lead to memory corruption, out-of-bounds accesses, or privilege escalation.
Therefore, it is **not exploitable** for code execution, but it reliably causes
a **Denial of Service (DoS)**.
**Access and Triggers:**
To trigger this bug, an attacker must be able to mount a malicious GFS2
filesystem image.
- **Unprivileged / User Namespaces:** The GFS2 filesystem does not have the
`FS_USERNS_MOUNT` flag set. This means it cannot be mounted inside a user
namespace. Mounting it requires `CAP_SYS_ADMIN` in the initial user namespace.
Thus, it is **not accessible from unprivileged processes or user namespaces**.
- **Malicious Filesystem / Peripheral Trigger:** The bug is explicitly triggered
by parsing a malicious filesystem image. If a system (such as a Linux desktop)
is configured to auto-mount external media, an attacker could trigger this by
plugging in a malicious USB drive.
- **VM Host Trigger:** In a Confidential Computing context, an untrusted VM host
can provide a malicious block device (e.g., via virtio-blk) to the protected
guest. When the guest kernel attempts to mount the filesystem, the host can
trigger this bug to crash the guest.
- **Network / Remote / VM Guest:** The bug involves local filesystem mounting
and cannot be triggered directly over the network, via remote protocols, or by a
guest attacking the host (since hosts do not mount guest-provided filesystems).
**Conclusion:**
This is a local Denial of Service vulnerability caused by a malicious filesystem
image. It requires elevated privileges to trigger directly but can be exploited
via physical access (USB auto-mount) or by a malicious hypervisor in a
confidential computing environment.]
|