Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1027908rwb; Thu, 22 Sep 2022 09:12:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XIocddAY/o/tXBcJybdqjyKOF7bat3T4sF5YQqeg9Ls9WT/qAEzAcqCcMgxFhHTl7vJB/ X-Received: by 2002:a17:907:2721:b0:77c:29f9:2c84 with SMTP id d1-20020a170907272100b0077c29f92c84mr3503857ejl.721.1663863121288; Thu, 22 Sep 2022 09:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663863121; cv=none; d=google.com; s=arc-20160816; b=OUtXsKw2ON8SToyGpXf3355K/MUAAHolyTFqxc3HIKcJLfvK17WwDK8L2tqbXzSgW8 dY+sP2JwQARqJ7iKfqeKOLJEW3LoxPNWQPKPDUThllpQMn/OVUkl492PHb9sIib6mEou CnxjPMBi89e0X74Fa65VZ86G/Oe30yslgneDPXMIEG0v6cx7qPvUKl7msaKpiBTrAXD3 4fCtYYwCdWBjQNwgYUxY0los6oA/ckDxNkYCQQiVu6YhEc7hQolY9y5SMzb+E5l4noyW UxLdjZTm3SY8r63BRRxBLmzwP6ouH+PKL4qv8OYG4Q0kcdrqPzIu7ih2osVV6nXXlrim uXYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TZpRIJCCMZKyVUgNnwboEjnHYpEIRQBSXZlSwc7OZ+0=; b=shR3HFR7IrCgy5NKFt2CMhm88cKFPNV7rkQIobA6uV1l/BtJNRrKDq05vRiYp/+Nmd ZVtyQyAC6L9moTYLDJqOu3XjvYn9AgeWuYFK/D30pKR815HI+/vR+C6fnyCyHXyFG+eH Lz8B4I+V/Osh6oLfshR/E4lW7kkzWUxrV4w/zZFbKV6PGfjvkn9xgF9drLO4HaIDdgLM cA2Q4BHXg7Z6/K+yWpGl+vrvdRHjSBgyD+/WvA0a//RCO//iUITDXCkpvQy7erYX1YUO CIWdZxs9PHCEWittaA8JDiClyIoiOZwKfnh3F6zwiAJfCxdJsQty0mdKeY9Au0AbEY2m QZsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lKwDDBjv; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp22-20020a1709073e1600b00780bbe20896si6543546ejc.535.2022.09.22.09.11.40; Thu, 22 Sep 2022 09:12:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@chromium.org header.s=google header.b=lKwDDBjv; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbiIVP4t (ORCPT + 63 others); Thu, 22 Sep 2022 11:56:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231709AbiIVP4o (ORCPT ); Thu, 22 Sep 2022 11:56:44 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD4CEE5F9F for ; Thu, 22 Sep 2022 08:56:38 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d24so9188756pls.4 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=YeY03v9INNnFHejKZLdQBkI+TgxaWh0hXUrXP/ClVZdTTMY/59cEoGLzO7/ZbmilAD fXPQCjakh9L5rWqMs56ZNg3+Uaq3ISj5nzRtRZ6o4yrsl//2e62lrpQxXshEvrUOLNiA l71edNgBSyrVrvlQcLYlc6kToibh3f34MaIj6EtLEHc6Ei9L3ksRb9L5qBKynasN5GIc C0T2ZSCT8jXiWCzsFKLKRme7V3Y3v+9L7P53tTeLd5p7I5OioKS3Wk51VTVqF3aud1Jf G2m/dV1QJj1r8auwwf2+w3zZvb+yUolG/kJ3sVF6SMKiF9RMF91DEAKY/Ub8u9ou/miv 0Lhw== X-Gm-Message-State: ACrzQf2wHmvsEL5eWIOZ4SKD6e4jkFnMw8cmD69+OihgOUlSCdFG76yi AWn9E9VdWS9Pw3JfZJtEQXW3Zg== 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: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-wireless@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