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

Baesken, Matthias matthias.baesken at sap.com
Wed Jan 2 16:08:52 UTC 2019


Hi David, thanks  for looking into it .

> ... but we need libcap it seems to  ask that question.

Yes I think  so too, we would need libcap  and I don't want to introduce  this dependency .
Should I change/remove  the warning  or  keep as it is in my webrev ?

Best regards, Matthias



> -----Original Message-----
> From: David Holmes <david.holmes at oracle.com>
> Sent: Mittwoch, 2. Januar 2019 12:25
> To: Baesken, Matthias <matthias.baesken at sap.com>; 'hotspot-
> dev at openjdk.java.net' <hotspot-dev at openjdk.java.net>
> Cc: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>
> Subject: Re: RFR : 8215962: Support ThreadPriorityPolicy mode 1 for non-root
> users on linux/bsd
> 
> 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