From patchwork Fri Dec 6 01:39:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Xu X-Patchwork-Id: 13896217 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 706AEE7716E for ; Fri, 6 Dec 2024 01:39:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 995D96B00BA; Thu, 5 Dec 2024 20:39:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 945606B014B; Thu, 5 Dec 2024 20:39:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E7FB6B0138; Thu, 5 Dec 2024 20:39:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 605266B014B for ; Thu, 5 Dec 2024 20:39:39 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DA61C14194E for ; Fri, 6 Dec 2024 01:39:38 +0000 (UTC) X-FDA: 82862826774.12.49729BE Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf18.hostedemail.com (Postfix) with ESMTP id A485B1C000B for ; Fri, 6 Dec 2024 01:39:29 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gFuftQAY; spf=pass (imf18.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.214.172 as permitted sender) smtp.mailfrom=jeffxu@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=1733449166; 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:references:dkim-signature; bh=XSQJ1HOy65NxdTTDtOXYHpi4KVX/eOZdGvlizxFTiXY=; b=AFAmsOuwfCX0Z682teLuo/xcUGFZB4RofC/UyZWk4NTzNipI2Cl7aTD9jU1JCwUpSOi9Lw mBzX3ZpevZFU4/J6jMLA209cR7UQpRHB5odOj6ZXfjxGDP8cDGtOsMmvqQJ1JbdQUOOJRH PwLkc6Sn6khXgWy0NJPseSH+fHgTT74= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733449166; a=rsa-sha256; cv=none; b=5Hal0FsfQqk4kRCscKtxysYu6Tfzr9m3iXH82PwJ1SbUCxot9BENHo+wtkkMYmqlnny1sE mc+ll4rbth9PFtCLmvIZzpw5F1f7e4rlKN2OlY/4Dxd/kGsgVX9fx/cj6hn+N/hbQuhmjq S227+DPJA1BUatqPbzGcHDMP+Og45Ag= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gFuftQAY; spf=pass (imf18.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.214.172 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-21273d4f9eeso1292035ad.0 for ; Thu, 05 Dec 2024 17:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733449175; x=1734053975; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XSQJ1HOy65NxdTTDtOXYHpi4KVX/eOZdGvlizxFTiXY=; b=gFuftQAY30zh6iaxyuOATZKUp68wpHZtYEcHXNZP3c1Yro0BkNDr0cQ9Eru322Sv8f /i9F7xZ3RMkTpFQuFUsS7w4roiVbK0ayOVe2kSGb6GCx35622w+A+CzhuAgRg8UUxnOw 8d3wB+nIHQanmeC3PrM8e5SaZYFEMIFrE4iBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733449175; x=1734053975; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XSQJ1HOy65NxdTTDtOXYHpi4KVX/eOZdGvlizxFTiXY=; b=brSog00/McgXkHpRmg98Wdmp14MDH4s84Z8tJRh0MgNRqzDvd3UpCsKu1BWlVlX7l6 LR6q24fO7tDTY5UO0gnbIuIJeuASkFO1Ziza1fJ+FDA8iINr5fQSxjODjInKztRwjcxY sdvfXleTvC8y3QbL2Ml6XlgGe4iYNamVaphf7nUfh47aHmG9bzcrd3bXYam/1xX6Gzqi TyuEx99Z1f+c+ri89WAMWDYdVKC6vyXQP++mZRcIclKk8yeM4SsY6ucxLc+nG+waVbjP P4xn9Rauu+68VpcbFqKHpeHQpeaWrHLDawubwx5gutnIHuTkQLgbJV0dV7EaHHFLpCAW GgDg== X-Forwarded-Encrypted: i=1; AJvYcCVTpymSAMT4+OKWuTXe8d4ls+psMxgtptbUzLuNstB1Bl03oLU+yTSPDwJvV48+RyPk+W+HwUe0KQ==@kvack.org X-Gm-Message-State: AOJu0YyycllLHuFNl3nc3cskcKvblR1E62yt/lW2cjvAheYvMpweKjjr iIvG8qwU/B1UpgRm6JKnQ0WTElEV+6qgPMAbDggATiy9sHU3+C4LMKr9rgdf/w== X-Gm-Gg: ASbGncurAo12HPaV34rKcKmyeb87/2/xRb4FyaYNYIXxcZiNnfuDs5/8TReKYRwOQzU YS/624wpn6bch7gbu5/pDI5POLeY3Zq6vcu++hHtfcBvDBlApmSyhANrhE08RXToLHc3chvLzfW p7lZbJ/dq6I4SD2rY6vFKnelmnwdbloviSk+/8fzhXOB4JbN8KOKQf37LDpds7HAVdB2bLy38Zy /Y0ic6P4vxqDI+p/ymHmDO3nHfufvKdGX24VYxCOvdM4zISioQW6d+NnBSToOEGxPvS8OY/DDbd 5IQjC4an68Y= X-Google-Smtp-Source: AGHT+IH3Fdeuwj9S9gBBbgIm2RrejRpYnXUO7GaCkJRgcg3/NVfmxr6SCUcgXFAlwY+/gZdwpnrdaA== X-Received: by 2002:a17:903:41ca:b0:215:7595:9474 with SMTP id d9443c01a7336-21614d44b20mr5508645ad.5.1733449175580; Thu, 05 Dec 2024 17:39:35 -0800 (PST) Received: from localhost (238.76.127.34.bc.googleusercontent.com. [34.127.76.238]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-215f8f092e2sm18343865ad.202.2024.12.05.17.39.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Dec 2024 17:39:34 -0800 (PST) From: jeffxu@chromium.org To: akpm@linux-foundation.org, vbabka@suse.cz, lorenzo.stoakes@oracle.com, Liam.Howlett@Oracle.com Cc: linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org, jorgelo@chromium.org, keescook@chromium.org, pedro.falcato@gmail.com, rdunlap@infradead.org, Jeff Xu Subject: [PATCH v1] mseal: move can_do_mseal to mseal.c Date: Fri, 6 Dec 2024 01:39:34 +0000 Message-ID: <20241206013934.2782793-1-jeffxu@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A485B1C000B X-Stat-Signature: q686cxt5afj8onyu56ag55xqeta4shtw X-Rspam-User: X-HE-Tag: 1733449169-312259 X-HE-Meta: U2FsdGVkX18MlFguwkMtGaWyFT4twatjF7HhNPgLU/uSx1wOozLjO8gl1w2Yk52v/NWc5HMVMUhgfPmlIWUjkjFpPQ4CrjzmaHonoN8mHhU20zl52d5nn7gxznGw2k3d0CJiB49bKdHiRDKxxK0fuF5NWmeMnHpJlMxL0DXZsVlse5RuyZxltuwMwNY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FhG4vAbQrJfoKka4+ayXznb1a0cAPw+ByaLwIaEo8I5uhViodXk4WFrSPbUCX0GEYfPdIS3dj6QSdvaCMr3jUUewjYtZcQ94I5nBOhg== 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: From: Jeff Xu No code logic change. can_do_mseal is called exclusively by mseal.c, and mseal.c is compiled only when CONFIG_64BIT flag is set in makefile. Therefore, it is unnecessary to have 32 bit stub function in the header file. Signed-off-by: Jeff Xu --- mm/internal.h | 16 ---------------- mm/mseal.c | 8 ++++++++ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 74dc1c48fa31..5e4ef5ce9c0a 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1457,22 +1457,6 @@ void __meminit __init_single_page(struct page *page, unsigned long pfn, unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct mem_cgroup *memcg, int priority); -#ifdef CONFIG_64BIT -static inline int can_do_mseal(unsigned long flags) -{ - if (flags) - return -EINVAL; - - return 0; -} - -#else -static inline int can_do_mseal(unsigned long flags) -{ - return -EPERM; -} -#endif - #ifdef CONFIG_SHRINKER_DEBUG static inline __printf(2, 0) int shrinker_debugfs_name_alloc( struct shrinker *shrinker, const char *fmt, va_list ap) diff --git a/mm/mseal.c b/mm/mseal.c index 81d6e980e8a9..e167220a0bf0 100644 --- a/mm/mseal.c +++ b/mm/mseal.c @@ -158,6 +158,14 @@ static int apply_mm_seal(unsigned long start, unsigned long end) return 0; } +static inline int can_do_mseal(unsigned long flags) +{ + if (flags) + return -EINVAL; + + return 0; +} + /* * mseal(2) seals the VM's meta data from * selected syscalls.