• Cyrill Gorcunov's avatar
    creds: restore -- Implement per-thread restore of credentials · eb5d8442
    Cyrill Gorcunov authored
    Because the creds parameters are to be passed inside pie/restorer
    code but read before thread_restore_args and task_restore_args
    structures are allocated we need a small trick and prepare
    creds int several stages
    
     - collect all creds data into separate private memory blobs
     - once all memory needed for restorer is allocated we relocate
       pointers in this blocks and setup
       thread_restore_args::thread_creds_args to appropriate
       address
     - restorer works as usual and setup creds parameters as before
    
    v2:
     - fix addressing in positioning of rst_ memory (I've occasionally
       zap pointers and when been sending patches forgot to merge changes
       back, so while I've the series successfully restoring containers
       with different creds, if been merged the series won't work. So
       all changes are merged as appropriate)
    
     - drop module's global @cap_last_cap from pie/restorer.c
    Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
    Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    eb5d8442
cr-restore.c 73.4 KB