From patchwork Tue Mar 5 10:10:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13581911 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ACA7C54798 for ; Tue, 5 Mar 2024 10:10:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A05EE6B0093; Tue, 5 Mar 2024 05:10:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 970C36B0099; Tue, 5 Mar 2024 05:10:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 598006B0096; Tue, 5 Mar 2024 05:10:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2FB946B0093 for ; Tue, 5 Mar 2024 05:10:34 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 011D3A0CEC for ; Tue, 5 Mar 2024 10:10:33 +0000 (UTC) X-FDA: 81862565988.16.B92B0A2 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf06.hostedemail.com (Postfix) with ESMTP id 3147618000B for ; Tue, 5 Mar 2024 10:10:31 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Ud80XEOv; spf=pass (imf06.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.169 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709633432; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=J4oJMKLdbK31ulnxzAH51pNhqUof8xsZThnS45kbbx0=; b=wQipVyfT4WcKGTpfoxF0imB2Pw0NWsC3Mk/ltQdLhosUNohKJbfTHdZz7CrEUhyrea0okY 0bzmQaZpq/Sa1RNxmolz7HBEdj4a/2bfoxbssTVD8WHCeJUnaGz7B8IroOqH8hNo2c/huG WyxNXknTUanIgmrsOIppLuylI3amk1w= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=Ud80XEOv; spf=pass (imf06.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.169 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709633432; a=rsa-sha256; cv=none; b=4YnzYsgfDtLRpTRBGFhAjfXv6t1E3wT0Z08s9ljtV7Ua6/n1iPDOOisFJB/ZfFBKXnfPRe wlFoT1pCB07rVfs27rm6muTblS+HwUu0M87qUbdWnCcp7Tv2Tw+Lys87be3fXeKBrPQGz2 UNg0Ygvfuk0h4VANdPzEEFZkBXx676E= Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1dba177c596so34016505ad.0 for ; Tue, 05 Mar 2024 02:10:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709633431; x=1710238231; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J4oJMKLdbK31ulnxzAH51pNhqUof8xsZThnS45kbbx0=; b=Ud80XEOvdwmmO4UL17RU8yCA+ngx4kZ/ye2JSjW+7nFLqlGNCJCyaHgf3IObD2sovT F0PYron9OzMGENlx3WpqlDHQYvMDMN/XqtF1rzdaTbirQPMeCEaU0k7IV8fO0Jfhecvn QsC5XdSsbVFg6wmJjQ5zjzYP6oQrwxBWWGgOw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709633431; x=1710238231; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J4oJMKLdbK31ulnxzAH51pNhqUof8xsZThnS45kbbx0=; b=N4Rzy0oIBt4d7My2QjBvIT7BR3jUbankJbdlKhRTzlsy6D6wsN8n87wwLuh8uMiXMi 1JerGg0s5ME3ligCjCzyrLA1QXCqXcQhFl7S9oqBEGNR+Zt/CKSnk3hcgcwTd3w28k7O L6mj0TdSL3ZAeB1w08WmBIU8RjuzcUcNcvqESvtLXTZN+q3KhNPU/M+0BqFof/uubg/x DkYkz762TOkpW/MRZcNMyTjf7yGLYF76iQL6SQl3Sjhcx6v5PGZ3Ob3Hn/odZV5cdYpH 0WrzZpIv2u2c0CS/gcqbB5M/R10r8i7cfHRRMJbRsr44jy0ndjxOM8wd67kT42KolC9j D2JA== X-Forwarded-Encrypted: i=1; AJvYcCUwLFjA0j4c73lwDWjnRWxO2TDX3Y/MkemxA5d4yhB5rsWMcOGUA7M6ysFvh5QPoAEjnQKJrvDYEejiq/5K+r/atNM= X-Gm-Message-State: AOJu0Yw1+qypEQFrCcOHmEPPOZnzOd9wxbtw9eJP0xBewR0HWdDX8AB+ xuBXNcZsCRebT18SAKL5t/vas0gnX1xvoSJEshYoL9ZAKtbApNLHvzfa9f3fnA== X-Google-Smtp-Source: AGHT+IHrjjh8uwOGfKisJHpLEa0Atyc/w3DC95jENvS8m/9tWBeTRxSog9SPn/yX99K3zySiGpAi+g== X-Received: by 2002:a17:902:c946:b0:1dc:f989:3116 with SMTP id i6-20020a170902c94600b001dcf9893116mr1689963pla.18.1709633431171; Tue, 05 Mar 2024 02:10:31 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id b4-20020a170902d50400b001dcf93e90a0sm6282358plg.20.2024.03.05.02.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 02:10:30 -0800 (PST) From: Kees Cook To: Vlastimil Babka Cc: Kees Cook , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, "GONG, Ruiqi" , Xiu Jianfeng , Suren Baghdasaryan , Kent Overstreet , Jann Horn , Matteo Rizzo , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v2 7/9] slab: Introduce kmem_buckets_valloc() Date: Tue, 5 Mar 2024 02:10:23 -0800 Message-Id: <20240305101026.694758-7-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305100933.it.923-kees@kernel.org> References: <20240305100933.it.923-kees@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1268; i=keescook@chromium.org; h=from:subject; bh=k3ROePG0wD7icc8xiWOerLraaHU6zkW2VMYF75ammOw=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBl5u+Q3E2uwV8NIpzb5dXDsQuDADvQD8oEdZqqt GBc07SpeUKJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZebvkAAKCRCJcvTf3G3A JkIREACdPvVBaWa/0ViOnT81LdqxheGCGDtUUmVO8IhLpzHQI2rh/b5CfK7msJHDhECQIcRrSdi 9nheGlO4Ww0GdAzyGQiuG+uKl+8tPoMsEDmLN9mYMJzOFVR9qtmtiAj8CWKbMecilAJj7/jLqds iCJqrBzYT0DBMPzR+RZ9sy4+mqmsXB8/VLVTfQt56mISQNPQ4HxWJF2ILoadyqB9vPcefR9U1EU OzMaLq1/npProPdec6qADdEauw08Z36eJCQphHgRvJ82WAFVrMNxpshJ6EMEpBpK8K5rISvVsar aqXEgU6wRqJfn9CHNyLBKbNEsewc+MTNzTH6kW30tWM/d0EuaYIykGXqwZFz6ALQ8Drk6s3yo+u KN1Nb+BF9a2zqYfrY9DNDIRvNra8AzrHVlKP3RHbTjzJDcvZDyjoEkPmDR2fCR2H+Z0kdexLb2B kk584A9xUsXzzD2J+uVGtk6XiiRF9RMheuM13Hn5v4gt4o/evttZNtO2TvSMEgiYlV7G77+lk27 THKPCHQ33k+oMkMYU93Eun2edSp14I5OInVVbt0+av7+/C3NRYD3Li2IJNOs4cX4OpXAliq48bk jKoGMk0FoWujDweGgEaojZtYDuVb8Uyxqw3TBzo2P0/2LUFvkVfm1Ovlo8NLjCSYQ6x2M+f71mk 5bgLk5y9jX9jonw== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 X-Rspamd-Queue-Id: 3147618000B X-Rspam-User: X-Stat-Signature: b816febeures9c5oc11npkp1weckez9o X-Rspamd-Server: rspam01 X-HE-Tag: 1709633431-834803 X-HE-Meta: U2FsdGVkX19U3ySY425vhmKN60TnlHZkqsiKNItPwCGdxPulRv5O4pF+dMcCG4zRZ6BgR2oxqifkyHLfygEvBOzvuDyN3Nf2yeK8fRN1Z2vrG4G1XlxJSSyCKiUEjdPBbdGQgJpbsAzKHo4Jf5Pk9L7Zt4wC4MKgP0axlJEYGMWMGU3JrGcK7lZcCaAHP79SMif/4s6Ao/5yS63EfMfXpQYegDMfqceq9ca5ViPB4Mzf1k67DvIjTEkjPEEIff7Vm6gAyp2Z56XYgyUMWdVCt+86G1RaXRU/BxKoG0wCXCc5Kt7dhyRnZ3Tnyu6HS46KZ0bycfe33LUK+iiRSMNFVykUTQY/lwULfHQ0FkRqPuNeEU8YjAVF9l5TJyHcVwvlxw8iGNqkI6N24tq8HyA8O9nc6vjlWmS4qEfAnR1KVvVhwBfMl3q0chJVzYl6ed8EniEdyhvDkkA1fEjzwqpV+5WGIduv1/yii7uMX5V204IO9vG3GoOjXSeuYInOJ8JnqvOsnhARM4d2cnMeijkbSgRgfOZgZFAbN9B/e9qOurUbeMsiC96m0InaPA9m7+sRfYfWDRRG6aIbSINX0oPKT8m9smmnCCRGvH4wHPXA6mkfeurUcUaHSRlkBpybZTXy2J+SHje+ixVOSySWMcS4pkidbzXZ/JkKfJAOslT0KsONb0LRkhPdrSs+6B8CfgbAxffZdeoRQEImeKpOglmZwVnPnFB+jRvblcowv0yINCF1jpFYHtN1EJ4/3+6CpkkKahBHcBpLW4m2XLpltn0+mZmdLeujwHJoz44HhSXIDxWMw6R1nEMW2ykRFP9u35ezTKnEaHBp8hJTgjAx6K7dt5LUElP+TGNYirRfMmwOlnzrjmDjphjhXhQ6sy970Gxi7ccNSZOOGxSvd051FTvIyvVTsjRD1n0sK2x6Ir1P49Bzwxtk91S5gkgVe5h4oX/7B58Ys6APU/zs62FVHDv w14TKYzZ MwJb7GcHq7NK7d3vsF4sslurpeXwUjsRAhvUznX/kTnRo88VsBd8M3FaJkTFIOlijfC9yJT9Ny8KjR1A22Lwf44mWoI7yX4CEnfwzOvsxKVs1ZOL9SY33hUWX2oSrci0bWTxUBhaZrcG7IZvrDvvfhKMv7QqRUPDBbvlB1ZNIP+V0KoM58V3RmWxsEJxJ0gPzJtraibpYyCQHS9VZFeOQPfxu86l3andghkyJRhxq4uGc2/c= 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: List-Subscribe: List-Unsubscribe: For allocations that may need to fallback to vmalloc, add kmem_buckets_valloc(). Signed-off-by: Kees Cook --- Cc: Vlastimil Babka Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: Roman Gushchin Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: linux-mm@kvack.org --- include/linux/slab.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/slab.h b/include/linux/slab.h index 7d84f875dcf4..0cf72861d5fa 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -740,6 +740,12 @@ static inline __alloc_size(1) void *kzalloc_node(size_t size, gfp_t flags, int n void * __alloc_size(2) __kvmalloc_node(kmem_buckets *b, size_t size, gfp_t flags, int node); +static __always_inline __alloc_size(2) +void *kmem_buckets_valloc(kmem_buckets *b, size_t size, gfp_t flags) +{ + return __kvmalloc_node(b, size, flags, NUMA_NO_NODE); +} + static inline __alloc_size(1) void *kvmalloc_node(size_t size, gfp_t flags, int node) { return __kvmalloc_node(NULL, size, flags, node);