Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2355107rdb; Tue, 3 Oct 2023 20:32:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwitjtKCNTK8mic1JwfETFyxYV9UCZrioI232HiiKr60ib8B73IaGwTYWKPMqGQ+tZ6TbJ X-Received: by 2002:a05:6870:611f:b0:1d5:b863:3a1f with SMTP id s31-20020a056870611f00b001d5b8633a1fmr1454374oae.7.1696390378162; Tue, 03 Oct 2023 20:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696390378; cv=none; d=google.com; s=arc-20160816; b=brJcuObC11wCbpbrb/R0/4PDZG4+zCOAZRhcxqqDIgAzHnfanHBf/KAFLAtdoRW5wV lLz4zQWA0Rq0GADAXiIx/gIf2rP66ZfMMqy1RBEwfMhlKCWcVSy85vHalIaIMGiJsd90 xuccS+5+LiiMBs2qxu0ZVWk1PetvOak4L5ZJQCN2yx50zA8N5vENIOpxat42lWir+tXJ 0uYwMlT7y8TRFPfY0sfh8MXJRUEVxx2M5XHjdKpv7q5FqScluKHBA5eSm0luNjEc66qU ouIQGYu2fyPE6TFjqizENaOuGQpcVelB8JfBcIevJaan/Pq3TQyi6/JH4aNfwYZd8eK6 xEDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=u5OaR8DthMsUyWl9mFY7CUG1t46HFxwH/NtoS9Paoao=; fh=CpZt/61nkHE3lmEB+2+biHZd8GCOVPVO6S7nqywsvtM=; b=NF3zasZWMDcMDxtJqcQRSTr92R5QetlSC4CdRxb5MqSxGnenw80YxoqnEc78fZoCPZ CMQW4KwNjWh6vX9ham60tNlVijXJGQT6LvK8poKwtqW7pjnvzpigHe2bElZbd6hTr1K+ 0QHkfSBhHNxWmpmEKPEQYWKMD7+BepRKwjfkXXFXMxhViZsjYjooOF8iRtScDFTB09ew YiS8bL1hqLRMPpbIrC8d9NrjTakyYPMT93zI5/+ndUQPnkZzkFYAsEOi7pkOL3DIU2pz rKyZS5fCAV/UIKV05B4F6T6mCWK1J1WI/ihR72BhErKfYP4G2KhZEVgCMfZstbkgHtHH 4Maw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20230601.gappssmtp.com header.s=20230601 header.b=CWSjTOLf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=networkplumber.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e2-20020a637442000000b005893c5bd119si1797208pgn.425.2023.10.03.20.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 20:32:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20230601.gappssmtp.com header.s=20230601 header.b=CWSjTOLf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=networkplumber.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8CE978235798; Tue, 3 Oct 2023 20:32:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234632AbjJDDcs (ORCPT + 99 others); Tue, 3 Oct 2023 23:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231867AbjJDDcr (ORCPT ); Tue, 3 Oct 2023 23:32:47 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F198BA9 for ; Tue, 3 Oct 2023 20:32:43 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-691c05bc5aaso1275204b3a.2 for ; Tue, 03 Oct 2023 20:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1696390363; x=1696995163; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=u5OaR8DthMsUyWl9mFY7CUG1t46HFxwH/NtoS9Paoao=; b=CWSjTOLfUidj+/k6i1A3DoOdhE5OhuTRB+68BrImmMhE8U4NkhujiJVYce/8cc9y1O QEeS9VfCd4oYzEZRK1CS1ScVMZgqfbQ73ZM7YZ62N7xSe0P4A3sawCZ7ZkNkayOyjnsR gqpQSSgeT9NQvaTFIjH/I5set4oM63NUeJzpHa4BTsc0wuadWYBb1Ga99RP/TBrOa5Ae nC8KDQ8azkmPl4Uztua02iQIV9WypRSgcpZVbh8/pTeCaKRXCeZDM3HhrnI9Si+AuNIV g8cNtrr7HRYpXYh3eqrHA10W619fwbwN1hzpP2+cqd2IrnFk58fNFkHGD905gFbQgB52 1bRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696390363; x=1696995163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u5OaR8DthMsUyWl9mFY7CUG1t46HFxwH/NtoS9Paoao=; b=hz/AIfeMDqQiHnVM2nwN7TLYbLOVJaKN999aDvJ3oK3HOCeJFaU2qoFUkKpykpADPl VjiHJEpqudGSCOJgb9QYh6T2rvqKOC2rBUOsZ3Ezeotn3QPx7kMyObX03UbUBmAYDA4M eaLeBw0rncnsgPyIXrdANiheSrbs20oukSWnHZcZMncj7TR8hX0ckaqMP6H0Pxc3JqcX juoWEEJbJIhQwaxzDpVtZWVbES7nmn8LSfYxogU34XOJz6rj+kBkGu63IpqUHqHaLGGD uJfYiXKh5vs3jDeoyYJiW0jVdyItdd2bH/q3dcqat4ffQ+7+9q88ngheKTiXPi3g0QYk fjWA== X-Gm-Message-State: AOJu0Yzn03BLzo0iQ99z2+fmUQzzHPsMNmuWF4X7hb3Q4sRK1trDHvIS i50nGfLqqd5XcUWjBERXLHtHCg== X-Received: by 2002:a05:6a00:a18:b0:690:fe13:1d28 with SMTP id p24-20020a056a000a1800b00690fe131d28mr1249286pfh.33.1696390363246; Tue, 03 Oct 2023 20:32:43 -0700 (PDT) Received: from hermes.local (204-195-126-68.wavecable.com. [204.195.126.68]) by smtp.gmail.com with ESMTPSA id m16-20020aa79010000000b0069346777241sm2185428pfo.97.2023.10.03.20.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 20:32:43 -0700 (PDT) Date: Tue, 3 Oct 2023 20:32:40 -0700 From: Stephen Hemminger To: Kees Cook Cc: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, "Gustavo A. R. Silva" , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] netem: Annotate struct disttable with __counted_by Message-ID: <20231003203240.45705fde@hermes.local> In-Reply-To: <20231003231823.work.684-kees@kernel.org> References: <20231003231823.work.684-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 20:32:55 -0700 (PDT) On Tue, 3 Oct 2023 16:18:23 -0700 Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct disttable. > > Cc: Stephen Hemminger > Cc: Jamal Hadi Salim > Cc: Cong Wang > Cc: Jiri Pirko > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: netdev@vger.kernel.org > Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1] > Signed-off-by: Kees Cook PS: size is intended wrong in original code but that is not important. Should have lined up with table[].