Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp329770lqo; Wed, 15 May 2024 16:33:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVoMAz//DKtP9udKCvhaE1FhHPllP+y0MpuNLFtWHGl6t4UVUVY2bbvd8AEYw/SwMoBdn5G+r8RQgkrZ15CEzNMej3Y3Z/2F/2bPP8N1w== X-Google-Smtp-Source: AGHT+IEuONxEjTNH0IjsXYECUYWJbW+zIQVgbJp6u61PIfZWbews0RpP7G+cGyD//s7Pz/+hja+6 X-Received: by 2002:a17:90b:3715:b0:2b3:9ce8:1239 with SMTP id 98e67ed59e1d1-2b6cc1438dbmr14930377a91.6.1715816028758; Wed, 15 May 2024 16:33:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715816028; cv=pass; d=google.com; s=arc-20160816; b=Z/tGETNPM0Pp6tYm0Hw1ZGyJ1Qbzv4LUZOhS+v1tu8MwmzJ0CBBh1U9dXwRStg4Ogf cE7UmlvkiviF9gkZTmKtU2a9BZD87X+zOHti1nNAg314aP8P2NZ4iLg1HtgXGDDDMuTB 3ZeRWPQ3VCCnawkajFEd5z6mVDfaiKztEiN7vHpUU6+kF8OOaw97vBdkhor1VvtdDTIg KgckgITU+SBghp2BQTBKG8LGY2vH1Cc3s1Cu/szfwvz0o26zyK7BEXyFFVYwNLQQcTFC lF6yHK9h/eZ5HNgVXGVIrJ+wujFAGp4uG4FrrqOH4KYafwU/xYNYU/hX/g0VLgdYcaL1 u4gQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=kNIfUSqmELR44cA1YYeUiPS/oNMg9kNiAuiUGNZMCbI=; fh=Df3U1REDMD67+639FNi40+J+MUgVgpOeNvO+wzJTg4k=; b=UfGP8TNyps7vOnOAhB3ocRXyTZLq+xCDRU7BtwHwF92lPZPkq9cA1TZ8LbF6YPHqP+ t3mSEgTp2605u92nDrAcj8/gxUpbozy3Tesxh8LkIVmmjXyxxSnEcuTEOL0HTeXZnjT9 5cocWJx+uwLBfudUJdDAAle+8tNRy7TMHF8YZBBV8zduOd4JsWkohBMRo+BndsVTOjIG auz8lv1vNDWxp9bcXpCYin1+kJbkPX0SAMBFpdYkALTOtXocU9QJBMtsbZhGYCp5J7Yr yhV0irSW5iwuH+IjWf6Y/kteqd8DaofT6cDmRIQ6EyXX/xvdGnl6Xnfd0/xycMfQko8u BS4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=aZJnNRCo; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-180490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b6290d443dsi16823669a91.185.2024.05.15.16.33.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 16:33:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@codeweavers.com header.s=s1 header.b=aZJnNRCo; arc=pass (i=1 spf=pass spfdomain=codeweavers.com dkim=pass dkdomain=codeweavers.com dmarc=pass fromdomain=codeweavers.com); spf=pass (google.com: domain of linux-kernel+bounces-180490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeweavers.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7F1CBB21938 for ; Wed, 15 May 2024 23:33:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E32D53392; Wed, 15 May 2024 23:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b="aZJnNRCo" Received: from mail.codeweavers.com (mail.codeweavers.com [4.36.192.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3A564D5A5; Wed, 15 May 2024 23:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=4.36.192.163 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715815962; cv=none; b=f1NawSIY0TUBux0MGXBqY122a/RvGUS6u9XdFIoXx13JDqWGXxei5Zm/aW4FmCTLoxKkqPaalGYpogJZKRahmPeMQG7G71w6Z8AREgGUNKRpUTkovJHZoV2RYc6Uhddjtjnx2yV9TfG5drzy8Ls3NSztxvVxszxlepdi3DWTG7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715815962; c=relaxed/simple; bh=kNIfUSqmELR44cA1YYeUiPS/oNMg9kNiAuiUGNZMCbI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c89AswlQlD3v7U6MRgRj5+dRJBUiz6ueEWH6B3eRi4VBHl6sfFe9csPvR76H59PvbxQ5buC14rkFcqbpYU2zSB28ypQPWyBb8MtHVAJ4IXE36478oDZa8VZp5nJi0L3fkO9z9P5WAsArtACU1oEdrgXubPMH5/apWCQxhBgVBnY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com; spf=pass smtp.mailfrom=codeweavers.com; dkim=pass (2048-bit key) header.d=codeweavers.com header.i=@codeweavers.com header.b=aZJnNRCo; arc=none smtp.client-ip=4.36.192.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeweavers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codeweavers.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codeweavers.com; s=s1; h=Message-ID:Date:Subject:Cc:To:From:Sender; bh=kNIfUSqmELR44cA1YYeUiPS/oNMg9kNiAuiUGNZMCbI=; b=aZJnNRCoU4VdBtKnFF2KaV3kkk H/MnU0t8TpOaClSFgLOcARfnRydTZRKZF4lEySoZF5MdxuK3dCAuZnhauaBUw/EgTy1cuxJTXWps9 gTnZhGETkt32V4J+P9tOsZoRWrL7ui4X8jCrqFoAV2L/r4N/kJ0deokolHOw4Ly6aiE+jnW9QyFiW h39hO6ClKz8UCmoeAUwLyVfjNWdqx7kziiVEn+FBD2WmLVqcCYXDGuUChuaawgovf9fifN2qydGDx GudVNON6odyAwWU/UppZkPacdf3qJ6/9hqsaNoPPQnaRJYhqWZsNv96w13xRkLbIkfupCDCsZyC7o S9uZ6e9A==; Received: from [10.69.139.9] (helo=watership.localnet) by mail.codeweavers.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1s7O6n-005nPN-1T; Wed, 15 May 2024 18:32:29 -0500 From: Elizabeth Figura To: Peter Zijlstra , wine-devel@winehq.org Cc: Arnd Bergmann , Greg Kroah-Hartman , Jonathan Corbet , Shuah Khan , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, wine-devel@winehq.org, =?ISO-8859-1?Q?Andr=E9?= Almeida , Wolfram Sang , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Randy Dunlap , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Elizabeth Figura Subject: Re: [PATCH v4 00/30] NT synchronization primitive driver Date: Wed, 15 May 2024 18:32:26 -0500 Message-ID: <2322852.ElGaqSPkdT@watership> In-Reply-To: <1790266.VLH7GnMWUR@camazotz> References: <20240416010837.333694-1-zfigura@codeweavers.com> <20240417100132.GK30852@noisy.programming.kicks-ass.net> <1790266.VLH7GnMWUR@camazotz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On Wednesday, April 17, 2024 3:02:13=E2=80=AFPM CDT Elizabeth Figura wrote: > > > Except for the "unowned" semantics of zero, the actual value of the > > > owner identifier is not interpreted by the ntsync driver at all. The > > > intended use is to store a thread identifier; however, the ntsync > > > driver does not actually validate that a calling thread provides > > > consistent or unique identifiers. > >=20 > > Why not verify it? Seems simple enough to put in a TID check, esp. if NT > > mandates the same. >=20 > I mostly figured it'd be simplest to leave the driver completely > agnostic, but I don't think there's any reason we can't use the real > TID for most calls. While trying to implement this I did realize a reason: if a Linux thread di= es=20 and a new Wine thread is created which happens to have the same Linux TID=20 *before* Wine notices the thread death, that thread's TID will be conflated= =20 with the thread that died. I don't think we can guarantee that we notice=20 thread death before we notice a request to create a new Wine thread. Using Wine-managed TIDs avoids this by virtue of ensuring that a Wine TID i= s=20 not reused until the associated Wine thread has been cleaned up.