Andi Kleen be27425dcc Add a personality to report 2.6.x version numbers
I ran into a couple of programs which broke with the new Linux 3.0
version.  Some of those were binary only.  I tried to use LD_PRELOAD to
work around it, but it was quite difficult and in one case impossible
because of a mix of 32bit and 64bit executables.

For example, all kind of management software from HP doesnt work, unless
we pretend to run a 2.6 kernel.

  $ uname -a
  Linux svivoipvnx001 3.0.0-08107-g97cd98f #1062 SMP Fri Aug 12 18:11:45 CEST 2011 i686 i686 i386 GNU/Linux

  $ hpacucli ctrl all show

  Error: No controllers detected.

  $ rpm -qf /usr/sbin/hpacucli
  hpacucli-8.75-12.0

Another notable case is that Python now reports "linux3" from
sys.platform(); which in turn can break things that were checking
sys.platform() == "linux2":

  https://bugzilla.mozilla.org/show_bug.cgi?id=664564

It seems pretty clear to me though it's a bug in the apps that are using
'==' instead of .startswith(), but this allows us to unbreak broken
programs.

This patch adds a UNAME26 personality that makes the kernel report a
2.6.40+x version number instead.  The x is the x in 3.x.

I know this is somewhat ugly, but I didn't find a better workaround, and
compatibility to existing programs is important.

Some programs also read /proc/sys/kernel/osrelease.  This can be worked
around in user space with mount --bind (and a mount namespace)

To use:

  wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c
  gcc -o uname26 uname26.c
  ./uname26 program

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-25 10:17:28 -07:00
..
2011-07-26 16:49:45 -07:00
2011-03-14 09:15:23 -04:00
2011-07-26 16:49:47 -07:00
2011-07-26 16:49:47 -07:00
2011-05-19 18:51:57 +10:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-07-14 12:59:14 +03:00
2011-07-26 16:49:44 -07:00
2011-05-17 23:19:17 +02:00
2011-08-04 09:09:27 +02:00
2011-08-03 22:03:29 -10:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:45 -07:00
2011-05-24 12:10:51 +02:00
2011-07-26 16:49:47 -07:00
2011-05-20 12:50:29 -07:00
2011-07-26 16:49:47 -07:00
2011-07-26 16:49:47 -07:00
2011-07-30 21:21:39 +02:00
2011-07-26 16:49:47 -07:00
2011-03-31 11:26:23 -03:00
2011-04-24 13:18:38 +02:00
2011-07-26 16:49:47 -07:00
2011-08-12 16:21:35 -05:00
2011-08-12 16:21:35 -05:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00