This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/22678] prlimit fails for RLIM_INFINITY values on 32-bit machines
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 05 Jan 2018 19:35:55 +0000
- Subject: [Bug libc/22678] prlimit fails for RLIM_INFINITY values on 32-bit machines
- Auto-submitted: auto-generated
- References: <bug-22678-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=22678
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via a6d0afb5075486773c4c70119a9bd9cd78faec9e (commit)
via 19be56d8cef5c157f436234b3af4439437da259f (commit)
via 24731685c89dbd2c4579234583c268b52d943d0b (commit)
via 8e900969dbde8e46963b3be4005d7941792327cb (commit)
via 0d0bc784cafcd27f1cf9584b2424fcfbf07b24f6 (commit)
from f1a844ac6389ea4e111afc019323ca982b5b027d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a6d0afb5075486773c4c70119a9bd9cd78faec9e
commit a6d0afb5075486773c4c70119a9bd9cd78faec9e
Author: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri Jan 5 20:34:10 2018 +0100
resource/tst-getrlimit.c: Add copyright header
The initial year is based on the date in the original ChangeLog entry
(2005-06-21).
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=19be56d8cef5c157f436234b3af4439437da259f
commit 19be56d8cef5c157f436234b3af4439437da259f
Author: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri Jan 5 20:34:10 2018 +0100
Add test for getrlimit/setrlimit/prlimit with infinity value
Add a test to check that the getrlimit, setrlimit and prlimit functions
and their 64-bit equivalent behave correctly with RLIM_INFINITY and
RLIM64_INFINITY. For that it assumes that the prlimit64 function calls
the syscall directly without translating the value and that the kernel
uses the -1 value to represent infinity.
It first finds a resource with the hard limit set to infinity so the
soft limit can be manipulated easily and check for the consistency
between the value set or get by the prlimit64 and the other functions.
It is Linux specific add it uses the prlimit and prlimit64 functions.
Changelog:
* sysdeps/unix/sysv/linux/tst-rlimit-infinity.c: New file.
* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-rlimit-infinity.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=24731685c89dbd2c4579234583c268b52d943d0b
commit 24731685c89dbd2c4579234583c268b52d943d0b
Author: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri Jan 5 20:34:10 2018 +0100
prlimit: Translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY [BZ
#22678]
prlimit called without a new value fails on 32-bit machines if any of
the soft or hard limits are infinity. This is because prlimit does not
translate old_rlimit from RLIM64_INFINITY to RLIM_INFINITY, but checks
that the value returned by the prlimit64 syscall fits into a 32-bit
value, like it is done for example in getrlimit. Note that on the
other hand new_rlimit is correctly translated from RLIM_INFINITY to
RLIM64_INFINITY before calling the syscall.
This patch fixes that.
Changelog:
[BZ #22678]
* sysdeps/unix/sysv/linux/prlimit.c (prlimit): Translate
old_rlimit from RLIM64_INFINITY to RLIM_INFINITY.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8e900969dbde8e46963b3be4005d7941792327cb
commit 8e900969dbde8e46963b3be4005d7941792327cb
Author: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri Jan 5 20:34:10 2018 +0100
Alpha: Fix the RLIM_INFINITY and RLIM64_INFINITY constants
Fix the RLIM_INFINITY and RLIM64_INFINITY constants on alpha to match
the kernel one and all other architectures. Change the getrlimit,
getrlimit64, setrlimit, setrlimit64 into old compat symbols, and provide
the Linux generic functions as GLIBC_2_27 version.
Changelog:
* sysdeps/unix/sysv/linux/getrlimit64.c [USE_VERSIONED_RLIMIT]: Do not
define getrlimit and getrlimit64 as weak aliases of __getrlimit64.
Define __GI_getrlimit64 as weak alias of __getrlimit64.
[__RLIM_T_MATCHES_RLIM64_T]: Do not redefine SHLIB_COMPAT, use #elif
instead.
* sysdeps/unix/sysv/linux/setrlimit64.c [USE_VERSIONED_RLIMIT]: Do not
define setrlimit and setrlimit64 as weak aliases of __setrlimit64.
* sysdeps/unix/sysv/linux/alpha/bits/resource.h (RLIM_INFINITY,
RLIM64_INFINITY): Fix values to match the kernel ones.
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: Define
USE_VERSIONED_RLIMIT. Rename __getrlimit64 into __old_getrlimit64 and
provide it as getrlimit@@GLIBC_2_0 and getrlimit64@@GLIBC_2_1. Add a
__getrlimit64 function and provide it as getrlimit@@GLIBC_2_27 and
getrlimit64@@GLIBC_2_27.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto with setrlimit
and setrlimit64.
* sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.27): Add
getrlimit, setrlimit, getrlimit64 and setrlimit64.
* sysdeps/unix/sysv/linux/alpha/Versions (libc): Add getrlimit,
setrlimit, getrlimit64 and setrlimit64.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0d0bc784cafcd27f1cf9584b2424fcfbf07b24f6
commit 0d0bc784cafcd27f1cf9584b2424fcfbf07b24f6
Author: Aurelien Jarno <aurelien@aurel32.net>
Date: Fri Jan 5 20:34:10 2018 +0100
Alpha: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant [BZ
#22648]
RLIM64_INFINITY was supposed to be a glibc convention rather than
anything seen by the kernel, but it ended being passed to the kernel
through the prlimit64 syscall.
* On the kernel side, the value is defined for the prlimit64 syscall for
all architectures in include/uapi/linux/resource.h:
#define RLIM64_INFINITY (~0ULL)
* On the kernel side, the value is defined for getrlimit and setrlimit
in arch/alpha/include/uapi/asm/resource.h
#define RLIM_INFINITY 0x7ffffffffffffffful
* On the GNU libc side, the value is defined in
sysdeps/unix/sysv/linux/alpha/bits/resource.h:
# define RLIM64_INFINITY 0x7fffffffffffffffLL
This was not an issue until the getrlimit and setrlimit glibc functions
have been changed in commit 045c13d185 ("Consolidate Linux setrlimit and
getrlimit implementation") to use the prlimit64 syscall instead of the
getrlimit and setrlimit ones.
This patch fixes that by adding a wrapper to fix the value passed to or
received from the kernel, before or after calling the prlimit64 syscall.
Changelog:
[BZ #22648]
* sysdeps/unix/sysv/linux/alpha/getrlimit64.c: New file.
* sysdeps/unix/sysv/linux/alpha/setrlimit64.c: Ditto.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 41 ++++++
resource/tst-getrlimit.c | 17 +++
sysdeps/unix/sysv/linux/Makefile | 3 +-
sysdeps/unix/sysv/linux/alpha/Versions | 3 +
sysdeps/unix/sysv/linux/alpha/bits/resource.h | 6 +-
sysdeps/unix/sysv/linux/alpha/getrlimit64.c | 56 ++++++++
sysdeps/unix/sysv/linux/alpha/libc.abilist | 4 +
sysdeps/unix/sysv/linux/alpha/setrlimit64.c | 53 ++++++++
sysdeps/unix/sysv/linux/getrlimit64.c | 18 ++--
sysdeps/unix/sysv/linux/prlimit.c | 15 ++-
sysdeps/unix/sysv/linux/setrlimit64.c | 5 +
sysdeps/unix/sysv/linux/tst-rlimit-infinity.c | 173 +++++++++++++++++++++++++
12 files changed, 375 insertions(+), 19 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/alpha/getrlimit64.c
create mode 100644 sysdeps/unix/sysv/linux/alpha/setrlimit64.c
create mode 100644 sysdeps/unix/sysv/linux/tst-rlimit-infinity.c
--
You are receiving this mail because:
You are on the CC list for the bug.