Skip to contentSkip to conversation

kernel BUG in __open_session

syzbot Superseded syzbot 2 participants 5 messages Sep 10 – Sep 11 Ceph client

lore
Share & tools
lore

syzbot

author syzbot
#0 lore raw

Hello,

syzbot found the following issue on:

HEAD commit:    50d05c7c76c9 Merge tag 'landlock-7.3-rc3' of git://git.ker..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14ef0905580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=1dbed5969931c19d3eb5
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=13d1fe01580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10cb14d1580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-50d05c7c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6f77d29903f3/vmlinux-50d05c7c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/23b2961d9c5d/bzImage-50d05c7c.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:

Reported-by [email protected]

libceph: resolve '127.0.0.' (ret=-3): failed

------------[ cut here ]------------
kernel BUG at net/ceph/mon_client.c:211!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 2 UID: 0 PID: 5924 Comm: syz.0.17 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:pick_new_mon net/ceph/mon_client.c:211 [inline]
RIP: 0010:__open_session+0x60f/0x740 net/ceph/mon_client.c:245
Code: f6 44 89 e7 e8 72 1e 27 fa 89 c5 e9 2b fb ff ff e8 96 4b 7e f6 c7 83 b4 09 00 00 0a 00 00 00 e9 22 fc ff ff e8 82 4b 7e f6 90 <0f> 0b e8 9a 86 f1 f6 e9 7b fa ff ff 4c 89 f7 e8 8d 86 f1 f6 e9 16
RSP: 0018:ffffc900039a7be0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888037864290 RCX: 0000000000000000
RDX: ffff888033b68000 RSI: ffffffff8b8dca8e RDI: ffff888033b68000
RBP: ffff88802a3b4d80 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 00000000ffffffff R14: ffff888037864400 R15: ffff888037864298
FS:  00005555720c7500(0000) GS:ffff8880d5d5a000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055e267f24d48 CR3: 0000000036162000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 ceph_monc_open_session+0x46/0x60 net/ceph/mon_client.c:534
 __ceph_open_session+0x135/0x590 net/ceph/ceph_common.c:798
 ceph_real_mount fs/ceph/super.c:1173 [inline]
 ceph_get_tree+0xd98/0x1fd0 fs/ceph/super.c:1362
 vfs_get_tree+0x92/0x320 fs/super.c:1947
 vfs_cmd_create+0xd7/0x2a0 fs/fsopen.c:231
 vfs_fsconfig_locked fs/fsopen.c:295 [inline]
 __do_sys_fsconfig+0x55a/0xcb0 fs/fsopen.c:463
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7feb99b9e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff76419958 EFLAGS: 00000246 ORIG_RAX: 00000000000001af
RAX: ffffffffffffffda RBX: 00007feb99e25fa0 RCX: 00007feb99b9e159
RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000003
RBP: 00007feb99c3503b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007feb99e25fac R14: 00007feb99e25fa0 R15: 00007feb99e25fa0
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:pick_new_mon net/ceph/mon_client.c:211 [inline]
RIP: 0010:__open_session+0x60f/0x740 net/ceph/mon_client.c:245
Code: f6 44 89 e7 e8 72 1e 27 fa 89 c5 e9 2b fb ff ff e8 96 4b 7e f6 c7 83 b4 09 00 00 0a 00 00 00 e9 22 fc ff ff e8 82 4b 7e f6 90 <0f> 0b e8 9a 86 f1 f6 e9 7b fa ff ff 4c 89 f7 e8 8d 86 f1 f6 e9 16
RSP: 0018:ffffc900039a7be0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888037864290 RCX: 0000000000000000
RDX: ffff888033b68000 RSI: ffffffff8b8dca8e RDI: ffff888033b68000
RBP: ffff88802a3b4d80 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: 00000000ffffffff R14: ffff888037864400 R15: ffff888037864298
FS:  00005555720c7500(0000) GS:ffff8880d5d5a000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055e267f24d48 CR3: 0000000036162000 CR4: 0000000000352ef0

