• Michael Neuling's avatar
    powerpc: Fix swapcontext system for VSX + old ucontext size · 16c29d18
    Michael Neuling authored
    Since VSX support was added, we now have two sizes of ucontext_t;
    the older, smaller size without the extra VSX state, and the new
    larger size with the extra VSX state.  A program using the
    sys_swapcontext system call and supplying smaller ucontext_t
    structures will currently get an EINVAL error if the task has
    used VSX (e.g. because of calling library code that uses VSX) and
    the old_ctx argument is non-NULL (i.e. the program is asking for
    its current context to be saved).  Thus the program will start
    getting EINVAL errors on calls that previously worked.
    
    This commit changes this behaviour so that we don't send an EINVAL in
    this case.  It will now return the smaller context but the VSX MSR bit
    will always be cleared to indicate that the ucontext_t doesn't include
    the extra VSX state, even if the task has executed VSX instructions.
    
    Both 32 and 64 bit cases are updated.
    
    [paulus@samba.org - also fix some access_ok() and get_user() calls]
    
    Thanks to Ben Herrenschmidt for noticing this problem.
    Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    16c29d18
signal_32.c 35.7 KB