[CentOS] kernel bug fixed in later kernels

Philip Manuel

phil at zomojo.com
Wed Nov 3 22:59:28 UTC 2010


Does anyone know if this is going to be fixed in CentOS ?

// test case code below
// expected behaviour is "all good" and a return code of zero.
// this works on 2.6.35-1
// does not work on 2.6.18-194.17.4.el5 from Centos 5.5

// think this bug was fixed in git commit 
8948e11f450e6189a79e47d6051c3d5a0b98e3f3
// around 2.6.22
// 
http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg11654.html


#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

int main(int argc, char** argv)
{
    int fd = open("foo", O_RDONLY);
       if (setuid(1000))
    {
        printf("could not setuid, run as root with correct uid\n");
        return 1;
    }

    char proc_name[1024];

    sprintf(proc_name, "/proc/self/fd/%d", fd);
    struct stat stat_buf;

    int rc = stat(proc_name, &stat_buf);

    if (rc == 0)
    {
        printf("all good\n");
    }
    else
    {
        printf("busted, could not access %s\n", proc_name);
    }

    return rc;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20101104/a4d8a0f4/attachment.html>


More information about the CentOS mailing list