delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/02/16/04:37:06

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:reply-to:in-reply-to:references
:from:date:message-id:subject:to:content-type; q=dns; s=default; b=
tJXb91IFTRAxeX/8AyK2E1VlAodV+89fboXSV+mxk9dBCz6HNH7JaxST7WYJqmRd
VEfTn7kNXRVtWdmSYQVuQcl22VvTETdvcDK85zWFsvNFCtsfrguu1dck58gC2ecQ
FuIpIsltYlRDWdvcb9xb1Nw8AajdcUvmaDM49reAnrQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:reply-to:in-reply-to:references
:from:date:message-id:subject:to:content-type; s=default; bh=+pc
H5uAE6OC1urYaEiMYTGXh0Hg=; b=QdlO6YXviEcf0EzKlcdKeWpBu4mTkZ4ARcM
S3DEpEBrTeE0g/X/xr3wrF8qqkZmJoUuGkaHfEYFnxs8TjRLyTgwXYqV5/xKLa5n
9YjScv68kiU0xUGpYlQhTD+QkcqEGxAFGHyR8bI5PNZrZzVoq3ITxS+OA7nkxIjg
weaCZb/s=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=233, Wines, wines, Wine's
X-HELO: mail-wm0-f51.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=C7CuTzkLD3fXn6tauOGnfcM87UITXkgqSU3aT6S7IXU=; b=CFJWqM+Dqm398PCHL+eDnS4VmkJQJR1UVioVQe3I7iDdwpZtvKmbKvbbUwvuQgXqKC upifzkq6Deyuup4DaRFlJOhWP5Stn2uDm9bqh0E/kThAfklQaS9oFPtu4P8tVNsKnm4P VpQAmi3CbceZG3hdQakYdnD5J47DcMOmtCRxP418uSjYMkY7zpn5sJT3aEiuxPvViknK tcrfUifkh06TLbOl3kR0CUOs7m+BLpUpBDdq4xXYgJayTBDONf8Tp+bOjNx03+4MNp1j EpAUKxJJc/45ECFqXW9bLw3Q0u84JpLIp82xOOWXx8oiqiWF9QGixf2ixN35ypgtHyPO U8Bg==
X-Gm-Message-State: AG10YOTzFv6miNLGM/wVVPUrEozyDACfeA4QzBoP7CyjSweQ8cTAHAGJOgl6jkBgKu8DJGIolbyb0Rt3klekUw==
X-Received: by 10.194.77.167 with SMTP id t7mr20357398wjw.90.1455615403872; Tue, 16 Feb 2016 01:36:43 -0800 (PST)
MIME-Version: 1.0
Reply-To: fracting AT gmail DOT com
In-Reply-To: <56BF9370.80303@glup.org>
References: <56BF9370 DOT 80303 AT glup DOT org>
From: Qian Hong <fracting AT gmail DOT com>
Date: Tue, 16 Feb 2016 17:36:04 +0800
Message-ID: <CALd+sZT614-VPBh4cOaBraDtGMEdu3jiDQB184bkeFJyA2vQ5Q@mail.gmail.com>
Subject: Re: mktemp() fails on Wine 1.9.3 + Cygwin 2.5.0-0.2
To: cygwin <cygwin AT cygwin DOT com>, John Hood <cgull AT glup DOT org>
X-IsSubscribed: yes

Hi John,

This looks like a bug in wineserver.

Cygwin strace log show an access error soon after fhandler_base::open()

  [main] mktemp 111 fhandler_base::open:
(\??\C:\cygwin\tmp\tmp.kAEScb0yvo, 0x108A02)
  [main] mktemp 111 __set_errno: int aclsort32(int, int,
aclent_t*):1403 setting errno 22
  [main] mktemp 111 __set_errno: void* set_posix_access(mode_t, uid_t,
gid_t, aclent_t*, int, security_descriptor&, bool):269 setting errno
13

fhandler_base::open() is forwarded to NtCreateFile, but Wine
+relay,+server log show that NtCreateFile seems fine (please ignore
the difference of random file name):

0009:Call ntdll.NtCreateFile(0060c7d4,c0100000,0060c7e8,0060c7e0,00000000,00000080,00000007,00000002,00004020,00000000,00000000)
ret=6103a45d
0009:trace:ntdll:FILE_CreateFile handle=0x60c7d4 access=c0100000
name=L"\\??\\C:\\cygwin\\tmp\\tmp.BM21HIw0vU" objattr=00000042
root=(nil) sec=(nil) io=0x60c7e0 alloc_size=(nil) attr=00000080
sharing=00000007 disp=2 options=00004020 ea=(nil).0x00000000
0009:trace:file:wine_nt_to_unix_file_name
L"\\??\\C:\\cygwin\\tmp\\tmp.BM21HIw0vU" ->
"/media/workspace/wine-cygwin-1028/dosdevices/c:/cygwin/tmp/tmp.BM21HIw0vU"
0009: create_file( access=c0100000, sharing=00000007, create=2,
options=00004020, attrs=00000080,
objattr={rootdir=0000,attributes=00000042,sd={},name=L""},
filename="/media/workspace/wine-cygwin-1028/dosdevices/c:/cygwin/tmp/tmp.BM21HIw0vU"
)
0009: create_file() = 0 { handle=00f4 }
0009:Ret  ntdll.NtCreateFile() retval=00000000 ret=6103a45d

(looks identity to the good version of log, so I won't paste the good
version here)

In this case, comparing +relay,+server log between good case and bad
case doesn't expose enough information, so we might need to compare
Linux strace log from good case and bad case:

[pid 11724] write(2, 0xb7584000, 2440009: create_file(
access=c0100000, sharing=00000007, create=2, options=00004020,
attrs=00000080,
objattr={rootdir=0000,attributes=00000042,sd={},name=L""},
filename="/media/workspace/wine-cygwin-1028/dosdevices/c:/cygwin/tmp/tmp.2kmv323jLu"
)
 <unfinished ...>
[pid 11732] close(9 <unfinished ...>
[pid 11724] <... write resumed> )       = 244
[pid 11732] <... close resumed> )       = 0
[pid 11724] open(0xa3a0e90, O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 107
[pid 11724] fstat64(107, {...})         = 0
[pid 11724] fgetxattr(107, 0x80a30e8, 0xbfe5dcec, 65536) = 314
[pid 11724] close(107)                  = 0
[pid 11724] open(0xa3a0e40,
O_RDWR|O_CREAT|O_EXCL|O_NONBLOCK|O_LARGEFILE, 0555 <unfinished ...>

By comparing to the good case, i found the above open syscall should
open the file as 0666 mode.

Related code below:

https://github.com/wine-compholio/wine-patched/blob/master/server/file.c#L408

226     if (sd)
227     {
228         const SID *owner = sd_get_owner( sd );
229         if (!owner)
230             owner = token_get_user( current->process->token );
231         mode = sd_to_mode( sd, owner );
232     }
233     else if (options & FILE_DIRECTORY_FILE)
234         mode = (attrs & FILE_ATTRIBUTE_READONLY) ? 0555 : 0777;
235     else
236         mode = (attrs & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666;


I need to do more research in order to write test and figure out the
right way to fix this bug, my current guess is Wine's sd/token
emulation is not completed yet, which cause unexpected behavior.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019