This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH v2] Cygwin: Fix the address of myself
- From: Ken Brown <kbrown at cornell dot edu>
- To: Jon Turney <jon dot turney at dronecode dot org dot uk>, "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Thu, 25 Jul 2019 19:59:17 +0000
- Subject: Re: [PATCH v2] Cygwin: Fix the address of myself
- Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=cornell.edu;dmarc=pass action=none header.from=cornell.edu;dkim=pass header.d=cornell.edu;arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KH8WDy/F9eQycARLx7+5zVMEmeIzCFDwy4kJbELqXAM=; b=ESVPTgHLOmJvuGVCbCbhcoYZGsf0GhKohxmMZwyZXDq+YpCxrKWo49jHg1CoCajRGeKCQWBt6W5XrMQ6CnlwyOdjKKSY2RvZk3xbhgKvx5kqFnFKxBrPUoO/d0AnDAnNibqgvE1uZubw4SBeI1Tj+DVf0tTaIhHbnctMWo4UHQiFw+5Zu1ha1N87dqA0G1xsohHK3IQso/w5XPdQKqz5VzQN27Fgq3UzEMnqBiRq3P1jHnE+HhVolt6F4WXv5+W3J8P5wzj5hdES8eQHpb+gwXxoC1OzgrUsjqy2l7L96JpmTlkq5wgHquZqfEXx4mTDYdNq2OsqtzhYXZHl5iCC9A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFnPpDaOnRtkT8OstoBFKAx2u/XL85SDN2bUa12ldRjnJRP4RY750C3X8ZWtk+qLh/6xOYUMXq1iKrahN5/T10Bx6zt5ikFnZpfypGFE39+7RBh4xltTBM0odIQofQafai+2FEKmbV2TEDtXUr+okShxaLiMaKTLCvuiYF3nQRgY1bwlOabQcUvYqKhgEjqzQBwt7uw3fSC3efIGuxTaXxI5PxEQMmrkfJdL8hSWJJ0Ls/QHjJyNfkD/62iGDX2V9APyWWWkwOF8FPwlAN0pr9K1+v/B6JqW1+9NyDIhdyqQSX9zgxg8yayrS0QMFg0RZcEfClodVZ46odTB9Dd6uw==
- References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <20190725133729.GB11632@calimero.vinschen.de>
On 7/25/2019 9:37 AM, Corinna Vinschen wrote:
> On Jul 24 19:11, Ken Brown wrote:
>> On 7/24/2019 12:54 PM, Corinna Vinschen wrote:
>>> From: Corinna Vinschen <email@example.com>
>>> v2: rephrase commit message
>>> Introducing an independent Cygwin PID introduced a regression:
>>> The expectation is that the myself pinfo pointer always points to a
>>> specific address right in front of the loaded Cygwin DLL.
>>> However, the independent Cygwin PID changes broke this. To create
>>> myself at the right address requires to call init with h0 set to
>>> INVALID_HANDLE_VALUE or an existing address:
>>> pinfo::init (pid_t n, DWORD flag, HANDLE h0)
>>> if (!h0 || myself.h)
>>> shloc = SH_MYSELF;
>>> if (h0 == INVALID_HANDLE_VALUE) <-- !!!
>>> h0 = NULL;
>>> The aforementioned commits changed that so h0 was always NULL, this way
>>> creating myself at an arbitrary address.
>>> This patch makes sure to set the handle to INVALID_HANDLE_VALUE again
>>> when creating a new process, so init knows that myself has to be created
>>> in the right spot. While at it, fix a potential uninitialized handle
>>> value in child_info_spawn::handle_spawn.
>>> Fixes: b5e1003722cb ("Cygwin: processes: use dedicated Cygwin PID rather than Windows PID")
>>> Fixes: 88605243a19b ("Cygwin: fix child getting another pid after spawnve")
>>> Signed-off-by: Corinna Vinschen <firstname.lastname@example.org>
>>> winsup/cygwin/dcrt0.cc | 2 +-
>>> winsup/cygwin/pinfo.cc | 3 +--
>>> 2 files changed, 2 insertions(+), 3 deletions(-)
>> I'll be glad to take a close look at this as you asked. But I'm not familiar
>> with this part of the code, so it will take me a little time.
> Thanks! I accidentally pushed the patch a few minutes ago when I
> was actually just planning to push the ndbm.h patch. Anyway, I
> took the opportunity to create new snapshots with all patches from
> yesterday and today, so the getpgrp problems in GDB 8.1.1 and 8.2.1
> should both be fixed there as well.
> I'd still be glad if the two of you could check if my patch makes
> sense as is.
It looks fine to me, though I can't claim to have grasped all its implications.
In any case, I've installed it and have done a few things that often catch bugs
(e.g., building emacs and running its test suite), and there are no problems so far.
My next step will be to install the experimental pipe code that I posted in
https://cygwin.com/ml/cygwin-patches/2019-q2/msg00144.html to see if that shakes