From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 AC50027E066 for ; Mon, 17 Nov 2025 17:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763400636; cv=none; b=FPUl0hgwJ7K9zuFfyBYJmFHRGwmXrBnLcosNAO3bCC71tyHeWDGlh2Fj4G+r6bf9dDFUD4y+fcXekHLMefyv54P5uryT9y9Xra2QKrlEI9yebgsM9z/22mCw6bn0C3Hzac2nFVWdB/LPTJm2r8K3sXQ/+DlgZqNu+F6j7qk0SLw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763400636; c=relaxed/simple; bh=w4CIjNZ1605si4lfku8gD0WaSIuSJ0mIYmzzxkOiGMU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CN04Bg+jVBkuvOilDrDLKMVEIMdR/jfoTstHHkyIn+/swSu5NJbGXUWBucON2ndl5oYyMcQPW/YU81r+4mBOseLVDSmJNvK0yZdKMJynuQLNrYtERzE2JzYDRPczcTX4fgKzOaDsOfa/0pi4c49zY2Iun5KXTWEUMFeL3TBIRtM= 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=KePt7xJj; arc=none smtp.client-ip=209.85.210.171 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="KePt7xJj" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-7b9387df58cso386358b3a.3 for ; Mon, 17 Nov 2025 09:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763400634; x=1764005434; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yLRfQs0wWjDMt4ZR8Ou2KlvzNHuxRbwkp7eOWLdaSCA=; b=KePt7xJjOgrGGydsaJZemyFPoB29kOA3vkkHZio4rOw6VUmc66M6RIBh1FeGGcou3q QRruayVCBJwfEcKbIVsEzCNCfNOBfdH9CzZlqulGe0Z3WWAmcDjSpuQ5Ud1BD+rpWTrt KnK4dwanHtnF4sYUzWC3jTy4sdI7LKZF1pdPdPFlZ+0rJlhjI8gBl9rLp617ukDyZQ0V Jqk9JTFRs6H0XqJ7tSNxNnTbEaPzDaCKQ5VVRaH3SotF68EHwmjYJIFDsKLXO2Xm4GQH xsnt6W+8zbT6kkJM3sS4W8VRAL/6VlbEBryJ+T0qiJA+eZ+mrywk4Er2no2yVk5xZZIT Lg/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763400634; x=1764005434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yLRfQs0wWjDMt4ZR8Ou2KlvzNHuxRbwkp7eOWLdaSCA=; b=QxyPE+5SBZdt9MtKONSgF5gWYZpQSXx2V4+WKA9Vx6+zAuF98fwVVC+Z4KR46MXaUz gK5qT+b6+GyBpuFJV53fqihF23RDKJ/O1rBCri8ZUEKqxVtgkSpGAbLi7xrBB/lQCFNo awYTdOWFYjCyKWi0gtvZuJ/uE9mZBFMYCohr0i2JOT3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89ed15mr17413944b3a.24.1763400633752; Mon, 17 Nov 2025 09:30:33 -0800 (PST) Received: from localhost.localdomain ([114.79.136.157]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7b9251c99aasm13948208b3a.28.2025.11.17.09.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 09:30:33 -0800 (PST) From: Prithvi Tambewagh To: mkl@pengutronix.de, socketcan@hartkopp.net Cc: Prithvi Tambewagh , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: Question about to KMSAN: uninit-value in can_receive Date: Mon, 17 Nov 2025 23:00:12 +0530 Message-Id: <20251117173012.230731-1-activprithvi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <68bae75b.050a0220.192772.0190.GAE@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, The call trace suggests that the bug appears to be due to effect of change in headroom by pskb_header_expand(). The new headroom remains uninitialized and when can_receive tries accessing can_skb_prv(skb)->skbcnt, indirectly skb->head is accessed which causes KMSAN uninitialized value read bug. To fix this bug, I think we can call can_dropped_invalid_skb() in can_rcv() just before calling can_receive(). Further, we can add a condition for these sk_buff with uninitialized headroom to initialize the skb, the way it had been done in the patch for an earlier packet injection case in a similar KMSAN bug: https://lore.kernel.org/linux-can/20191207183418.28868-1-socketcan@hartkopp.net/ However, I am not getting on what basis can I filter the sk_buff so that only those with an uninitialized headroom will be initialized via this path. Is this the correct approach? Thank you, Prithvi