This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH 0/3] Support opening a symlink with O_PATH | O_NOFOLLOW
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin-patches at cygwin dot com" <cygwin-patches at cygwin dot com>
- Date: Sat, 28 Dec 2019 19:52:29 +0000
- Subject: [PATCH 0/3] Support opening a symlink with O_PATH | O_NOFOLLOW
- 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=waRghVT6qadLsIWiCs+3j1s5DzbUx9fP7ywakW0ndDg=; b=CuUdilK1r7VkMht8Mj39hDQikR7UAf6dR2Lzidis6YweEH6DQQVr79rca34GqvOsLsA9tf6ea+SQCemm3CIY4TEHryTzCO7cWm9rQKaH1ZXWCjMPxGvuum379mrllBCrxYjMR21DPhNqLT5pxmGh4BdCSIX0M+ceRSqWDOqcijYE0zcdkr6MfQKFOsXYZcx8veuouLdXKE5P77bVY8Wiak0M4EugwelQbmLzyYSw7o50WNh0eRPc6GWfP0O1AD0SzSGBoO9lQJKU5iB2qUW2Yty3BFMvkgNUGqZZHs8DFvPyoaFZrWVRApi3QFVPA0ucflHPRirTNBlCsUFIcZBLBg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FWNxWxNbhlU5zPO0l6SkaNHst1i7dFTouTAo5UK3s6QgI4HEmY51WTpGGZswMvOrQarwr+YCR/4/GcJGdZ18VB1jJucDA63eY5nuFuC+4Mvu8yC00yl+UOc0hSHHXx3pco4nazVAFbcYZahMVOZ8cFesq9AMo3oFToJphQxtsWz1SJ2GI1Ep/eBc2ZViObJ8dE3+T4KAL08Y4y5rbEiSRg8sj1ovZZmZwwKJEyW4KwGVB9flwSrKWUg8x9IlFOjXH2T+H12X/fz6HFq0qq9p5lymRlczFtyTvw9Bk4SmpVzUgXdn//2KK2Sm7cqNh4Y1KI7LeUI9Cd03COmo7oKiPg==
Currently, opening a symlink with O_NOFOLLOW fails with ELOOP.
Following Linux, the first patch in this series allows the call to
succeed if O_PATH is also specified.
According to the Linux man page for 'open', the file descriptor
returned by the call should be usable as the dirfd argument in calls
to fchownat, fstatat, and readlinkat with an empty pathname, to have
the calls operate on the symbolic link. The second and third patches
achieve this. For fchownat and fstatat, we do this by adding support
for the AT_EMPTY_PATH flag. [The man page mentions linkat also, but
it already supports the AT_EMPTY_PATH flag.]
Ken Brown (3):
Cygwin: allow opening a symlink with O_PATH | O_NOFOLLOW
Cygwin: readlinkat: allow pathname to be empty
Cygwin: fchownat and fstatat: support the AT_EMPTY_PATH flag
winsup/cygwin/syscalls.cc | 51 +++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 13 deletions(-)
--
2.21.0