[PATCH] Cygwin: Fix access to block devices below /proc/sys.

Christian Franke Christian.Franke@t-online.de
Tue Dec 1 18:48:13 GMT 2020


Corinna Vinschen wrote:
> On Dec  1 16:59, Christian Franke wrote:
>> Corinna Vinschen wrote:
>>> \Device\Mup is a character device and thus the devices below are not
>>> accessible for directory enumeration.  I assume it's the same for DFS.
>> Here I see \Device\Mup as a block device on two systems (cygwin1.dll 3.1.7):
>>
>> $ ls -l /proc/sys/Device/Mup
>> brwxrwx--x 1 Administrators SYSTEM 0, 250 Dec  1 16:50 /proc/sys/Device/Mup
> Huh?
>
> $ ls -l /proc/sys/Device/Mup
> crwxrwx--x 1 Administrators SYSTEM 0, 250 Dec  1 17:04 /proc/sys/Device/Mup
>
> This is what I'd expect.  Can you debug why this is a block device
> on your systems?
>

NtQueryVolumeInformationFile() returns {DeviceType = 0x14, 
Characteristics = 0x20010}

fhandler_procsys::exists(...):
...
   status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES, &attr, &io,
                   FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
...
   if (NT_SUCCESS (status))
     {
       FILE_FS_DEVICE_INFORMATION ffdi;
...
       /* Check for the device type. */
       status = NtQueryVolumeInformationFile (h, &io, &ffdi, sizeof ffdi,
                          FileFsDeviceInformation);
...
       if (NT_SUCCESS (status))
       {
         if (ffdi.DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM)
           file_type = virt_blk;  <<===============
        ...


Thanks,
Christian



More information about the Cygwin-patches mailing list