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 EAAD9C433FE for ; Fri, 18 Feb 2022 17:16:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41E006B0074; Fri, 18 Feb 2022 12:16:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CDD46B0075; Fri, 18 Feb 2022 12:16:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 294FB6B0078; Fri, 18 Feb 2022 12:16:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id 19A816B0074 for ; Fri, 18 Feb 2022 12:16:02 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CDBD8180C11EB for ; Fri, 18 Feb 2022 17:16:01 +0000 (UTC) X-FDA: 79156553322.25.7457104 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf20.hostedemail.com (Postfix) with ESMTP id 276CB1C0017 for ; Fri, 18 Feb 2022 17:16:01 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9EBD8219A4; Fri, 18 Feb 2022 17:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645204559; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zpVTMN5crc6K1MF78ftYrPJFMOci1TdJrt+hVPeq/w=; b=AsIMLeva+P0GlDGnDCf06J1i2KnXl+5nAmZgGIujgukrWdYIBDgdf/mq3I4M5VFzd4D85B W2s21/X3770XiMfAyPtEt183uB3cqgDmQvXAFWuJgQBnhoS74aYEYH/08CfnLgwOI+PoCp ilCITaX5bktqFSC0gKzll2tHQHeAC6w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645204559; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zpVTMN5crc6K1MF78ftYrPJFMOci1TdJrt+hVPeq/w=; b=BlzL7u0HyzyzyKkOmqAUVW78roUbpkvRBvQYkZkUyV0AN4k6LkgMUPs2TM2jYoRRLgIcCI FLPOuApZD1L/bJBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 545C813CBE; Fri, 18 Feb 2022 17:15:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oclrE0/UD2IhVQAAMHmgww (envelope-from ); Fri, 18 Feb 2022 17:15:59 +0000 Message-ID: Date: Fri, 18 Feb 2022 18:14:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] slab: remove __alloc_size attribute from __kmalloc_track_caller Content-Language: en-US To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable , Kees Cook , Daniel Micay , Nick Desaulniers , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Nathan Chancellor , linux-mm@kvack.org, llvm@lists.linux.dev References: <20220218131358.3032912-1-gregkh@linuxfoundation.org> From: Vlastimil Babka In-Reply-To: <20220218131358.3032912-1-gregkh@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=AsIMLeva; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=BlzL7u0H; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 276CB1C0017 X-Stat-Signature: 3d839xtr4dxfjpmpnz6nyh6pi7m7yfwu X-HE-Tag: 1645204561-224145 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 2/18/22 14:13, Greg Kroah-Hartman wrote: > Commit c37495d6254c ("slab: add __alloc_size attributes for better > bounds checking") added __alloc_size attributes to a bunch of kmalloc > function prototypes. Unfortunately the change to __kmalloc_track_caller > seems to cause clang to generate broken code and the first time this is > called when booting, the box will crash. > > While the compiler problems are being reworked and attempted to be > solved, let's just drop the attribute to solve the issue now. Once it > is resolved it can be added back. Could we instead wrap it in some #ifdef that' only true for clang build? That would make the workaround more precise and self-documented. Even better if it can trigger using clang version range and once a fixed clang version is here, it can be updated to stay true for older clangs. > Fixes: c37495d6254c ("slab: add __alloc_size attributes for better bounds checking") > Cc: stable > Cc: Kees Cook > Cc: Daniel Micay > Cc: Nick Desaulniers > Cc: Christoph Lameter > Cc: Pekka Enberg > Cc: David Rientjes > Cc: Joonsoo Kim > Cc: Andrew Morton > Cc: Vlastimil Babka > Cc: Nathan Chancellor > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > Cc: llvm@lists.linux.dev > Signed-off-by: Greg Kroah-Hartman > --- > include/linux/slab.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 37bde99b74af..5b6193fd8bd9 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -660,8 +660,7 @@ static inline __alloc_size(1, 2) void *kcalloc(size_t n, size_t size, gfp_t flag > * allocator where we care about the real place the memory allocation > * request comes from. > */ > -extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller) > - __alloc_size(1); > +extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller); > #define kmalloc_track_caller(size, flags) \ > __kmalloc_track_caller(size, flags, _RET_IP_) >