linux-mips
[Top] [All Lists]

Re: prlimit64: inconsistencies between kernel and userland

To: Rich Felker <dalias@aerifal.cx>
Subject: Re: prlimit64: inconsistencies between kernel and userland
From: "Joseph S. Myers" <joseph@codesourcery.com>
Date: Tue, 5 Nov 2013 15:13:23 +0000
Cc: David Miller <davem@davemloft.net>, <aurelien@aurel32.net>, <linux-mips@linux-mips.org>, <libc-alpha@sourceware.org>
In-reply-to: <20131105012203.GA24286@brightrain.aerifal.cx>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20130628133835.GA21839@hall.aurel32.net> <20131104213756.GD18700@hall.aurel32.net> <20131104.194519.1657797548878784116.davem@davemloft.net> <Pine.LNX.4.64.1311050058580.9883@digraph.polyomino.org.uk> <20131105012203.GA24286@brightrain.aerifal.cx>
Sender: linux-mips-bounce@linux-mips.org
On Mon, 4 Nov 2013, Rich Felker wrote:

> > Surely you can create new symbol versions for getrlimit64 and setrlimit64, 
> > with the old versions just using the 32-bit syscalls (or otherwise 
> > translating between conventions, but using the 32-bit syscalls is the 
> > simplest approach)?  I see no need to break compatibility with existing 
> > binaries.
> > 
> > As I noted in 
> > <https://sourceware.org/ml/libc-ports/2006-05/msg00020.html>, at that time 
> > the value of RLIM64_INFINITY for o32/n32 was purely a glibc convention the 
> > kernel didn't see at all.  It's only with the use of newer syscalls that 
> > this glibc convention is any sort of problem.
> 
> Why not just make them convert any value >= 0x7fffffffffffffff to
> infinity before making the syscall? There's certainly no meaningful
> use for finite values in that range...

It might be possible to do such a conversion in setrlimit64 - I'm not sure 
offhand if such a conversion for large finite values is valid, and a new 
symbol version is certainly the more conservative option - but getrlimit64 
in existing binaries should return results using the existing 
RLIM64_INFINITY, in case binaries compare against that, so if you change 
the header value to match the kernel I don't think you can avoid the new 
symbol version for getrlimit64, and versioning both together seems safer.

-- 
Joseph S. Myers
joseph@codesourcery.com

<Prev in Thread] Current Thread [Next in Thread>