• Sukadev Bhattiprolu's avatar
    autofs4: allow autofs to work outside the initial PID namespace · 6eaba35b
    Sukadev Bhattiprolu authored
    Enable autofs4 to work in a "container".  oz_pgrp is converted from
    pid_t to struct pid and this is stored at mount time based on the
    "pgrp=" option or if the option is missing then the current pgrp.
    
    The "pgrp=" option is interpreted in the PID namespace of the current
    process.  This option is flawed in that it doesn't carry the namespace
    information, so it should be deprecated.  AFAICS the autofs daemon
    always sends the current pgrp, which is the default anyway.
    
    The oz_pgrp is also set from the AUTOFS_DEV_IOCTL_SETPIPEFD_CMD ioctl.
    This ioctl sets oz_pgrp to the current pgrp.  It is not allowed to
    change the pid namespace.
    
    oz_pgrp is used mainly to determine whether the process traversing the
    autofs mount tree is the autofs daemon itself or not.  This function now
    compares the pid pointers instead of the pid_t values.
    
    One other use of oz_pgrp is in autofs4_show_options.  There is shows the
    virtual pid number (i.e.  the one that is valid inside the PID namespace
    of the calling process)
    
    For debugging printk convert oz_pgrp to the value in the initial pid
    namespace.
    Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@us.ibm.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
    Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Acked-by: default avatarIan Kent <raven@themaw.net>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    6eaba35b
autofs_i.h 9.24 KB