2022-09-07 12:31:20

by Vincenzo Frascino

[permalink] [raw]
Subject: [PATCH] security/keys: Remove inconsistent __user annotation

The declaration of keyring_read does not match the definition
(security/keys/keyring.c). In this case the definition is correct
because it matches what defined in "struct key_type::read"
(linux/key-type.h).

Fix the declaration removing the inconsistent __user annotation.

Cc: David Howells <[email protected]>
Cc: Jarkko Sakkinen <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: James Morris <[email protected]>
Signed-off-by: Vincenzo Frascino <[email protected]>
---
Note: This issue was discovered during the porting of the linux kernel
on Morello [1].

[1] https://git.morello-project.org/morello/kernel/linux

security/keys/keyring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index 5e6a90760753..4448758f643a 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -79,7 +79,7 @@ static void keyring_revoke(struct key *keyring);
static void keyring_destroy(struct key *keyring);
static void keyring_describe(const struct key *keyring, struct seq_file *m);
static long keyring_read(const struct key *keyring,
- char __user *buffer, size_t buflen);
+ char *buffer, size_t buflen);

struct key_type key_type_keyring = {
.name = "keyring",
--
2.37.3


2022-09-07 14:38:54

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] security/keys: Remove inconsistent __user annotation



On 9/7/22 05:12, Vincenzo Frascino wrote:
> The declaration of keyring_read does not match the definition
> (security/keys/keyring.c). In this case the definition is correct
> because it matches what defined in "struct key_type::read"
> (linux/key-type.h).
>
> Fix the declaration removing the inconsistent __user annotation.
>
> Cc: David Howells <[email protected]>
> Cc: Jarkko Sakkinen <[email protected]>
> Cc: Paul Moore <[email protected]>
> Cc: James Morris <[email protected]>
> Signed-off-by: Vincenzo Frascino <[email protected]>
> ---
> Note: This issue was discovered during the porting of the linux kernel
> on Morello [1].
>
> [1] https://git.morello-project.org/morello/kernel/linux

FTR, I have sent this same patch 3 times.
Good luck.

> security/keys/keyring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/keys/keyring.c b/security/keys/keyring.c
> index 5e6a90760753..4448758f643a 100644
> --- a/security/keys/keyring.c
> +++ b/security/keys/keyring.c
> @@ -79,7 +79,7 @@ static void keyring_revoke(struct key *keyring);
> static void keyring_destroy(struct key *keyring);
> static void keyring_describe(const struct key *keyring, struct seq_file *m);
> static long keyring_read(const struct key *keyring,
> - char __user *buffer, size_t buflen);
> + char *buffer, size_t buflen);
>
> struct key_type key_type_keyring = {
> .name = "keyring",

--
~Randy

2022-09-07 16:00:09

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH] security/keys: Remove inconsistent __user annotation

On Wed, Sep 7, 2022 at 10:06 AM Randy Dunlap <[email protected]> wrote:
> On 9/7/22 05:12, Vincenzo Frascino wrote:
> > The declaration of keyring_read does not match the definition
> > (security/keys/keyring.c). In this case the definition is correct
> > because it matches what defined in "struct key_type::read"
> > (linux/key-type.h).
> >
> > Fix the declaration removing the inconsistent __user annotation.
> >
> > Cc: David Howells <[email protected]>
> > Cc: Jarkko Sakkinen <[email protected]>
> > Cc: Paul Moore <[email protected]>
> > Cc: James Morris <[email protected]>
> > Signed-off-by: Vincenzo Frascino <[email protected]>
> > ---
> > Note: This issue was discovered during the porting of the linux kernel
> > on Morello [1].
> >
> > [1] https://git.morello-project.org/morello/kernel/linux
>
> FTR, I have sent this same patch 3 times.
> Good luck.

David or Jarkko, this patch is both trivial and obviously correct,
please merge this into the keys tree for the next merge window else
I'll take it via the LSM tree.

Reviewed-by: Paul Moore <[email protected]>

> > security/keys/keyring.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/security/keys/keyring.c b/security/keys/keyring.c
> > index 5e6a90760753..4448758f643a 100644
> > --- a/security/keys/keyring.c
> > +++ b/security/keys/keyring.c
> > @@ -79,7 +79,7 @@ static void keyring_revoke(struct key *keyring);
> > static void keyring_destroy(struct key *keyring);
> > static void keyring_describe(const struct key *keyring, struct seq_file *m);
> > static long keyring_read(const struct key *keyring,
> > - char __user *buffer, size_t buflen);
> > + char *buffer, size_t buflen);
> >
> > struct key_type key_type_keyring = {
> > .name = "keyring",

--
paul-moore.com

2022-09-08 05:24:32

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] security/keys: Remove inconsistent __user annotation

On Wed, Sep 07, 2022 at 07:05:55AM -0700, Randy Dunlap wrote:
>
>
> On 9/7/22 05:12, Vincenzo Frascino wrote:
> > The declaration of keyring_read does not match the definition
> > (security/keys/keyring.c). In this case the definition is correct
> > because it matches what defined in "struct key_type::read"
> > (linux/key-type.h).
> >
> > Fix the declaration removing the inconsistent __user annotation.
> >
> > Cc: David Howells <[email protected]>
> > Cc: Jarkko Sakkinen <[email protected]>
> > Cc: Paul Moore <[email protected]>
> > Cc: James Morris <[email protected]>
> > Signed-off-by: Vincenzo Frascino <[email protected]>
> > ---
> > Note: This issue was discovered during the porting of the linux kernel
> > on Morello [1].
> >
> > [1] https://git.morello-project.org/morello/kernel/linux
>
> FTR, I have sent this same patch 3 times.
> Good luck.
>
Right.

