OK,
Yes, libc itself is fine. But from the application's pov, personality()
returns int, not long.
it is already 'unsigned int' ;)
I think the same.
Yes! and despite the fact it returns -EINVAL, current->personality was
changed. This can't be right.
Well. Think about personality(0xffffffff - 1). It passes both checks
and we change current->personality. Then the application calls
personality() again, we return the old value, and since the user-space
expects "int" it gets -2.
How about
if (personality != 0xffffffff) {
if (personality >= 0x7fffffff)
return -EINVAL;
set_personality(personality);
}
? Now that personality always fits into "insigned int" we don't need
to recheck current->personality == personality, and "< 0x7fffffff"
gurantees that "int old_personality = personality(whatever)" in user
space can be never misinterpeted as error.
As for the other oddities, they need the separate patches. Or we can
just leave this code alone ;)
Oleg.
--