[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241206194839.3030596-2-jeffxu@google.com>
Date: Fri, 6 Dec 2024 19:48:39 +0000
From: jeffxu@...omium.org
To: akpm@...ux-foundation.org,
vbabka@...e.cz,
lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com
Cc: linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org,
linux-mm@...ck.org,
jorgelo@...omium.org,
keescook@...omium.org,
pedro.falcato@...il.com,
rdunlap@...radead.org,
Jeff Xu <jeffxu@...omium.org>
Subject: [PATCH v2 1/1] mseal: remove can_do_mseal()
From: Jeff Xu <jeffxu@...omium.org>
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, remove
this function and merge the logic into do_mseal().
Link: https://lkml.kernel.org/r/20241206013934.2782793-1-jeffxu@google.com
Signed-off-by: Jeff Xu <jeffxu@...omium.org>
Cc: Jorge Lucangeli Obes <jorgelo@...omium.org>
Cc: Kees Cook <keescook@...omium.org>
Cc: Liam R. Howlett <Liam.Howlett@...cle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Pedro Falcato <pedro.falcato@...il.com>
Cc: Randy Dunlap <rdunlap@...radead.org>
Cc: Vlastimil Babka <vbabka@...e.cz>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---
mm/internal.h | 16 ----------------
mm/mseal.c | 6 +++---
2 files changed, 3 insertions(+), 19 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..c27197ac04e8 100644
--- a/mm/mseal.c
+++ b/mm/mseal.c
@@ -217,9 +217,9 @@ int do_mseal(unsigned long start, size_t len_in, unsigned long flags)
unsigned long end;
struct mm_struct *mm = current->mm;
- ret = can_do_mseal(flags);
- if (ret)
- return ret;
+ /* Verify flags not set. */
+ if (flags)
+ return -EINVAL;
start = untagged_addr(start);
if (!PAGE_ALIGNED(start))
--
2.47.0.338.g60cca15819-goog
Powered by blists - more mailing lists