Bug 1465 - setrlimit broken on old i386 kernels
Summary: setrlimit broken on old i386 kernels
Status: NEW
Alias: None
Product: uClibc
Classification: Unclassified
Component: Other (show other bugs)
Version: 0.9.30.3
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-01 03:10 UTC by Michael Deutschmann
Modified: 2015-12-02 19:38 UTC (History)
1 user (show)

See Also:
Host: i386-pc-linux-uclibc
Target:
Build:


Attachments
Fix for setrlimit on old kernels (1.39 KB, patch)
2010-04-01 03:10 UTC, Michael Deutschmann
Details
Fix for setrlimit on old kernels, against 0.9.31 (1.38 KB, patch)
2010-05-19 01:12 UTC, Michael Deutschmann
Details
Fix for setrlimit on old kernels, against 0.9.32 (777 bytes, patch)
2011-06-17 13:31 UTC, Michael Deutschmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Deutschmann 2010-04-01 03:10:34 UTC
Created attachment 1435 [details]
Fix for setrlimit on old kernels

On Linux 2.0.40, setting a limit to infinity with setrlimit() produces an error.

The problem is that __UCLIBC_HANDLE_OLDER_RLIMIT__ is incorrectly switched off for the i386 platform.  Reversing that fixes the bug.

However, this bug seems to exist to paper over a separate bug, which would otherwise cause 2.4+ kernels to be treated like 2.2/2.0.  This is that the code assumes that all kernels with a history of signed int limits but current support for unsigned int limits, provide a "usetrlimit" system call.  But recent kernels actually add only a ugetrlimit call.

I'm attaching a patch that fixes the define, and also fixes the code so that *either* the absence of __UCLIBC_HANDLE_OLDER_RLIMIT__, or the presence of __NR_ugetrlimit, is enough to allow > 2^31 limits to be passed to the setrlimit syscall.  This should avoid any regression on 2.4/2.6.
Comment 1 Michael Deutschmann 2010-05-19 01:12:18 UTC
Created attachment 1747 [details]
Fix for setrlimit on old kernels, against 0.9.31

Here is a version of the patch for the current release version, 0.9.31
Comment 2 Bernhard Reutner-Fischer 2011-05-02 08:54:44 UTC
(In reply to comment #1)
> Created attachment 1747 [details]
> Fix for setrlimit on old kernels, against 0.9.31
> 
> Here is a version of the patch for the current release version, 0.9.31

Can you handle that in libc/sysdeps/linux/common/bits/kernel-features.h instead?

TIA,
Comment 3 Michael Deutschmann 2011-06-17 13:31:36 UTC
Created attachment 3421 [details]
Fix for setrlimit on old kernels, against 0.9.32