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 83179E95A9F for ; Mon, 9 Oct 2023 16:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234568AbjJIQCd (ORCPT ); Mon, 9 Oct 2023 12:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjJIQCd (ORCPT ); Mon, 9 Oct 2023 12:02:33 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E3092 for ; Mon, 9 Oct 2023 09:02:31 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c63164a2b6so41899695ad.0 for ; Mon, 09 Oct 2023 09:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696867351; x=1697472151; 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=VBo7/M8weK7GqJKgsmfZy4H/ddypVZXezIGNc/laBIM=; b=gL6h0k5VVMBjDMJOPDCAChakBz/wXsEo6uNJ4kH0G/X0fAPjMgZ9W4v89lzqTRPAmV OFjEgn/K7ii/k9/uUnCvyiROzS6spfyytS20e92g13MKOth1lGpSsDdmoayzKpCOfGCR J9jf/PzmIKYBEbbFeaQ4jCzerQrff3DRdxWCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696867351; x=1697472151; 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=VBo7/M8weK7GqJKgsmfZy4H/ddypVZXezIGNc/laBIM=; b=vA5VVx4iqepqOBoIYzVnXBDuciuXqRtuhQi7xw19rKome/D5/tu3okWjqJfNSPXO7s tjA1odhBodWAPcIyDhqHr+/Ap2t7AQ9mKXtVO34NfJvzArppT8vFiBZXDQGVcsKQ2QYH P/tkCZJD19smbdBLEGgHLaRjsgForBgg542TxtdIB0pq//PzrmGpiUMThbL+Zd/iPZ1V ejDCqVuqgYJkv5jjuWqtP6aODahgvhwumIGH0D7GSD3VJoVU+O2Ch23iOXdPQp1oq9qE H6aqOSFjsibnkBuDsODv+py6UVdGoYefYZMBQ0HguBPrmx/bi4sDiknQHq05T68Lcf3P A8Mw== X-Gm-Message-State: AOJu0YyYlWroLxwqDvZX/TfB4cfQk62foJtOnJku8+dg0r8wVYFkvzqW Col7dczikas3+NFB6fJPqWVpiA== X-Google-Smtp-Source: AGHT+IHzup/xAx1ifpxmi3UryQvmiHkOx8P4Nc2On1Fyx56aKemvsYmRNFsp4H4ofYMWZ2mFLT5hmQ== X-Received: by 2002:a17:902:cecb:b0:1c0:cbaf:6954 with SMTP id d11-20020a170902cecb00b001c0cbaf6954mr21386914plg.25.1696867351114; Mon, 09 Oct 2023 09:02:31 -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 f7-20020a17090274c700b001bc445e2497sm9742768plt.79.2023.10.09.09.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 09:02:30 -0700 (PDT) Date: Mon, 9 Oct 2023 09:02:27 -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 , "Lee, Chun-Yi" , 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: <202310090902.10ED782652@keescook> References: <20231009134826.1063869-1-arnd@kernel.org> <2abaad09-b6e0-4dd5-9796-939f20804865@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2abaad09-b6e0-4dd5-9796-939f20804865@app.fastmail.com> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Oct 09, 2023 at 05:36:55PM +0200, Arnd Bergmann wrote: > On Mon, Oct 9, 2023, at 15:48, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > These functions are simple wrappers around memcmp() and memcpy(), which > > contain compile-time checks for buffer overflow. Something in gcc-13 and > > likely other versions makes this trigger a warning when the functions > > are not inlined and the compiler misunderstands the buffer length: > > > > In file included from net/bluetooth/hci_event.c:32: > > In function 'bacmp', > > inlined from 'hci_conn_request_evt' at > > net/bluetooth/hci_event.c:3276:7: > > include/net/bluetooth/bluetooth.h:364:16: error: 'memcmp' specified > > bound 6 exceeds source size 0 [-Werror=stringop-overread] > > 364 | return memcmp(ba1, ba2, sizeof(bdaddr_t)); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Use the __always_inline annotation to ensure that the helpers are > > correctly checked. This has no effect on the actual correctness > > of the code, but avoids the warning. Since the patch that introduced > > the warning is marked for stable backports, this one should also > > go that way to avoid introducing build regressions. > > > > Fixes: d70e44fef8621 ("Bluetooth: Reject connection with the device > > which has same BD_ADDR") > > Cc: Kees Cook > > Cc: Lee, Chun-Yi > > Cc: Luiz Augusto von Dentz > > Cc: Marcel Holtmann > > Cc: stable@vger.kernel.org > > Signed-off-by: Arnd Bergmann > > 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? -- Kees Cook