[syzbot] [kvmarm?] [kvm?] WARNING: locking bug in vgic_put_irq

18 views
Skip to first unread message

syzbot

unread,
Aug 25, 2025, 5:08:43 PM8/25/25
to catalin...@arm.com, joey....@arm.com, k...@vger.kernel.org, kvm...@lists.linux.dev, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, m...@kernel.org, oliver...@linux.dev, suzuki....@arm.com, syzkall...@googlegroups.com, wi...@kernel.org, yuze...@huawei.com
Hello,

syzbot found the following issue on:

HEAD commit: 7b8346bd9fce KVM: arm64: Don't attempt vLPI mappings when ..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next
console output: https://syzkaller.appspot.com/x/log.txt?x=17b4e862580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7c53d3478750eda0
dashboard link: https://syzkaller.appspot.com/bug?extid=cef594105ac7e60c6d93
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15860634580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1074e862580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/fa3fbcfdac58/non_bootable_disk-7b8346bd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/74f545807499/vmlinux-7b8346bd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d83062566dc7/Image-7b8346bd.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+cef594...@syzkaller.appspotmail.com

=============================
[ BUG: Invalid wait context ]
6.16.0-rc3-syzkaller-g7b8346bd9fce #0 Not tainted
-----------------------------
syz.0.29/3743 is trying to lock:
a3ff80008e2e9e18 (&xa->xa_lock#20){....}-{3:3}, at: vgic_put_irq+0xb4/0x190 arch/arm64/kvm/vgic/vgic.c:137
other info that might help us debug this:
context-{5:5}
3 locks held by syz.0.29/3743:
#0: a3ff80008e2e90a8 (&kvm->slots_lock){+.+.}-{4:4}, at: kvm_vgic_destroy+0x50/0x624 arch/arm64/kvm/vgic/vgic-init.c:499
#1: a3ff80008e2e9fa0 (&kvm->arch.config_lock){+.+.}-{4:4}, at: kvm_vgic_destroy+0x5c/0x624 arch/arm64/kvm/vgic/vgic-init.c:500
#2: 58f0000021be1428 (&vgic_cpu->ap_list_lock){....}-{2:2}, at: vgic_flush_pending_lpis+0x3c/0x31c arch/arm64/kvm/vgic/vgic.c:150
stack backtrace:
CPU: 0 UID: 0 PID: 3743 Comm: syz.0.29 Not tainted 6.16.0-rc3-syzkaller-g7b8346bd9fce #0 PREEMPT
Hardware name: linux,dummy-virt (DT)
Call trace:
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C)
__dump_stack+0x30/0x40 lib/dump_stack.c:94
dump_stack_lvl+0xd8/0x12c lib/dump_stack.c:120
dump_stack+0x1c/0x28 lib/dump_stack.c:129
print_lock_invalid_wait_context kernel/locking/lockdep.c:4833 [inline]
check_wait_context kernel/locking/lockdep.c:4905 [inline]
__lock_acquire+0x978/0x299c kernel/locking/lockdep.c:5190
lock_acquire+0x14c/0x2e0 kernel/locking/lockdep.c:5871
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x5c/0x7c kernel/locking/spinlock.c:162
vgic_put_irq+0xb4/0x190 arch/arm64/kvm/vgic/vgic.c:137
vgic_flush_pending_lpis+0x24c/0x31c arch/arm64/kvm/vgic/vgic.c:158
__kvm_vgic_vcpu_destroy+0x44/0x500 arch/arm64/kvm/vgic/vgic-init.c:455
kvm_vgic_destroy+0x100/0x624 arch/arm64/kvm/vgic/vgic-init.c:505
kvm_arch_destroy_vm+0x80/0x138 arch/arm64/kvm/arm.c:244
kvm_destroy_vm virt/kvm/kvm_main.c:1308 [inline]
kvm_put_kvm+0x800/0xff8 virt/kvm/kvm_main.c:1344
kvm_vm_release+0x58/0x78 virt/kvm/kvm_main.c:1367
__fput+0x4ac/0x980 fs/file_table.c:465
____fput+0x20/0x58 fs/file_table.c:493
task_work_run+0x1bc/0x254 kernel/task_work.c:227
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
do_notify_resume+0x1b4/0x270 arch/arm64/kernel/entry-common.c:151
exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline]
el0_svc+0xb4/0x160 arch/arm64/kernel/entry-common.c:768
el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:786
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600


---
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 syzk...@googlegroups.com.

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

Oliver Upton

