linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] remove can_do_mseal
@ 2024-12-06 19:48 jeffxu
  2024-12-06 19:48 ` [PATCH v2 1/1] mseal: remove can_do_mseal() jeffxu
  0 siblings, 1 reply; 4+ messages in thread
From: jeffxu @ 2024-12-06 19:48 UTC (permalink / raw)
  To: akpm, vbabka, lorenzo.stoakes, Liam.Howlett
  Cc: linux-kernel, linux-hardening, linux-mm, jorgelo, keescook,
	pedro.falcato, rdunlap, Jeff Xu

From: Jeff Xu <jeffxu@chromium.org>

History:
V2: remove the can_do_mseal (Liam.Howlett, Lorenzo Stoakes)

V1: initial version.

Jeff Xu (1):
  mseal: move can_do_mseal() to mseal.c

 mm/internal.h | 16 ----------------
 mm/mseal.c    |  6 +++---
 2 files changed, 3 insertions(+), 19 deletions(-)

-- 
2.47.0.338.g60cca15819-goog



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/1] mseal: remove can_do_mseal()
  2024-12-06 19:48 [PATCH v2 0/1] remove can_do_mseal jeffxu
@ 2024-12-06 19:48 ` jeffxu
  2024-12-06 19:56   ` Lorenzo Stoakes
  0 siblings, 1 reply; 4+ messages in thread
From: jeffxu @ 2024-12-06 19:48 UTC (permalink / raw)
  To: akpm, vbabka, lorenzo.stoakes, Liam.Howlett
  Cc: linux-kernel, linux-hardening, linux-mm, jorgelo, keescook,
	pedro.falcato, rdunlap, Jeff Xu

From: Jeff Xu <jeffxu@chromium.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@chromium.org>
Cc: Jorge Lucangeli Obes <jorgelo@chromium.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] mseal: remove can_do_mseal()
  2024-12-06 19:48 ` [PATCH v2 1/1] mseal: remove can_do_mseal() jeffxu
@ 2024-12-06 19:56   ` Lorenzo Stoakes
  2024-12-06 20:08     ` Jeff Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Stoakes @ 2024-12-06 19:56 UTC (permalink / raw)
  To: jeffxu
  Cc: akpm, vbabka, Liam.Howlett, linux-kernel, linux-hardening,
	linux-mm, jorgelo, keescook, pedro.falcato, rdunlap

On Fri, Dec 06, 2024 at 07:48:39PM +0000, jeffxu@chromium.org wrote:
> From: Jeff Xu <jeffxu@chromium.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@chromium.org>

LGTM,

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> Cc: Jorge Lucangeli Obes <jorgelo@chromium.org>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Cc: Pedro Falcato <pedro.falcato@gmail.com>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Not sure you should be submitting a S-o-b for Andrew :P I'm thinking this
is a copy/paste mistake.

> ---
>  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
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] mseal: remove can_do_mseal()
  2024-12-06 19:56   ` Lorenzo Stoakes
@ 2024-12-06 20:08     ` Jeff Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Xu @ 2024-12-06 20:08 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: akpm, vbabka, Liam.Howlett, linux-kernel, linux-hardening,
	linux-mm, jorgelo, keescook, pedro.falcato, rdunlap

On Fri, Dec 6, 2024 at 11:57 AM Lorenzo Stoakes
<lorenzo.stoakes@oracle.com> wrote:
>
> On Fri, Dec 06, 2024 at 07:48:39PM +0000, jeffxu@chromium.org wrote:
> > From: Jeff Xu <jeffxu@chromium.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
Please remove the link field here when applying.
(I pull the mm-unstable and apply my change on top of the existing commit.)


> > Signed-off-by: Jeff Xu <jeffxu@chromium.org>
>
> LGTM,
>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
> > Cc: Jorge Lucangeli Obes <jorgelo@chromium.org>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
> > Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > Cc: Pedro Falcato <pedro.falcato@gmail.com>
> > Cc: Randy Dunlap <rdunlap@infradead.org>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>
> Not sure you should be submitting a S-o-b for Andrew :P I'm thinking this
> is a copy/paste mistake.
>
I realized where this is coming from after seeing this response.
 Thanks for pointing it out


> > ---
> >  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
> >


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-06 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-06 19:48 [PATCH v2 0/1] remove can_do_mseal jeffxu
2024-12-06 19:48 ` [PATCH v2 1/1] mseal: remove can_do_mseal() jeffxu
2024-12-06 19:56   ` Lorenzo Stoakes
2024-12-06 20:08     ` Jeff Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox