This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] linux: add support for uname26 personality


On 12/03/2015 12:22 AM, Aurelien Jarno wrote:
> When the kernel is running under the uname26 personality (for programs
> that cannot handle "Linux 3.0"), it maps version 3.x to 2.6.40+x and
> 4.x to 2.6.60+x. When the GNU libc is configured with --enable-kernel=3.x
> or 4.x and uname26 personality is enabled, binaries get abort with a
> "FATAL: kernel too old message", even if the kernel actually supports
> such a binary.

I'm sorry, I don't think this is the correct way to handle this.  The
reason is that

> +/* When the kernel is running under the uname26 personality (for programs
> +   that cannot handle "Linux 3.0"), it maps version 3.x to 2.6.40+x and
> +   4.x to 2.6.60+x.  We need to convert that back to the standard version
> +   numbering to be able to compare versions.  */
> +static int
> +convert_from_uname26 (int version)
> +{
> +  if ((version & 0xffff00) == 0x020600)
> +    {
> +      /* 2.6.40+x to 3.x */
> +      if ((version & 0xff) >= 60)
> +	version += 0x020000 - 60;
> +      /* 2.6.60+x to 4.x */
> +      else if ((version & 0xff) >= 40)
> +	version += 0x010000 - 40;
> +    }
> +
> +  return version;
> +}

… this function will have to be changed again for Linux 5.0.

A long-term solution would map the minimum required version hard-coded
into libc to its 2.6 equivalent, and check that if the kernel reports a
2.6 version.  This is solves the forward compatibility issue because the
2.6 mapping for the minimum version is known at the time glibc is compiled.

Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]