From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 649AC374E5A for ; Fri, 10 Jul 2026 13:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783690909; cv=none; b=qS4bF5CdGN/I6V34Bm1NkA8Cwqge3ccZKvcQH/MRh8dSjMYAaIofAoJevGz/WNXxFLXSL6OPrxb2Ybv3ZpOLn/21PFoVXDuzmwISAZXrHdfsxvwO7MInEPG65tCkPfwMlGRx9dzKsd0sNQuSfJXU04e88tGOITaSJ4m/7qpTynY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783690909; c=relaxed/simple; bh=R1tmYU4DXwUaYNRIS2ITaY7bEA0QNeDNVMefmnOlu7U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=apbDqevTuQaWa8afuHn+dKf3MfexaJPoyPKw3vAhRL4fTU+ZkDxdKzWA+YJWbKb6hfAGv4wLO4+CYDqN0xhZpwb9G2RLawoaV/5DDxup/vxPmd+amLD+eopk8iRhBaptYbutEFOm3ET0QB+2nHRpnO+OIlWFZQVqunKV+676BgI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=pc+GgHyx; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pc+GgHyx" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-493c2c7770bso574245e9.1 for ; Fri, 10 Jul 2026 06:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783690907; x=1784295707; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=8SAfw2XLSvgndVDo3hUQeQr3dLbpgg8qNv+9M2JCbKc=; b=pc+GgHyxUIH8HQjnQY442iJt8dRQZ6v3B6NIJXGorYKR+7yeshA9vQ8pOwN5NPnkxB jthUnMMGMOI8YMjzZZblJ8CAg0zhclmXQl7GtoWRPZv1Qc3f77Qgz6/MIO4A1eNbvO/8 yPTFswOCNIs8XbYgYKUgZL1BN+Er8NKCxlryG4Tmeo46V1VzpRBsrHyv99oSAcebQ7ix TlIFiaJpsfQLdXAMGuFo7qRVGtOI5+aEarY7ayC5I8jxkLc71u/GH/0wEQxmmKoXjRX3 dKs2574NET+Ug/YKpMdUwP2eQxSJjbgPNifC5KBSWoiy/48gVANOg54jti06xk4Hmhgh 3zaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783690907; x=1784295707; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8SAfw2XLSvgndVDo3hUQeQr3dLbpgg8qNv+9M2JCbKc=; b=c6PHA+WQ6zWRwRzDeeTLb+sIoTOyQ4Qp5Gx63szVAV815OlLFIAYkHpkuZTRUJai5h 1BYq7sCsFiksLpwd52sSTY4APgm7Ynbt67sjrwXnN36d15/8FbcdRhPA8c9yIHuhGYfU A07uVZuLxWKFTqTumUa1v2gOJRdfT0bXJAdCCrDnmW3s+RE6HHTNvbC6R1ywwBWwhez4 vCRQDj4A5steTodyK9X5UKRLzwq8CgqfMEOiO9dAaDcqclb35aYVqqiEU+K4IJFlvbw8 q6iu/YjJSBzJEEqSSLGHFZOeQkkyrKbBECyMS5viLvZOfOgSmj65UsfAr4CnoZEgKarR C3uw== X-Forwarded-Encrypted: i=1; AHgh+Rqg5IkX/lS7g1g5Y18rKj6HJrvW0XRY+FVIBgjla7ji3z6jbzYOyAKdvsjguGIw+6S0uJ6TStfQ57Mc8Bs=@vger.kernel.org X-Gm-Message-State: AOJu0YypHOmJA+g0w9z2CvyNITZqjT1J2uHtkdWVP8zlNIb8IdSalbiY obaHjE8zAeSEWQCOeTeW9REZ0s69Q/LG9KF0taFY6/LbrEsPT/61CSEm X-Gm-Gg: AfdE7ckgkPpthGoEzinWXjTtQcSba7cMtyvxn2T0KvpWwx/VmHMjJcxrgFvM176FltD ve19Oy1c8urEucat+yEsLBJIFWbNEdy4NFzrGzuieUJ8ORfNdlt7jLRRqcXi+d+13qsVInavQA9 Ey6VtKLpEqapD83czA3m7/fKesE6KBTPQ/THv5xfmpbD+JQKC8TbFIgWUDH3pZ4OXYAW/eh3YiT 0AnzNlfKRYcfEoNPRV720NVKmZle2XayWUqSscOhjwaSz8JNkMo4o9zm7WkcPBQ6CsHVEpKg+QT hcDUKc5C2kqRwfS1ErIk92l6eCEkgY2PDRY8Fp64K04uPw4UldL1smwYCCe4st5vjp7eUZ+A/zA hHEmrWco5ajD3wbXquPgZxMQd0aKkuBOHlJw+hW8klFVONguskETrv0vsePZl+vB2xrmqq8STHo gTep3vbWMVRA== X-Received: by 2002:a05:600c:548d:b0:492:506a:f48c with SMTP id 5b1f17b1804b1-493e684ea1bmr71597275e9.4.1783690906328; Fri, 10 Jul 2026 06:41:46 -0700 (PDT) Received: from AtiePC ([79.117.54.17]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493eb6f3b85sm228006715e9.2.2026.07.10.06.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 06:41:45 -0700 (PDT) From: Daniel Paziyski To: Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: Daniel Paziyski , "H. Peter Anvin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: x86: Fix null pointer dereference in trace_kvm_inj_exception Date: Fri, 10 Jul 2026 15:40:54 +0200 Message-ID: <20260710134055.16432-1-danielpaziyski@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The trace_kvm_inj_exception tracepoint takes as arguments the exception vector, whether the exception has an error code (and subsequently, the error code), and whether it is being reinjected. The error code is formatted to the trace log as a string using __print_symbolic, which takes an integer value and an array of structs containing a mask value and a string. An empty struct is being passed, which makes the kernel derefence a NULL pointer when the error code is 0. Remove this stray struct in the invocation of __print_symbolic. Signed-off-by: Daniel Paziyski --- arch/x86/kvm/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 0db25bba1..93de876c3 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h @@ -490,7 +490,7 @@ TRACE_EVENT(kvm_inj_exception, TP_printk("%s%s%s%s%s", __print_symbolic(__entry->exception, kvm_trace_sym_exc), !__entry->has_error ? "" : " (", - !__entry->has_error ? "" : __print_symbolic(__entry->error_code, { }), + !__entry->has_error ? "" : __print_symbolic(__entry->error_code), !__entry->has_error ? "" : ")", __entry->reinjected ? " [reinjected]" : "") ); -- 2.55.0