Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp251658lqo; Wed, 27 Mar 2024 11:57:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWMxpCo+tcXh5i6oDPX+D4iEB/9QpntroSmuX1bQLXseXMq3pvWqwsfBaPWtElvQtcLsSlG6pQKqCkG9bQ5e3gurQAJN0G57OyqzV7lAg== X-Google-Smtp-Source: AGHT+IETJV35ROSaawpC8oZTOIi5tCo3i5MjpyOCueR06AcY2BFrFnYL12my9s10zIKoDGUp/muG X-Received: by 2002:a17:906:ca11:b0:a4d:fdf7:d6be with SMTP id jt17-20020a170906ca1100b00a4dfdf7d6bemr273532ejb.42.1711565840778; Wed, 27 Mar 2024 11:57:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711565840; cv=pass; d=google.com; s=arc-20160816; b=mbkpf1jdA9dJepRRvP6G6llPz3czK+zjU2zqrNUkc4A+r+NwTvis0iV0WgvfcoeRNp Hmxul+XRRMgoQOMf9qW1WSfzqLjqZAwXM69Cy8JOESMAWe7+DCVgK9JrqA30kst8/FLw RT5dtUbc5tL8CqUsRNEGo1IbnKi5+o1TUojLE/wriYz8ngFTziu04Wz7GP9tvua6hSYF 4gZso1Oq6RWjZiLyswWrC9Og4QrznTG9oTcpVAVd/tVIk/jswiIL6h+FPLFf1AaFXMEn fGULX3z2J/ZtGJLpv7sP/4uWp/CpOWJS2lTRuyK7z5rSAzxfG62GnJETu1EHrBlbmupI QV1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=Yx1UbkHwdHZLLbNuRcSx7DJyIY0QwP+4nFSmm21yDtQ=; fh=fDd+wXTWPIe5cEz8AUgnfHoCx2ztrcfsjrYUgnTTlzU=; b=xEHOwiWoY1sHq/xv2WwatrrNJmYgP9zc+bSCIQn/wOdRDT2GH6dv1/HFVRg4m/Xofg A8LSRRhLY2gX7t+zcbHG/AnlUTDfIFdaOaPRrQHtIkNhaP1agWdGwZkV5jSro0ke0zpZ VID5/aghFpBWDQleo8Hb6nH8IH3CLFD5B7O0LpHEl95obJfA8JYVh8Pni1Etw1Csy6mE 9eo+h/7PQfiesgIrcnYJvuHJo9xLYNN37vqDWkSIi15RegzpdkdhXF1ZaFERlUojTs0D NzkIAs5mmRVSK8uTS+Zwk/C80f1zq0Asnf1MSO5lDxmwHB9CF1ZEopew9BG5EGLacnx9 zsTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Vz588ZcO; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-121851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b3-20020a17090630c300b00a4dfad59b39si1465837ejb.830.2024.03.27.11.57.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:57:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Vz588ZcO; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-121851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 931781F33E46 for ; Wed, 27 Mar 2024 18:47:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F7EB1514E0; Wed, 27 Mar 2024 18:46:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Vz588ZcO" Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00D9F150981 for ; Wed, 27 Mar 2024 18:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711565218; cv=none; b=Wmlv4kHiaSUXJFGWlKHbzS1cwc37UgxbMvowLsctjeOPIv6vJKnbBz1xhCca6SeddOsJJhdgccvepo+h5AyReKddUIyHnxOmPFALtgAwg60vSpdZysJ92hNv+5dlkghTRziQuZjApSW76E1D1EhNXpsWBJwe6eOfvkP9tDba0EM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711565218; c=relaxed/simple; bh=wOYDqXQBwndxLNpGzVpA/alUz261GjYTc0wTNh/rnrg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qFqpaKNY0U8Zce0QRGYiF6MsEQpyjioSeNUNczmU5VAJEgzNN9r7RxIl9xefF2eW0oOkpFNmeJwY6dnArkcbB3b3ZwosrsBkyB9hQTZr0EnNHqV97WYYFGX+u1Kz6p6k9FJy22tH1fb9nyGKdlvAqpuZWDxzzz1udgBEQKWmjJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Vz588ZcO; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1711565213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yx1UbkHwdHZLLbNuRcSx7DJyIY0QwP+4nFSmm21yDtQ=; b=Vz588ZcOD6FrUivNA4zc/O2aYjnlG2CqGtHPSocyox7umNsKF3yrwoGxP1Xubf7bKxC3qD PdLQbAW86bvNr3QJAtjD+9zFfsK5J7mP1o1wTd3mzIRv2X7ddNDqhmGbirF6+MM4bUQ+Ib vU6poku+UMDG74k7C13EYaeERKDSLeA= Date: Wed, 27 Mar 2024 11:46:42 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [syzbot] [bpf?] [net?] KMSAN: uninit-value in dev_map_lookup_elem Content-Language: en-US To: Yonghong Song , Alexei Starovoitov , syzkaller-bugs Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , syzbot , bpf , "David S. Miller" , Eddy Z , Hao Luo , Jesper Dangaard Brouer , John Fastabend , Jiri Olsa , KP Singh , Jakub Kicinski , LKML , Network Development , Stanislav Fomichev , Song Liu References: <0000000000006f876b061478e878@google.com> <5063d525-d9df-4aaf-991d-bcb9f495c041@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <5063d525-d9df-4aaf-991d-bcb9f495c041@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 3/26/24 9:47 PM, Yonghong Song wrote: > > On 3/26/24 6:07 PM, Alexei Starovoitov wrote: >> On Tue, Mar 26, 2024 at 5:54 PM Martin KaFai Lau wrote: >>> On 3/25/24 2:36 AM, syzbot wrote: >>>> Hello, >>>> >>>> syzbot found the following issue on: >>>> >>>> HEAD commit:    5e74df2f8f15 Merge tag 'x86-urgent-2024-03-24' of git://gi.. >>>> git tree:       upstream >>>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=148872a5180000 >>>> kernel config:  https://syzkaller.appspot.com/x/.config?x=e6bd769cb793b98a >>>> dashboard link: https://syzkaller.appspot.com/bug?extid=1a3cf6f08d68868f9db3 >>>> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for >>>> Debian) 2.40 >>>> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15921a6e180000 >>>> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12e081f1180000 >>>> >>>> Downloadable assets: >>>> disk image: >>>> https://storage.googleapis.com/syzbot-assets/1a82880723a7/disk-5e74df2f.raw.xz >>>> vmlinux: >>>> https://storage.googleapis.com/syzbot-assets/fd3046ac43b9/vmlinux-5e74df2f.xz >>>> kernel image: >>>> https://storage.googleapis.com/syzbot-assets/2097be59cbc1/bzImage-5e74df2f.xz >>>> >>>> IMPORTANT: if you fix the issue, please add the following tag to the commit: >>>> Reported-by: syzbot+1a3cf6f08d68868f9db3@syzkaller.appspotmail.com >>>> >>>> ===================================================== >>>> BUG: KMSAN: uninit-value in __dev_map_lookup_elem kernel/bpf/devmap.c:441 >>>> [inline] >>>> BUG: KMSAN: uninit-value in dev_map_lookup_elem+0xf3/0x170 >>>> kernel/bpf/devmap.c:796 >>>>    __dev_map_lookup_elem kernel/bpf/devmap.c:441 [inline] >>>>    dev_map_lookup_elem+0xf3/0x170 kernel/bpf/devmap.c:796 >>>>    ____bpf_map_lookup_elem kernel/bpf/helpers.c:42 [inline] >>>>    bpf_map_lookup_elem+0x5c/0x80 kernel/bpf/helpers.c:38 >>>>    ___bpf_prog_run+0x13fe/0xe0f0 kernel/bpf/core.c:1997 >>>>    __bpf_prog_run256+0xb5/0xe0 kernel/bpf/core.c:2237 >>> It should be in the interpreter mode. >>> >>> The C reproducer is trying to run the following bpf prog: >>> >>>      0: (18) r0 = 0x0 >>>      2: (18) r1 = map[id:49] >>>      4: (b7) r8 = 16777216 >>>      5: (7b) *(u64 *)(r10 -8) = r8 >>>      6: (bf) r2 = r10 >>>      7: (07) r2 += -229 >>>              ^^^^^^^^^^ >>> >>>      8: (b7) r3 = 8 >>>      9: (b7) r4 = 0 >>>     10: (85) call dev_map_lookup_elem#1543472 >>>     11: (95) exit >>> >>> I think this KMSAN report (and a few others related to lookup/delete_elem) >>> should only happen in the interpreter mode. >>> >>> Does it worth to suppress it by always initializing the stack in the interpreter >>> mode considering the interpreter is not very speed sensitive ? >> Maybe we can mark it as initialized from kmsan pov ? >> There are kasan_poison/unpoison helpers that may fit ? > > Maybe use kmsan_unpoison_memory()? Good idea. It should do. My qemu cannot boot with CONFIG_KMSAN somehow. I will ask syzbot to test. #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/martin.lau/bpf-next.git interpreter.kmsan