Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1769332iob; Thu, 19 May 2022 14:11:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaT+jRiJCkOXp03UxejLHZoLOzhR7yBXKoTgM4uD0uyKFi18oLdO/urwr8lxb0hKj904vs X-Received: by 2002:aa7:d414:0:b0:42a:b49e:d502 with SMTP id z20-20020aa7d414000000b0042ab49ed502mr7792772edq.68.1652994675436; Thu, 19 May 2022 14:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652994675; cv=none; d=google.com; s=arc-20160816; b=v0TbCFRA1fRbhv3y/QHy0WIdcCT89JRuzJ+jXIDKLBrawBC80xcWF3AMe174zGRzAs sZy7NFJL6TF1gl9cHhxCklmdFjmwLlBh4b4yP62zrh3cVfhDr3RwygSH6OQUPt49ICDl FkA0jjuSA5ocT5jMPkUaZelYdZHSk4Bsr/heCEYuwhxz3crbTzNx97uycwf+RJdbUs2H F+/yO7MxvU6yffQhk72j+n0tDC4r1HWh9+YSWXz+WcswQ7uyuI2QFSzM1bFECrgyOKt/ AcRZTEg6s5F7BPahjt6ERRPR+gV4JUFQcSWsBzdfLoFkGEgHcXgT9SO/e9yTl6WfIVIb S9rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g2iR/GvonzPEkGcOKxVcDjAfsuXSBx9Hn0L+1eWPrSQ=; b=kIj2GgZqg4sgS/mZjMZzOWTCShrOhREnpBmodc3R5w3DZQZbMIqymVOt16H42x6L51 AUOQWk5Qxsplh0abqnAE1vyGGpZ1Uez2NHHMk3Oan9gbAMQQ8AjUwVLnafKc59vCPqZq G0CnqtcugNqPxN22Y3q5z+ttDes9x9U6R3R4pjCaXR0GUvjMclIRicnnEhztDQxTLT6B iQslqIcomsrPbcmi09qkgnCNEUlQUuXXs0h4/iHHgSpt5Pfi9IptKXM5FTa/wOWwHWEy fO+tJEpLDoTnZs0T0lejOvnv+PxJEznOqDPbZrQiSy0EPSqkYHPX7ti/aDOMWy8EwXce pPXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=HYAMB4AH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz10-20020a0564021d4a00b00425df5b7c44si7542855edb.330.2022.05.19.14.10.48; Thu, 19 May 2022 14:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=HYAMB4AH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240213AbiESPDU (ORCPT + 99 others); Thu, 19 May 2022 11:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240319AbiESPC5 (ORCPT ); Thu, 19 May 2022 11:02:57 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C018EC323 for ; Thu, 19 May 2022 08:01:49 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id p4so8218648lfg.4 for ; Thu, 19 May 2022 08:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g2iR/GvonzPEkGcOKxVcDjAfsuXSBx9Hn0L+1eWPrSQ=; b=HYAMB4AH5gGz4FKZpC2Pc3mwADJ6aR5PiQjCis0N7SlAr8kC+vXCm5Hzs+VdDUuUx8 GtWWXgWyQi9xlLdHQ5SmUrcWRoNb1kVvTwaLJNIaTqno1NCCvCSnr+6tA1XCiZLZbNi1 7iV10GDmU+Oz5id5Bf6XxNnO7W+IAVjq1mTWw3jRs6eTeBfRu2v1rXL/FxyUL7BlQMhl y+WChPaYFAr/Rl1/11pqisqSbS9p2yR+ofZ0NreKNON8BDBtcMK7cJZErvyT5TrVGnVl Geig/30uhj0y4d2AU/Mk/BMB639SSrkn93FwJPGkscb/NPyxchmNnzmTvwl7hyDiBec0 qiiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g2iR/GvonzPEkGcOKxVcDjAfsuXSBx9Hn0L+1eWPrSQ=; b=Im8PcwiNPjqnuWvyx32dFhxwxi8Yt8pNIFyrQWt986bJTzdZ3zFFUUANPR/KF2Fchn Iwemn/KBrnJE4qS229wQaL9O0BDF/OvbwG/SxvblIgfPq3o/J/WPSQYnrY03BVKaK46K IUGqvfftF2SuOMyC/d8m+D09unsdPD2OM9SjOqkVEu9w8MMq0YDMrMsWQInMobx0IpvF 3GOfjq1Prb89sUlNidQlkGg7bQgAS+9cPRA7oR84gY8iVCN02zQ4AuiBwINx5n1RunPc HVPJ7H6ERqjVUcYSKbcI53FH7fTCp3RA4eArQxkqoTTwX+2DM3YYo7uDahICnHXhRZZ3 FE8A== X-Gm-Message-State: AOAM531L9ooP06uVssvz33YFAqi/ue6IOmpflcGK150ReRxFjsOTViyJ waxpIMaghP1oub3+RecMBv4fDt9QtOxi7xduh+Xe7Q== X-Received: by 2002:a05:6512:114d:b0:473:b1ba:e589 with SMTP id m13-20020a056512114d00b00473b1bae589mr3804418lfg.206.1652972506965; Thu, 19 May 2022 08:01:46 -0700 (PDT) MIME-Version: 1.0 References: <000000000000367c2205d2549cb9@google.com> <0000000000009fa8ee05d60428f1@google.com> In-Reply-To: From: Dmitry Vyukov Date: Thu, 19 May 2022 17:01:35 +0200 Message-ID: Subject: Re: [syzbot] KASAN: vmalloc-out-of-bounds Read in __bpf_prog_put To: Vegard Nossum Cc: syzbot , andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, "David S. Miller" , fgheet255t@gmail.com, hawk@kernel.org, jakub@cloudflare.com, john.fastabend@gmail.com, kafai@fb.com, kpsingh@kernel.org, kuba@kernel.org, LKML , lmb@cloudflare.com, Linux Netdev List , songliubraving@fb.com, syzkaller-bugs@googlegroups.com, yhs@fb.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Jan 2022 at 12:42, Vegard Nossum wrote: > > On Thu, 20 Jan 2022 at 15:17, syzbot > wrote: > > > > syzbot suspects this issue was fixed by commit: > > > > commit 218d747a4142f281a256687bb513a135c905867b > > Author: John Fastabend > > Date: Tue Jan 4 21:46:45 2022 +0000 > > > > bpf, sockmap: Fix double bpf_prog_put on error case in map_link > > I can confirm the above commit fixes the issue, but it references a > slightly different report. Looks like the only difference is > __bpf_prog_put instead of bpf_prog_put: > > KASAN: vmalloc-out-of-bounds Read in __bpf_prog_put > KASAN: vmalloc-out-of-bounds Read in bpf_prog_put > > However, looking at the stack traces for the two bugs shows that > __bpf_prog_put() is really the location for both reports, see: > > https://syzkaller.appspot.com/bug?id=797cd651dd0d9bd921e4fa51b792f5afdc3f390f > kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 mm/kasan/report.c:450 > __bpf_prog_put.constprop.0+0x1dd/0x220 kernel/bpf/syscall.c:1812 > kernel/bpf/syscall.c:1812 > bpf_prog_put kernel/bpf/syscall.c:1829 [inline] > bpf_prog_put kernel/bpf/syscall.c:1829 [inline] kernel/bpf/syscall.c:1837 > > vs. > > https://syzkaller.appspot.com/bug?extid=bb73e71cf4b8fd376a4f > kasan_report+0x19a/0x1f0 mm/kasan/report.c:450 mm/kasan/report.c:450 > __bpf_prog_put kernel/bpf/syscall.c:1812 [inline] > __bpf_prog_put kernel/bpf/syscall.c:1812 [inline] kernel/bpf/syscall.c:1829 > bpf_prog_put+0x8c/0x4f0 kernel/bpf/syscall.c:1829 kernel/bpf/syscall.c:1829 > > Looks to me like the compiler's inlining decision caused syzbot to see > __bpf_prog_put() instead of bpf_prog_put(), but I can't tell if it's > because it got inlined or because of the .constprop.0 suffix... I > guess syzbot skips the [inline] entries when deciding which function > to report the bug in? Not sure if you are still interested in this or not... But, yes, it's inline frames that are a problem, ".constprop.0" should be stripped. syzkaller parses non-symbolized kernel output w/o inlined frames to extract the title. This was a very early decision, not sure if it's the right one or not. On the other hand using inline frames can cause attribution to all the common one-liners. Now it's somewhat hard to change b/c if we change it, new crashes will be parsed differently and it will cause a storm of duplicates for already reported bugs. > In any case: > > #syz dup: KASAN: vmalloc-out-of-bounds Read in bpf_prog_put > > Vegard