• Andi Kleen's avatar
    [PATCH] Fix argument checking in sched_setaffinity · 973705e2
    Andi Kleen authored
    This patch fixes the argument length checking in sched_setaffinity.
    
    Previously it would error out when the length passed was smaller than
    sizeof(cpumask_t).  And any bits beyond cpumask_s would be silently
    ignored.
    
    First this assumes that the user application knows the size of cpumask_t,
    which should be kernel internal.  When you increase cpumask_t old
    applications break and there is no good way for the application to find out
    the cpumask_t size the kernel uses.
    
    This patch changes it to do similar checking to the NUMA API calls:
    
    - Any length is ok as long as all online CPUs are covered (this could
      still cause application breakage with more CPUs, but there is no good way
      around it)
    
    - When the user passes more than cpumask_t bytes the excess bytes are
      checked to be zero.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    973705e2
sched.c 119 KB