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 smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5A31C32771 for ; Wed, 28 Sep 2022 17:13:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2BA23418EE; Wed, 28 Sep 2022 17:13:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2BA23418EE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1664385201; bh=7QjX6WqvLfVNssbZYZg2DrD0YHlSy5f7EPy8zn+Iv90=; h=Date:From:To:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=sWxY1TUB76A2Gx3GyUtsui1Jn9pl10k3Nyn85mQkFlxBHXZMoy9y4SiqTrRkJUGQd Xz1QzyiEw7Z/Yu1PPP3bMIxI32/yTWuWTPmCzMCtHTodZe2Af3tH2W+US4kti5ugfc ZOIgsaUHjNRhLcJDxdFU8SL6OA8jauHsGyRMpfN1ak9oYyVdINgTTIYPMuaYPGebFO Wt9Gjrpj0adfoK6+m+oo8SYvlLmWflRQwYRv4u/Yas6ewMzqodZX3oFRjsSlaw0m5l 6isCp57FtVYaj/se07e4pN9ZziZRPKGPco7CSMOBPNbF/R+FQUXqy+4EE7/pCzQ5kP 6pfic4xXD0IiA== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tbn5QcwSdniX; Wed, 28 Sep 2022 17:13:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id BF86241911; Wed, 28 Sep 2022 17:13:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BF86241911 Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B5E6B1BF2F0 for ; Wed, 28 Sep 2022 17:13:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9A36040FCF for ; Wed, 28 Sep 2022 17:13:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9A36040FCF X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nk0AAxoUBDUI for ; Wed, 28 Sep 2022 17:13:15 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4BAB440FBD Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4BAB440FBD for ; Wed, 28 Sep 2022 17:13:15 +0000 (UTC) Received: by mail-pj1-x102f.google.com with SMTP id e11-20020a17090a77cb00b00205edbfd646so3188691pjs.1 for ; Wed, 28 Sep 2022 10:13:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=d6n7vVcWWAUhY50nx1oX+SjTLgFqeY1Yq8iTalyfqd0=; b=uyFPfj6kL05r6DqEWPTSEn98aXS3wA2nywn8j00hOPIlxAgFNDVd8PJCtqNSStOM3w TzYDyrFDSxCehnutFNUXia3gjuEHHpdwKwSKtA5RxBsM4vDeGIJ0soDjkyBkhINwhjVP a7+voLuXOIVkw9Z2b/g0gvjNSoeXmbPIj8iH0kXCIUYHz3AInv5/HvW2DLbVzEU8vXnm AbGntAOi1mc8Oh9nb5sZHZ35m+EloTqCJARo/NkrdzduFEBZmLCTG6WY5qZwljDlhQM3 A66hUnX6CJULaiI/aDreCD1ez84ZTmlzRRcZTLpUYGMf9XvXs9wHNwIlTf2fex39l2fC bXHg== X-Gm-Message-State: ACrzQf3PAE3zCTjSyVnHtBsBFT0pnGxVII/+JgdGmaTKnRFhSkWSlzVw ajCks5B0s8OcXTjsnFnN7SN6bA== X-Google-Smtp-Source: AMsMyM6sCBBdOCLg/ekAp2unP2+2il2GSYEdTvWU2WPyIonTKW/L3Ua/pLmu7ZGbcH4WrqStMgqaPQ== X-Received: by 2002:a17:902:db08:b0:176:d40e:4b57 with SMTP id m8-20020a170902db0800b00176d40e4b57mr799977plx.172.1664385194575; Wed, 28 Sep 2022 10:13:14 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q3-20020a170902dac300b00177faf558b5sm4082449plx.250.2022.09.28.10.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 10:13:13 -0700 (PDT) Date: Wed, 28 Sep 2022 10:13:12 -0700 From: Kees Cook To: Geert Uytterhoeven Message-ID: <202209281011.66DD717D@keescook> References: <20220923202822.2667581-1-keescook@chromium.org> <20220923202822.2667581-2-keescook@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=d6n7vVcWWAUhY50nx1oX+SjTLgFqeY1Yq8iTalyfqd0=; b=lIRHIZiWHITqRmakxRZHSG2SU2bpWinoR3Swar+fPYJBmT1qOO/MT6WnWN5yBDlhGu /lQXgjvlz0O4V2+hnYy+98Yh09p4wB3YUjZ22bnBWEa9dMSwUm7gVI6Ae5kXcacwBn8L BoOjiPYblWsCdJGhH6goLGXzHmU5/JoB80oyI= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=lIRHIZiW Subject: Re: [Intel-wired-lan] [PATCH v2 01/16] slab: Remove __malloc attribute from realloc functions X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Gushchin , dri-devel@lists.freedesktop.org, "Ruhl, Michael J" , Eric Dumazet , linux-hardening@vger.kernel.org, Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , Sumit Semwal , dev@openvswitch.org, x86@kernel.org, intel-wired-lan@lists.osuosl.org, David Rientjes , Miguel Ojeda , Jakub Kicinski , Paolo Abeni , linux-media@vger.kernel.org, Marco Elver , llvm@lists.linux.dev, Josef Bacik , linaro-mm-sig@lists.linaro.org, Yonghong Song , David Sterba , Andrew Morton , Vlastimil Babka , Alex Elder , linux-mm@kvack.org, Greg Kroah-Hartman , Nick Desaulniers , linux-kernel@vger.kernel.org, Christian =?iso-8859-1?Q?K=F6nig?= , Pekka Enberg , Daniel Micay , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, Joonsoo Kim , "David S. Miller" , linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" T24gV2VkLCBTZXAgMjgsIDIwMjIgYXQgMDk6MjY6MTVBTSArMDIwMCwgR2VlcnQgVXl0dGVyaG9l dmVuIHd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Assassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC98EC04A95 for ; Wed, 28 Sep 2022 17:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234548AbiI1ROK (ORCPT ); Wed, 28 Sep 2022 13:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234599AbiI1RNn (ORCPT ); Wed, 28 Sep 2022 13:13:43 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B59AF1859 for ; Wed, 28 Sep 2022 10:13:15 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id f23so12284028plr.6 for ; Wed, 28 Sep 2022 10:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=d6n7vVcWWAUhY50nx1oX+SjTLgFqeY1Yq8iTalyfqd0=; b=lIRHIZiWHITqRmakxRZHSG2SU2bpWinoR3Swar+fPYJBmT1qOO/MT6WnWN5yBDlhGu /lQXgjvlz0O4V2+hnYy+98Yh09p4wB3YUjZ22bnBWEa9dMSwUm7gVI6Ae5kXcacwBn8L BoOjiPYblWsCdJGhH6goLGXzHmU5/JoB80oyI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=d6n7vVcWWAUhY50nx1oX+SjTLgFqeY1Yq8iTalyfqd0=; b=BD06M61a8uujW9XsB7XAgtjiPBzivIF3wbkqRQ1f6j4umymb/Ua+BL8vstPsJfz2WZ aFTI7/c59etKq2QuMqj14W9/3BrA1Au/8ImS4U8duKEQbxwN01M7C78KNxTi/br0TJ4t p8UsWdbrhn7/Uc1Zy/fsokE2ZzPGBRL3/5fGUMyleXVbZeswdwH20whhw/cOVSOFU+qd FbtF4+tpTba9g3Xkm+20l8fI0t5t/xxCFE3ZTBvrtNwt2T38JoyInfy6ro/7PZnlOcPW FnGp6fCwvEcVpHJv4CaKRygFMR4ygRnbr5z+bItBo3SAa4pTeVnK72Ir1l93hXll9D/g IFTA== X-Gm-Message-State: ACrzQf1qiN+EMtbLNjsj9pfbrz6m6GGq5pNS7f6zI1NH+2KwrzkOXoWF tFwm645XJcOD6nkEGFmLfX7RHg== X-Google-Smtp-Source: AMsMyM6sCBBdOCLg/ekAp2unP2+2il2GSYEdTvWU2WPyIonTKW/L3Ua/pLmu7ZGbcH4WrqStMgqaPQ== X-Received: by 2002:a17:902:db08:b0:176:d40e:4b57 with SMTP id m8-20020a170902db0800b00176d40e4b57mr799977plx.172.1664385194575; Wed, 28 Sep 2022 10:13:14 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q3-20020a170902dac300b00177faf558b5sm4082449plx.250.2022.09.28.10.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 10:13:13 -0700 (PDT) Date: Wed, 28 Sep 2022 10:13:12 -0700 From: Kees Cook To: Geert Uytterhoeven Cc: Vlastimil Babka , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Marco Elver , linux-mm@kvack.org, "Ruhl, Michael J" , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , Nick Desaulniers , Alex Elder , Josef Bacik , David Sterba , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Jesse Brandeburg , Daniel Micay , Yonghong Song , Miguel Ojeda , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, dev@openvswitch.org, x86@kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2 01/16] slab: Remove __malloc attribute from realloc functions Message-ID: <202209281011.66DD717D@keescook> References: <20220923202822.2667581-1-keescook@chromium.org> <20220923202822.2667581-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, Sep 28, 2022 at 09:26:15AM +0200, Geert Uytterhoeven wrote: > Hi Kees, > > On Fri, Sep 23, 2022 at 10:35 PM Kees Cook wrote: > > The __malloc attribute should not be applied to "realloc" functions, as > > the returned pointer may alias the storage of the prior pointer. Instead > > of splitting __malloc from __alloc_size, which would be a huge amount of > > churn, just create __realloc_size for the few cases where it is needed. > > > > Additionally removes the conditional test for __alloc_size__, which is > > always defined now. > > > > Cc: Christoph Lameter > > Cc: Pekka Enberg > > Cc: David Rientjes > > Cc: Joonsoo Kim > > Cc: Andrew Morton > > Cc: Vlastimil Babka > > Cc: Roman Gushchin > > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > Cc: Marco Elver > > Cc: linux-mm@kvack.org > > Signed-off-by: Kees Cook > > Thanks for your patch, which is now commit 63caa04ec60583b1 ("slab: > Remove __malloc attribute from realloc functions") in next-20220927. > > Noreply@ellerman.id.au reported all gcc8-based builds to fail > (e.g. [1], more at [2]): > > In file included from : > ./include/linux/percpu.h: In function ‘__alloc_reserved_percpu’: > ././include/linux/compiler_types.h:279:30: error: expected > declaration specifiers before ‘__alloc_size__’ > #define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > ^~~~~~~~~~~~~~ > ./include/linux/percpu.h:120:74: note: in expansion of macro ‘__alloc_size’ > [...] > > It's building fine with e.g. gcc-9 (which is my usual m68k cross-compiler). > Reverting this commit on next-20220927 fixes the issue. > > [1] http://kisskb.ellerman.id.au/kisskb/buildresult/14803908/ > [2] http://kisskb.ellerman.id.au/kisskb/head/1bd8b75fe6adeaa89d02968bdd811ffe708cf839/ Eek! Thanks for letting me know. I'm confused about this -- __alloc_size__ wasn't optional in compiler_attributes.h -- but obviously I broke something! I'll go figure this out. -Kees -- Kees Cook 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC3F9C32771 for ; Wed, 28 Sep 2022 17:13:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0AAF10E4C3; Wed, 28 Sep 2022 17:13:16 +0000 (UTC) Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A45610E4C3 for ; Wed, 28 Sep 2022 17:13:15 +0000 (UTC) Received: by mail-pl1-x634.google.com with SMTP id z20so5405306plb.10 for ; Wed, 28 Sep 2022 10:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=d6n7vVcWWAUhY50nx1oX+SjTLgFqeY1Yq8iTalyfqd0=; b=lIRHIZiWHITqRmakxRZHSG2SU2bpWinoR3Swar+fPYJBmT1qOO/MT6WnWN5yBDlhGu /lQXgjvlz0O4V2+hnYy+98Yh09p4wB3YUjZ22bnBWEa9dMSwUm7gVI6Ae5kXcacwBn8L BoOjiPYblWsCdJGhH6goLGXzHmU5/JoB80oyI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=d6n7vVcWWAUhY50nx1oX+SjTLgFqeY1Yq8iTalyfqd0=; b=Vw8qO79qLCqy91OQdSXT3jaPTbXeHxvmF6xSx17/IzQFK6PAFJeA6RZvwOYnm16olc 354v7GCdxdatRpgEDTuxs3rBTmcgze3pLDzqZZKBxL728W6Fd2tAdFi+xzLwmYZMtDen rqYGiCVJqbRQesQfEzEo365LRlAZOesG4vbLvmIWxBkpbUQGYHdzWbmsCglZIg7+EziZ 9ypb/2kZqnnC6k06oE3Mb3uqGRM1HP6b6226bAceNlLx2w84O3rKDCKrI3AKMQ5B6HLN hmXdZwSBUCRfrDvdNjrredyTiPiWaeM5Xa7MI5/jTKyh2huYJY87hpw81IXbCtfp7wmA 8xcw== X-Gm-Message-State: ACrzQf25rgmaIuBcRp8sxZ2/btBfN0VsNxBZ1IZHm+v20SsybjiRjkb0 /rOZAcCrPfZiQ12Xguu+zX2c6w== X-Google-Smtp-Source: AMsMyM6sCBBdOCLg/ekAp2unP2+2il2GSYEdTvWU2WPyIonTKW/L3Ua/pLmu7ZGbcH4WrqStMgqaPQ== X-Received: by 2002:a17:902:db08:b0:176:d40e:4b57 with SMTP id m8-20020a170902db0800b00176d40e4b57mr799977plx.172.1664385194575; Wed, 28 Sep 2022 10:13:14 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q3-20020a170902dac300b00177faf558b5sm4082449plx.250.2022.09.28.10.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 10:13:13 -0700 (PDT) Date: Wed, 28 Sep 2022 10:13:12 -0700 From: Kees Cook To: Geert Uytterhoeven Subject: Re: [PATCH v2 01/16] slab: Remove __malloc attribute from realloc functions Message-ID: <202209281011.66DD717D@keescook> References: <20220923202822.2667581-1-keescook@chromium.org> <20220923202822.2667581-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Gushchin , dri-devel@lists.freedesktop.org, "Ruhl, Michael J" , Eric Dumazet , linux-hardening@vger.kernel.org, Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , Sumit Semwal , dev@openvswitch.org, x86@kernel.org, Jesse Brandeburg , intel-wired-lan@lists.osuosl.org, David Rientjes , Miguel Ojeda , Jakub Kicinski , Paolo Abeni , linux-media@vger.kernel.org, Marco Elver , llvm@lists.linux.dev, Josef Bacik , linaro-mm-sig@lists.linaro.org, Yonghong Song , David Sterba , Andrew Morton , Vlastimil Babka , Alex Elder , linux-mm@kvack.org, Greg Kroah-Hartman , Nick Desaulniers , linux-kernel@vger.kernel.org, Christian =?iso-8859-1?Q?K=F6nig?= , Pekka Enberg , Daniel Micay , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, Joonsoo Kim , "David S. Miller" , linux-btrfs@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Sep 28, 2022 at 09:26:15AM +0200, Geert Uytterhoeven wrote: > Hi Kees, > > On Fri, Sep 23, 2022 at 10:35 PM Kees Cook wrote: > > The __malloc attribute should not be applied to "realloc" functions, as > > the returned pointer may alias the storage of the prior pointer. Instead > > of splitting __malloc from __alloc_size, which would be a huge amount of > > churn, just create __realloc_size for the few cases where it is needed. > > > > Additionally removes the conditional test for __alloc_size__, which is > > always defined now. > > > > Cc: Christoph Lameter > > Cc: Pekka Enberg > > Cc: David Rientjes > > Cc: Joonsoo Kim > > Cc: Andrew Morton > > Cc: Vlastimil Babka > > Cc: Roman Gushchin > > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > Cc: Marco Elver > > Cc: linux-mm@kvack.org > > Signed-off-by: Kees Cook > > Thanks for your patch, which is now commit 63caa04ec60583b1 ("slab: > Remove __malloc attribute from realloc functions") in next-20220927. > > Noreply@ellerman.id.au reported all gcc8-based builds to fail > (e.g. [1], more at [2]): > > In file included from : > ./include/linux/percpu.h: In function ‘__alloc_reserved_percpu’: > ././include/linux/compiler_types.h:279:30: error: expected > declaration specifiers before ‘__alloc_size__’ > #define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > ^~~~~~~~~~~~~~ > ./include/linux/percpu.h:120:74: note: in expansion of macro ‘__alloc_size’ > [...] > > It's building fine with e.g. gcc-9 (which is my usual m68k cross-compiler). > Reverting this commit on next-20220927 fixes the issue. > > [1] http://kisskb.ellerman.id.au/kisskb/buildresult/14803908/ > [2] http://kisskb.ellerman.id.au/kisskb/head/1bd8b75fe6adeaa89d02968bdd811ffe708cf839/ Eek! Thanks for letting me know. I'm confused about this -- __alloc_size__ wasn't optional in compiler_attributes.h -- but obviously I broke something! I'll go figure this out. -Kees -- Kees Cook