resend: Implement SetThreadPriority

Chris chris.kcat at gmail.com
Mon Jul 31 07:46:50 CDT 2006


This is basically a stripped down version of the patch on the wiki. Before you 
start re-iterating what was said back around the beginning of April or so 
when it first came up, please, hear me out.

This modified patch *does not* encourage users to run as root. In fact, the 
stuff I removed was related to libcap and playing around with privs. So, if 
you run run as root, or with the suid-root bit set, you're on your own. It's 
as if you're running any other app the same way. It doesn't go out of its 
way "just in case" you decide to run with root privs or anything. Your 
system's stability and security is in your hands.

What this patch does, however, is simply call sched_setscheduler when a 
thread's priority needs to be changed. If it works, it works. If it doesn't, 
it doesn't (and prints a one-time warning to stderr).

Now, the reason why I think this is sufficient, is because of what I said on 
wine-devel. Starting with Linux 2.6.12, there is an RLIMIT_RTPRIO resource 
limit which, if it has a soft limit of non-zero, allows normal unprivileged 
processes to change their priority up to the set value. This value must be 
set by the system administrator, it can't be changed by a normal unprivileged 
user/app, and the patch makes no attempt to change it. In this regard, it is 
simply benefitting from a new-ish ability of the Linux kernel like any other 
normal Linux application would. Nothing more, nothing less.

According to the Wine Weekly Newsletter Issue #311, Alexandre's argument 
against the original patch was this:

"Until it crashes your box of course... I really don't think we want to 
encourage running as root, or give Windows apps a way to screw up the system. 
If we have to require people to upgrade their kernel to get the feature 
that's fine; at least then when the box dies we can blame the kernel 
guys ;-)"

Since this patch requires the user to explicitly set a non-zero RLIMIT_RTPRIO 
value to work, it is completely at the user's descretion with what to do. 
This patch does nothing to encourage running as root, and doesn't require 
Wine to change how it is run. It does nothing except work with the system's 
set configuration. I hope that satisfies those concerns. :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine_thread_prio.diff
Type: text/x-diff
Size: 2566 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060731/b2bbd4c6/wine_thread_prio.bin


More information about the wine-patches mailing list