linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* wine fails to start with seccomp updates for v5.9-rc1
       [not found] <1596812929.lz7fuo8r2w.none.ref@localhost>
@ 2020-08-07 15:19 ` Alex Xu (Hello71)
  2020-08-07 15:48   ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Xu (Hello71) @ 2020-08-07 15:19 UTC (permalink / raw)
  To: Kees Cook
  Cc: Linus Torvalds, linux-kernel, Aleksa Sarai, Chris Palmer,
	Christian Brauner, Christoph Hellwig, Matt Denton, Robert Sesek,
	Thadeu Lima de Souza Cascardo, Sargun Dhillon, Shuah Khan,
	Tycho Andersen, Will Deacon, Will Drewry, Yonghong Song

Hi,

On Linus' master, wine fails to start with the following error:

wine client error:0: write: Bad file descriptor

This issue is not present on 5.8. It appears to be caused by failure to 
write to a pipe FD received via SCM_RIGHTS. Therefore, I tried reverting 
9ecc6ea491f0, which resolved the issue.

Thanks,
Alex.

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

* Re: wine fails to start with seccomp updates for v5.9-rc1
  2020-08-07 15:19 ` wine fails to start with seccomp updates for v5.9-rc1 Alex Xu (Hello71)
@ 2020-08-07 15:48   ` Linus Torvalds
  2020-08-07 17:36     ` Thadeu Lima de Souza Cascardo
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2020-08-07 15:48 UTC (permalink / raw)
  To: Alex Xu (Hello71)
  Cc: Kees Cook, Linux Kernel Mailing List, Aleksa Sarai, Chris Palmer,
	Christian Brauner, Christoph Hellwig, Matt Denton, Robert Sesek,
	Thadeu Lima de Souza Cascardo, Sargun Dhillon, Shuah Khan,
	Tycho Andersen, Will Deacon, Will Drewry, Yonghong Song

On Fri, Aug 7, 2020 at 8:19 AM Alex Xu (Hello71) <alex_y_xu@yahoo.ca> wrote:
>
> On Linus' master, wine fails to start with the following error:
>
> wine client error:0: write: Bad file descriptor
>
> This issue is not present on 5.8. It appears to be caused by failure to
> write to a pipe FD received via SCM_RIGHTS. Therefore, I tried reverting
> 9ecc6ea491f0, which resolved the issue.

Would you mind trying to bisect exactly where it happens?

I don't think any of the commits in that pull are supposed to change
semantics, and while reverting the whole merge shows that yes, that's
what brought in the problems, it would be good to pinpoint just which
change breaks so that we can fix just that thing.

Kees, ideas?

                 Linus

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

* Re: wine fails to start with seccomp updates for v5.9-rc1
  2020-08-07 15:48   ` Linus Torvalds
@ 2020-08-07 17:36     ` Thadeu Lima de Souza Cascardo
  2020-08-07 17:42       ` Kees Cook
  2020-08-07 17:51       ` Alex Xu (Hello71)
  0 siblings, 2 replies; 5+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2020-08-07 17:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Alex Xu (Hello71),
	Kees Cook, Linux Kernel Mailing List, Aleksa Sarai, Chris Palmer,
	Christian Brauner, Christoph Hellwig, Matt Denton, Robert Sesek,
	Sargun Dhillon, Shuah Khan, Tycho Andersen, Will Deacon,
	Will Drewry, Yonghong Song

On Fri, Aug 07, 2020 at 08:48:46AM -0700, Linus Torvalds wrote:
> On Fri, Aug 7, 2020 at 8:19 AM Alex Xu (Hello71) <alex_y_xu@yahoo.ca> wrote:
> >
> > On Linus' master, wine fails to start with the following error:
> >
> > wine client error:0: write: Bad file descriptor
> >
> > This issue is not present on 5.8. It appears to be caused by failure to
> > write to a pipe FD received via SCM_RIGHTS. Therefore, I tried reverting
> > 9ecc6ea491f0, which resolved the issue.
> 
> Would you mind trying to bisect exactly where it happens?
> 

