• Sergei Trofimovich's avatar
    alpha: unbreak osf_setsysinfo(SSI_NVPAIRS, [SSIN_UACPROC, UAC_SIGBUS]) · 2df7a7d1
    Sergei Trofimovich authored
    The bug was accidentally found by the following program:
    
        #include <asm/sysinfo.h>
        #include <asm/unistd.h>
        #include <sys/syscall.h>
        static int setsysinfo(unsigned long op, void *buffer, unsigned long size,
                              int *start, void *arg, unsigned long flag) {
            return syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag);
        }
    
        int main(int argc, char **argv) {
            short x[10];
            unsigned int buf[2] = { SSIN_UACPROC, UAC_SIGBUS, };
            setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0);
    
            int  *y = (int*) (x+1);
            *y = 0;
            return 0;
        }
    
    The program shoud fail on SIGBUS, but didn't.
    
    The patch is a second part of userspace flag fix (commit 745dd240
    "Alpha: Rearrange thread info flags fixing two regressions").
    
    Deleted outdated out-of-sync 'UAC_SHIFT' (the cause of bug) in favour of
    'ALPHA_UAC_SHIFT'.
    
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
    Acked-by: default avatarMichael Cree <mcree@orcon.net.nz>
    Cc: Richard Henderson <rth@twiddle.net>
    Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Cc: Matt Turner <mattst88@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    2df7a7d1
sysinfo.h 691 Bytes