From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B623CD612F for ; Mon, 9 Oct 2023 19:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346683AbjJITsU (ORCPT ); Mon, 9 Oct 2023 15:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346674AbjJITsU (ORCPT ); Mon, 9 Oct 2023 15:48:20 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED43A6 for ; Mon, 9 Oct 2023 12:48:19 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-692a885f129so3666750b3a.0 for ; Mon, 09 Oct 2023 12:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696880899; x=1697485699; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YnnGBorqi/0sryABcLeiVXw4usVlXXVKQE9toG3inJM=; b=e23yKq1wv/lY0x9LjebsVqZvLDC3yPdbjBtEyEgGrIxa5/qW5r8N3OKAZN6Fe4AI2C iBYNB18joJFFK+/Of93yr1coecNoCqRoHQOzFzxtTQvgQzAVc+JKy3yXUm0PscC5TDD8 VyIz40oa3DURNPKhXQnNorxfjCrCgHOEwuaXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696880899; x=1697485699; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YnnGBorqi/0sryABcLeiVXw4usVlXXVKQE9toG3inJM=; b=amL5KCE2DnxTjrLlIXgvikGrsigIYFGRSlhTqHEAUZKWfw7048ZHL7rZQOak+8txTM IIRh2E9PiF+2ktVCKma6BEheQCClWUKK3c4m5VzrKNczBe0fhY5GcERNGddts015jeh/ 6ujOiXG0X3PJX35ZF5E05dEeKT1z3HWp7aG1lkfsCvLk/o2NAZsq0AL19bPnvzs7VyBp mXLL3vy3AnH62/9ByAcififY9AEUABvSYQ8pbMepkh2pYVQMDiH/VkH5jMTIh0ItFcLg FI3Z6sG83RuOG+abpDXX16TkicFLR/fCgb04XSTH7DBJ9DzCN2Ny2/p6iWtjSsgz9yxl u5Hg== X-Gm-Message-State: AOJu0Yzso+TLh2YyhZpY2UqBfRaiHsVXzON0gr67v8FcpnCewMd4EkcB 1Z0kWPVVHmwUTmefYX3TsmAOcg== X-Google-Smtp-Source: AGHT+IH/EU8sCax66tncCUgtwE24oZqKUnAw5nHePbac/qTNhw0neUzqI+uVELgQYBYwoASCkEKRUQ== X-Received: by 2002:a05:6a00:1516:b0:691:da6:47b with SMTP id q22-20020a056a00151600b006910da6047bmr16111870pfu.10.1696880898803; Mon, 09 Oct 2023 12:48:18 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id fn27-20020a056a002fdb00b00688435a9915sm6820661pfb.189.2023.10.09.12.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 12:48:18 -0700 (PDT) Date: Mon, 9 Oct 2023 12:48:15 -0700 From: Kees Cook To: Arnd Bergmann Cc: Arnd Bergmann , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chun-Yi Lee , Luiz Augusto von Dentz , stable@vger.kernel.org, Iulia Tanasescu , Wenjia Zhang , linux-bluetooth@vger.kernel.org, Netdev , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Bluetooth: mark bacmp() and bacpy() as __always_inline Message-ID: <202310091246.ED5A2AFB21@keescook> References: <20231009134826.1063869-1-arnd@kernel.org> <2abaad09-b6e0-4dd5-9796-939f20804865@app.fastmail.com> <202310090902.10ED782652@keescook> <73f552a4-4ff5-441a-a624-ddc34365742f@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <73f552a4-4ff5-441a-a624-ddc34365742f@app.fastmail.com> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Oct 09, 2023 at 08:23:08PM +0200, Arnd Bergmann wrote: > On Mon, Oct 9, 2023, at 18:02, Kees Cook wrote: > > On Mon, Oct 09, 2023 at 05:36:55PM +0200, Arnd Bergmann wrote: > >> On Mon, Oct 9, 2023, at 15:48, Arnd Bergmann wrote: > >> > >> Sorry, I have to retract this, something went wrong on my > >> testing and I now see the same problem in some configs regardless > >> of whether the patch is applied or not. > > > > Perhaps turn them into macros instead? > > I just tried that and still see the problem even with the macro, > so whatever gcc is doing must be a different issue. Maybe it > has correctly found a codepath that triggers this? > > If you are able to help debug the issue better, > see these defconfigs for examples: > > https://pastebin.com/raw/pC8Lnrn2 > https://pastebin.com/raw/yb965unC This seems like a GCC bug. It is complaining about &hdev->bdaddr for some reason. This silences it: diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 6f4409b4c364..509e86b36576 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3266,6 +3266,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, void *data, int mask = hdev->link_mode; struct inquiry_entry *ie; struct hci_conn *conn; + bdaddr_t a; __u8 flags = 0; bt_dev_dbg(hdev, "bdaddr %pMR type 0x%x", &ev->bdaddr, ev->link_type); @@ -3273,7 +3274,8 @@ static void hci_conn_request_evt(struct hci_dev *hdev, void *data, /* Reject incoming connection from device with same BD ADDR against * CVE-2020-26555 */ - if (!bacmp(&hdev->bdaddr, &ev->bdaddr)) { + a = hdev->bdaddr; + if (!bacmp(&a, &ev->bdaddr)) { bt_dev_dbg(hdev, "Reject connection with same BD_ADDR %pMR\n", &ev->bdaddr); hci_reject_conn(hdev, &ev->bdaddr); :( -- Kees Cook