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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C596C54EE9 for ; Thu, 22 Sep 2022 15:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230247AbiIVP4s (ORCPT ); Thu, 22 Sep 2022 11:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbiIVP4o (ORCPT ); Thu, 22 Sep 2022 11:56:44 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD1A6E5F94 for ; Thu, 22 Sep 2022 08:56:38 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id v1so9171219plo.9 for ; Thu, 22 Sep 2022 08:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=TZpRIJCCMZKyVUgNnwboEjnHYpEIRQBSXZlSwc7OZ+0=; b=lKwDDBjvYm/0Jleq+GCxBaTtwnHH7tK+nJ5dJ9Mroo7Wx2WiOGB/Kmka/kC9bYFq8z aE3zrV852KZPixgDhOan1L1Vq5Tj1ydcVjIMjp+7gLHmlIsooLMnRpZ01jzKR4yf16m5 6AQEJMsyFTKj/8+82bO+4x4lXyaSTMa1R26kY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=TZpRIJCCMZKyVUgNnwboEjnHYpEIRQBSXZlSwc7OZ+0=; b=x5ojpYVrmnts+zKyD11CXIZV3IVvxZmo0bYWCdq4ePz5T+EwPHb+ctUT80HAMKAdIy B2vUGqR8kRYIZ5tgsuGwgkikSQgg6ysEIgWfvFgRzynUZOIkY4BAO/YVSsMbxLwPxoxx hVZ7OkjhPxEkf1LJr1eS8QiuPoDXgBmUpFARjnM6GNBZ37JEjBbGK3LgOPUzyRwbwaE1 0PvAJuXdEmVWsXDdxRG2QcGYWMssYwJWIsV7ihDC0KiG2LkrdCHt/KXtRcF9IujByNeB oNaVPW5NT35sAtsmjPuOmwd4uEl8p0Kum/58USw5aXOIXpFP8p0IIqHd/UDmkTGwadub Yq2Q== X-Gm-Message-State: ACrzQf1urFw8vl5qs8ijXR9zxqBui/v9RFtBF1q1wh8bBX/V+6oOcUN5 eGdWR8veC/P0lcMhoCUjEJkUwA== X-Google-Smtp-Source: AMsMyM6wj70ZRZNEGtsTQjOpU6Y4OkbiX+0Wag8Z4tUWxe6CdbDk3WijTof+igifPO84VXufZHizeQ== X-Received: by 2002:a17:90b:4d8e:b0:200:73b4:4da2 with SMTP id oj14-20020a17090b4d8e00b0020073b44da2mr16393990pjb.197.1663862197527; Thu, 22 Sep 2022 08:56:37 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b5-20020a170902d50500b00176ca533ea0sm4327600plg.90.2022.09.22.08.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 08:56:36 -0700 (PDT) Date: Thu, 22 Sep 2022 08:56:35 -0700 From: Kees Cook To: Miguel Ojeda Cc: Vlastimil Babka , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Nick Desaulniers , Hao Luo , Marco Elver , linux-mm@kvack.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Greg Kroah-Hartman , Alex Elder , Josef Bacik , David Sterba , Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , Jesse Brandeburg , Daniel Micay , Yonghong Song , Miguel Ojeda , Feng Tang , 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, linux-wireless@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH 11/12] slab: Remove __malloc attribute from realloc functions Message-ID: <202209220855.B8DA16E@keescook> References: <20220922031013.2150682-1-keescook@chromium.org> <20220922031013.2150682-12-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Sep 22, 2022 at 11:23:46AM +0200, Miguel Ojeda wrote: > On Thu, Sep 22, 2022 at 5:10 AM Kees Cook wrote: > > > > -#ifdef __alloc_size__ > > -# define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > > -#else > > -# define __alloc_size(x, ...) __malloc > > -#endif > > +#define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc > > +#define __realloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) > > These look unconditional now, so we could move it to > `compiler_attributes.h` in a later patch (or an independent series). I wasn't sure if this "composite macro" was sane there, especially since it would be using __malloc before it was defined, etc. Would you prefer I move it? -- Kees Cook