public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Yoshinao Muramatsu <ysno@ac.auone-net.jp>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH 0/3] fix unlink/rename failure in hyper-v container
Date: Mon, 20 Mar 2023 22:06:49 +0900	[thread overview]
Message-ID: <608a78b6-f523-14f1-333d-f59e9f2bb8d5@ac.auone-net.jp> (raw)
In-Reply-To: <ZBWL85hJIlbZHc/D@calimero.vinschen.de>

On 2023/03/18 19:01, Corinna Vinschen wrote:
>> In the logs, here we can find some differences.
>> But I believe it is unclear if it will always be so.
>> If additional inspections are done, they will be costly.
> 
> Assuming we can pull some information from the filesystem flags, the
> cost is negligible.  We just check bits in a filesystem bitmask.

I was expecting something like checking the file system driver
configuration as an additional test.
It would be ideal if the checks could be done at no additional cost.

> Assuming we can fetch useful info from the filesystem flags, we could
> basically do both, add your patch to have a workaround in case the
> Windows call returns INVALID_PARAMETER, and an early test for a FS
> flag which can be used down the road to avoid the workaround.

Adding workarounds can be done now and adding early testing
can be done once the judgment conditions are known. Great.

> This is disappointing.  One of the newer filesystem flags is
> 0x400, FILE_SUPPORTS_POSIX_UNLINK_RENAME.  As you can see,
> the flag is set.  But the POSIX functionality doesn't work
> here, right?

I was not aware that there was a FILE_SUPPORTS_POSIX_UNLINK_RENAME there.
I was only looking at the part where there was a difference.
Right, FILE_SUPPORTS_POSIX_UNLINK_RENAME doesn't work
on mounted volume with hyper-v isolation.

I additionally checked with the ltsc2016 version of the hyper-v container.
POSIX_UNLINK_RENAME should not be supported from the windows version,
but interesting results were obtained.
FILE_SUPPORTS_POSIX_UNLINK_RENAME is not considered to work,
but has not been tested.

> However, what's really curious here is the fact that the
> FILE_SUPPORTS_OPEN_BY_FILE_ID flag is missing.
> 
> NTFS always supports this since Windows 2003!  So we could
> use this flag as indicator that, probably, POSIX rename/unlink
> won't work.

I thought that if there was no FILE_SUPPORTS_OPEN_BY_FILE_ID
and OpenByFileId() worked, it would be a Signature,
but the result was different.

I tested OpenByFileID() on a bind-mounted directory, it was failed.
Maybe it's because of the path isolation.
ltsc2022 process isolation says "I support it" but it not works.
Okay, it's not a security issue. So now I'm writing this here.

Unfortunately, the state of the FILE_SUPPORTS_OPEN_BY_FILE_ID flag
does not match the actual behavior, so I fear it may be corrected.

FileSystemAttributes on containers
image   isolation mounted? FileSystemAttributes
ltsc2016 hyper-v  normal  0x1c700df        +OPEN_BYID
ltsc2022 hyper-v  normal  0x1c706df        +OPEN_BYID +POSIX +CLEANUP
ltsc2022 process  normal  0x1c706df        +OPEN_BYID +POSIX +CLEANUP
ltsc2016 hyper-v  binded  0x2c706ff +USN_J            +POSIX +CLEANUP +QUOTA
ltsc2022 hyper-v  binded  0x2c706ff +USN_J            +POSIX +CLEANUP +QUOTA
ltsc2022 process  binded  0x3e706ff +USN_J +OPEN_BYID +POSIX +CLEANUP +QUOTA

OpenByFileId and POSIX_UNLINK_RENAME test result
image    isolation mounted? OpenByFileId POSIX_UNLINK_RENAME
ltsc2016 hyper-v   normal   success      fail?(windows version)
ltsc2022 hyper-v   normal   success      success
ltsc2022 process   normal   success      success
ltsc2016 hyper-v   binded   fail         not tested
ltsc2022 hyper-v   binded   fail         fail
ltsc2022 process   binded   fail         success

ps
Corinna, I read the new email about fs_info::update patch
you posted while I was writing this.
I will report back when I test it, but it may take some time
as I usually use msys2 and don't have a cygwin development environment.

-- 
Yoshinao Muramatsu <ysno@ac.auone-net.jp>


  reply	other threads:[~2023-03-20 13:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 14:43 YO4
2023-03-17 14:43 ` [PATCH 1/3] fix unlink in container YO4
2023-03-17 14:43 ` [PATCH 2/3] fix rename " YO4
2023-03-17 14:43 ` [PATCH 3/3] log disabling posix semantics YO4
2023-03-17 19:15 ` [PATCH 0/3] fix unlink/rename failure in hyper-v container Corinna Vinschen
2023-03-18  5:29   ` Yoshinao Muramatsu
2023-03-18 10:01     ` Corinna Vinschen
2023-03-20 13:06       ` Yoshinao Muramatsu [this message]
2023-03-20 14:51         ` Corinna Vinschen
2023-03-20 14:54           ` Corinna Vinschen
2023-03-20 20:37           ` Corinna Vinschen
2023-03-21 15:32             ` Yoshinao Muramatsu
2023-03-21 17:58               ` Corinna Vinschen
2023-03-23 16:40                 ` Yoshinao Muramatsu
2023-03-24 11:54                   ` Corinna Vinschen
2023-03-24 13:20                     ` Jon Turney
2023-03-24 13:22                       ` Corinna Vinschen
2023-03-24 14:20                         ` Jon Turney
2023-03-24 13:48                     ` Yoshinao Muramatsu
2023-03-20 11:50   ` [PATCH 0/3] fix unlink/rename failure in hyper-v container(regenerate) Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 1/3] fix unlink in container Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 2/3] fix rename " Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 3/3] log disabling posix semantics Yoshinao Muramatsu
2023-03-20 12:12     ` [PATCH 0/3] fix unlink/rename failure in hyper-v container(regenerate) Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=608a78b6-f523-14f1-333d-f59e9f2bb8d5@ac.auone-net.jp \
    --to=ysno@ac.auone-net.jp \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).