• Anton Blanchard's avatar
    perf_counter: Make sure we dont leak kernel memory to userspace · 413ee3b4
    Anton Blanchard authored
    There are a few places we are leaking tiny amounts of kernel
    memory to userspace. This happens when writing out strings
    because we always align the end to 64 bits.
    
    To avoid this we should always use an appropriately sized
    temporary buffer and ensure it is zeroed.
    
    Since d_path assembles the string from the end of the buffer
    backwards, we need to add 64 bits after the buffer to allow for
    alignment.
    
    We also need to copy arch_vma_name to the temporary buffer,
    because if we use it directly we may end up copying to
    userspace a number of bytes after the end of the string
    constant.
    Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <20090716104817.273972048@samba.org>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    413ee3b4
perf_counter.c 108 KB