linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring
@ 2020-08-07 18:20 Kees Cook
  2020-08-07 18:29 ` Thadeu Lima de Souza Cascardo
  2020-08-07 19:46 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2020-08-07 18:20 UTC (permalink / raw)
  To: Christian Zigotzky, Alex Xu (Hello71)
  Cc: Thadeu Lima de Souza Cascardo, Linus Torvalds, Aleksa Sarai,
	Chris Palmer, Christian Brauner, Christoph Hellwig, Matt Denton,
	Robert Sesek, Sargun Dhillon, Shuah Khan, Tycho Andersen,
	Will Deacon, Will Drewry, Yonghong Song, linux-kernel

When refactoring the SCM_RIGHTS code, I accidentally mis-merged my
native/compat diffs, which entirely broke using SCM_RIGHTS in compat
mode. Use the correct helper.

Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Link: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html
Reported-by: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
Link: https://lore.kernel.org/lkml/1596812929.lz7fuo8r2w.none@localhost/
Suggested-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fixes: c0029de50982 ("net/scm: Regularize compat handling of scm_detach_fds()")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 net/compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/compat.c b/net/compat.c
index 703acb51c698..95ce707a30a3 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -294,7 +294,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
 		(struct compat_cmsghdr __user *)msg->msg_control;
 	unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0;
 	int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count);
-	int __user *cmsg_data = CMSG_USER_DATA(cm);
+	int __user *cmsg_data = CMSG_COMPAT_DATA(cm);
 	int err = 0, i;
 
 	for (i = 0; i < fdmax; i++) {
-- 
2.25.1


-- 
Kees Cook

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

* Re: [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring
  2020-08-07 18:20 [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring Kees Cook
@ 2020-08-07 18:29 ` Thadeu Lima de Souza Cascardo
  2020-08-07 19:46 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2020-08-07 18:29 UTC (permalink / raw)
  To: Kees Cook
  Cc: Christian Zigotzky, Alex Xu (Hello71),
	Linus Torvalds, Aleksa Sarai, Chris Palmer, Christian Brauner,
	Christoph Hellwig, Matt Denton, Robert Sesek, Sargun Dhillon,
	Shuah Khan, Tycho Andersen, Will Deacon, Will Drewry,
	Yonghong Song, linux-kernel

On Fri, Aug 07, 2020 at 11:20:05AM -0700, Kees Cook wrote:
> When refactoring the SCM_RIGHTS code, I accidentally mis-merged my
> native/compat diffs, which entirely broke using SCM_RIGHTS in compat
> mode. Use the correct helper.
> 
> Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
> Link: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html
> Reported-by: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
> Link: https://lore.kernel.org/lkml/1596812929.lz7fuo8r2w.none@localhost/
> Suggested-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> Fixes: c0029de50982 ("net/scm: Regularize compat handling of scm_detach_fds()")
> Signed-off-by: Kees Cook <keescook@chromium.org>

Hi, Kees.

You might want to add the Teste-by line that Alex Xu sent. And if my ack adds
any value on top of Suggested-by, here it goes:

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

Thanks.
Cascardo.

> ---
>  net/compat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/compat.c b/net/compat.c
> index 703acb51c698..95ce707a30a3 100644
> --- a/net/compat.c
> +++ b/net/compat.c
> @@ -294,7 +294,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
>  		(struct compat_cmsghdr __user *)msg->msg_control;
>  	unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0;
>  	int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count);
> -	int __user *cmsg_data = CMSG_USER_DATA(cm);
> +	int __user *cmsg_data = CMSG_COMPAT_DATA(cm);
>  	int err = 0, i;
>  
>  	for (i = 0; i < fdmax; i++) {
> -- 
> 2.25.1
> 
> 
> -- 
> Kees Cook

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

* Re: [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring
  2020-08-07 18:20 [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring Kees Cook
  2020-08-07 18:29 ` Thadeu Lima de Souza Cascardo
@ 2020-08-07 19:46 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2020-08-07 19:46 UTC (permalink / raw)
  To: Kees Cook
  Cc: Christian Zigotzky, Alex Xu (Hello71),
	Thadeu Lima de Souza Cascardo, Linus Torvalds, Aleksa Sarai,
	Chris Palmer, Christoph Hellwig, Matt Denton, Robert Sesek,
	Sargun Dhillon, Shuah Khan, Tycho Andersen, Will Deacon,
	Will Drewry, Yonghong Song, linux-kernel

On Fri, Aug 07, 2020 at 11:20:05AM -0700, Kees Cook wrote:
> When refactoring the SCM_RIGHTS code, I accidentally mis-merged my
> native/compat diffs, which entirely broke using SCM_RIGHTS in compat
> mode. Use the correct helper.
> 
> Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
> Link: https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html
> Reported-by: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
> Link: https://lore.kernel.org/lkml/1596812929.lz7fuo8r2w.none@localhost/
> Suggested-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
> Fixes: c0029de50982 ("net/scm: Regularize compat handling of scm_detach_fds()")
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---

Oh fun,

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

Thanks for fixing this quickly, Kees! I already built stuff on top of
the notifier fd injection work we did this cycle so it's great that we
don't have to revert this!



>  net/compat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/compat.c b/net/compat.c
> index 703acb51c698..95ce707a30a3 100644
> --- a/net/compat.c
> +++ b/net/compat.c
> @@ -294,7 +294,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
>  		(struct compat_cmsghdr __user *)msg->msg_control;
>  	unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0;
>  	int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count);
> -	int __user *cmsg_data = CMSG_USER_DATA(cm);
> +	int __user *cmsg_data = CMSG_COMPAT_DATA(cm);
>  	int err = 0, i;
>  
>  	for (i = 0; i < fdmax; i++) {
> -- 
> 2.25.1
> 
> 
> -- 
> Kees Cook

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

end of thread, other threads:[~2020-08-07 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 18:20 [PATCH] net/scm: Fix typo in SCM_RIGHTS compat refactoring Kees Cook
2020-08-07 18:29 ` Thadeu Lima de Souza Cascardo
2020-08-07 19:46 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).