Cygwin 3.5 mapping uid/gid on NFSv4 filesystem to unexpected IDs ...

Roland Mainz roland.mainz@nrubsig.org
Fri Nov 10 12:22:04 GMT 2023


On Tue, Oct 31, 2023 at 5:20 PM Roland Mainz <roland.mainz@nrubsig.org> wrote:
> We've modified the NFSv4 drive for WIndows to support the Nfs3Attr API
> uid/gid fields for Cygwin&SFU compatibility, and SID support (local
> users mapped to their SIDs, and NFS users/groups without local
> accounts are mapped to "S-1-22-1-*" (Unix_User+) and "S-1-22-2-*"
> (Unix_Group+)) .
>
> But on Cygwin 3.4.9 and Cygwin 3.5.0 something unexpected happens -
> Cygwin /usr/bin/ls shows the wrong uid/uids:
> For example the kernel driver fills in uid=197608/gid=197121 (matching
> what $ getent passwd/group # says), but ls(1) prints
> uid=4278387688/gid=4278387201
> It seems Cygwin is mapping ALL NFS3Attr uid/gid values to the
> Unix_User+/Unix_Group+ range. On Solaris&Linux the NFS uid/gid values
> are correct, and the Windows NFSv4 driver uses the same numeric
> values.
>
> Example:
> ---- snip ----
> $ uname -a
> CYGWIN_NT-10.0-19045 wingrendel02 3.5.0-0.448.gd56d58ace27b.x86_64
> 2023-10-30 11:42 UTC x86_64 Cygwin
>
> $ cmd /c 'dir /q'
>  Datenträger in Laufwerk T: ist PnfsVolume
>  Volumeseriennummer: DEAD-BEEF
>
>  Verzeichnis von T:\test1
>
> 31.10.2023  11:53    <DIR>          WINGRENDEL02\roland_mai.
> 27.10.2023  16:36    <DIR>          ...                    ..
> 31.10.2023  11:54    <DIR>          WINGRENDEL02\roland_maiksh
> 30.10.2023  13:05         1.411.059 WINGRENDEL02\roland_maixxx
> 30.10.2023  12:46    <DIR>          WINGRENDEL02\roland_maijunctiontest1
> 31.10.2023  05:16    <DIR>          WINGRENDEL02\roland_maibash
>                1 Datei(en),      1.415.039 Bytes
>                5 Verzeichnis(se),  1.686.773.760 Bytes frei
>
> $ id -a
> uid=197608(roland_mainz) gid=197121(Kein)
> groups=197121(Kein),545(Benutzer),559(Leistungsprotokollbenutzer),4(INTERAKTIV),66049(KONSOLENANMELDUNG),11(Authentifizierte
> Benutzer),15(Diese Organisation),113(Lokales
> Konto),4095(CurrentSession),66048(LOKAL),262154(NTLM-Authentifizierung),401408(Mittlere
> Verbindlichkeitsstufe)
>
> $ ls -la
> total 1386
> drwxr-xr-x  5 Unix_User+197608 Unix_Group+197121     120 Oct 31 11:53 .
> drwxrwxrwt  3 Unix_User+0      Unix_Group+0           60 Oct 27 17:36 ..
> drwxr-xr-x 14 Unix_User+197608 Unix_Group+197121    3660 Oct 31 05:16 bash
> drwxr-xr-x  2 Unix_User+197608 Unix_Group+197121      60 Oct 30 12:46
> junctiontest1
> drwxr-xr-x  3 Unix_User+197608 Unix_Group+197121      80 Oct 31 11:54 ksh
> -rwxr-xr-x  1 Unix_User+197608 Unix_Group+197121 1411059 Oct 30 13:05 xxx
>
> $ ls -lan
> total 1386
> drwxr-xr-x  5 4278387688 4278387201     120 Oct 31 11:53 .
> drwxrwxrwt  3 4278190080 4278190080      60 Oct 27 17:36 ..
> drwxr-xr-x 14 4278387688 4278387201    3660 Oct 31 05:16 bash
> drwxr-xr-x  2 4278387688 4278387201      60 Oct 30 12:46 junctiontest1
> drwxr-xr-x  3 4278387688 4278387201      80 Oct 31 11:54 ksh
> -rwxr-xr-x  1 4278387688 4278387201 1411059 Oct 30 13:05 xxx
> ---- snip ----
>
> Is the Cygwin behaviour (i.e. mapping of NFS3Attr uid/gid to different
> uid/gid in Cygwin $ ls -n #) intended ?

In the meantime I tried this:
---- snip ----
# Map NFSv4 uid/gid 1:1 to Cygwin uid/gid - does not work
regtool -i set '/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/NTDS/trustPosixOffset'
0x0
regtool -i set '/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Netlogon/Parameters/trustPosixOffset'
0x0
---- snip ----

Both have no effect, as the test machine is NOT in a domain, and if I
understand the Cygwin code in |fetch_posix_offset()| correctly a
"trustPosixOffset" value below PRIMARY_POSIX_OFFSET (including 0x0)
will not work.

Corinna: Is there any way to get a "trustPosixOffset" value of 0
working on a standalone (not in a domain) machine (e.g. via registry
settings), so that on an NFS filesystem the NFS uid/gid are mapped
1:1/unchanged to the Cygwin uid/gids ? Yes, I know, it might cause
uid/gid collisions, but right now, for this use case, the risk is
acceptable...

----

Bye,
Roland
-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)


More information about the Cygwin-developers mailing list