---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

#1 lore raw

From: Edward Aadm Davis <[email protected]>

#syz test: upstream 50d05c7c76c9

fs/ceph/super.c +5 -1
index 72935f665f11..0f20d6c5e4bd 100644
@@ -818,7 +818,11 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
 					struct ceph_options *opt)
 {
 	struct ceph_fs_client *fsc;
-	int err;
+	int err, num_mon;
+
+	num_mon = opt->num_mon;
+	if (num_mon == 0 || num_mon > CEPH_MAX_MON)
+		return ERR_PTR(-EINVAL);
 
 	fsc = kzalloc_obj(*fsc);
 	if (!fsc) {
author syzbot Tested-by
#2 lore raw
syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Tested on:

commit:         50d05c7c Merge tag 'landlock-7.3-rc3' of git://git.ker..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=13b294d1580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=1dbed5969931c19d3eb5
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15c22601580000

Note: testing is done by a robot and is best-effort only.

#3 lore raw

PATCH 1/1 ceph: reject create client if no monitor

In reply to syzbot

From: Edward Adam Davis <[email protected]>

During the resolution of monitor addresses, the failure to resolve the server name [1] resulted in no available monitors (i.e., the num_mon value in ceph_options was 0).

This triggered the issue [2] when joining the Ceph cluster.

Before creating the client, if the number of monitors specified in the options is invalid, the client creation process is aborted.

[1]
libceph: resolve '127.0.0.' (ret=-3): failed

[2]
kernel BUG at net/ceph/mon_client.c:211!

Call Trace:
 ceph_monc_open_session+0x46/0x60 net/ceph/mon_client.c:534
 __ceph_open_session+0x135/0x590 net/ceph/ceph_common.c:798
 ceph_real_mount fs/ceph/super.c:1173 [inline]
 ceph_get_tree+0xd98/0x1fd0 fs/ceph/super.c:1362
---
 fs/ceph/super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ceph/super.c +5 -1
index 72935f665f11..0f20d6c5e4bd 100644
@@ -818,7 +818,11 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
 					struct ceph_options *opt)
 {
 	struct ceph_fs_client *fsc;
-	int err;
+	int err, num_mon;
+
+	num_mon = opt->num_mon;
+	if (num_mon == 0 || num_mon > CEPH_MAX_MON)
+		return ERR_PTR(-EINVAL);
 
 	fsc = kzalloc_obj(*fsc);
 	if (!fsc) {
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 1/1 ceph: reject create client if no monitor

During the resolution of monitor addresses, the failure to resolve the server name [1] resulted in no available monitors (i.e., the num_mon value in ceph_options was 0).

This triggered the issue [2] when joining the Ceph cluster.

Before creating the client, if the number of monitors specified in the options is invalid, the client creation process is aborted.

[1]
libceph: resolve '127.0.0.' (ret=-3): failed

[2]
kernel BUG at net/ceph/mon_client.c:211!

Call Trace:
 ceph_monc_open_session+0x46/0x60 net/ceph/mon_client.c:534
 __ceph_open_session+0x135/0x590 net/ceph/ceph_common.c:798
 ceph_real_mount fs/ceph/super.c:1173 [inline]
 ceph_get_tree+0xd98/0x1fd0 fs/ceph/super.c:1362

---
v1 -> v2: unified email address

 fs/ceph/super.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ceph/super.c +5 -1
index 72935f665f11..0f20d6c5e4bd 100644
@@ -818,7 +818,11 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
 					struct ceph_options *opt)
 {
 	struct ceph_fs_client *fsc;
-	int err;
+	int err, num_mon;
+
+	num_mon = opt->num_mon;
+	if (num_mon == 0 || num_mon > CEPH_MAX_MON)
+		return ERR_PTR(-EINVAL);
 
 	fsc = kzalloc_obj(*fsc);
 	if (!fsc) {
Signature · 1 line
2.43.0