Add a personality to report 2.6.x version numbers
PATCH 1/1 Add a personality to report 2.6.x version numbers
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
-Andi
--
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.
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
--- include/linux/personality.h | 1 + kernel/sys.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 0 deletions(-)
include/linux/personality.h +1 -0
@@ -22,6 +22,7 @@ extern int __set_personality(unsigned int);* These occupy the top three bytes. */ enum { +UNAME26 =0x0020000 ,ADDR_NO_RANDOMIZE =0x0040000 ,/* disable randomization of VA space */ FDPIC_FUNCPTRS =0x0080000 ,/* userspace function ptrs point to descriptors * (signal handling)
kernel/sys.c +38 -0
@@ -37,6 +37,8 @@#include <linux/fs_struct.h> #include <linux/gfp.h> #include <linux/syscore_ops.h> +#include <linux/version.h> +#include <linux/ctype.h> #include <linux/compat.h> #include <linux/syscalls.h>
@@ -44,6 +46,8 @@#include <linux/user_namespace.h> #include <linux/kmsg_dump.h> +/* Move somewhere else to avoid recompiling? */ +#include <generated/utsrelease.h> #include <asm/uaccess.h> #include <asm/io.h>
@@ -1154,6 +1158,34 @@ DECLARE_RWSEM(uts_sem);#define override_architecture (name) 0#endif +/* +* Work around broken programs that cannot handle "Linux 3.0". +* Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 +*/ +static int override_release (char __user *release,int len) +{ +int ret =0 ; +char buf[len]; + +if (current->personality &UNAME26 ) { +char *rest =UTS_RELEASE ; +int ndots =0 ; +unsigned v; + +while (*rest) { +if (*rest =='.' && ++ndots >=3 ) +break ; +if (!isdigit (*rest) && *rest !='.' ) +break ; + rest++; + } + v = ((LINUX_VERSION_CODE >>8 ) &0xff ) +40 ; +snprintf (buf, len,"2.6.%u%s" , v, rest); + ret =copy_to_user (release, buf, len); + } +return ret; +} + SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) {int errno =0 ;
@@ -1163,6 +1195,8 @@ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) errno = -EFAULT ;up_read (&uts_sem); +if (!errno &&override_release (name->release,sizeof (name->release))) + errno = -EFAULT ;if (!errno &&override_architecture (name)) errno = -EFAULT ;return errno;
@@ -1184,6 +1218,8 @@ SYSCALL_DEFINE1(uname, struct old_utsname __user *, name) error = -EFAULT ;up_read (&uts_sem); +if (!error &&override_release (name->release,sizeof (name->release))) + error = -EFAULT ;if (!error &&override_architecture (name)) error = -EFAULT ;return error;
@@ -1218,6 +1254,8 @@ SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)if (!error &&override_architecture (name)) error = -EFAULT ; +if (!error &&override_release (name->release,sizeof (name->release))) + error = -EFAULT ; return error ? -EFAULT : 0; }#endif
Signature · 1 line
1.7.4.4
Hi,
Quoted 7 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
FWIW, couldn't this be made a boot option ?
That might help some distros, say Fedora, who actually ships 2.6.40+x-branded kernels, or allow people to use no longer supported distros with recent kernels.
About this last point, once functional, I intend to upgrade my trixbox install (based on 2.6.18) to a 3.x-ish kernel, that might be fun...
Thanks,
- Arnaud
Quoted 135 lines
-Andi
--
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_PRELOADto work around it, but it was quite difficult and in one case impossible because of a mix of 32bit and 64bit executables.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 programSigned-off-by Andi Kleen <[email protected]>---
include/linux/personality.h | 1 +
kernel/sys.c | 38 ++++++++++++++++++++++++++++++++++++++2 files changed, 39 insertions(+), 0 deletions(-)include/linux/personality.h +1
-0@@ -22,6 +22,7 @@ extern int __set_personality(unsigned int);* These occupy the top three bytes. */ enum { + UNAME26 = 0x0020000,ADDR_NO_RANDOMIZE =
0x0040000, /* disable randomization of VA space */FDPIC_FUNCPTRS= 0x0080000, /* userspace function ptrs point to descriptors
* (signal handling)kernel/sys.c +38
-1@@ -37,6 +37,8 @@ #include <linux/fs_struct.h> #include <linux/gfp.h> #include <linux/syscore_ops.h> +#include <linux/version.h> +#include <linux/ctype.h> #include <linux/compat.h> #include <linux/syscalls.h>@@ -44,6 +46,8 @@ #include <linux/user_namespace.h> #include <linux/kmsg_dump.h> +/* Move somewhere else to avoid recompiling? */ +#include <generated/utsrelease.h> #include <asm/uaccess.h> #include <asm/io.h>@@ -1154,6 +1158,34 @@ DECLARE_RWSEM(uts_sem); #define override_architecture(name) 0 #endif +/* +* Work around broken programs that cannot handle "Linux 3.0". +* Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 +*/ +static int override_release (char __user *release,int len) +{ + int ret = 0; + char buf[len]; + + if (current->personality & UNAME26) { + char *rest = UTS_RELEASE; + int ndots = 0; + unsigned v; + + while (*rest) { + if (*rest == '.' && ++ndots >= 3) + break; + if (!isdigit(*rest) && *rest != '.') + break; + rest++; + } + v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; + snprintf(buf, len, "2.6.%u%s", v, rest); + ret = copy_to_user(release, buf, len); + } + return ret; +} + SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) { int errno = 0;@@ -1163,6 +1195,8 @@ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) errno = -EFAULT; up_read(&uts_sem); + if (!errno && override_release(name->release, sizeof(name->release))) + errno = -EFAULT; if (!errno && override_architecture(name)) errno = -EFAULT; return errno;@@ -1184,6 +1218,8 @@ SYSCALL_DEFINE1(uname, struct old_utsname __user *, name) error = -EFAULT; up_read(&uts_sem); + if (!error && override_release(name->release, sizeof(name->release))) + error = -EFAULT; if (!error && override_architecture(name)) error = -EFAULT; return error;@@ -1218,6 +1254,8 @@ SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name) if (!error && override_architecture(name)) error = -EFAULT; + if (!error && override_release(name->release, sizeof(name->release))) + error = -EFAULT; return error ? -EFAULT : 0; } #endif --1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 10 lines · Arnaud Lacombe
Hi,
Quoted 7 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
Quoted 9 lines
FWIW, couldn't this be made a boot option ?
That might help some distros, say Fedora, who actually ships 2.6.40+x-branded kernels, or allow people to use no longer supported distros with recent kernels.
About this last point, once functional, I intend to upgrade my trixbox install (based on 2.6.18) to a 3.x-ish kernel, that might be fun...
Just a random thought.
Since this is purely to be backwards compatible with binary only software that makes bad assumptions about the kernel version (as far as I can tell at least), shouldn't we make it explicit from the beginning that this will have a limited life time by adding it to Documentation/feature-removal-schedule.txt with a removal date at somewhere soon(ish) like 3.6 (or something) at day one?
I can't imaging we'd want to support something like this forever going forward... or..?
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
Quoted 11 lines · Arnaud Lacombe
Hi,
Quoted 7 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
FWIW, couldn't this be made a boot option ?
init=/script/that/runs/uname26/sbin/init
-Andi
Quoted 18 lines · Jesper Juhl
Quoted 16 lines · Arnaud Lacombe
Hi,
Quoted 7 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
FWIW, couldn't this be made a boot option ?
That might help some distros, say Fedora, who actually ships 2.6.40+x-branded kernels, or allow people to use no longer supported distros with recent kernels.
Quoted 7 lines
Quoted 3 lines
About this last point, once functional, I intend to upgrade my trixbox install (based on 2.6.18) to a 3.x-ish kernel, that might be fun...
Just a random thought.
Since this is purely to be backwards compatible with binary only software that makes bad assumptions about the kernel version (as far as I can
Believe it or not, even users of programs with source do not necessarily want or are able to to patch the program and recompile.
Also binary compatibility is important. It's one of the things that made Linux successfull.
Quoted 2 lines
tell at least), shouldn't we make it explicit from the beginning that this will have a limited life time by adding it to
No.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Hi,
Quoted 6 lines · Andi Kleen
Quoted 5 lines · Arnaud Lacombe
Hi,
Quoted 2 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
FWIW, couldn't this be made a boot option ?
init=/script/that/runs/uname26/sbin/init
It does not work if / on a ROM, unless you start using trampoline partition, but this is starting to become really convoluted...
- Arnaud
Quoted 2 lines
It does not work if / on a ROM, unless you start using trampoline partition, but this is starting to become really convoluted...
On a ROM you never change the kernel.
Besides who uses ROMs now when there is flash?
-Andi
Hi,
Quoted 5 lines · Andi Kleen
Quoted 2 lines
It does not work if / on a ROM, unless you start using trampoline partition, but this is starting to become really convoluted...
On a ROM you never change the kernel.
For this particular board, the kernel is on a small read-write NOR flash, and the userland on write-protected NAND chip.
Quoted 2 lines
Besides who uses ROMs now when there is flash?
this is totally irrelevant to the problem...
- Arnaud
Quoted 10 lines · Arnaud Lacombe
Hi,
Quoted 5 lines · Andi Kleen
Quoted 2 lines
It does not work if / on a ROM, unless you start using trampoline partition, but this is starting to become really convoluted...
On a ROM you never change the kernel.
For this particular board, the kernel is on a small read-write NOR flash, and the userland on write-protected NAND chip.
You can use a initrd
And hopefully it's not connected to any network, because you can't fix any security holes.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Quoted 11 lines · Arnaud Lacombe
Hi,
Quoted 7 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
FWIW, couldn't this be made a boot option ?
A boot parameter to change kernel version sounds odd.
Quoted 8 lines
That might help some distros, say Fedora, who actually ships 2.6.40+x-branded kernels, or allow people to use no longer supported distros with recent kernels.
About this last point, once functional, I intend to upgrade my trixbox install (based on 2.6.18) to a 3.x-ish kernel, that might be fun...
Then a Kconfig option would help.
Quoted 3 lines · Andi Kleen
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
I have heard this several times now, but nobody actually ever says *what* is broken.
The Fedora people seem to have done the 2.6.40 thing without any actual reason, for example (the two programs they claim were broken were things that they had already fixed in rawhide, afaik).
I'm not at all interested in these kinds of "all kinds of software" reports.
Details. Examples. Name the f&*cking names already. Shame them publicly.
Linus
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Andi Kleen
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
I have heard this several times now, but nobody actually ever says *what* is broken.
Quoted 7 lines
The Fedora people seem to have done the 2.6.40 thing without any actual reason, for example (the two programs they claim were broken were things that they had already fixed in rawhide, afaik).
I'm not at all interested in these kinds of "all kinds of software" reports.
Details. Examples. Name the f&*cking names already. Shame them publicly.
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
Quoted 20 lines · Eric Dumazet
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Andi Kleen
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
I have heard this several times now, but nobody actually ever says *what* is broken.
Quoted 7 lines
The Fedora people seem to have done the 2.6.40 thing without any actual reason, for example (the two programs they claim were broken were things that they had already fixed in rawhide, afaik).
I'm not at all interested in these kinds of "all kinds of software" reports.
Details. Examples. Name the f&*cking names already. Shame them publicly.
For example, all kind of management software from HP doesnt work, unless we pretend to run a 2.6 kernel.
Quoted 8 lines
$ 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 showError: No controllers detected.
Perhaps the 3.x version change patch should be reverted on the never-ever-break-userspace grounds. :-) It would appear that the 2.6 version information has become a de facto part of the kernel's ABI.
David Daney
Quoted 1 line
Details. Examples. Name the f&*cking names already. Shame them publicly.
My original motivation for this was pin (http://www.pintool.org/)
However that got fixed in pin after I posted v1.
Then people kept emailing me that they had their own applications with similar problems. I don't have a lot of details on those, but I hope others will chime in on this thread.
e.g. Dirk claimed he had a bunch. Dirk?
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
PATCH 1/1 setarch: Add --uname-2.6 option for personality flag UNAME26
In reply to Andi Kleen---
On Fri, 2011-08-19 at 16:15 -0700, Andi Kleen wrote:
[...]
Quoted 5 lines
To use:
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 program
[...]
I would suggest adding this to setarch, as that handles all the other personality flags. The following patch to util-linux seems to do the trick.
Ben.
configure.ac | 1 + sys-utils/setarch.8 | 3 +++ sys-utils/setarch.c | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletions(-)
configure.ac +1 -0
@@ -792,6 +792,7 @@ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,, [#include <sys/stat.h>]) AC_CHECK_DECLS([ + UNAME26, ADDR_NO_RANDOMIZE, FDPIC_FUNCPTRS, MMAP_PAGE_ZERO,
sys-utils/setarch.8 +3 -0
@@ -29,6 +29,9 @@ Be verbose. .I "\-h," "\-\-help" Display help (it is also displayed when setarch takes no arguments). .TP +.I "\-\-uname\-2.6" +Causes the program to see a kernel version number beginning with 2.6. +.TP .I "\-3," "\-\-3gb" Specifies that processes should use a maximum of 3GB of address space on systems where it is supported (ADDR_LIMIT_3GB). .TP
sys-utils/setarch.c +11 -1
@@ -41,6 +41,8 @@/* Option --4gb has no equivalent short option, use a non-character as a pseudo short option. */ #define OPT_4GB (CHAR_MAX+1) +/* Similarly for --uname-2.6 */ +#define OPT_UNAME26 (OPT_4GB+1)#define turn_on (_flag, _opts) \ do { \
@@ -50,6 +52,9 @@ } while(0) +#if !HAVE_DECL_UNAME26 +# define UNAME26 0x0020000 +#endif #if !HAVE_DECL_ADDR_NO_RANDOMIZE # define ADDR_NO_RANDOMIZE 0x0040000#endif
@@ -98,6 +103,7 @@ static const struct option longopts[] = { "sticky-timeouts", 0, 0, 'T' }, { "3gb", 0, 0, '3' }, { "4gb", 0, 0, OPT_4GB }, + { "uname-2.6", 0, 0, OPT_UNAME26 }, { NULL, 0, 0, 0 } };
@@ -125,7 +131,8 @@ show_help(void)" -S, --whole-seconds turns on WHOLE_SECONDS\n" " -T, --sticky-timeouts turns on STICKY_TIMEOUTS\n" " -3, --3gb limits the used address space to a maximum of 3 GB\n" - " --4gb ignored (for backward compatibility only)\n")); +" --4gb ignored (for backward compatibility only)\n" + " --uname-2.6 turns on UNAME26\n"));printf (_ ("\nFor more information see setarch(8).\n" ));exit (EXIT_SUCCESS );
@@ -306,6 +313,9 @@ int main(int argc, char *argv[])break ;case OPT_4GB :/* just ignore this one */ break ; +case OPT_UNAME26 : +turn_on (UNAME26 , options); +break ; } }
Signature · 1 line
1.7.5.4
Re: [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26
Quoted 6 lines · Ben Hutchings
Signed-off-by Ben Hutchings <[email protected]>---
On Fri, 2011-08-19 at 16:15 -0700, Andi Kleen wrote:
[...]Quoted 2 lines
To use:
Quoted 8 lines
Quoted 3 lines
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 program[...]
I would suggest adding this to setarch, as that handles all the other personality flags. The following patch to util-linux seems to do the trick.
I have one simple rule: "Linus' tree first", and I don't see UNAME26 in include/linux/personality.h ...
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Re: [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26
Quoted 10 lines · Karel Zak
Quoted 9 lines · Ben Hutchings
Signed-off-by Ben Hutchings <[email protected]>---
On Fri, 2011-08-19 at 16:15 -0700, Andi Kleen wrote:
[...]Quoted 5 lines
To use:
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 program
Quoted 8 lines
Quoted 5 lines
[...]
I would suggest adding this to setarch, as that handles all the other personality flags. The following patch to util-linux seems to do the trick.
I have one simple rule: "Linus' tree first", and I don't see UNAME26 in
include/linux/personality.h...
Sure, I don't expect this to be applied until and unless Linus takes the kernel patch.
Ben.
Quoted 4 lines · Andi Kleen
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_PRELOADto work around it, but it was quite difficult and in one case impossible because of a mix of 32bit and 64bit executables.
I guess another option would be to add a new sys_newnewuname syscall and change glibc. You could use symbol versioning so that old applications continue to see the 2.6.x version numbers, while anything that is built against a new glibc would see the true version.
Quoted 2 lines
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.
Why not just always return 3.6.39 or 2.6.40 hardcoded? If an application does not understand the concept of future kernel versions, it won't need to know which future version it's running on.
Arnd
Quoted 1 line · Linus Torvalds
Details. Examples. Name the f&*cking names already. Shame them publicly.
A notable one 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
Seems pretty clear to me though it's a bug in the apps that are using '==' instead of .startswith().
Quoted 9 lines
A notable one is that Python now reports "linux3" from
sys.platform(); which in turn can break things that were checkingsys.platform()== "linux2".https://bugzilla.mozilla.org/show_bug.cgi?id=664564
Seems pretty clear to me though it's a bug in the apps that are using '==' instead of .startswith().
That's a good point. I googled for this pattern in google codesearch and there are 10+ in the first two pages.
http://www.google.com/codesearch#search/&q=lang:^python$%20sys.platform%20linux2&p=1&type=cs
-andi
Quoted 5 lines · Andi Kleen
That's a good point. I googled for this pattern in google codesearch and there are 10+ in the first two pages.
http://www.google.com/codesearch#search/&q=lang:^python$%20sys.platform%20linux2&p=1&type=cs
Yes, though I should note I wasn't trying to defend having a compatibility sysctl or whatever - I think it's clear these apps are broken. The python docs explicitly say that the returned string is just a straightforward transformation of uname, and if the apps read that carefully they'd realize they only want the first part.
The reportlab example will break for FreeBSD 5 too:
elif sys.platform in ("freebsd4", "darwin", "mac", "linux2"):I just happen to watch Mozilla bugzilla so I saw that one go by and wanted to provide data for the discussion.
Hi,
Quoted 4 lines · Colin Walters
[...]
I just happen to watch Mozilla bugzilla so I saw that one go by and wanted to provide data for the discussion.
Just to provide fuel, you can also just do a regular google search for "strncmp release 2.6". Lots of exploits, but not only.
- Arnaud
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Colin Walters
Seems pretty clear to me though it's a bug in the apps that are using '==' instead of .startswith().
This doesn't count under "no userspace breakage" doctrine. Or rather, it shouldn't.
valgrind _compilation_ was broken by 3.0:
11 *valgrind-3.6.1-r1 (09 Jun 2011)
12
13 09 Jun 2011; Anthony G. Basile <[email protected]>
14 +valgrind-3.6.1-r1.ebuild, +files/valgrind-3.6.1-linux-3.patch:
15 Fixed to build against linux-3.x, bug #370857
Was this fixed? Yes.
Will this break one more time? Of course!
case "${kernel}" in
- 2.6.*)
+ 2.6.*|3.*)
AC_MSG_RESULT([2.6 family (${kernel})])Review
Quoted 7 lines · Alexey Dobriyan
Was this fixed? Yes.
Will this break one more time? Of course!case "${kernel}" in(quoted diff) +1
-1- 2.6.*) + 2.6.*|3.*) AC_MSG_RESULT([2.6 family (${kernel})])
What you need is an exaustive list of past versions plus a catch-all for future versions:
case "${kernel}" in
1.*|2.0.*|2.1.*|2.2.*|2.3.*)
echo "too old"
;;
2.4.*)
echo "Linux-2.4 style"
;;
2.5.*)
echo "unstable and not supported"
;;
*)
echo "2.6 or newer"
;;
esacWe don't break ABIs as a rule, so you should always assume that a newer version will keep working.
Arnd
Quoted 22 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
Only change is rebase against current master.
-Andi
--
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_PRELOADto work around it, but it was quite difficult and in one case impossible because of a mix of 32bit and 64bit executables.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.
Quoted 8 lines
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
I hate to ask, but can you put a proper copyright and license on this file so that distros can distribute it?
thanks,
greg k-h
Re: [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26
In reply to Karel ZakQuoted 10 lines · Karel Zak
Quoted 9 lines · Ben Hutchings
Signed-off-by Ben Hutchings <[email protected]>---
On Fri, 2011-08-19 at 16:15 -0700, Andi Kleen wrote:
[...]Quoted 5 lines
To use:
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 program
Quoted 8 lines
Quoted 5 lines
[...]
I would suggest adding this to setarch, as that handles all the other personality flags. The following patch to util-linux seems to do the trick.
I have one simple rule: "Linus' tree first", and I don't see UNAME26 in
include/linux/personality.h...
It's in Linus's tree now, and will be in the next 3.0.y stable release.
thanks,
greg k-h
Quoted 6 lines
Quoted 3 lines
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 programI hate to ask, but can you put a proper copyright and license on this file so that distros can distribute it?
I assumed it's too trivial for that.
Anyways I put a GPL license on it now.
-Andi
Quoted 8 lines · Andi Kleen
Quoted 6 lines
Quoted 3 lines
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 programI hate to ask, but can you put a proper copyright and license on this file so that distros can distribute it?
I assumed it's too trivial for that.
Lawyers never assume that :)
Quoted 1 line
Anyways I put a GPL license on it now.
Thanks, much appreciated.
greg k-h
Quoted 11 lines · Andi Kleen
Quoted 6 lines
Quoted 3 lines
wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c gcc -o uname26
uname26.c
./uname26 programI hate to ask, but can you put a proper copyright and license on this file so that distros can distribute it?
I assumed it's too trivial for that.
Anyways I put a GPL license on it now.
Hi Andi
I assume the mention of "mcelog" is a cut'n'paste error and that it really should have been "uname26", so here's a trivial patch to correct that. I also deleted all trailing whitespace and used EXIT_FAILURE rather than 1 for exit().
Take it or leave it :)
---
uname26.c renamed from uname26.c.orig +8 -8
@@ -1,19 +1,19 @@ -/* Copyright (C) 2011 Intel Corporation +/* Copyright (C) 2011 Intel Corporation Author: Andi Kleen Set 2.6.x personality -mcelog is free software; you can redistribute it and/or +uname26 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2. -mcelog is distributed in the hope that it will be useful, +uname26 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should find a copy of v2 of the GNU General Public License somewhere -on your Linux system; if not, write to the Free Software Foundation, +on your Linux system; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <sys/personality.h> #include <stdio.h>
@@ -26,15 +26,15 @@int main (int ac,char **av) { -if (!av[1 ]) { +if (!av[1 ]) {fprintf (stderr,"Usage: uname26 program ...\n" "Run program with the uname 2.6 personality\n" ); -exit (1 ); +exit (EXIT_FAILURE ); }if (personality (PER_LINUX |UNAME26 ) <0 )perror ("personality" ),exit (1 ); - +execvp (av[1 ], av +1 );fprintf (stderr,"Cannot execute %s: %s\n" , av[1 ],strerror (errno)); -exit (1 ); +exit (EXIT_FAILURE ); }
Signature · 3 lines
Jesper Juhl <[email protected]> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please.
Karel Zak
AppliedRe: [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26
In reply to Ben HutchingsQuoted 4 lines · Ben Hutchings
configure.ac | 1 + sys-utils/setarch.8 | 3 +++ sys-utils/setarch.c | 12 +++++++++++- 3 files changed, 15 insertions(+), 1 deletions(-)
Applied, thanks.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Andi Kleen
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
I have heard this several times now, but nobody actually ever says *what* is broken.
Quoted 7 lines
The Fedora people seem to have done the 2.6.40 thing without any actual reason, for example (the two programs they claim were broken were things that they had already fixed in rawhide, afaik).
I'm not at all interested in these kinds of "all kinds of software" reports.
Details. Examples. Name the f&*cking names already. Shame them publicly.
ketchup :-(. And no, it is probably not what you wanted, and no, it is not easy to fix.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Pavel Machek
Quoted 10 lines · Linus Torvalds
Quoted 2 lines · Andi Kleen
Reposting due to popular demand. Several other people are running into the same problem with all kinds of software.
I have heard this several times now, but nobody actually ever says *what* is broken.
The Fedora people seem to have done the 2.6.40 thing without any actual reason, for example (the two programs they claim were broken were things that they had already fixed in rawhide, afaik).
Quoted 6 lines
Quoted 3 lines
I'm not at all interested in these kinds of "all kinds of software" reports.
Details. Examples. Name the f&*cking names already. Shame them publicly.
ketchup :-(. And no, it is probably not what you wanted, and no, it is not easy to fix.
ketchup? [1]
Well, I think it doesn't really matter at all, if ketchup broke with 3.x kernels, but there is a (semi-)working version of ketchup (I'm not very proud of the code I wrote), which works with 3.x kernels (and fortunately with 4.x and later).
[1] https://github.com/psomas/ketchup
Thanks,
Signature · 7 lines
Stratos Psomadakis <[email protected]> -- Stratos Psomadakis <[email protected]>
Quoted 1 line
ketchup? [1]
My patch won't fix ketchup. Obviously it cannot download 2.6.40
-Andi
Quoted 4 lines · Andi Kleen
Quoted 1 line
ketchup? [1]
My patch won't fix ketchup. Obviously it cannot download 2.6.40
-Andi
Well, since ketchup does not in any way rely on the kernel version reported at 'runtime' (ie by uname), your patch doesn't actually affect ketchup.
Anyway, I think that this discussion is a bit 'offtopic', since I didn't think you had ketchup (or similar scripts) in mind for this patch. I just replied to Pavel, just to let him (and anyone else interested) know, that ketchup has in fact been updated to handle the newer kernel versions.
Thanks,
Signature · 2 lines
Stratos Psomadakis <[email protected]>