2

My ubuntu server returns Linux 3.13.0-63-generic when I run uname -rs. From what I found in internet, uname is also a system call which can't be easily overridden when third party program run this system call from C++ for example.

Does anyone know if there is a way to spoof the return value, like by manipulating /proc/sys/kernel/ostype files? It will be even better if I can spoof it per process instance.

  • What does this have to do with Firefox? If your underlying problem has something to do with Firefox, ask a question about that problem; spoofing uname is unlikely to help. – Gilles Mar 15 '16 at 23:36
1

As far as I know, there are only limited ways in which release (uname -r) and machine (uname -m) can be customized per process using the personality() system call, all exposed through the setarch command, and sysname (uname -r) cannot be customized at all.

$ uname -rsm; setarch i386 --uname-2.6 --32bit uname -rsm
Linux 3.16.0-4-amd64 x86_64
Linux 2.6.56-4-amd64 i686

If you want to spoof uname in a different way and the program is dynamically linked, you can use LD_PRELOAD to override the uname function; see Redirect a file descriptor before execution for an example of function overload through LD_PRELOAD. If the program is statically linked, you can use ptrace to spoof its system calls, but that requires fancier programming.

  • Thank you for detailed answer. The reason I want to override uname system call and added a firefox tag is because firefox flash plugin use this call in one of the functions and I want it to return a faked value. I don't know if flash plugin is statically or dynamically linked, but I want to hire a freelancer to do this job and want to understand what proggramming skills he should have. Do you think it will be easier to override flash plugin function that use uname instead of overridding system calls? – offline15 Mar 16 '16 at 7:57
  • @offline15 Overriding a function call is definitely easier than overriding a system call. I'm doubtful that changing what uname returns would solve whatever problem you're having with the Flash plugin though. – Gilles Mar 16 '16 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.