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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 963D7C46467 for ; Tue, 29 Nov 2022 13:41:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 224536B0078; Tue, 29 Nov 2022 08:41:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D4686B007D; Tue, 29 Nov 2022 08:41:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0775E6B007E; Tue, 29 Nov 2022 08:41:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EEB736B0078 for ; Tue, 29 Nov 2022 08:41:57 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DCE721A0B0A for ; Tue, 29 Nov 2022 12:24:58 +0000 (UTC) X-FDA: 80186399076.04.27C6B00 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by imf12.hostedemail.com (Postfix) with ESMTP id 9D3C34000B for ; Tue, 29 Nov 2022 12:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669724698; x=1701260698; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=sgAPAU2YJaG40uPP2ZS1Letyp9PAABP/Vbd40Hx4+eQ=; b=dBWZu8NDsOinKPGyR71OEHehoqWMPS9guIj9xluEcWvYrTc3CQkmQqa8 95m+zBDseDl5BxdJvset9zlnBtfB61NGW2zqzfIENTHa1wkEut3taTul0 WxoRoqIU5wyYa4rlJTpYahLJfZq2uAZz66GQX7LpM5gCdTs+q544u6T14 GzD5SPDq3UICATxO+flXAUKURLfWGHOHDEIpOVv0p+S1MXY0Iy9rIwjC5 rdI+lEsZlOi/Up6ZQgA69fo7RJsnKC8CkB3arY9nLKE6gB2eP/ywjeQ5c R1LETk4Vj2M/D3WzLpnMZ0FJjUzURIqqVisdqFBfxI8Zw0Lbq0j48GelW g==; X-IronPort-AV: E=Sophos;i="5.96,203,1665471600"; d="scan'208";a="189146869" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Nov 2022 05:24:55 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 29 Nov 2022 05:24:53 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12 via Frontend Transport; Tue, 29 Nov 2022 05:24:50 -0700 Date: Tue, 29 Nov 2022 12:24:32 +0000 From: Conor Dooley To: Kees Cook CC: Vlastimil Babka , David Gow , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Rasmus Villemoes , Guenter Roeck , Andy Shevchenko , Paolo Abeni , Geert Uytterhoeven , Nathan Chancellor , Nick Desaulniers , Tom Rix , , , , Subject: Re: [PATCH 0/6] slab: Provide full coverage for __alloc_size attribute Message-ID: References: <20221101222520.never.109-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20221101222520.never.109-kees@kernel.org> ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=microchip.com header.s=mchp header.b=dBWZu8ND; spf=pass (imf12.hostedemail.com: domain of Conor.Dooley@microchip.com designates 68.232.154.123 as permitted sender) smtp.mailfrom=Conor.Dooley@microchip.com; dmarc=pass (policy=quarantine) header.from=microchip.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669724698; a=rsa-sha256; cv=none; b=QiUH8FfyDB4Is5kP38O3JhcuBu6+qUoEIPmznW56GWLIO7Z5Ev92i0gtpk1N4sSwAdm2Co dVriAVfvBIBqGwNbYjk/0E12gW+Ju8+BvEsjI2EQ/J8MKENargfrLKcp9pXkOsmXZS9ZBD ZbTNa2GOdiEI22oJbpx0pJxnZ8fhg2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669724698; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=phkdVA6lbyZ1nDgkc+ZEvtfgoevafBDlOH1/qawB9pY=; b=ysrOq7qXUXgajaYUL7eahW9uCKiv3b0YwXY2H48wOru2XGy3GWQkqgy41yGtNkq48irjot ipPN2IoULfgn1jrkNg54XdEQzFK0wi2jpMEyAoWOFaGkOUdkKBcPxCfcNbixUVAFyIEJ+7 S3Yvh8grzUNR5YBbn+PNLEDjQhrogpQ= X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9D3C34000B Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=microchip.com header.s=mchp header.b=dBWZu8ND; spf=pass (imf12.hostedemail.com: domain of Conor.Dooley@microchip.com designates 68.232.154.123 as permitted sender) smtp.mailfrom=Conor.Dooley@microchip.com; dmarc=pass (policy=quarantine) header.from=microchip.com X-Stat-Signature: f5oiutzk8ur35ehn4ja57gem65a1u4ki X-HE-Tag: 1669724697-595553 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 Tue, Nov 01, 2022 at 03:33:08PM -0700, Kees Cook wrote: > Hi, > > This is a series to work around a deficiency in GCC (>=11) and Clang > (<16) where the __alloc_size attribute does not apply to inlines. :( > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96503 > > This manifests as reduced overflow detection coverage for many allocation > sites under CONFIG_FORTIFY_SOURCE=y, where the allocation size was > not actually being propagated to __builtin_dynamic_object_size(). In > addition to working around the issue, expand use of __alloc_size (and > __realloc_size) to more places and provide KUnit tests to validate all > the covered allocator APIs. Hello Kees! It would appear that one of the macros you've added here is doing Bad Things^TM to allmodconfig on RISC-V since the 22nd: ../lib/fortify_kunit.c: In function 'alloc_size_kmalloc_const_test': ../lib/fortify_kunit.c:140:1: error: the frame size of 2384 bytes is larger than 2048 bytes [-Werror=frame-larger-than=] 140 | } \ | ^ ../lib/fortify_kunit.c:209:1: note: in expansion of macro 'DEFINE_ALLOC_SIZE_TEST_PAIR' 209 | DEFINE_ALLOC_SIZE_TEST_PAIR(kmalloc) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors CONFIG_GCC_VERSION=110100 CONFIG_AS_VERSION=23700 CONFIG_LD_VERSION=23700 The report came out of my CI (which I should have passed on sooner) so I do not have anything other than stderr - I can get you anything else you'd like/need though if you LMK. Thanks, Conor. > Kees Cook (6): > slab: Clean up SLOB vs kmalloc() definition > slab: Remove special-casing of const 0 size allocations > slab: Provide functional __alloc_size() hints to kmalloc_trace*() > string: Add __realloc_size hint to kmemdup() > driver core: Add __alloc_size hint to devm allocators > kunit/fortify: Validate __alloc_size attribute results > > include/linux/device.h | 7 +- > include/linux/fortify-string.h | 2 +- > include/linux/slab.h | 36 ++--- > include/linux/string.h | 2 +- > lib/Makefile | 1 + > lib/fortify_kunit.c | 255 +++++++++++++++++++++++++++++++++ > mm/slab_common.c | 14 ++ > 7 files changed, 296 insertions(+), 21 deletions(-) > > -- > 2.34.1 > >