unread,
Sep 9, 2025, 5:26:06 PM9/9/25
to syzbot, catalin...@arm.com, joey....@arm.com, k...@vger.kernel.org, kvm...@lists.linux.dev, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, m...@kernel.org, suzuki....@arm.com, syzkall...@googlegroups.com, wi...@kernel.org, yuze...@huawei.com

syzbot

unread,
Sep 9, 2025, 6:14:04 PM9/9/25
to catalin...@arm.com, joey....@arm.com, k...@vger.kernel.org, kvm...@lists.linux.dev, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, m...@kernel.org, oliver...@linux.dev, suzuki....@arm.com, syzkall...@googlegroups.com, wi...@kernel.org, yuze...@huawei.com
Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to copy binary to VM: failed to run ["scp" "-P" "31225" "-F" "/dev/null" "-o" "UserKnownHostsFile=/dev/null" "-o" "IdentitiesOnly=yes" "-o" "BatchMode=yes" "-o" "StrictHostKeyChecking=no" "-o" "ConnectTimeout=10" "/tmp/syz-executor3241787550" "root@localhost:/syz-executor3241787550"]: exit status 255
Connection timed out during banner exchange
Connection to 127.0.0.1 port 31225 timed out
scp: Connection closed




syzkaller build log:
go env (err=<nil>)
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='auto'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/syzkaller/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/syzkaller/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3554905218=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/syzkaller/jobs/linux/gopath/src/github.com/google/syzkaller/go.mod'
GOMODCACHE='/syzkaller/jobs/linux/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/syzkaller/jobs/linux/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/syzkaller/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.24.4'
GOWORK=''
PKG_CONFIG='pkg-config'

git status (err=<nil>)
HEAD detached at bf27483f96
nothing to commit, working tree clean


tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
go: downloading golang.org/x/sys v0.34.0
go: downloading github.com/prometheus/client_golang v1.23.0
go: downloading github.com/prometheus/common v0.65.0
go: downloading github.com/prometheus/client_model v0.6.2
go: downloading github.com/prometheus/procfs v0.16.1
go list -f '{{.Stale}}' -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=bf27483f963359281b2d9b6d6efd36289f82e282 -X github.com/google/syzkaller/prog.gitRevisionDate=20250821-140520" ./sys/syz-sysgen | grep -q false || go install -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=bf27483f963359281b2d9b6d6efd36289f82e282 -X github.com/google/syzkaller/prog.gitRevisionDate=20250821-140520" ./sys/syz-sysgen
make .descriptions
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
bin/syz-sysgen
touch .descriptions
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=bf27483f963359281b2d9b6d6efd36289f82e282 -X github.com/google/syzkaller/prog.gitRevisionDate=20250821-140520" -o ./bin/linux_arm64/syz-execprog github.com/google/syzkaller/tools/syz-execprog
mkdir -p ./bin/linux_arm64
g++ -o ./bin/linux_arm64/syz-executor executor/executor.cc \
-O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -std=c++17 -I. -Iexecutor/_include -DGOOS_linux=1 -DGOARCH_arm64=1 \
-DHOSTGOOS_linux=1 -DGIT_REVISION=\"bf27483f963359281b2d9b6d6efd36289f82e282\"
go: downloading golang.org/x/sync v0.16.0
go: downloading golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc
go: downloading cloud.google.com/go/spanner v1.82.0
go: downloading cloud.google.com/go/bigquery v1.69.0
go: downloading github.com/sergi/go-diff v1.4.0
go: downloading google.golang.org/genproto v0.0.0-20250603155806-513f23925822
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822
go: downloading github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.52.0
go: downloading github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.28.0
go: downloading github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.52.0
go: downloading github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8
go: downloading github.com/go-logr/logr v1.4.3
go: downloading github.com/goccy/go-json v0.10.5
go: downloading golang.org/x/net v0.42.0
go: downloading github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443
go: downloading cel.dev/expr v0.24.0
go: downloading github.com/go-jose/go-jose/v4 v4.1.0
go: downloading golang.org/x/text v0.27.0
go: downloading golang.org/x/crypto v0.40.0
/usr/bin/ld: /tmp/ccHdKQ2T.o: in function `Connection::Connect(char const*, char const*)':
executor.cc:(.text._ZN10Connection7ConnectEPKcS1_[_ZN10Connection7ConnectEPKcS1_]+0xd8): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking



Tested on:

commit: 2d047827 KVM: arm64: vgic: fix incorrect spinlock API ..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes
kernel config: https://syzkaller.appspot.com/x/.config?x=a348a32a552b6434
dashboard link: https://syzkaller.appspot.com/bug?extid=cef594105ac7e60c6d93
compiler: Debian clang version 20.1.8 (++20250708123704+0de59a293f7a-1~exp1~20250708003721.134), Debian LLD 20.1.8
userspace arch: arm64

Note: no patches were applied.

Hillf Danton

unread,
Sep 9, 2025, 8:03:25 PM9/9/25
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
> Date: Mon, 25 Aug 2025 14:08:41 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 7b8346bd9fce KVM: arm64: Don't attempt vLPI mappings when ..
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next
> console output: https://syzkaller.appspot.com/x/log.txt?x=17b4e862580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=7c53d3478750eda0
> dashboard link: https://syzkaller.appspot.com/bug?extid=cef594105ac7e60c6d93
> compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
> userspace arch: arm64
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15860634580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1074e862580000

#syz test

--- x/arch/arm64/kvm/vgic/vgic.c
+++ y/arch/arm64/kvm/vgic/vgic.c
@@ -146,20 +146,25 @@ void vgic_flush_pending_lpis(struct kvm_
struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
struct vgic_irq *irq, *tmp;
unsigned long flags;
+ LIST_HEAD(head);

raw_spin_lock_irqsave(&vgic_cpu->ap_list_lock, flags);

list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) {
if (irq->intid >= VGIC_MIN_LPI) {
raw_spin_lock(&irq->irq_lock);
- list_del(&irq->ap_list);
+ list_move(&irq->ap_list, &head);
irq->vcpu = NULL;
raw_spin_unlock(&irq->irq_lock);
- vgic_put_irq(vcpu->kvm, irq);
}
}

raw_spin_unlock_irqrestore(&vgic_cpu->ap_list_lock, flags);
+
+ list_for_each_entry_safe(irq, tmp, &head, ap_list) {
+ list_del(&irq->ap_list);
+ vgic_put_irq(vcpu->kvm, irq);
+ }
}

void vgic_irq_set_phys_pending(struct vgic_irq *irq, bool pending)
--

syzbot

unread,
Sep 9, 2025, 8:53:07 PM9/9/25
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to copy binary to VM: failed to run ["scp" "-P" "8142" "-F" "/dev/null" "-o" "UserKnownHostsFile=/dev/null" "-o" "IdentitiesOnly=yes" "-o" "BatchMode=yes" "-o" "StrictHostKeyChecking=no" "-o" "ConnectTimeout=10" "/tmp/syz-executor2510371855" "root@localhost:/syz-executor2510371855"]: exit status 255
Connection timed out during banner exchange
Connection to 127.0.0.1 port 8142 timed out
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2016643261=/tmp/go-build -gno-record-gcc-switches'
go list -f '{{.Stale}}' -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=bf27483f963359281b2d9b6d6efd36289f82e282 -X github.com/google/syzkaller/prog.gitRevisionDate=20250821-140520" ./sys/syz-sysgen | grep -q false || go install -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=bf27483f963359281b2d9b6d6efd36289f82e282 -X github.com/google/syzkaller/prog.gitRevisionDate=20250821-140520" ./sys/syz-sysgen
make .descriptions
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
bin/syz-sysgen
touch .descriptions
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=bf27483f963359281b2d9b6d6efd36289f82e282 -X github.com/google/syzkaller/prog.gitRevisionDate=20250821-140520" -o ./bin/linux_arm64/syz-execprog github.com/google/syzkaller/tools/syz-execprog
mkdir -p ./bin/linux_arm64
g++ -o ./bin/linux_arm64/syz-executor executor/executor.cc \
-O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -std=c++17 -I. -Iexecutor/_include -DGOOS_linux=1 -DGOARCH_arm64=1 \
-DHOSTGOOS_linux=1 -DGIT_REVISION=\"bf27483f963359281b2d9b6d6efd36289f82e282\"
/usr/bin/ld: /tmp/ccD2Uc1q.o: in function `Connection::Connect(char const*, char const*)':
executor.cc:(.text._ZN10Connection7ConnectEPKcS1_[_ZN10Connection7ConnectEPKcS1_]+0xd8): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking



Tested on:

commit: aae5a983 Merge branch kvm-arm64/misc-6.18 into kvmarm-..
kernel config: https://syzkaller.appspot.com/x/.config?x=a348a32a552b6434
dashboard link: https://syzkaller.appspot.com/bug?extid=cef594105ac7e60c6d93
compiler: Debian clang version 20.1.8 (++20250708123704+0de59a293f7a-1~exp1~20250708003721.134), Debian LLD 20.1.8
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=11814d62580000

Reply all
Reply to author
Forward
0 new messages