RFR : 8215962: Support ThreadPriorityPolicy mode 1 for non-root users on linux/bsd

David Holmes david.holmes at oracle.com
Wed Jan 2 11:25:12 UTC 2019


Hi Matthias,

On 2/01/2019 7:11 pm, Baesken, Matthias wrote:
> Hello , please  review the following patch .
> 
> Currently, when ThreadPriorityPolicy is set to 1 (so called “Aggressive 
> mode”), on linux and bsd(+Mac) a root-user-check (geteuid() != 0)) is done.
> See for example the coding in jdk/src/hotspot/os/linux/os_linux.cpp int 
> prio_init().
> 
> However the root-user-check has a few drawbacks:
> - it blocks the capabilities feature available on current Linux distros 
> (CAP_SYS_NICE capability) that can be used to allow setting lower 
> niceness also for non-root
> - setting a higher "niceness" (lower priority) is not possible on Linux 
> for non-root because of the geteuid check
> 
> We  had a discussion about this in „ThreadPriorityPolicy settings for 
> non-root users“  ,  with this suggestion :
> 
> https://mail.openjdk.java.net/pipermail/hotspot-dev/2018-December/035986.html
> 
> ….
> 
>> Just drop the root check for ThreadPriorityPolicy=1 and let the underlying system
> 
>> permissions control success or failure.
> 
> I  did  the change  in this  webrev :
> 
> Bug/webrev :
> 
> https://bugs.openjdk.java.net/browse/JDK-8215962
> 
> http://cr.openjdk.java.net/~mbaesken/webrevs/8215962.0/

This seems reasonable. I'm a little unsure about the warning when you 
might have the SYS_CAP_NICE capability. Ideally you'd only warn if you 
ask for something that can't be done ... but we need libcap it seems to 
ask that question.

Thanks,
David

> Best Regards ,  Matthias
> 


More information about the hotspot-dev mailing list