Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2422370pxa; Fri, 7 Aug 2020 10:43:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyJ5aTvOSwLw8cOk/Bn1yZ6CdX81G81YamagkU1t2O+pd+w/FiE/lCROBG/hFHv98aftaS X-Received: by 2002:a50:d942:: with SMTP id u2mr2166411edj.0.1596822187990; Fri, 07 Aug 2020 10:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596822187; cv=none; d=google.com; s=arc-20160816; b=qTiERgOFryzlq3LunKVyEuk9BKAcQRbLC3iAB5Sd91YTiUqGaNj6MPaFjqHKUbDifc 360qrthY5KPV8qaxAoyGggs/+4+LUBGHGtPpjSU4hRVWSY2bOO9wEKDo+NHwTIGnjJEC 6ALkr1IZVHZcCzzurPgiyhbgZo1K/qInKDdKJxZbKBKNvXxAD5OoTKbAp6e8p8v/yAr9 vNz7s8k/IFlVth2ZTdwTLmwmG5QjiYwkeDKKUkS6OublZGnvO51/xrodXjN5O3U0KqvH 6y9NZ8J7zhCG9q/ZH6/zyQqrf5bVhr6HAblvpwDOhblzAF9a+zeQvi/AoSHZXejGughT qagg== 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 :dkim-signature; bh=3or5Uc/EoDqPWURPsRB27O8EdmQJvFJDjXDNilQ2W/o=; b=metgWHXhXZhTEYK96Fweot9fQpQ7sije90LCzsNbUAOiNO7LOtWskuccXnEyrEGkVi Hv0XJGbj1tlCT1Qvirl1kXSa+u0Q73Hjz4WCBgt2d9MNTos7+P+X12yI+MtIkRTXCe+g LhZr8GkQRGkFX9AaRSsfESkKrTAvqkFtdCn3Py7Y+XiI0hS1J/vPq1qriDuGy0pECy7I D/qAmd0iVVyl0JPx1MJ90jufC9uVVKv1Rszw84pLE0zSFAGLnpxiZrfsP3g74eEuM6Zp tgpMTWYYicUcfN2owXXnQUx2t9M7mi/GMw4UmZaC5dKAI0RGLMVazaJJ37IywIEC97oC zubg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="SiRgFI/B"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si5450901edr.126.2020.08.07.10.42.44; Fri, 07 Aug 2020 10:43:07 -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; dkim=pass header.i=@chromium.org header.s=google header.b="SiRgFI/B"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726076AbgHGRmJ (ORCPT + 99 others); Fri, 7 Aug 2020 13:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgHGRmH (ORCPT ); Fri, 7 Aug 2020 13:42:07 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6695CC061756 for ; Fri, 7 Aug 2020 10:42:07 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id o1so1404653plk.1 for ; Fri, 07 Aug 2020 10:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3or5Uc/EoDqPWURPsRB27O8EdmQJvFJDjXDNilQ2W/o=; b=SiRgFI/BFbh9JTxI3YwMHZSDmB7howP4OchHiXcHKJFY8YCK5Q3Wuy0Xwcr4Yi4mft pbITlt7SMmCxbYRtE2CxRtDVzUlWU+4RTeRDeFwHpCf0M8E9vKPe0n0cWeW1WcpXti1V qUFOlBKxqusGOtX+vNfbIEktsb8Il6URA4hWk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3or5Uc/EoDqPWURPsRB27O8EdmQJvFJDjXDNilQ2W/o=; b=cakG7yHsOlNUwC7BWL/ViWpudGSgAAAZJ/nrORjYHIGbA3Jr8I+C+cTXd4Qw9dC6bI mXJrqdGC/JFlLbtzAWhPSTJLY/URaRsH6jcg3nsfcDFk3BPsa54h5QN3UqjV3VQQ3r78 +O0w5sOt/ToRXAdEZvytbrv3nPhQUxjM5GRh3zT9z7JH9Q9WYv0GfDXqXnZER0aib7O5 FdZIrRkt5l6sBvpql6MiMq2UDHdUPx+tcmB6RzW58KIa/WeB8eC/EpmNGxeoD8PWFmn/ R0yiz8RGQF7vNbFebH+HKc9O50UzX6G7PczzCZvEeH0sdQwrgC5ejJA9OIduN3TSPmXu 8Mig== X-Gm-Message-State: AOAM53237myJx62uQPsfHEU93RzpsQYi57mVzV2pRGJcGmf83h1uP123 hK7bgkgoeHdX/Twc50NypCIWHA== X-Received: by 2002:a17:902:9f94:: with SMTP id g20mr12241520plq.14.1596822126947; Fri, 07 Aug 2020 10:42:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s6sm12670167pfb.50.2020.08.07.10.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 10:42:05 -0700 (PDT) Date: Fri, 7 Aug 2020 10:42:03 -0700 From: Kees Cook 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 Subject: Re: wine fails to start with seccomp updates for v5.9-rc1 Message-ID: <202008071038.3F308DEEE@keescook> References: <1596812929.lz7fuo8r2w.none.ref@localhost> <1596812929.lz7fuo8r2w.none@localhost> <20200807173609.GJ4402@mussarela> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807173609.GJ4402@mussarela> 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 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) 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