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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97F8BC433F5 for ; Fri, 10 Sep 2021 19:49:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 743D560E54 for ; Fri, 10 Sep 2021 19:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233120AbhIJTud (ORCPT ); Fri, 10 Sep 2021 15:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbhIJTuc (ORCPT ); Fri, 10 Sep 2021 15:50:32 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213E7C061762 for ; Fri, 10 Sep 2021 12:49:21 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id i28so4956625ljm.7 for ; Fri, 10 Sep 2021 12:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GN80YMAl1pIDXe7DGEZBk2ixhfr92aqiNjP2rTtktow=; b=VrIWHd9zX+z/Bt8qhmJLxwhXLsSmMpb5HTPD6Aiz8jfHHtTUEtE0mkTgf7qj7VHubp 3P4eltXAuhHbS/cA+4h2VyZb3T0p+2QF4kDk8AnfDShf05as/Pdv9nh3Olt5MwuYyHj7 Sp8n+WG/xfOzb7Z+Oi7hvJ93DjSZpGCB4IIFeOUNfJ7NSV7D42WG+DiVBqMtiN/deCUr /2C7CUV+Jtc/wCoWuf4Zjkz/z4hNVPLaR6HYIR8amSyhrVs/f/tYROHBsqg71DniXvSU G5Wapit+FV0hUXgghiY0zGBiCjFld0d1ZJ/ijldbBZmmIXclNJRa3NMOU0zrQKUWW2q1 dZeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GN80YMAl1pIDXe7DGEZBk2ixhfr92aqiNjP2rTtktow=; b=FXcbUyD6FXyUrVCr901XGds6bSgrJQWOquQ6/MWkTd0HsSF7HESk0+gTx1yMKTzEA6 z2S4uxPlE/tmWJKPxLU5QjlTuBdlj6f7k2qU8a6zD8WP9WDdaeLnK2sPtJtunkKdoZav p/hJlt93e48kyloUue5mJeL3g+8+Qeh8qIxutNRsS9DqlVZp1RcgMRSv5i9ZylGrDXYM Q3iQpmmKE5qKUdXoEEV0haXjZKjuZosx+m3o82DM7FtmO5/fvSuTK5aXrTq8MGkNGGrb Fh+SptQsjixBSQstSJ0cishvBpByF85bA+Rb8HcAHlA9tF2AfZsxdmb+IdXE9Y+7ltfR hMyg== X-Gm-Message-State: AOAM532fzV209jzRcS9P5q/ywnrRMCgNX/j42IZeEmXJD45x5yRpff6C gEy08G40Nxc9LJzRLOQGLGM54Z7kaguFpdFD9U8ogg== X-Google-Smtp-Source: ABdhPJxwTNhBoufvxArxxeBrmLxqq5WMeCXnPZLFRdIv0bH95PUKM8LahYoXspk9rANHib3uaORJqtM9SCT5hY1Sta8= X-Received: by 2002:a2e:99da:: with SMTP id l26mr5248054ljj.339.1631303359314; Fri, 10 Sep 2021 12:49:19 -0700 (PDT) MIME-Version: 1.0 References: <20210909200948.090d4e213ca34b5ad1325a7e@linux-foundation.org> <20210910031046.G76dQvPhV%akpm@linux-foundation.org> In-Reply-To: From: Nick Desaulniers Date: Fri, 10 Sep 2021 12:49:08 -0700 Message-ID: Subject: Re: [patch 9/9] mm/vmalloc: add __alloc_size attributes for better bounds checking To: Linus Torvalds Cc: Andrew Morton , apw@canonical.com, Christoph Lameter , Daniel Micay , Dennis Zhou , dwaipayanray1@gmail.com, Joonsoo Kim , Joe Perches , Kees Cook , Linux-MM , Lukas Bulwahn , mm-commits@vger.kernel.org, Nathan Chancellor , Miguel Ojeda , Pekka Enberg , David Rientjes , Tejun Heo , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org On Fri, Sep 10, 2021 at 10:24 AM Linus Torvalds wrote: > > On Thu, Sep 9, 2021 at 8:10 PM Andrew Morton wrote: > > > > +__alloc_size(1) > > extern void *vmalloc(unsigned long size); > [...] > > All of these are added in the wrong place Huh? $ grep -rn __always_inline $ grep -rn noinline $ grep -rn __cold ... Not that we have explicit guidance here in any coding style guide, perhaps we can make a clarification in Documentation/process/coding-style.rst? I'd say when using function attributes, we tend to have the linkage (ie. explicitly static or implicitly extern), followed by function attributes related to inlining (__always_inline, noinline), followed by return type, followed by function level attributes, followed by parameter list. But I don't think we're even internally consistent here. -- Thanks, ~Nick Desaulniers 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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C569C433EF for ; Fri, 10 Sep 2021 19:49:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8D84560E54 for ; Fri, 10 Sep 2021 19:49:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8D84560E54 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0D5566B0071; Fri, 10 Sep 2021 15:49:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0854A6B0072; Fri, 10 Sep 2021 15:49:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB6E86B0073; Fri, 10 Sep 2021 15:49:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id DF5996B0071 for ; Fri, 10 Sep 2021 15:49:21 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8620D1801E237 for ; Fri, 10 Sep 2021 19:49:21 +0000 (UTC) X-FDA: 78572702922.21.B64D54F Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by imf01.hostedemail.com (Postfix) with ESMTP id 21AAF505401A for ; Fri, 10 Sep 2021 19:49:21 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id l18so4941918lji.12 for ; Fri, 10 Sep 2021 12:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GN80YMAl1pIDXe7DGEZBk2ixhfr92aqiNjP2rTtktow=; b=VrIWHd9zX+z/Bt8qhmJLxwhXLsSmMpb5HTPD6Aiz8jfHHtTUEtE0mkTgf7qj7VHubp 3P4eltXAuhHbS/cA+4h2VyZb3T0p+2QF4kDk8AnfDShf05as/Pdv9nh3Olt5MwuYyHj7 Sp8n+WG/xfOzb7Z+Oi7hvJ93DjSZpGCB4IIFeOUNfJ7NSV7D42WG+DiVBqMtiN/deCUr /2C7CUV+Jtc/wCoWuf4Zjkz/z4hNVPLaR6HYIR8amSyhrVs/f/tYROHBsqg71DniXvSU G5Wapit+FV0hUXgghiY0zGBiCjFld0d1ZJ/ijldbBZmmIXclNJRa3NMOU0zrQKUWW2q1 dZeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GN80YMAl1pIDXe7DGEZBk2ixhfr92aqiNjP2rTtktow=; b=pL9Q3/xRyvZXfbthvobznnII7XJcbdqvebDzB5q8LY1rj9I7kWL9K24s5dqx5jXMOe vQ3R2fSSFwqzN94bQEmWmTj6EgRKYtPDAP1XHK/RTRzEa6p9llDupEmE8y0DqlOUbjZ0 N+2Knts6mNV6ct0FoPASGyAeb/7C4azWavxn4cs8n1v0q0oJJLKzF76y/41Kbzf9KuJl s5GS6LHfFEAedUy67VO4ZfVVoBc7/KBc9hryrkZvqFdsw8+CQnGfMSFRVTHJ04GmpIoP AxP7SvWHQh0uoiISyx9aVllJkcX0/zvAERlsRh3w9E8GEIXgQnnhmjm/817JMFOxsXWr 7krg== X-Gm-Message-State: AOAM531NeHCvq08YZPckoE7gz9+VMS1bhSSEAMl3PPMp2Oe6maMV79db fw06dtmcnXIbipxac8BixyGKEUA76jNez1LkWEgllQ== X-Google-Smtp-Source: ABdhPJxwTNhBoufvxArxxeBrmLxqq5WMeCXnPZLFRdIv0bH95PUKM8LahYoXspk9rANHib3uaORJqtM9SCT5hY1Sta8= X-Received: by 2002:a2e:99da:: with SMTP id l26mr5248054ljj.339.1631303359314; Fri, 10 Sep 2021 12:49:19 -0700 (PDT) MIME-Version: 1.0 References: <20210909200948.090d4e213ca34b5ad1325a7e@linux-foundation.org> <20210910031046.G76dQvPhV%akpm@linux-foundation.org> In-Reply-To: From: Nick Desaulniers Date: Fri, 10 Sep 2021 12:49:08 -0700 Message-ID: Subject: Re: [patch 9/9] mm/vmalloc: add __alloc_size attributes for better bounds checking To: Linus Torvalds Cc: Andrew Morton , apw@canonical.com, Christoph Lameter , Daniel Micay , Dennis Zhou , dwaipayanray1@gmail.com, Joonsoo Kim , Joe Perches , Kees Cook , Linux-MM , Lukas Bulwahn , mm-commits@vger.kernel.org, Nathan Chancellor , Miguel Ojeda , Pekka Enberg , David Rientjes , Tejun Heo , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 21AAF505401A Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VrIWHd9z; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of ndesaulniers@google.com designates 209.85.208.176 as permitted sender) smtp.mailfrom=ndesaulniers@google.com X-Stat-Signature: qp95jdu41fcb5wkjztbmoct9icxiyg5a X-HE-Tag: 1631303361-974240 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 Fri, Sep 10, 2021 at 10:24 AM Linus Torvalds wrote: > > On Thu, Sep 9, 2021 at 8:10 PM Andrew Morton wrote: > > > > +__alloc_size(1) > > extern void *vmalloc(unsigned long size); > [...] > > All of these are added in the wrong place Huh? $ grep -rn __always_inline $ grep -rn noinline $ grep -rn __cold ... Not that we have explicit guidance here in any coding style guide, perhaps we can make a clarification in Documentation/process/coding-style.rst? I'd say when using function attributes, we tend to have the linkage (ie. explicitly static or implicitly extern), followed by function attributes related to inlining (__always_inline, noinline), followed by return type, followed by function level attributes, followed by parameter list. But I don't think we're even internally consistent here. -- Thanks, ~Nick Desaulniers