• Pavel Emelyanov's avatar
    cr: Task creds support · beb158a6
    Pavel Emelyanov authored
    Dumping is simple. All but secbits can be read from proc, secbits
    are got from parasite.
    
    Restoring is a bit tricky -- when you change anything on kernel
    cred's struct it performs sophisticated checks and can change
    some more stuff than requested, so the creds restoration procedure
    is carefully commented step-by-step.
    
    Another thing to mention is that creds are restored after everything
    else, i.e. right before performing final threads sync and sigreturns.
    This is done to avoid potential problems with insufficient caps for
    restoring other stuff (e.g. CAP_DAC_OVERRIDE or zero euid is most
    likely required for opening any image file and the notorious control
    /proc/sys/kernel/ns_last_pid, which in turn is performed till the
    very last moment).
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
    beb158a6
restorer.c 16.9 KB