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=-7.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 A38D9C4320A for ; Fri, 20 Aug 2021 05:11:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4046A6103C for ; Fri, 20 Aug 2021 05:11:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4046A6103C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DD8666B0075; Fri, 20 Aug 2021 01:11:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D88138D0001; Fri, 20 Aug 2021 01:11:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9D6C6B007B; Fri, 20 Aug 2021 01:11:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id B38596B0075 for ; Fri, 20 Aug 2021 01:11:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7697E8248047 for ; Fri, 20 Aug 2021 05:11:19 +0000 (UTC) X-FDA: 78494285478.18.0BB220B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP id 29439504D1E9 for ; Fri, 20 Aug 2021 05:11:19 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id DC1966054E; Fri, 20 Aug 2021 05:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1629436278; bh=cc0SAzsXcx00EyeJ0FnbHDyCca6n3ae4I61WSDxYEwA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bvG0F0sKpl38gpuSoBBM0DZ34c97J/dKjpUWMG8mSl3eY714SZ4ZWdp1CQY8YNrA2 SPU8krSWxILdcGpNCLNNpl3SdCjAgi0zjp2U1rC0n6EVvrIEJaZlb50Q7cdfCLrPAX lEVaPGgaOoS19JK0+ItRQJeLSQeMZf5dbV0xOzew= Date: Thu, 19 Aug 2021 22:11:15 -0700 From: Andrew Morton To: Kees Cook Cc: linux-kernel@vger.kernel.org, Daniel Micay , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-mm@kvack.org, Joe Perches , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Masahiro Yamada , Michal Marek , clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2 6/7] percpu: Add __alloc_size attributes for better bounds checking Message-Id: <20210819221115.b3a34e280cfe748ad6a76b04@linux-foundation.org> In-Reply-To: <20210818214021.2476230-7-keescook@chromium.org> References: <20210818214021.2476230-1-keescook@chromium.org> <20210818214021.2476230-7-keescook@chromium.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 29439504D1E9 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=bvG0F0sK; dmarc=none; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam04 X-Stat-Signature: 1ry8pzdb8xk6ie56hobro74bfftwss1w X-HE-Tag: 1629436279-609202 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 Wed, 18 Aug 2021 14:40:20 -0700 Kees Cook wrote: > As already done in GrapheneOS, add the __alloc_size attribute for > appropriate percpu allocator interfaces, to provide additional hinting > for better bounds checking, assisting CONFIG_FORTIFY_SOURCE and other > compiler optimizations. > Caught one, I assume: In file included from ./include/linux/string.h:262, from ./include/linux/bitmap.h:11, from ./include/linux/cpumask.h:12, from ./arch/x86/include/asm/cpumask.h:5, from ./arch/x86/include/asm/msr.h:11, from ./arch/x86/include/asm/processor.h:22, from ./arch/x86/include/asm/cpufeature.h:5, from ./arch/x86/include/asm/thread_info.h:53, from ./include/linux/thread_info.h:60, from ./arch/x86/include/asm/preempt.h:7, from ./include/linux/preempt.h:78, from ./include/linux/spinlock.h:55, from ./include/linux/mmzone.h:8, from ./include/linux/gfp.h:6, from ./include/linux/slab.h:15, from drivers/misc/lkdtm/heap.c:7: In function 'memset', inlined from 'lkdtm_VMALLOC_LINEAR_OVERFLOW' at drivers/misc/lkdtm/heap.c:27:2: ./include/linux/fortify-string.h:172:3: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object passed as 1st parameter 172 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~ make[3]: *** [drivers/misc/lkdtm/heap.o] Error 1 make[2]: *** [drivers/misc/lkdtm] Error 2 make[1]: *** [drivers/misc] Error 2 make: *** [drivers] Error 2 I want to get a kernel release out, so I'll hide mm-vmalloc-add-__alloc_size-attributes-for-better-bounds-checking.patch for now.