I'll pick this to my tree https://lore.kernel.org/keyrings/[email protected]/

And need to clearly sync up better with David.

BR, Jarkko

2022-09-08 05:42:28

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] security/keys: Remove inconsistent __user annotation

On Wed, Sep 07, 2022 at 01:12:30PM +0100, Vincenzo Frascino wrote:
> The declaration of keyring_read does not match the definition
> (security/keys/keyring.c). In this case the definition is correct
> because it matches what defined in "struct key_type::read"
> (linux/key-type.h).
>
> Fix the declaration removing the inconsistent __user annotation.
>
> Cc: David Howells <[email protected]>
> Cc: Jarkko Sakkinen <[email protected]>
> Cc: Paul Moore <[email protected]>
> Cc: James Morris <[email protected]>
> Signed-off-by: Vincenzo Frascino <[email protected]>
> ---
> Note: This issue was discovered during the porting of the linux kernel
> on Morello [1].
>
> [1] https://git.morello-project.org/morello/kernel/linux
>
> security/keys/keyring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/keys/keyring.c b/security/keys/keyring.c
> index 5e6a90760753..4448758f643a 100644
> --- a/security/keys/keyring.c
> +++ b/security/keys/keyring.c
> @@ -79,7 +79,7 @@ static void keyring_revoke(struct key *keyring);
> static void keyring_destroy(struct key *keyring);
> static void keyring_describe(const struct key *keyring, struct seq_file *m);
> static long keyring_read(const struct key *keyring,
> - char __user *buffer, size_t buflen);
> + char *buffer, size_t buflen);
>
> struct key_type key_type_keyring = {
> .name = "keyring",
> --
> 2.37.3
>

Acked-by: Jarkko Sakkinen <[email protected]>

BR, Jarkko

2022-09-08 06:02:05

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH] security/keys: Remove inconsistent __user annotation

On Wed, Sep 07, 2022 at 11:43:17AM -0400, Paul Moore wrote:
> On Wed, Sep 7, 2022 at 10:06 AM Randy Dunlap <[email protected]> wrote:
> > On 9/7/22 05:12, Vincenzo Frascino wrote:
> > > The declaration of keyring_read does not match the definition
> > > (security/keys/keyring.c). In this case the definition is correct
> > > because it matches what defined in "struct key_type::read"
> > > (linux/key-type.h).
> > >
> > > Fix the declaration removing the inconsistent __user annotation.
> > >
> > > Cc: David Howells <[email protected]>
> > > Cc: Jarkko Sakkinen <[email protected]>
> > > Cc: Paul Moore <[email protected]>
> > > Cc: James Morris <[email protected]>
> > > Signed-off-by: Vincenzo Frascino <[email protected]>
> > > ---
> > > Note: This issue was discovered during the porting of the linux kernel
> > > on Morello [1].
> > >
> > > [1] https://git.morello-project.org/morello/kernel/linux
> >
> > FTR, I have sent this same patch 3 times.
> > Good luck.
>
> David or Jarkko, this patch is both trivial and obviously correct,
> please merge this into the keys tree for the next merge window else
> I'll take it via the LSM tree.
>
> Reviewed-by: Paul Moore <[email protected]>

I picked it to my tree.

BR, Jarkko

2022-09-08 15:16:24

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH] security/keys: Remove inconsistent __user annotation

On Thu, Sep 8, 2022 at 1:17 AM Jarkko Sakkinen <[email protected]> wrote:
> On Wed, Sep 07, 2022 at 11:43:17AM -0400, Paul Moore wrote:
> > On Wed, Sep 7, 2022 at 10:06 AM Randy Dunlap <[email protected]> wrote:
> > > On 9/7/22 05:12, Vincenzo Frascino wrote:
> > > > The declaration of keyring_read does not match the definition
> > > > (security/keys/keyring.c). In this case the definition is correct
> > > > because it matches what defined in "struct key_type::read"
> > > > (linux/key-type.h).
> > > >
> > > > Fix the declaration removing the inconsistent __user annotation.
> > > >
> > > > Cc: David Howells <[email protected]>
> > > > Cc: Jarkko Sakkinen <[email protected]>
> > > > Cc: Paul Moore <[email protected]>
> > > > Cc: James Morris <[email protected]>
> > > > Signed-off-by: Vincenzo Frascino <[email protected]>
> > > > ---
> > > > Note: This issue was discovered during the porting of the linux kernel
> > > > on Morello [1].
> > > >
> > > > [1] https://git.morello-project.org/morello/kernel/linux
> > >
> > > FTR, I have sent this same patch 3 times.
> > > Good luck.
> >
> > David or Jarkko, this patch is both trivial and obviously correct,
> > please merge this into the keys tree for the next merge window else
> > I'll take it via the LSM tree.
> >
> > Reviewed-by: Paul Moore <[email protected]>
>
> I picked it to my tree.

Thanks Jarkko.

--
paul-moore.com