Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: zfs howto



> On 14. Feb 2021, at 02:55, Brad Spencer <brad%anduin.eldar.org@localhost> wrote:
> 
> Chavdar Ivanov <ci4ic4%gmail.com@localhost> writes:
> 
> [snip]
> 
>>> I am not sure of the complete context of the statement, but I do this
>>> all of the time with normal NetBSD NFS against a ZFS fileset.
>>> 
>>> build% cat /etc/exports
>>> /usr/installed_src/PKGSRC_2018Q4 -alldirs -maproot=root anotherbuild.system.eldar.org
>>> 
>>> build% zfs list /usr/installed_src/PKGSRC_2018Q4
>>> NAME                               USED  AVAIL  REFER  MOUNTPOINT
>>> tank/installed_src/PKGSRC_2018Q4   414M   250G   414M  /usr/installed_src/PKGSRC_2018Q4
>>> 
>>> 
>>> These are DOMUs running NetBSD 9.0_STABLE from around September.  I have
>>> not tried this with -current, but there are no crashes for me with 9.x.
> 
> [snip]
> 
>> 
>> I got it ---
>> 
>> With the following entry in -etc-exports:
>> 
>>     /tank/t1 -maproot=0:10 -network 192.168.0/24
>> 
>> the NFS server crashes when /tank/t1 is zfs system.
>> 
>> With the following one:
>> 
>>     /tank/t1 -maproot=root -network 192.168.0/24
>> 
>> it works fine.
>> 
>> Mind you, '-maproot=0:10' is the first example from 'man exports' ...

The trigger is '-maproot' with group(s), first bug is mountd leaving
'cr_gid' as -2 and setting the first group list member to 10 in this case.

Second bug is ZFS setting illegal group id -2 aka 4294967294 to GID_NOBODY
with id -2.  Later this illegal id leads to null pointer dereference
in zfs_log_create() at zfs_log.c:297 "lr->lr_gid = fuidp->z_fuid_group"
where fuidp is NULL.

With the attached diff the ZFS bug gets fixed and your export works.

> Glad to see that it isn't totally broken.  I am by no means an expert in
> the ZFS code, and I am not in a position to take a lot of time looking
> at it right now, but if the trace back in the PR is correct, it makes it
> almost totally though the mkdir call and crashes in the log create step
> after the directory node is created.  I am trying not to speculate too
> much here, but the code may fail to handle the group in the exports
> line.
> 
> 
> 
> 
> 
> 
> --
> Brad Spencer - brad%anduin.eldar.org@localhost - KC8VKS - http://anduin.eldar.org

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig

Attachment: zfs_context.h.diff
Description: Binary data

Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index