Message ID | 20210818214021.2476230-6-keescook@chromium.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=AujH=NJ=kvack.org=owner-linux-mm@kernel.org> 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 DB692C4338F for <linux-mm@archiver.kernel.org>; Wed, 18 Aug 2021 21:40:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 91E21610CD for <linux-mm@archiver.kernel.org>; Wed, 18 Aug 2021 21:40:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 91E21610CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 870B78D0003; Wed, 18 Aug 2021 17:40:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7AAF48D0007; Wed, 18 Aug 2021 17:40:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F8EB8D0003; Wed, 18 Aug 2021 17:40:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 35FE48D0006 for <linux-mm@kvack.org>; Wed, 18 Aug 2021 17:40:43 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C40CA253C4 for <linux-mm@kvack.org>; Wed, 18 Aug 2021 21:40:42 +0000 (UTC) X-FDA: 78489521124.25.FBFC91D Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf29.hostedemail.com (Postfix) with ESMTP id 7F393900802C for <linux-mm@kvack.org>; Wed, 18 Aug 2021 21:40:42 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id x1so125763plg.10 for <linux-mm@kvack.org>; Wed, 18 Aug 2021 14:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gkpL6W5wADmlyNHUFZldG5mVI9okFbona7uNlwuA1mU=; b=Qy6If4qcKtJkUwTqjP8yxEzl81jcjqu3HXxxHD0WGo85OKcGnfjztCysIKYYXPN72G SnwjhDp/FioXSHi9fY1oM+99u51Sf23nMV3pdTq5lcrcYFl/uGbHH0LYNFERH/McPKxz NnpyYsr58PmrgdH74qwoLj/U42/4DaqEYdHIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gkpL6W5wADmlyNHUFZldG5mVI9okFbona7uNlwuA1mU=; b=FidWtuiP01wP0Gn2f3iMek8M5u/sOcd4afQ/PBJlYebVRaw5APDrEj8iwdBfm9P67Q OEuil/rlR7DEwCNuDX3q3wHGF/JgKLDuOiprsDqisRBSnvBBHxn5PXzV0myuy0pepqfP bmlN/7jBvs7cz09DxmlXS2P2ECVGCx3ySvDvWScly/CFT4pWIGuAhGqEQ4znN/l/mtXi 3hLuKNtv7dzvFvt8b5AovfTOWReg1xm+1sv1RsOnlqymID+Z6Y8vTpu/MavFiyNNaPjZ fm7zmMMHvTp8WgOxB6zW6tjn35E0y4KI3w6o/NyD7acoVZePNT+6cNSXCvzZ08gDMfbj 9bEw== X-Gm-Message-State: AOAM532W0+0s9fPnPphM4PxKct631mQp0X+5RhutKkYz7wX7oE74GmRR +unkZdZVKrxMTMKWvFHTcO9DyA== X-Google-Smtp-Source: ABdhPJzrhbYuLI5UlRW4aCCE3cbFMxFlFAXa9Z61qJQhnBzGGozo/4kJ/fhJlNKJnbWcs4ZQihLH7g== X-Received: by 2002:a17:90b:fd3:: with SMTP id gd19mr9573234pjb.76.1629322841706; Wed, 18 Aug 2021 14:40:41 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x19sm834704pgk.37.2021.08.18.14.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 14:40:39 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: linux-kernel@vger.kernel.org Cc: Kees Cook <keescook@chromium.org>, Daniel Micay <danielmicay@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, Joe Perches <joe@perches.com>, Miguel Ojeda <ojeda@kernel.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Andy Whitcroft <apw@canonical.com>, Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com>, Christoph Lameter <cl@linux.com>, Pekka Enberg <penberg@kernel.org>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Vlastimil Babka <vbabka@suse.cz>, Dennis Zhou <dennis@kernel.org>, Tejun Heo <tj@kernel.org>, Masahiro Yamada <masahiroy@kernel.org>, Michal Marek <michal.lkml@markovi.net>, clang-built-linux@googlegroups.com, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v2 5/7] mm/page_alloc: Add __alloc_size attributes for better bounds checking Date: Wed, 18 Aug 2021 14:40:19 -0700 Message-Id: <20210818214021.2476230-6-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210818214021.2476230-1-keescook@chromium.org> References: <20210818214021.2476230-1-keescook@chromium.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1190; h=from:subject; bh=W6Cb28S2qXmrTKUD2DPqGU+sVI4WS8pidViY5hBWcNE=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhHX5ERWo0fTNGYg6mwSKLViBT93/C8jzcI2r2WUjP LwkFmOOJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYR1+RAAKCRCJcvTf3G3AJu5UD/ 9yIUyrMR9IxHlxKAanhzIsME7zxx04n6zWRtwcafigdh/kVuzrzuRYMif8CdvvgBvmz8HJwZdDcdQE 82qUSTku6Uc0adci2vK6LHAWS+sDWZ3y83xb61th6T9qdLd8fcpin+QnJYegrBY56S1DOI4ipiyEXa w68LROW++aDn1Yb0oS+5DBCusLj0DqNdO63YohcPDDjtXNNamr5A6kjzJLbtUDeFJDxp65/gisJEo6 oV/morkS6bYX73qMpvcGnt1dXWLw6irYepPYWiyYPa29OL4bzmjo8TVNFj6869tivAN6s2p8BxyeHM 5hpfLWXwu1dC1GqLFGMxENpbegEsaqkzhn/KFG3dPkm8DFSCbTzB14kZ7wr1vqD65b1FQoZhlghJEW PWciluNwgNnwlQKgC3uvfsvBPMJvWN5974DLE/OCwJWr4P8y6OGFjeAg3GFD4ds+UgtkXb9nEwEVij SojHGWi6tife8OuVdpiyAaAousPkkz02htMpPDwG8SSxJJO1Fw9CwRWGDF0sEkOHwCCosUKhVTp8Vu UivVUOYfr/LVdMW5lpya4iiJDoBoL8ww5GKz0SAGrRpmPpbLtWALZA9bu9NmpyoloQ9lKFEAACF+dJ Fq0C6qVNHPMSUlCr0vhM7/JSbua0QjaQtTxhpC+iz25WikK4frNDFwJKbcnw== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Qy6If4qc; spf=pass (imf29.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.176 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7F393900802C X-Stat-Signature: bos5msed9uw15yhmntd6xyzb884oiugb X-HE-Tag: 1629322842-470711 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
Add __alloc_size() for better bounds checking
|
expand
|
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 3745efd21cf6..897538d5ffd2 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -618,8 +618,10 @@ static inline struct folio *folio_alloc(gfp_t gfp, unsigned int order) extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); extern unsigned long get_zeroed_page(gfp_t gfp_mask); +__alloc_size(1) void *alloc_pages_exact(size_t size, gfp_t gfp_mask); void free_pages_exact(void *virt, size_t size); +__alloc_size(1) void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask); #define __get_free_page(gfp_mask) \