[syzbot] [afs?] BUG: sleeping function called from invalid context in __alloc_frozen_pages_noprof

David Howells dhowells at redhat.com
Mon Mar 31 03:58:41 PDT 2025


Note to syzbot maintainers: the C test program contains a compressed ext3
image and decompression code that I think is entirely unnecessary.  All it
does is provide a directory that the afs dynroot can be mounted upon.

This is the only bit of the test that is actually necessary:

  NONFAILING(memcpy((void*)0x2000000001c0, "./file0\000", 8));
  NONFAILING(memcpy((void*)0x2000000002c0, "afs\000", 4));
  NONFAILING(memcpy((void*)0x200000000400, "dyn", 3));
  NONFAILING(*(uint8_t*)0x200000000403 = 0x2c);
  NONFAILING(*(uint8_t*)0x200000000404 = 0);
  syscall(__NR_mount, /*src=*/0ul, /*dst=*/0x2000000001c0ul,
          /*type=*/0x2000000002c0ul, /*flags=*/0ul, /*opts=*/0x200000000400ul);
  NONFAILING(memcpy((void*)0x2000000000c0, "./file0\000", 8));
  syscall(__NR_chdir, /*dir=*/0x2000000000c0ul);
  NONFAILING(memcpy((void*)0x200000000240, "./file1\000", 8));
  syscall(__NR_lstat, /*file=*/0x200000000240ul, /*statbuf=*/0ul);
  NONFAILING(memcpy((void*)0x2000000000c0, ".\000", 2));
  res = syscall(__NR_open, /*file=*/0x2000000000c0ul, /*flags=*/0ul,
                /*mode=*/0ul);
  if (res != -1)
    r[0] = res;
  syscall(__NR_getdents, /*fd=*/r[0], /*ent=*/0x200000001fc0ul,
          /*count=*/0xb8ul);

Basically:

  mount(NULL, "./file0", "afs", 0, "dyn,") = 0
  chdir("./file0")                  = 0
  lstat("./file1", NULL)            = -1 EFAULT (Bad address)
  open(".", O_RDONLY)               = 4
  getdents(4, 0x200000001fc0 /* 5 entries */, 184) = 168

David




More information about the linux-afs mailing list