Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3073716rwd; Mon, 22 May 2023 08:17:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vnn+w0HjQbXiTbbRdgx/gajyiECUVxU2WaayQALHQ02sBl39OYtrvDMY0Y/5hn/8E6xEj X-Received: by 2002:a05:6a20:8e29:b0:10c:3a80:4e04 with SMTP id y41-20020a056a208e2900b0010c3a804e04mr675051pzj.14.1684768653544; Mon, 22 May 2023 08:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684768653; cv=none; d=google.com; s=arc-20160816; b=WfNNZk//jet2vrirhx19fzO9dhHqPmSezNinfsBXC2ACY8CeifkHyNaKSm3VGjRadC e/oP1an9yuWEZbpdBG1SblXwuQVMhY2KuedDmrefrrXKsEJKvKCyClrEY6XuyDNwCziw Vl8G5yyjLz17ZTE+4lVN6dAJ65oKb8ColM3tppXB6TCCs/p3GAkE1X8Mbrr2n3qlnANz wG2rKut42pEUZ4lZ5A72+6TggpJtcvaO1KOaZv9vQLE5wu6wRlGOU5PL6o+3KtkXdPUX wqkBkREeUsjB+sbVW6NwMzZcsxUHcTTgIcxJF/8qu/BxoOQ34PvDL97xj5NcDeY9yIgr zMqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9odVnjjoR+4AuNw6ksnagpqi3r+RrcYNLrZWenZLiqg=; b=h9TDaLPd0cnvN1m1xSk6xnAaFUQwy75XGMxZl3CJrGgRd+gEp3BkxsLJPeKLNvByPM nl06+ywfa/RydLYpxfMLA/nN3MXeETVSIIb7cSbGEpjB5ps5248OOaKN3KGf/QiSA7O8 M8NekQL/rgqOruAI1/w7uUIaFay5XvlqrFQxiXcuQoFyln1ifUIIdWWQizY0Hnqs4vwj oRq1Z2KgEVU+DWKyhYgozhdpEUCD4qAp4NVhcguc24Lo1w+1dYaijUqVJMjpdnVXc8Xd h1ze6OdHruuA7BaYrW/fWfVC47fJ5D2ezNr3HRFzgWhO9XpQwMz8CT4t6Vc+g+wTY0c7 5DNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=BmDabCZP; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a639558000000b0053416d0b54fsi4666302pgn.165.2023.05.22.08.17.20; Mon, 22 May 2023 08:17:33 -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=@gmail.com header.s=20221208 header.b=BmDabCZP; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjEVOx3 (ORCPT + 99 others); Mon, 22 May 2023 10:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230023AbjEVOx2 (ORCPT ); Mon, 22 May 2023 10:53:28 -0400 Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F47ABB; Mon, 22 May 2023 07:53:27 -0700 (PDT) Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-4572fc781daso601219e0c.2; Mon, 22 May 2023 07:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684767206; x=1687359206; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9odVnjjoR+4AuNw6ksnagpqi3r+RrcYNLrZWenZLiqg=; b=BmDabCZP63yATPO3XTiegoftHUu9QDq5tUiWk9D2y5meNYS71L2+1QqBnzNqGAW0Kv 1a3mvYpDCSEQeZOhOynLeIHLkpkoNMgcNPBA/0kb6ZJ82jRLgvXYDfPvU1QJ9hlXfVej EIV2LHLSbXfJIcp6rmNKIjLR+21txsxlBNLBZ8SaSbNMwI5Q7xzu7RVBd32UZoNHcQnA mCzpFCYnkbnwxLv0fP+4KZeTfiDQAMwjLgb5qaw1/r3fE9UOGIMKrQotlQ5iXSVZN/rw +cHtNUQtGBzbT6+VKET+/tqfJbXmhb/hv/ckaKtSMSHwX5u0hnPZWf5ejpHH4phQXn/v +ZVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684767206; x=1687359206; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9odVnjjoR+4AuNw6ksnagpqi3r+RrcYNLrZWenZLiqg=; b=Y7zZMtqnvS3MngCmJ3ChUQ1q0q3AFYVokGTT0BgNFQagVGiRAhqd8lczVWEuP5C+BK 420B99i+FoSUQF+V1Xp85tgvOfn/teeB35DH6QSVzGPMtuKZpDaIrXLrdqXECDszquZ9 jaXkF5m6pSZinra3TZjInFsaCJ/LeoqyRtln3sxcI5ZRC158fNvI/ps2XWfdJDzl9DwG XwhtL3JjXQdA+ALKGHCPX4JaZFs9naJpXWgI3LFcIV5EvdHSptWS6zB+vTvNQDsShgS8 cYKW6uDn82sg5czWUj/iW637cJr3ZAvAJsqtoDdLAtsg2S/Hi2fS2gE2ve1RuqcrvFRo Y6Kg== X-Gm-Message-State: AC+VfDwfcUmmWJfkKawoRHBVoUwKJ/Nl0Og/3Z04f5FwociC/IAN+9SL Sul+LVbrtnC2k6Y2GUEXDRZBCG2oEtqQ1ihLlOQ= X-Received: by 2002:a1f:3f88:0:b0:457:1a8:9ea4 with SMTP id m130-20020a1f3f88000000b0045701a89ea4mr3819909vka.3.1684767206566; Mon, 22 May 2023 07:53:26 -0700 (PDT) MIME-Version: 1.0 References: <00000000000037341d05fc460fa6@google.com> In-Reply-To: <00000000000037341d05fc460fa6@google.com> From: Willem de Bruijn Date: Mon, 22 May 2023 10:52:49 -0400 Message-ID: Subject: Re: [syzbot] [net?] KASAN: invalid-access Read in __packet_get_status To: syzbot Cc: bpf@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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, May 22, 2023 at 6:51=E2=80=AFAM syzbot wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit: 2d1bcbc6cd70 Merge tag 'probes-fixes-v6.4-rc1' of git://g= i.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=3D154b8fa128000= 0 > kernel config: https://syzkaller.appspot.com/x/.config?x=3D51dd28037b2a5= 5f > dashboard link: https://syzkaller.appspot.com/bug?extid=3D64b0f633159fde0= 8e1f1 > compiler: aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, = GNU ld (GNU Binutils for Debian) 2.35.2 > userspace arch: arm64 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=3D12b6382e280= 000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=3D17fd0aee28000= 0 > > Downloadable assets: > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/3= 84ffdcca292/non_bootable_disk-2d1bcbc6.raw.xz > vmlinux: https://storage.googleapis.com/syzbot-assets/d2e21a43e11e/vmlinu= x-2d1bcbc6.xz > kernel image: https://storage.googleapis.com/syzbot-assets/49e0b029f9af/I= mage-2d1bcbc6.gz.xz > > IMPORTANT: if you fix the issue, please add the following tag to the comm= it: > Reported-by: syzbot+64b0f633159fde08e1f1@syzkaller.appspotmail.com > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > BUG: KASAN: invalid-access in __packet_get_status+0x70/0xe0 net/packet/af= _packet.c:438 The offending line is the last one in " static int __packet_get_status(const struct packet_sock *po, void *frame) { union tpacket_uhdr h; smp_rmb(); h.raw =3D frame; switch (po->tp_version) { case TPACKET_V1: flush_dcache_page(pgv_to_page(&h.h1->tp_status)); return h.h1->tp_status; case TPACKET_V2: flush_dcache_page(pgv_to_page(&h.h2->tp_status)); " The reproducer is very small: " // socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL); r0 =3D socket$packet(0x11, 0x2, 0x300) // setsockopt PACKET_RX_RING with same block and frame sizes and counts setsockopt$packet_rx_ring(r0, 0x107, 0x5, &(0x7f0000000040)=3D@req3=3D{0x8000, 0x200, 0x80, 0x20000}, 0x1c) // excessive length, too many bits in prot, MAP_SHARED | MAP_ANONYMOUS mmap(&(0x7f0000568000/0x2000)=3Dnil, 0x1000000, 0x20567fff, 0x11, r0, 0x0) " What is odd here is that the program never sets packet version explicitly, and the default is TPACKET_V1.