Use Reddit? Join us on our very own subreddit: https://www.reddit.com/r/Linuxstuff/
You can sign up to get a daily email of our articles, see the Mailing List page!
Support us on Patreon to keep GamingOnLinux alive. This ensures we have no timed articles and no paywalls. Just good, fresh content! Alternatively, you can support us on Paypal and Liberapay!
Latest Comments by marcus
2nd generation AMD Ryzen desktop processors now available to pre-order
13 April 2018 at 7:40 pm UTC Likes: 3

Cestus<<--- party pooper Anyone know the status of meltdown v1 V2 and spectre? is it fixed to the hardware level with these new CPU?

AMD was not affected by V3/meltdown.
V1/Spectre is mitigated in the OS (RETPOLINE)
V2/Spectre is hard to exploit on AMD and fixed in microcode (https://www.amd.com/en/corporate/security-updates)

Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
12 April 2018 at 8:50 am UTC

NeverthelessEasier... just try setting the cpu governor without it

Interesting ... learned something new ...

(all binaries with setuid-root)

It works without the setuid call:

#include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <errno.h> int main() { printf("EUID: %i\n",geteuid()); printf("UID: %i\n",getuid()); FILE* file = fopen("/sys/devices/system/cpu/cpu1/online","w"); if (!file) { perror("Error opening: \n"); return -1; } if (fprintf(file,"0\n") < 0) { perror("Error writing: \n"); return -2; } }

(Sorry, have no governors to set, so I just used cpu1/online for the same effect).

However, it does not work if you use system (which you should not do to begin with ^^, see also Caveats section in man 3 system and https://stackoverflow.com/questions/27461936/system-vs-execve). This is because the EUID is not propagated to the program called by system, while the UID is.

steam@SteamBox ~ $ cat test2.c #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { printf("EUID: %i\n",geteuid()); printf("UID: %i\n",getuid()); system("echo EUID_System: $EUID"); } steam@SteamBox ~ $ ./test2 EUID: 0 UID: 1000 EUID_System: 1000 steam@SteamBox ~ $

steam@SteamBox ~ $ ./test3 EUID: 0 UID: 0 EUID_System: 0 steam@SteamBox ~ $ cat test3.c #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { setuid(0); printf("EUID: %i\n",geteuid()); printf("UID: %i\n",getuid()); system("echo EUID_System: $EUID"); } steam@SteamBox ~ $

Bottom line: Please don't use system in a setuid-root binary. This is broken and a serious security hole.

Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
12 April 2018 at 7:14 am UTC

NeverthelessI forgot about the "setuid( 0 );" in the file. It's nessessary. Try for yourself (with owner root and suid root):

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
system( "whoami" );
setuid( 0 );
system( "whoami" );
return 0;
}

No its not You are confusing uid and euid (effective user id). Whoami is the wrong command to show what you want to show since it outputs the username based on the UID. But the UID is not what is used to check privileges. (See man credentials for the difference between user id and effective user id.)

Try with this code snippet instead:

#include <sys/types.h> #include <stdio.h> #include <unistd.h> int main() { printf("EUID: %i\n",geteuid()); printf("UID: %i\n",getuid()); }

The EUID is what matters when you write to files. Unless you want to use setuid() to change the apparent username to root (and then output it using whoami) it is useless. You can NOT elevate privileges this way.

Hmm ... @Liam: Indentation is somehow broken for code blocks or I'm too stupid

Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
11 April 2018 at 8:41 am UTC

Nevertheless
mike44Good but I would prefer not to install anything. Could we simply run a command before and after playing?

I found a simple suid program on the net, which I just had to change a bit to do the right things.


#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
setuid( 0 );
system( "echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );

return 0;
}


and to set it back to powersave:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
setuid( 0 );
system( "echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );

return 0;
}

This is really bogus, broken code ...
The setuid command is useless since
  • a) you are already root (per chmod u+s)
  • b) you would not be able to elevate your privileges like that if you were not. That would be a security hole. The purpose of setuid is to drop privileges when you are already root. Not to elevate them (see man setuid).

Using sudo in the system commandline makes no sense as well. It is benign if you have a setuid root binary (i.e. does nothing, just leave it out). If you are not yet root it will ask of course but then you can really just use the commandline directly. Skip the c and use bash.

Factorio will have a price increase this month and leave Early Access soon
3 April 2018 at 6:37 am UTC Likes: 1

Kimyrielle
PatolaI am curious, what would be the reason for a "no sales" policy?

Arrogance.

I'm pretty sure that's what your boss would say too when you don't partake in work-for-half-the-salary month...

Intel hires former-AMD Radeon Chief, Raja Koduri, Intel planning high-end discrete graphics solutions
10 November 2017 at 7:04 pm UTC

elmapulpsp ??

Platform Security Processor, the big firmware blob that is the OS beneath the OS.

SteamOS beta updated with Flatpak support
27 July 2017 at 7:27 pm UTC

How people think that concepts such as Flatpaks are better than SteamRuntime is beyond me.

The concept of Containers means that every application provides its own required libraries. Every sane person that cares about security has to ask himself who will update these libraries? This is going to be the same we have with Windows applications that litter the disk with their own versions of outdated libraries.

A concept such as SteamRuntime with a single runtime that gets updated by the provider of that runtime (here steam) seems way saner. They take care of updating the libraries and *all* applications will instantly get the added security benefits.

Containers are a nice way to install software, no doubt, but they bring the problems Windows has had for ages to Linux. The install a bunch of software outside of the established software management system (apt, yum, whatever) which is then exempt from updates. This central software management was one of the strong points of Linux once.

While SteamRuntime also runs outside of the system package management it is still a central place that takes care of library updates and, as added benefit, you can also install all libraries provided by steam runtime through your own package management, effectively removing the update problem.

I don't really get this recent obsession with containers. It feels like a 'Windowsization' of Linux to me ...

The share of Linux users on Steam is still holding steady
2 July 2017 at 4:27 pm UTC Likes: 6

AnxiousInfusionUnless the Steam client goes open source and they start offering DRM-free options, I will be ditching Steam ASAP.

Steam does not force games to use DRM. That is what the developers choose (or don't). As for it going open source: that's just as likely as Debian providing non-outdated software


AnxiousInfusionI hate having software installed on my system that shows me popup advertisements when I open it.. like why do I even make an exception to tolerate this shit?

You do know that you can disable these, right?

Steam -> Settings -> Interface -> "Notify me about [...]"

You will want to force your CPU into high performance mode for Vulkan games on Linux
23 March 2017 at 6:09 pm UTC

Concerning setuid on Scripts. This should *not* work on any recent Linux system, as it provides an even larger possible security vulnerability than setuid is to begin with. For details see here:

http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html

Regarding the frequency governers for Intel CPUs:

These governors are *not* comparable to the regular pstate driver for Linux (e.g. used on older Intel Cores and AMD Cores). Intel implements its own policies in the driver that are independent of the cpufreq policies. Thus cpufreq policies will *not* work as expected. Details can be found here:

https://www.kernel.org/doc/Documentation/cpu-freq/intel-pstate.txt

This driver especially does *not* honor additional cpufreq settings apart from max_freq / min_freq.

What have you been playing recently and what do you think about it?
11 March 2017 at 7:21 pm UTC

I liked Shadow Tactics a lot recently. And then I started playing EU4. Now I'm broke, have lost all my free time and kind of love/hate my friend for fixing me up to the game.

  Go to:
Livestreams & Videos
Community Livestreams
  • Friday Livestream with Samsai
  • Date:
See more!
Popular this week
View by Category
Contact
Latest Comments
Latest Forum Posts