Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2419097pxa; Fri, 7 Aug 2020 10:37:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8UXvw2fomkaA6JXTPjAmmez4xw5dFzJs3P7maO9BwK+0HxeyNPkBoKmQhMSrK36yQvHWe X-Received: by 2002:a17:907:2115:: with SMTP id qn21mr10789289ejb.157.1596821877462; Fri, 07 Aug 2020 10:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596821877; cv=none; d=google.com; s=arc-20160816; b=rFf0a4G16lgloLAycL/f8E40FSYJS2vnU/Kcx7KTbqSkgYaby/ksgF9BXE2yr9mGtY dFLjNjqfjoUF/mxjcJUwO4zBrh8VQsZHg7+OFfl7LKK7frLAZioXbFurT4Hbnx3RynhA 2eniqMhG5vxuK51sgeUTEK2m6rArLtIW85QZocrNCsJXCkhFjQrZtTswPRLFE4Xdbyq/ mCpMJjv/gCT3AD/0ZlxFpR6Z5RvlDzMz/8SsU5XqLQL7DLAakVrgSu4bmNsK85mIvRLH xXS9jQO5ptEVj6OHg7rWMuIVEMSmWbhzTFjD7vjnU3t4JTHyB4DaqJwX1uVlhOnCKiWg 2U/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=/j8ekCpNX/J7MQAkpBs02z6ddPiqIYL0weUDBMYyDZg=; b=tjWkFYPFvcPaYmXsp4vTJ78GEpNhwkUFvWeFf0bCUtGAOjwzP7LUzA9AQsuQ2keXaQ v95/DcZP1+owx7VocnjKV02d0nQYADNorAMDwDsrGV8IpOiLhLOEwH7goDhkZloSYcaz kuqEWuzvTl8Uff6wV5Ryc+hqoPCKn1Vf6Mti0hLBG6wUWY1K/oIvo30CDi1uJZeLEtzC /8fVF2kf6PKaOH8MoXo7vkKyQDjaFW73GhgbYP+jt//YQp/pBKmdh15A6Cb4U8LSDhES smbIX7lNnGDQ3e6rbdH4emHpcRaxc7FfUq/vXejGz0C0h+faJx68WGvLqUtkcfF2+tPA n3Ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si5409338edx.265.2020.08.07.10.37.34; Fri, 07 Aug 2020 10:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726644AbgHGRgV (ORCPT + 99 others); Fri, 7 Aug 2020 13:36:21 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:33521 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbgHGRgV (ORCPT ); Fri, 7 Aug 2020 13:36:21 -0400 Received: from [177.9.89.61] (helo=mussarela) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k46Hw-0006Pt-Un; Fri, 07 Aug 2020 17:36:17 +0000 Date: Fri, 7 Aug 2020 14:36:09 -0300 From: Thadeu Lima de Souza Cascardo 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 Subject: Re: wine fails to start with seccomp updates for v5.9-rc1 Message-ID: <20200807173609.GJ4402@mussarela> References: <1596812929.lz7fuo8r2w.none.ref@localhost> <1596812929.lz7fuo8r2w.none@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) 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++) {