* [Linux Kernel Bug] KASAN: slab-out-of-bounds Read in hfsplus_strcasecmp
@ 2025-09-15 3:04 Jiaming Zhang
2025-09-15 17:29 ` Viacheslav Dubeyko
0 siblings, 1 reply; 2+ messages in thread
From: Jiaming Zhang @ 2025-09-15 3:04 UTC (permalink / raw)
To: frank.li, glaubitz, linux-fsdevel, slava; +Cc: linux-kernel, syzkaller
[-- Attachment #1: Type: text/plain, Size: 8725 bytes --]
Dear Linux kernel developers and maintainers:
We are writing to report a slab-out-of-bounds bug discovered in the
hfsplus subsystem with our modified syzkaller. This bug is
reproducible on the latest version (v6.17-rc6, commit
f83ec76bf285bea5727f478a68b894f5543ca76e).
The kernel console output, kernel config, syzkaller reproducer, and C
reproducer are attached to this email to help analysis. The KASAN
report from v6.17-rc6, formatted by syz-symbolize, is listed below:
hfsplus: invalid length 63743 has been corrected to 255
==================================================================
BUG: KASAN: slab-out-of-bounds in hfsplus_strcasecmp+0x1bc/0x490
fs/hfsplus/unicode.c:47
Read of size 2 at addr ffff88804b8d640c by task repro.out/9757
CPU: 1 UID: 0 PID: 9757 Comm: repro.out Not tainted 6.17.0-rc6 #1 PREEMPT(full)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x17e/0x810 mm/kasan/report.c:482
kasan_report+0x147/0x180 mm/kasan/report.c:595
hfsplus_strcasecmp+0x1bc/0x490 fs/hfsplus/unicode.c:47
hfs_find_rec_by_key+0xa6/0x1e0 fs/hfsplus/bfind.c:89
__hfsplus_brec_find+0x18b/0x480 fs/hfsplus/bfind.c:124
hfsplus_brec_find+0x289/0x500 fs/hfsplus/bfind.c:184
hfsplus_brec_read+0x2b/0x120 fs/hfsplus/bfind.c:211
hfsplus_lookup+0x2aa/0x890 fs/hfsplus/dir.c:52
__lookup_slow+0x294/0x3d0 fs/namei.c:1808
lookup_slow+0x53/0x70 fs/namei.c:1825
walk_component+0x2d4/0x400 fs/namei.c:2129
lookup_last fs/namei.c:2630 [inline]
path_lookupat+0x163/0x430 fs/namei.c:2654
filename_lookup+0x212/0x570 fs/namei.c:2683
user_path_at+0x3a/0x60 fs/namei.c:3127
ksys_umount fs/namespace.c:2112 [inline]
__do_sys_umount fs/namespace.c:2120 [inline]
__se_sys_umount fs/namespace.c:2118 [inline]
__x64_sys_umount+0xee/0x160 fs/namespace.c:2118
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x452627
Code: 06 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66
2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d
01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc5dd08ae8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 0000000000452627
RDX: 0000000000000009 RSI: 0000000000000009 RDI: 00007ffc5dd08b90
RBP: 00007ffc5dd09bd0 R08: 0000000000000015 R09: 00007ffc5dd08980
R10: 00000000004b9560 R11: 0000000000000206 R12: 000000000040a070
R13: 0000000000000000 R14: 00000000004bc018 R15: 00000000004004a0
</TASK>
Allocated by task 9757:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:388 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:405
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4376 [inline]
__kmalloc_noprof+0x27a/0x4f0 mm/slub.c:4388
kmalloc_noprof include/linux/slab.h:909 [inline]
hfsplus_find_init+0x8c/0x1d0 fs/hfsplus/bfind.c:21
hfsplus_lookup+0x19c/0x890 fs/hfsplus/dir.c:44
__lookup_slow+0x294/0x3d0 fs/namei.c:1808
lookup_slow+0x53/0x70 fs/namei.c:1825
walk_component+0x2d4/0x400 fs/namei.c:2129
lookup_last fs/namei.c:2630 [inline]
path_lookupat+0x163/0x430 fs/namei.c:2654
filename_lookup+0x212/0x570 fs/namei.c:2683
user_path_at+0x3a/0x60 fs/namei.c:3127
ksys_umount fs/namespace.c:2112 [inline]
__do_sys_umount fs/namespace.c:2120 [inline]
__se_sys_umount fs/namespace.c:2118 [inline]
__x64_sys_umount+0xee/0x160 fs/namespace.c:2118
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff88804b8d6000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes to the right of
allocated 1036-byte region [ffff88804b8d6000, ffff88804b8d640c)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4b8d0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000040 ffff88801a442000 0000000000000000 dead000000000001
raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000
head: 04fff00000000040 ffff88801a442000 0000000000000000 dead000000000001
head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000
head: 04fff00000000003 ffffea00012e3401 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask
0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC),
pid 8133, tgid 8133 (sh), ts 23500816499, free_ts 23484371257
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
alloc_slab_page mm/slub.c:2492 [inline]
allocate_slab+0x8a/0x370 mm/slub.c:2660
new_slab mm/slub.c:2714 [inline]
___slab_alloc+0xbeb/0x1420 mm/slub.c:3901
__slab_alloc mm/slub.c:3992 [inline]
__slab_alloc_node mm/slub.c:4067 [inline]
slab_alloc_node mm/slub.c:4228 [inline]
__do_kmalloc_node mm/slub.c:4375 [inline]
__kmalloc_noprof+0x305/0x4f0 mm/slub.c:4388
kmalloc_noprof include/linux/slab.h:909 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
tomoyo_init_log+0x1a32/0x1f30 security/tomoyo/audit.c:275
tomoyo_supervisor+0x340/0x1490 security/tomoyo/common.c:2198
tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline]
tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:63
tomoyo_environ security/tomoyo/domain.c:672 [inline]
tomoyo_find_next_domain+0x15cf/0x1aa0 security/tomoyo/domain.c:888
tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
security_bprm_check+0x89/0x270 security/security.c:1302
search_binary_handler fs/exec.c:1660 [inline]
exec_binprm fs/exec.c:1702 [inline]
bprm_execve+0x8ee/0x1450 fs/exec.c:1754
do_execveat_common+0x521/0x6b0 fs/exec.c:1860
do_execve fs/exec.c:1934 [inline]
__do_sys_execve fs/exec.c:2010 [inline]
__se_sys_execve fs/exec.c:2005 [inline]
__x64_sys_execve+0x94/0xb0 fs/exec.c:2005
page last free pid 5289 tgid 5289 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0xbc0/0xd40 mm/page_alloc.c:2895
discard_slab mm/slub.c:2758 [inline]
__put_partials+0x156/0x1a0 mm/slub.c:3223
put_cpu_partial+0x17c/0x250 mm/slub.c:3298
__slab_free+0x2d5/0x3c0 mm/slub.c:4565
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:340
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4191 [inline]
slab_alloc_node mm/slub.c:4240 [inline]
kmem_cache_alloc_node_noprof+0x1bb/0x3c0 mm/slub.c:4292
__alloc_skb+0x12a/0x2f0 net/core/skbuff.c:659
netlink_sendmsg+0x5c6/0xb30 net/netlink/af_netlink.c:1871
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg+0x219/0x270 net/socket.c:729
____sys_sendmsg+0x507/0x840 net/socket.c:2614
___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
__sys_sendmsg net/socket.c:2700 [inline]
__do_sys_sendmsg net/socket.c:2705 [inline]
__se_sys_sendmsg net/socket.c:2703 [inline]
__x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff88804b8d6300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88804b8d6380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88804b8d6400: 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88804b8d6480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88804b8d6500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Please let me know if any further information is required.
Best Regards,
Jiaming Zhang.
[-- Attachment #2: repro.c --]
[-- Type: text/plain, Size: 27410 bytes --]
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <dirent.h>
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.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/prctl.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <linux/loop.h>
#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif
static unsigned long long procid;
static void sleep_ms(uint64_t ms)
{
usleep(ms * 1000);
}
static uint64_t current_time_ms(void)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts))
exit(1);
return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
}
static void use_temporary_dir(void)
{
char tmpdir_template[] = "./syzkaller.XXXXXX";
char* tmpdir = mkdtemp(tmpdir_template);
if (!tmpdir)
exit(1);
if (chmod(tmpdir, 0777))
exit(1);
if (chdir(tmpdir))
exit(1);
}
static bool write_file(const char* file, const char* what, ...)
{
char buf[1024];
va_list args;
va_start(args, what);
vsnprintf(buf, sizeof(buf), what, args);
va_end(args);
buf[sizeof(buf) - 1] = 0;
int len = strlen(buf);
int fd = open(file, O_WRONLY | O_CLOEXEC);
if (fd == -1)
return false;
if (write(fd, buf, len) != len) {
int err = errno;
close(fd);
errno = err;
return false;
}
close(fd);
return true;
}
//% 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");
}
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;
}
#define FS_IOC_SETFLAGS _IOW('f', 2, long)
static void remove_dir(const char* dir)
{
int iter = 0;
DIR* dp = 0;
const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW;
retry:
while (umount2(dir, umount_flags) == 0) {
}
dp = opendir(dir);
if (dp == NULL) {
if (errno == EMFILE) {
exit(1);
}
exit(1);
}
struct dirent* ep = 0;
while ((ep = readdir(dp))) {
if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0)
continue;
char filename[FILENAME_MAX];
snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name);
while (umount2(filename, umount_flags) == 0) {
}
struct stat st;
if (lstat(filename, &st))
exit(1);
if (S_ISDIR(st.st_mode)) {
remove_dir(filename);
continue;
}
int i;
for (i = 0;; i++) {
if (unlink(filename) == 0)
break;
if (errno == EPERM) {
int fd = open(filename, O_RDONLY);
if (fd != -1) {
long flags = 0;
if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) {
}
close(fd);
continue;
}
}
if (errno == EROFS) {
break;
}
if (errno != EBUSY || i > 100)
exit(1);
if (umount2(filename, umount_flags))
exit(1);
}
}
closedir(dp);
for (int i = 0;; i++) {
if (rmdir(dir) == 0)
break;
if (i < 100) {
if (errno == EPERM) {
int fd = open(dir, O_RDONLY);
if (fd != -1) {
long flags = 0;
if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) {
}
close(fd);
continue;
}
}
if (errno == EROFS) {
break;
}
if (errno == EBUSY) {
if (umount2(dir, umount_flags))
exit(1);
continue;
}
if (errno == ENOTEMPTY) {
if (iter < 100) {
iter++;
goto retry;
}
}
}
exit(1);
}
}
static void kill_and_wait(int pid, int* status)
{
kill(-pid, SIGKILL);
kill(pid, SIGKILL);
for (int i = 0; i < 100; i++) {
if (waitpid(-1, status, WNOHANG | __WALL) == pid)
return;
usleep(1000);
}
DIR* dir = opendir("/sys/fs/fuse/connections");
if (dir) {
for (;;) {
struct dirent* ent = readdir(dir);
if (!ent)
break;
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
continue;
char abort[300];
snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
ent->d_name);
int fd = open(abort, O_WRONLY);
if (fd == -1) {
continue;
}
if (write(fd, abort, 1) < 0) {
}
close(fd);
}
closedir(dir);
} else {
}
while (waitpid(-1, status, __WALL) != pid) {
}
}
static void reset_loop()
{
char buf[64];
snprintf(buf, sizeof(buf), "/dev/loop%llu", procid);
int loopfd = open(buf, O_RDWR);
if (loopfd != -1) {
ioctl(loopfd, LOOP_CLR_FD, 0);
close(loopfd);
}
}
static void setup_test()
{
prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
setpgrp();
write_file("/proc/self/oom_score_adj", "1000");
if (symlink("/dev/binderfs", "./binderfs")) {
}
}
#define USLEEP_FORKED_CHILD (3 * 50 * 1000)
static long handle_clone_ret(long ret)
{
if (ret != 0) {
return ret;
}
usleep(USLEEP_FORKED_CHILD);
syscall(__NR_exit, 0);
while (1) {
}
}
static long syz_clone(volatile long flags, volatile long stack,
volatile long stack_len, volatile long ptid,
volatile long ctid, volatile long tls)
{
long sp = (stack + stack_len) & ~15;
long ret = (long)syscall(__NR_clone, flags & ~CLONE_VM, sp, ptid, ctid, tls);
return handle_clone_ret(ret);
}
static void execute_one(void);
#define WAIT_FLAGS __WALL
static void loop(void)
{
int iter = 0;
for (;; iter++) {
char cwdbuf[32];
sprintf(cwdbuf, "./%d", iter);
if (mkdir(cwdbuf, 0777))
exit(1);
reset_loop();
int pid = fork();
if (pid < 0)
exit(1);
if (pid == 0) {
if (chdir(cwdbuf))
exit(1);
setup_test();
execute_one();
exit(0);
}
int status = 0;
uint64_t start = current_time_ms();
for (;;) {
sleep_ms(10);
if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
break;
if (current_time_ms() - start < 5000)
continue;
kill_and_wait(pid, &status);
break;
}
remove_dir(cwdbuf);
}
}
void execute_one(void)
{
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
}
memcpy((void*)0x20000600, "hfsplus\000", 8);
memcpy((void*)0x20000640, "./file0\000", 8);
*(uint8_t*)0x20000040 = 0;
memcpy(
(void*)0x20000e00,
"\x78\x9c\xec\xdd\x4f\x6f\x1c\x67\x1d\x07\xf0\xef\x6e\x9c\x8d\x6d\xd4\x74"
"\x93\x26\x6d\xa0\x95\xb0\x8a\x04\x08\x8b\xc4\xde\x45\x25\x41\x55\x81\x52"
"\x90\x85\x2a\xd4\x8a\x57\x60\x11\xa7\xb1\xb2\x49\x2b\x7b\x8b\xdc\x1e\x90"
"\x41\x9c\xfb\x1a\xca\xc1\x52\xcf\x88\x2b\x52\xa5\x72\x86\x57\x80\x8c\x7a"
"\x44\xe2\x6e\x4e\xae\x66\x76\xf6\x4f\xec\xad\xe3\xd4\xae\x77\xd3\x7e\x3e"
"\xd2\xec\xf3\x3c\xf3\xcc\x3c\xf3\x9b\xdf\xfc\xc9\x8c\x57\xd1\x06\xf8\xda"
"\x5a\x59\xcc\xcc\x76\x6a\x59\x59\x7c\x7d\xab\x68\xef\xee\xb4\x3b\xbb\x3b"
"\xed\xfb\xfd\x7a\x92\x0b\x49\xea\xc9\x6c\x92\x5a\x31\xfb\x6f\x49\x3e\x4d"
"\xb6\xd3\x9b\xf2\xcd\x7e\xc7\x48\x79\xc8\x9b\x2f\x3f\xf5\xd1\x07\xcf\x7f"
"\xf2\x4a\xaf\x35\x5b\x4d\xe5\xf2\xb5\xa3\xd6\x3b\x9e\x41\x2c\xcd\x5e\xac"
"\x65\x79\x5a\xe3\xb5\x4e\x3c\xde\x70\x0f\x17\x92\x5c\xae\x4a\x98\xb8\xfd"
"\xbe\xff\x8c\xed\x3e\xe1\x75\x09\x00\x4c\xb3\x5a\x72\x6e\xdc\xfc\x66\x32"
"\x5f\x3d\xac\x17\xef\x01\xbd\xa7\xe2\xde\x33\xf6\x13\x6d\x7b\xd2\x01\x00"
"\x00\x00\xc0\x19\x78\x7a\x2f\x7b\xd9\xca\xc5\x49\xc7\x01\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x4f\x92\xea\xf7\xff\x6b\xd5\x54\xef\xd7\x17\x52\xeb"
"\xff\xfe\x7f\xa3\x9a\x97\xaa\xfe\x44\xfb\x78\xd2\x01\x00\x00\x00\x00\x00"
"\x00\x00\xc0\x29\xf8\xf6\x5e\xf6\xb2\x95\x8b\xfd\xf6\x7e\xad\xfc\xce\xff"
"\xc5\xb2\x71\xa5\xfc\xfc\x46\xde\xcd\x66\xd6\xb2\x91\xeb\xd9\xca\x6a\xba"
"\xe9\x66\x23\xcb\x49\x9a\x23\x03\x35\xb6\x56\xbb\xdd\x8d\xe5\x63\xac\xd9"
"\x1a\xbb\x66\xeb\x6c\xf6\x17\x00\x00\x00\x00\x00\x00\x00\xbe\xa2\xfe\x94"
"\x95\xe1\xf7\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\x0d\x6a"
"\xc9\xb9\x5e\x51\x4e\x57\xfa\xf5\x66\xea\x33\x49\x66\x93\x34\x8a\xe5\xb6"
"\x93\x7f\xf5\xeb\x53\xad\x7e\x74\xf7\xc7\x67\x15\x07\x00\x00\x00\x4c\xd0"
"\xd3\x7b\xd9\xcb\x56\x2e\xf6\xdb\xfb\xb5\xf2\x9d\xff\xd9\xf2\xbd\x7f\x36"
"\xef\xe6\x41\xba\x59\x4f\x37\x9d\xac\xe5\x76\xf9\xb7\x80\xde\x5b\x7f\x7d"
"\x77\xa7\xdd\xd9\xdd\x69\xdf\x2f\xa6\xc3\xe3\xfe\xfc\x7f\x8f\x15\x46\xa3"
"\x7a\x53\x3f\x57\xb6\xc6\x6d\xf9\x5a\xb9\xc4\x5c\xee\x64\xbd\x9c\x73\x3d"
"\xbf\xcb\xdb\xe9\xe4\x76\xea\x83\x77\xfc\x6b\xfd\x78\xc6\xc7\xf5\xc7\x22"
"\xa6\xda\x4f\x2b\xc7\x8c\xec\x76\x55\x16\x7b\xfe\xeb\xaa\x9c\x0e\xcd\x32"
"\x23\xe7\x07\x19\x59\xaa\x62\x2b\xb2\x71\xe9\xe8\x4c\x3c\xe6\xd1\x39\xb8"
"\xa5\xe5\xd4\x07\x7f\xf9\xb9\xf2\x25\xe4\x7c\xbe\x2a\x8b\xfd\x79\x6d\xaa"
"\x73\xde\x1a\x39\xfb\x9e\x3d\x3a\x13\xc9\xfc\xbf\xdb\xff\xbf\xdb\x79\x70"
"\xef\xee\x9d\xcd\xc5\xe9\xd9\xa5\x2f\xe8\x60\x26\xda\x23\x99\x78\xee\x6b"
"\x95\x89\xa5\x22\x13\x7b\xfb\x3d\x49\x56\xf2\xab\xfc\x36\x8b\x59\xc8\x1b"
"\xd9\xc8\x7a\x7e\x9f\xd5\x74\xb3\x96\x85\xbc\x56\xd6\x56\xab\xf3\xb9\xf8"
"\x6c\x1e\x9d\xa9\x9f\x3d\xd4\x7a\xe3\x51\x91\x34\xaa\xe3\xd2\xbb\x8b\xd6"
"\x73\x75\xd0\xf3\xe8\x98\x5e\x2c\xd7\xbd\x98\xf5\xfc\x26\x6f\xe7\x76\x79"
"\x95\xdf\x4c\x2b\xad\xbc\x94\x9b\xb9\x95\x56\x79\xd5\xf7\x8f\xf0\xd5\x63"
"\x5c\xf5\xf5\xc7\xbb\xea\xbf\xf3\xfd\xaa\x72\x3e\xc9\x2f\xab\x72\x3a\x14"
"\x79\xbd\x34\x92\xd7\xd1\x7b\x6e\xb3\xec\x1b\x9d\x33\xcc\xd2\xe5\xd3\xbf"
"\x37\xce\x7c\xab\xaa\x14\x67\xcf\xab\x53\x77\x6f\xbc\x74\xe0\x5f\x89\x7e"
"\x26\x9e\x39\x3a\x13\x7f\x29\xae\x9b\x6c\x76\x1e\xdc\xdb\xb8\xbb\xfa\xce"
"\x31\xb7\xf7\xbd\xaa\x2c\x32\xf0\x8b\xa9\xca\x44\x71\xbe\x5c\x2e\x0e\x56"
"\xd9\x7a\xf8\xec\x28\xfa\x9e\x19\xdb\xb7\x5c\xf6\x5d\x19\xf4\xd5\x0f\xf5"
"\x5d\x1d\xf4\x3d\xea\x4a\x6d\x54\xcf\x70\x87\x47\x6a\x95\x7d\xcf\x8d\xed"
"\x6b\x97\x7d\xd7\x46\xfa\xc6\x3d\x6f\x01\x30\xf5\xe6\x7f\x30\xdf\x98\xfb"
"\xef\xdc\x3f\xe7\x3e\x9c\xfb\xf3\xdc\xdd\xb9\xd7\x67\x5f\xbd\x70\xf3\xc2"
"\x0b\x8d\x9c\xff\xc7\xf9\x9f\xcc\x2c\x9d\xfb\x6e\xfd\x85\xda\x5f\xf3\x61"
"\xfe\x30\x7c\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbe\xb8\xcd\xf7\xde\xbf\xb7\xda"
"\xe9\xac\x6d\xa8\xa8\xa8\xa8\x0c\x2a\x93\xbe\x33\x01\x5f\xb6\x1b\xdd\xfb"
"\xef\xdc\xd8\x7c\xef\xfd\x1f\xae\xdf\x5f\x7d\x6b\xed\xad\xb5\x07\x3f\x6a"
"\xb5\x5f\xba\xf5\xe3\xf6\xf2\xad\xe5\x1b\x77\xd6\x3b\x6b\x4b\xbd\xcf\x49"
"\x87\x09\x00\x9c\xa2\xe1\x43\xff\xa4\x23\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x3e\xcf\x59\xfc\x77\xe2\x49\xef\x23\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf0\xd5\xb6\xb2\x98\x99"
"\xed\xd4\xb2\xbc\x74\x7d\xa9\x68\xef\xee\xb4\x3b\xc5\xd4\xaf\x0f\x97\x9c"
"\x4d\x52\x2b\x2a\x7f\x4f\xf2\x69\xb2\x9d\xde\x94\xe6\xc8\x70\xb5\xcf\xdb"
"\xce\x9b\x2f\x3f\xf5\xd1\x07\xcf\x7f\xf2\xca\x70\xac\xd9\xfe\xf2\xb5\xa3"
"\xd6\x3b\x9e\x87\x62\xa9\x1f\x88\xe9\xa4\xe3\xb5\x4e\x3c\xde\x70\x0f\x17"
"\x92\x5c\xae\x4a\x98\xb8\xcf\x02\x00\x00\xff\xff\x2a\xb4\x09\x9a",
1492);
syz_mount_image(/*fs=*/0x20000600, /*dir=*/0x20000640, /*flags=*/0,
/*opts=*/0x20000040, /*chdir=*/1, /*size=*/0x5d4,
/*img=*/0x20000e00);
syz_clone(/*flags=*/0x11, /*stack=*/0, /*stack_len=*/0, /*parentid=*/0,
/*childtid=*/0, /*tls=*/0);
}
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
/*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
/*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul,
/*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
/*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
/*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
/*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
/*offset=*/0ul);
const char* reason;
(void)reason;
use_temporary_dir();
loop();
return 0;
}
[-- Attachment #3: repro.syz --]
[-- Type: application/octet-stream, Size: 2168 bytes --]
syz_mount_image$hfsplus(&(0x7f0000000600), &(0x7f0000000640)='./file0\x00', 0x0, &(0x7f0000000040), 0x1, 0x5d4, &(0x7f0000000e00)="$eJzs3U9vHGcdB/DvbpyNbdR0kyZtoJWwigQIi8TeRSVBVYFSkIUq1IpXYBGnsbJJK3uL3B6QQZz7GsrBUs+IK1KlcoZXgIx6ROJuTq5mdvZP7K3j1K53034+0uzzPPPMPPOb3/zJjFfRBvjaWlnMzHZqWVl8fato7+60O7s77fv9epILSerJbJJaMftvST5NttOb8s1+x0h5yJsvP/XRB89/8kqvNVtN5fK1o9Y7nkEszV6sZXla47VOPN5wDxeSXK5KmLj9vv+M7T7hdQkATLNacm7c/GYyXz2sF+8Bvafi3jP2E2170gEAAADAGXh6L3vZysVJxwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPkur3/2vVVO/XF1Lr//5/o5qXqv5E+3jSAQAAAAAAAADAKfj2XvaylYv99n6t/M7/xbJxpfz8Rt7NZtaykevZymq66WYjy0maIwM1tla73Y3lY6zZGrtm62z2FwAAAAAAAAC+ov6UleH3/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMA1qybleUU5X+vVm6jNJZpM0iuW2k3/161OtfnT3x2cVBwAAAEzQ03vZy1Yu9tv7tfKd/9nyvX827+ZBullPN52s5Xb5t4DeW399d6fd2d1p3y+mw+P+/H+PFUajelM/V7bGbflaucRc7mS9nHM9v8vb6eR26oN3/Gv9eMbH9cciptpPK8eM7HZVFnv+66qcDs0yI+cHGVmqYiuycenoTDzm0Tm4peXUB3/5ufIl5Hy+Kov9eW2qc94aOfuePToTyfy/2/+/23lw7+6dzcXp2aUv6GAm2iOZeO5rlYmlIhN7+z1JVvKr/DaLWcgb2ch6fp/VdLOWhbxW1lar87n4bB6dqZ891HrjUZE0quPSu4vWc3XQ8+iYXizXvZj1/CZv53Z5ld9MK628lJu5lVZ51feP8NVjXPX1x7vqv/P9qnI+yS+rcjoUeb00ktfRe26z7BudM8zS5dO/N858q6oUZ8+rU3dvvHTgX4l+Jp45OhN/Ka6bbHYe3Nu4u/rOMbf3vaosMvCLqcpEcb5cLg5W2Xr47Cj6nhnbt1z2XRn01Q/1XR30PepKbVTPcIdHapV9z43ta5d910b6xj1vATD15n8w35j779w/5z6c+/Pc3bnXZ1+9cPPCC42c/8f5n8wsnftu/YXaX/Nh/jB8/wcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL64zffev7fa6axtqKioqAwqk74zAV+2G93779zYfO/9H67fX31r7a21Bz9qtV+69eP28q3lG3fWO2tLvc9JhwkAnKLhQ/+kIwEAAAAAAAAAAAAAAD7PWfx34knvIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8NW2spiZ7dSyvHR9qWjv7rQ7xdSvD5ecTVIrKn9P8mmynd6U5shwtc/bzpsvP/XRB89/8spwrNn+8rWj1jueh2KpH4jppOO1TjzecA8XklyuSpi4zwIAAP//KrQJmg==")
syz_clone(0x11, 0x0, 0x0, 0x0, 0x0, 0x0)
[-- Attachment #4: report --]
[-- Type: application/octet-stream, Size: 8317 bytes --]
hfsplus: invalid length 63743 has been corrected to 255
==================================================================
BUG: KASAN: slab-out-of-bounds in hfsplus_strcasecmp+0x1bc/0x490 fs/hfsplus/unicode.c:47
Read of size 2 at addr ffff88804b8d640c by task repro.out/9757
CPU: 1 UID: 0 PID: 9757 Comm: repro.out Not tainted 6.17.0-rc6 #1 PREEMPT(full)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x17e/0x810 mm/kasan/report.c:482
kasan_report+0x147/0x180 mm/kasan/report.c:595
hfsplus_strcasecmp+0x1bc/0x490 fs/hfsplus/unicode.c:47
hfs_find_rec_by_key+0xa6/0x1e0 fs/hfsplus/bfind.c:89
__hfsplus_brec_find+0x18b/0x480 fs/hfsplus/bfind.c:124
hfsplus_brec_find+0x289/0x500 fs/hfsplus/bfind.c:184
hfsplus_brec_read+0x2b/0x120 fs/hfsplus/bfind.c:211
hfsplus_lookup+0x2aa/0x890 fs/hfsplus/dir.c:52
__lookup_slow+0x294/0x3d0 fs/namei.c:1808
lookup_slow+0x53/0x70 fs/namei.c:1825
walk_component+0x2d4/0x400 fs/namei.c:2129
lookup_last fs/namei.c:2630 [inline]
path_lookupat+0x163/0x430 fs/namei.c:2654
filename_lookup+0x212/0x570 fs/namei.c:2683
user_path_at+0x3a/0x60 fs/namei.c:3127
ksys_umount fs/namespace.c:2112 [inline]
__do_sys_umount fs/namespace.c:2120 [inline]
__se_sys_umount fs/namespace.c:2118 [inline]
__x64_sys_umount+0xee/0x160 fs/namespace.c:2118
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x452627
Code: 06 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc5dd08ae8 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 0000000000452627
RDX: 0000000000000009 RSI: 0000000000000009 RDI: 00007ffc5dd08b90
RBP: 00007ffc5dd09bd0 R08: 0000000000000015 R09: 00007ffc5dd08980
R10: 00000000004b9560 R11: 0000000000000206 R12: 000000000040a070
R13: 0000000000000000 R14: 00000000004bc018 R15: 00000000004004a0
</TASK>
Allocated by task 9757:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:388 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:405
kasan_kmalloc include/linux/kasan.h:260 [inline]
__do_kmalloc_node mm/slub.c:4376 [inline]
__kmalloc_noprof+0x27a/0x4f0 mm/slub.c:4388
kmalloc_noprof include/linux/slab.h:909 [inline]
hfsplus_find_init+0x8c/0x1d0 fs/hfsplus/bfind.c:21
hfsplus_lookup+0x19c/0x890 fs/hfsplus/dir.c:44
__lookup_slow+0x294/0x3d0 fs/namei.c:1808
lookup_slow+0x53/0x70 fs/namei.c:1825
walk_component+0x2d4/0x400 fs/namei.c:2129
lookup_last fs/namei.c:2630 [inline]
path_lookupat+0x163/0x430 fs/namei.c:2654
filename_lookup+0x212/0x570 fs/namei.c:2683
user_path_at+0x3a/0x60 fs/namei.c:3127
ksys_umount fs/namespace.c:2112 [inline]
__do_sys_umount fs/namespace.c:2120 [inline]
__se_sys_umount fs/namespace.c:2118 [inline]
__x64_sys_umount+0xee/0x160 fs/namespace.c:2118
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff88804b8d6000
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes to the right of
allocated 1036-byte region [ffff88804b8d6000, ffff88804b8d640c)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4b8d0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000040 ffff88801a442000 0000000000000000 dead000000000001
raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000
head: 04fff00000000040 ffff88801a442000 0000000000000000 dead000000000001
head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000
head: 04fff00000000003 ffffea00012e3401 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 8133, tgid 8133 (sh), ts 23500816499, free_ts 23484371257
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
alloc_slab_page mm/slub.c:2492 [inline]
allocate_slab+0x8a/0x370 mm/slub.c:2660
new_slab mm/slub.c:2714 [inline]
___slab_alloc+0xbeb/0x1420 mm/slub.c:3901
__slab_alloc mm/slub.c:3992 [inline]
__slab_alloc_node mm/slub.c:4067 [inline]
slab_alloc_node mm/slub.c:4228 [inline]
__do_kmalloc_node mm/slub.c:4375 [inline]
__kmalloc_noprof+0x305/0x4f0 mm/slub.c:4388
kmalloc_noprof include/linux/slab.h:909 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
tomoyo_init_log+0x1a32/0x1f30 security/tomoyo/audit.c:275
tomoyo_supervisor+0x340/0x1490 security/tomoyo/common.c:2198
tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline]
tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:63
tomoyo_environ security/tomoyo/domain.c:672 [inline]
tomoyo_find_next_domain+0x15cf/0x1aa0 security/tomoyo/domain.c:888
tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
security_bprm_check+0x89/0x270 security/security.c:1302
search_binary_handler fs/exec.c:1660 [inline]
exec_binprm fs/exec.c:1702 [inline]
bprm_execve+0x8ee/0x1450 fs/exec.c:1754
do_execveat_common+0x521/0x6b0 fs/exec.c:1860
do_execve fs/exec.c:1934 [inline]
__do_sys_execve fs/exec.c:2010 [inline]
__se_sys_execve fs/exec.c:2005 [inline]
__x64_sys_execve+0x94/0xb0 fs/exec.c:2005
page last free pid 5289 tgid 5289 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0xbc0/0xd40 mm/page_alloc.c:2895
discard_slab mm/slub.c:2758 [inline]
__put_partials+0x156/0x1a0 mm/slub.c:3223
put_cpu_partial+0x17c/0x250 mm/slub.c:3298
__slab_free+0x2d5/0x3c0 mm/slub.c:4565
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:340
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4191 [inline]
slab_alloc_node mm/slub.c:4240 [inline]
kmem_cache_alloc_node_noprof+0x1bb/0x3c0 mm/slub.c:4292
__alloc_skb+0x12a/0x2f0 net/core/skbuff.c:659
netlink_sendmsg+0x5c6/0xb30 net/netlink/af_netlink.c:1871
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg+0x219/0x270 net/socket.c:729
____sys_sendmsg+0x507/0x840 net/socket.c:2614
___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
__sys_sendmsg net/socket.c:2700 [inline]
__do_sys_sendmsg net/socket.c:2705 [inline]
__se_sys_sendmsg net/socket.c:2703 [inline]
__x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff88804b8d6300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88804b8d6380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88804b8d6400: 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88804b8d6480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88804b8d6500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
[-- Attachment #5: kernel.log --]
[-- Type: application/octet-stream, Size: 195518 bytes --]
[-- Attachment #6: .config --]
[-- Type: application/xml, Size: 275931 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [Linux Kernel Bug] KASAN: slab-out-of-bounds Read in hfsplus_strcasecmp
2025-09-15 3:04 [Linux Kernel Bug] KASAN: slab-out-of-bounds Read in hfsplus_strcasecmp Jiaming Zhang
@ 2025-09-15 17:29 ` Viacheslav Dubeyko
0 siblings, 0 replies; 2+ messages in thread
From: Viacheslav Dubeyko @ 2025-09-15 17:29 UTC (permalink / raw)
To: Jiaming Zhang, frank.li, glaubitz, linux-fsdevel; +Cc: linux-kernel, syzkaller
On Mon, 2025-09-15 at 11:04 +0800, Jiaming Zhang wrote:
> Dear Linux kernel developers and maintainers:
>
> We are writing to report a slab-out-of-bounds bug discovered in the
> hfsplus subsystem with our modified syzkaller. This bug is
> reproducible on the latest version (v6.17-rc6, commit
> f83ec76bf285bea5727f478a68b894f5543ca76e).
>
Thank you for the report. Issue has been created:
https://github.com/hfs-linux-kernel/hfs-linux-kernel/issues/238
Thanks,
Slava.
> The kernel console output, kernel config, syzkaller reproducer, and C
> reproducer are attached to this email to help analysis. The KASAN
> report from v6.17-rc6, formatted by syz-symbolize, is listed below:
>
> hfsplus: invalid length 63743 has been corrected to 255
> ==================================================================
> BUG: KASAN: slab-out-of-bounds in hfsplus_strcasecmp+0x1bc/0x490
> fs/hfsplus/unicode.c:47
> Read of size 2 at addr ffff88804b8d640c by task repro.out/9757
>
> CPU: 1 UID: 0 PID: 9757 Comm: repro.out Not tainted 6.17.0-rc6 #1
> PREEMPT(full)
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1
> 04/01/2014
> Call Trace:
> <TASK>
> __dump_stack lib/dump_stack.c:94 [inline]
> dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120
> print_address_description mm/kasan/report.c:378 [inline]
> print_report+0x17e/0x810 mm/kasan/report.c:482
> kasan_report+0x147/0x180 mm/kasan/report.c:595
> hfsplus_strcasecmp+0x1bc/0x490 fs/hfsplus/unicode.c:47
> hfs_find_rec_by_key+0xa6/0x1e0 fs/hfsplus/bfind.c:89
> __hfsplus_brec_find+0x18b/0x480 fs/hfsplus/bfind.c:124
> hfsplus_brec_find+0x289/0x500 fs/hfsplus/bfind.c:184
> hfsplus_brec_read+0x2b/0x120 fs/hfsplus/bfind.c:211
> hfsplus_lookup+0x2aa/0x890 fs/hfsplus/dir.c:52
> __lookup_slow+0x294/0x3d0 fs/namei.c:1808
> lookup_slow+0x53/0x70 fs/namei.c:1825
> walk_component+0x2d4/0x400 fs/namei.c:2129
> lookup_last fs/namei.c:2630 [inline]
> path_lookupat+0x163/0x430 fs/namei.c:2654
> filename_lookup+0x212/0x570 fs/namei.c:2683
> user_path_at+0x3a/0x60 fs/namei.c:3127
> ksys_umount fs/namespace.c:2112 [inline]
> __do_sys_umount fs/namespace.c:2120 [inline]
> __se_sys_umount fs/namespace.c:2118 [inline]
> __x64_sys_umount+0xee/0x160 fs/namespace.c:2118
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x452627
> Code: 06 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66
> 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48>
> 3d
> 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffc5dd08ae8 EFLAGS: 00000206 ORIG_RAX:
> 00000000000000a6
> RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 0000000000452627
> RDX: 0000000000000009 RSI: 0000000000000009 RDI: 00007ffc5dd08b90
> RBP: 00007ffc5dd09bd0 R08: 0000000000000015 R09: 00007ffc5dd08980
> R10: 00000000004b9560 R11: 0000000000000206 R12: 000000000040a070
> R13: 0000000000000000 R14: 00000000004bc018 R15: 00000000004004a0
> </TASK>
>
> Allocated by task 9757:
> kasan_save_stack mm/kasan/common.c:47 [inline]
> kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
> poison_kmalloc_redzone mm/kasan/common.c:388 [inline]
> __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:405
> kasan_kmalloc include/linux/kasan.h:260 [inline]
> __do_kmalloc_node mm/slub.c:4376 [inline]
> __kmalloc_noprof+0x27a/0x4f0 mm/slub.c:4388
> kmalloc_noprof include/linux/slab.h:909 [inline]
> hfsplus_find_init+0x8c/0x1d0 fs/hfsplus/bfind.c:21
> hfsplus_lookup+0x19c/0x890 fs/hfsplus/dir.c:44
> __lookup_slow+0x294/0x3d0 fs/namei.c:1808
> lookup_slow+0x53/0x70 fs/namei.c:1825
> walk_component+0x2d4/0x400 fs/namei.c:2129
> lookup_last fs/namei.c:2630 [inline]
> path_lookupat+0x163/0x430 fs/namei.c:2654
> filename_lookup+0x212/0x570 fs/namei.c:2683
> user_path_at+0x3a/0x60 fs/namei.c:3127
> ksys_umount fs/namespace.c:2112 [inline]
> __do_sys_umount fs/namespace.c:2120 [inline]
> __se_sys_umount fs/namespace.c:2118 [inline]
> __x64_sys_umount+0xee/0x160 fs/namespace.c:2118
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> The buggy address belongs to the object at ffff88804b8d6000
> which belongs to the cache kmalloc-2k of size 2048
> The buggy address is located 0 bytes to the right of
> allocated 1036-byte region [ffff88804b8d6000, ffff88804b8d640c)
>
> The buggy address belongs to the physical page:
> page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
> pfn:0x4b8d0
> head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0
> pincount:0
> anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff)
> page_type: f5(slab)
> raw: 04fff00000000040 ffff88801a442000 0000000000000000
> dead000000000001
> raw: 0000000000000000 0000000080080008 00000000f5000000
> 0000000000000000
> head: 04fff00000000040 ffff88801a442000 0000000000000000
> dead000000000001
> head: 0000000000000000 0000000080080008 00000000f5000000
> 0000000000000000
> head: 04fff00000000003 ffffea00012e3401 00000000ffffffff
> 00000000ffffffff
> head: ffffffffffffffff 0000000000000000 00000000ffffffff
> 0000000000000008
> page dumped because: kasan: bad access detected
> page_owner tracks the page as allocated
> page last allocated via order 3, migratetype Unmovable, gfp_mask
> 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALL
> OC),
> pid 8133, tgid 8133 (sh), ts 23500816499, free_ts 23484371257
> set_page_owner include/linux/page_owner.h:32 [inline]
> post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
> prep_new_page mm/page_alloc.c:1859 [inline]
> get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
> __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
> alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
> alloc_slab_page mm/slub.c:2492 [inline]
> allocate_slab+0x8a/0x370 mm/slub.c:2660
> new_slab mm/slub.c:2714 [inline]
> ___slab_alloc+0xbeb/0x1420 mm/slub.c:3901
> __slab_alloc mm/slub.c:3992 [inline]
> __slab_alloc_node mm/slub.c:4067 [inline]
> slab_alloc_node mm/slub.c:4228 [inline]
> __do_kmalloc_node mm/slub.c:4375 [inline]
> __kmalloc_noprof+0x305/0x4f0 mm/slub.c:4388
> kmalloc_noprof include/linux/slab.h:909 [inline]
> kzalloc_noprof include/linux/slab.h:1039 [inline]
> tomoyo_init_log+0x1a32/0x1f30 security/tomoyo/audit.c:275
> tomoyo_supervisor+0x340/0x1490 security/tomoyo/common.c:2198
> tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline]
> tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:63
> tomoyo_environ security/tomoyo/domain.c:672 [inline]
> tomoyo_find_next_domain+0x15cf/0x1aa0 security/tomoyo/domain.c:888
> tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102
> security_bprm_check+0x89/0x270 security/security.c:1302
> search_binary_handler fs/exec.c:1660 [inline]
> exec_binprm fs/exec.c:1702 [inline]
> bprm_execve+0x8ee/0x1450 fs/exec.c:1754
> do_execveat_common+0x521/0x6b0 fs/exec.c:1860
> do_execve fs/exec.c:1934 [inline]
> __do_sys_execve fs/exec.c:2010 [inline]
> __se_sys_execve fs/exec.c:2005 [inline]
> __x64_sys_execve+0x94/0xb0 fs/exec.c:2005
> page last free pid 5289 tgid 5289 stack trace:
> reset_page_owner include/linux/page_owner.h:25 [inline]
> free_pages_prepare mm/page_alloc.c:1395 [inline]
> __free_frozen_pages+0xbc0/0xd40 mm/page_alloc.c:2895
> discard_slab mm/slub.c:2758 [inline]
> __put_partials+0x156/0x1a0 mm/slub.c:3223
> put_cpu_partial+0x17c/0x250 mm/slub.c:3298
> __slab_free+0x2d5/0x3c0 mm/slub.c:4565
> qlink_free mm/kasan/quarantine.c:163 [inline]
> qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
> kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
> __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:340
> kasan_slab_alloc include/linux/kasan.h:250 [inline]
> slab_post_alloc_hook mm/slub.c:4191 [inline]
> slab_alloc_node mm/slub.c:4240 [inline]
> kmem_cache_alloc_node_noprof+0x1bb/0x3c0 mm/slub.c:4292
> __alloc_skb+0x12a/0x2f0 net/core/skbuff.c:659
> netlink_sendmsg+0x5c6/0xb30 net/netlink/af_netlink.c:1871
> sock_sendmsg_nosec net/socket.c:714 [inline]
> __sock_sendmsg+0x219/0x270 net/socket.c:729
> ____sys_sendmsg+0x507/0x840 net/socket.c:2614
> ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
> __sys_sendmsg net/socket.c:2700 [inline]
> __do_sys_sendmsg net/socket.c:2705 [inline]
> __se_sys_sendmsg net/socket.c:2703 [inline]
> __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xf3/0x3b0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Memory state around the buggy address:
> ffff88804b8d6300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> ffff88804b8d6380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > ffff88804b8d6400: 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ^
> ffff88804b8d6480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff88804b8d6500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ==================================================================
>
> Please let me know if any further information is required.
>
> Best Regards,
> Jiaming Zhang.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-15 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-15 3:04 [Linux Kernel Bug] KASAN: slab-out-of-bounds Read in hfsplus_strcasecmp Jiaming Zhang
2025-09-15 17:29 ` Viacheslav Dubeyko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®