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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AC9EC4338F for ; Thu, 19 Aug 2021 01:11:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB153610FD for ; Thu, 19 Aug 2021 01:11:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB153610FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 757306B006C; Wed, 18 Aug 2021 21:11:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 706DD6B0071; Wed, 18 Aug 2021 21:11:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F61C8D0001; Wed, 18 Aug 2021 21:11:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 4585D6B006C for ; Wed, 18 Aug 2021 21:11:05 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E19D818485033 for ; Thu, 19 Aug 2021 01:11:04 +0000 (UTC) X-FDA: 78490051248.07.4E05B88 Received: from smtprelay.hostedemail.com (smtprelay0166.hostedemail.com [216.40.44.166]) by imf06.hostedemail.com (Postfix) with ESMTP id 7E301802408D for ; Thu, 19 Aug 2021 01:11:04 +0000 (UTC) Received: from omf03.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 204F81847717B; Thu, 19 Aug 2021 01:11:04 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA id 2393B13D96; Thu, 19 Aug 2021 01:10:59 +0000 (UTC) Message-ID: <3a0c55a3fabc57ce9771c93499ef19327f3b8621.camel@perches.com> Subject: Re: [PATCH 2/5] slab: Add __alloc_size attributes for better bounds checking From: Joe Perches To: Matthew Wilcox , Jonathan Corbet , linux-doc Cc: Kees Cook , linux-kernel@vger.kernel.org, Daniel Micay , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , linux-mm@kvack.org, Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Dennis Zhou , Tejun Heo , Masahiro Yamada , Michal Marek , clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org Date: Wed, 18 Aug 2021 18:10:57 -0700 In-Reply-To: References: <20210818050841.2226600-1-keescook@chromium.org> <20210818050841.2226600-3-keescook@chromium.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18uoPU/elFRF3Nb3Gx5R4/gAdoN63UF+n4= X-HE-Tag: 1629335459-615253 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7E301802408D X-Stat-Signature: 1a8t44mx9xio83rny6z16e7igr36mj4o Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=none (imf06.hostedemail.com: domain of joe@perches.com has no SPF policy when checking 216.40.44.166) smtp.mailfrom=joe@perches.com X-HE-Tag: 1629335464-683776 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 2021-08-19 at 01:27 +0100, Matthew Wilcox wrote: > On Tue, Aug 17, 2021 at 10:31:32PM -0700, Joe Perches wrote: > > Lastly __alloc_size should probably be added to checkpatch > >=20 > > Maybe: > > --- > > =A0scripts/checkpatch.pl | 3 ++- > > =A01 file changed, 2 insertions(+), 1 deletion(-) > >=20 > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > > @@ -489,7 +489,8 @@ our $Attribute =3D qr{ > > =A0 ____cacheline_aligned| > > =A0 ____cacheline_aligned_in_smp| > > =A0 ____cacheline_internodealigned_in_smp| > > - __weak > > + __weak| > > + __alloc_size\s*\(\s*\d+\s*(?:,\s*d+\s*){0,5}\) >=20 > Should probably be added to kernel-doc as well. Any other awful regexe= s > that need to be changed to understand it? And can we commonise the > regexes that do exist into a perl helper library? probably, but there would need to be some library work done and changes made to both utilities so they could use the same $helpers. And there are several nominally incomplete regexes already in kernel-doc and I'm not at all familiar with kernel-doc. e.g.: kernel-doc has: my $attribute =3D qr{__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)}i; but __attribute__ can have quotes like: __attribute__((section("foo"))) and spaces around and and I believe between (( and )) like: __attribute__ ((packed)) so those wouldn't match. The use of parentheses internal to attributes like __align__(8) may not work particularly well either given greedy matching.