This report [1] seemed related and pointed out at c0029de50982 ("net/scm:
Regularize compat handling of scm_detach_fds()"). The use of CMSG_USER_DATA
instead of CMSG_COMPAT_DATA seems fishy.

Alex, can you try applying the patch below?

Cascardo.

[1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html

> I don't think any of the commits in that pull are supposed to change
> semantics, and while reverting the whole merge shows that yes, that's
> what brought in the problems, it would be good to pinpoint just which
> change breaks so that we can fix just that thing.
> 
> Kees, ideas?
> 
>                  Linus

---
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++) {

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

* Re: wine fails to start with seccomp updates for v5.9-rc1
  2020-08-07 17:36     ` Thadeu Lima de Souza Cascardo
@ 2020-08-07 17:42       ` Kees Cook
  2020-08-07 17:51       ` Alex Xu (Hello71)
  1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2020-08-07 17:42 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo
  Cc: Linus Torvalds, Alex Xu (Hello71),
	Linux Kernel Mailing List, Aleksa Sarai, Chris Palmer,
	Christian Brauner, Christoph Hellwig, Matt Denton, Robert Sesek,
	Sargun Dhillon, Shuah Khan, Tycho Andersen, Will Deacon,
	Will Drewry, Yonghong Song

On Fri, Aug 07, 2020 at 02:36:09PM -0300, Thadeu Lima de Souza Cascardo wrote:
> On Fri, Aug 07, 2020 at 08:48:46AM -0700, Linus Torvalds wrote:
> > On Fri, Aug 7, 2020 at 8:19 AM Alex Xu (Hello71) <alex_y_xu@yahoo.ca> wrote:
> > >
> > > On Linus' master, wine fails to start with the following error:
> > >
> > > wine client error:0: write: Bad file descriptor
> > >
> > > This issue is not present on 5.8. It appears to be caused by failure to
> > > write to a pipe FD received via SCM_RIGHTS. Therefore, I tried reverting
> > > 9ecc6ea491f0, which resolved the issue.
> > 
> > Would you mind trying to bisect exactly where it happens?
> > 
> 
> This report [1] seemed related and pointed out at c0029de50982 ("net/scm:
> Regularize compat handling of scm_detach_fds()"). The use of CMSG_USER_DATA
> instead of CMSG_COMPAT_DATA seems fishy.

Argh; yes. Thank you for finding that! That's what I get for trying to
regularize the compat path. :(

> Alex, can you try applying the patch below?
> 
> Cascardo.
> 
> [1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html
> 
> > I don't think any of the commits in that pull are supposed to change
> > semantics, and while reverting the whole merge shows that yes, that's
> > what brought in the problems, it would be good to pinpoint just which
> > change breaks so that we can fix just that thing.
> > 
> > Kees, ideas?
> > 
> >                  Linus
> 
> ---
> 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++) {

That almost certainly will fix the problem.

-- 
Kees Cook

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

* Re: wine fails to start with seccomp updates for v5.9-rc1
  2020-08-07 17:36     ` Thadeu Lima de Souza Cascardo
  2020-08-07 17:42       ` Kees Cook
@ 2020-08-07 17:51       ` Alex Xu (Hello71)
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Xu (Hello71) @ 2020-08-07 17:51 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo, Linus Torvalds
  Cc: Christian Brauner, Aleksa Sarai, Christoph Hellwig, Kees Cook,
	Linux Kernel Mailing List, Matt Denton, Chris Palmer,
	Robert Sesek, Sargun Dhillon, Shuah Khan, Tycho Andersen,
	Will Drewry, Will Deacon, Yonghong Song

Excerpts from Thadeu Lima de Souza Cascardo's message of August 7, 2020 1:36 pm:
> On Fri, Aug 07, 2020 at 08:48:46AM -0700, Linus Torvalds wrote:
>> On Fri, Aug 7, 2020 at 8:19 AM Alex Xu (Hello71) <alex_y_xu@yahoo.ca> wrote:
>> >
>> > On Linus' master, wine fails to start with the following error:
>> >
>> > wine client error:0: write: Bad file descriptor
>> >
>> > This issue is not present on 5.8. It appears to be caused by failure to
>> > write to a pipe FD received via SCM_RIGHTS. Therefore, I tried reverting
>> > 9ecc6ea491f0, which resolved the issue.
>> 
>> Would you mind trying to bisect exactly where it happens?
>> 
> 
> This report [1] seemed related and pointed out at c0029de50982 ("net/scm:
> Regularize compat handling of scm_detach_fds()"). The use of CMSG_USER_DATA
> instead of CMSG_COMPAT_DATA seems fishy.
> 
> Alex, can you try applying the patch below?
> 
> Cascardo.
> 
> [1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-August/216156.html
> 
>> I don't think any of the commits in that pull are supposed to change
>> semantics, and while reverting the whole merge shows that yes, that's
>> what brought in the problems, it would be good to pinpoint just which
>> change breaks so that we can fix just that thing.
>> 
>> Kees, ideas?
>> 
>>                  Linus
> 
> ---
> 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++) {
> 

Yes, this seems to work.

Tested-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>

Thanks!

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1596812929.lz7fuo8r2w.none.ref@localhost>
2020-08-07 15:19 ` wine fails to start with seccomp updates for v5.9-rc1 Alex Xu (Hello71)
2020-08-07 15:48   ` Linus Torvalds
2020-08-07 17:36     ` Thadeu Lima de Souza Cascardo
2020-08-07 17:42       ` Kees Cook
2020-08-07 17:51       ` Alex Xu (Hello71)

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