Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3185156pxf; Sun, 21 Mar 2021 23:05:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEd7aCrGslnesL2SiROns2xvzG9o7e0ytIJeWG58E1D0Q4ycjEmy+qNOYqw9byZ1hqhz12 X-Received: by 2002:a17:906:4a05:: with SMTP id w5mr17196804eju.526.1616393129715; Sun, 21 Mar 2021 23:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616393129; cv=none; d=google.com; s=arc-20160816; b=HRWmxWANA8mKgxmgKYypT4eMDbfh1U+qPZIW+4husPIOHEe+aL81yOgS/Da5kmI3bz ic9A/ggTJxC6Fp88FM43WA96aUzF6ubkrCu3pmDpxU1sXeXfr3L8t00W3vq8JcqoTgAt yzsQCItBY93rBFUkXb5YxMsN+uyqmPrAZbckU9iTGSSKrBA6aaOSVGH91DaWKLHlgzxj 6hdcaNW/x082/Ti9qPjp3OHMTrfAt/YIwVFI4QK2yoYOgKLW3GQAIxOEvxlaHM+8y7BQ lzcX4No4SRtHE9sJmw3ivH9qWyYGpwujKtUATzu0KWhsaAspG7edN5wPVF6SAYMAjdlF sjdQ== 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=L7oOn/ROAR60H6KG2WZjLarg9P4X7xIFiM6//2EpiH4=; b=NdyzB2qK4qM2QzUEe7J1wSGD62KEQpVYot5tW+5AhdFJibnROLuM89iVXi7rj/kIi7 MEi7ia+ICPIjWJoLkzI2YfFkbCl+snKC2FNo9sq3b7eSQ7WTwM1vnLDGN4JgNXP4ZfEx QxxnKWVuJ5yOt78Vopn3Atha6f1rGyW0fsXJgfyf0IneVUyg4Hx/4PPu85TNiJ/eLcPn evjMwC9vry6zzKy57XKvMEzY8ce9tHxa4ShDGLNbyij2pdLlc3xitHdPbz1jOMbGvoVv GdAHKO97jwiLRm+DTmGAj9XR5Uvw0h3BfSTh12/KG/92kLdJm2R70tjstrHVpvbiBB3X b+7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RReUc0BW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg23si10130740edb.519.2021.03.21.23.05.07; Sun, 21 Mar 2021 23:05:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RReUc0BW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230063AbhCVGEI (ORCPT + 99 others); Mon, 22 Mar 2021 02:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbhCVGEB (ORCPT ); Mon, 22 Mar 2021 02:04:01 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C702C061574; Sun, 21 Mar 2021 23:04:01 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id x2so11908437oiv.2; Sun, 21 Mar 2021 23:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=L7oOn/ROAR60H6KG2WZjLarg9P4X7xIFiM6//2EpiH4=; b=RReUc0BWxXmf8zDGRBzHgEqjLOovym2EEzkAFzbie33DYd+hDLBPKhSOJiTdsBQbgU +6SjQTr/JTuxeFwRYC4eV4CgsFfVDI1UW1c8HhqvShbc0Id3WBXxzEvIAei6v4JC/1oI FLcU+hoMjXCfN63sqJBwVHHAn3Bh2r6YXf5kDHDHsR5eXQzUycYUXeegJ+nxXhHrfnz/ aT94jHNVS9iyveE6Lg9vG3kmjL69eAFa7iKAkGzabpUStRfjiCcy6DUpAQHU+GKVTmT5 h9rGCzaaTKv22nPNmy0D07bIj16570NkUcwIPP7ttKoz6NGQQc9fvSpNDB74lumXixYw tEJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=L7oOn/ROAR60H6KG2WZjLarg9P4X7xIFiM6//2EpiH4=; b=KL/IcP33HTta7OLqxCDQvYed2M790G1TDPBQjRrJ42JlJmm6Bov0t6pj8/YgCbOqSL uT95htuJmG93bsouTQgN/PPZ02sYahWoK8wa7z2cmpvKA/lSGxV00JZe56HiWN3fp09q gC8yUsN5ighOEcTr1q5qR8ldt7BftVu0kY3L9lYOo6PRxPqfEhJWGqhfqKjIMcDSucUg Lhgbbe9OHwPnmn9ibTu0uqqO/WcIZr8rvCCGC55cBMl2N+k4/KmaXzHlrK5HdQNt/pll nHd2EPYG+4PBB5bWFDTLjEAVwkxFsYCaDKtoGf8HVJ3TonewPhdGkrAsjRJ3GKl+y+Qe +yAA== X-Gm-Message-State: AOAM532BXv6OOtHpnkvHWv5IaTQ5u9nwcTQMq7+Gu/vQWODsDJrrRt6L rQJqQWA7tqngVGm4Z/U2AzYAfp3h1UXXEdHu5+GKIn02qog= X-Received: by 2002:aca:c4c7:: with SMTP id u190mr8149442oif.161.1616393040807; Sun, 21 Mar 2021 23:04:00 -0700 (PDT) MIME-Version: 1.0 References: <13aed72.61c7.17853a6a5cd.Coremail.linma@zju.edu.cn> In-Reply-To: From: Luiz Augusto von Dentz Date: Sun, 21 Mar 2021 23:03:50 -0700 Message-ID: Subject: Re: BUG: Out of bounds read in hci_le_ext_adv_report_evt() To: Emil Lenngren Cc: =?UTF-8?B?6ams6bqf?= , Marcel Holtmann , Johan Hedberg , David Miller , Jakub Kicinski , "linux-bluetooth@vger.kernel.org" , "open list:NETWORKING [GENERAL]" , Linux Kernel Mailing List , yajin_zhou@zju.edu.cn, syzkaller@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Emil, On Sun, Mar 21, 2021 at 4:23 PM Emil Lenngren wro= te: > > Hi, > > Den m=C3=A5n 22 mars 2021 kl 00:01 skrev Luiz Augusto von Dentz > : > > Or we do something like > > https://lore.kernel.org/linux-bluetooth/20201024002251.1389267-1-luiz.d= entz@gmail.com/, > > that said the reason we didn't applied my patches was that the > > controller would be the one generating invalid data, but it seems you > > are reproducing with vhci controller which is only used for emulating > > a controller and requires root privileges so it is unlikely these > > conditions would happens with hardware itself, in the other hand as > > there seems to be more and more reports using vhci to emulate broken > > events it perhaps more productive to introduce proper checks for all > > events so we don't have to deal with more reports like this in the > > future. > > Keep in mind that when using the H4 uart protocol without any error > correction (as H5 has), it is possible that random bit errors occur on > the wire. I wouldn't like my kernel to crash due to this. Bit errors > happen all the time on RPi 4 for example at the default baud rate if > you just do some heavy stress testing, or use an application that > transfers a lot of data over Bluetooth. While we can catch some errors like that, and possible avoid crashes, this should be limited to just boundary checks and not actually error correction, that I'm afraid is out of our hands since we can still receive an event that does match the original packet size but meant something else which may break the synchronization of the states between the controller and the host, also perhaps we need to notify this type of error since even if we start discarding the events that can possible cause states to be out of sync and the controller will need to be reset in order to recover. --=20 Luiz Augusto von Dentz