Re: [PATCH] sys_set/getpriority PRIO_USER semantics fix and optimisation

From: Prasanna Meda
Date: Thu Dec 02 2004 - 15:51:57 EST


pmeda@xxxxxxxxxx wrote:

> sys_set/getpriority is rewritten in 2.5/2.6, perhaps while transitioning
> to the pid maps. It has now semantical bug, when uid is zero. Note

A test case:

#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>

int main()
{
int prio1, prio2, ret, errno;

/* If root, loose priv. for testing */
setresuid(237, 237, 237);

prio1 = getpriority(2, getuid());
if (setpriority(PRIO_USER, 0, prio1+1) < 0) {
perror("setprio");
printf("FAILED!\n");
}
else {
prio2 = getpriority(2, getuid());
printf("Old prio:%d to new prio:%d\n", prio1, prio2);
printf((prio1 +1 != prio2)? "FAILED\n":"PASSED\n");
}
exit(0);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/