Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1553881pxb; Fri, 18 Feb 2022 10:06:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyq2IaPmb0cnBnEu7TADvKv7Pj5TtPg5WcUav0cUyX0hr9LCmAhA9NbdcUoETVGFGG3Ps35 X-Received: by 2002:a17:90a:5802:b0:1b8:b737:a62b with SMTP id h2-20020a17090a580200b001b8b737a62bmr13919321pji.123.1645207592767; Fri, 18 Feb 2022 10:06:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645207592; cv=none; d=google.com; s=arc-20160816; b=pTrgjKqdCnN/aDUhEz/Gip9d57GmCh7Ug8rMO+BigzoALEbQD5JPgC7zf8amw9cRTo kntpjJcaeoI/Eq7b1YgPN9kivulwnVLPF5OFtIoYCIHIzVt3+mig80ui85nyKiOkkVaC rMcMTmvFI4kD+mObizAl2DQ6o5uPH8IvLmquHHpz5jr1/zugG34lLRolYSdMnC4c+JSe c0a7JO0CTnmM/hTaOw5bR8+XN18gEkO0noJ5Kyr17Q3FTAC50MmqBJEtLoInYjxA8GSh l3vMko1IqMoBPTp6qT8gaOzJAyo8aHhbys5nTj0oASqmvn+cMci2DVI+5rSkHJOGpnUp L68A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=8zpVTMN5crc6K1MF78ftYrPJFMOci1TdJrt+hVPeq/w=; b=AWF4QekFZuD/cR7mhifYHnCFL7owD8XX4X+bLJmvEwbli0xsHkm64i1EU4Lz0mx6uk IyBcy1SoZLXlWB4ME5BEWgqRfSo0s6wt/i/iAV+SGXyGZ4qxgVqFzgbEhwC0Uun+Oaop w9+M574LKWEsFdNSY8VCLuTTlF0iXpbuRNbWoXSlbo2peQLN1ywBmcWiQ/HpfszeRZ0S 8JsoXhsD89NZZ5+foTIpzYn/4ghKC63pAVS9n9QtEO6RdfWhswxCq0Foq6+MUKv+7231 FaosQodOQpgn87uirHi4XfcHx6V8KlJ0heOgr3ucAV0NM8BdQ+2ak1L7t8sR4DGBdfuY 9s/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AsIMLeva; dkim=neutral (no key) header.i=@suse.cz header.b=BlzL7u0H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1si7291741pgz.388.2022.02.18.10.06.15; Fri, 18 Feb 2022 10:06:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AsIMLeva; dkim=neutral (no key) header.i=@suse.cz header.b=BlzL7u0H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238486AbiBRRRY (ORCPT + 99 others); Fri, 18 Feb 2022 12:17:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238471AbiBRRRA (ORCPT ); Fri, 18 Feb 2022 12:17:00 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 086162B7615; Fri, 18 Feb 2022 09:16:01 -0800 (PST) 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 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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_) >