public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12201] New: Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
@ 2010-11-07 15:02 mtk.manpages at gmail dot com
  2010-11-08 20:16 ` [Bug libc/12201] " drepper.fsp at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mtk.manpages at gmail dot com @ 2010-11-07 15:02 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12201

           Summary: Fix setrlimit/getrlimit  32-bit platforms for limits >
                    2^32-1
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: mtk.manpages@gmail.com


The current glibc wrappers for getrlimit/setrlimit do some work to paper over
this kernel bug:
https://bugzilla.kernel.org/show_bug.cgi?id=5042
With the kernel 2.6.36 addition of the prlimit(2) syscall, the wrappers could
be written to use prlimit() and thus avoid the problem resulting from the
broken kernel syscalls.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
@ 2010-11-08 20:16 ` drepper.fsp at gmail dot com
  2010-11-11  5:34 ` mtk.manpages at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: drepper.fsp at gmail dot com @ 2010-11-08 20:16 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12201

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #1 from Ulrich Drepper <drepper.fsp at gmail dot com> 2010-11-08 20:16:22 UTC ---
What exactly are you talking about?  We are using ugetrlimit for some time.  At
the same time setrlimit was changed.  These syscalls now match exactly the
required userlevel semantic.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
  2010-11-08 20:16 ` [Bug libc/12201] " drepper.fsp at gmail dot com
@ 2010-11-11  5:34 ` mtk.manpages at gmail dot com
  2010-11-11  9:09 ` drepper.fsp at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mtk.manpages at gmail dot com @ 2010-11-11  5:34 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12201

Michael Kerrisk <mtk.manpages at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #2 from Michael Kerrisk <mtk.manpages at gmail dot com> 2010-11-11 05:33:45 UTC ---
(In reply to comment #1)
> What exactly are you talking about?

It was fairly carefully explained in the kernel.org bug report...

> We are using ugetrlimit for some time.  At
> the same time setrlimit was changed.  These syscalls now match exactly the
> required userlevel semantic.

No, they do not. Look at the following.

$ cat rlimit_large.c 
/* rlimit_large.c
*/
#define _FILE_OFFSET_BITS 64
#include <sys/resource.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

#define errMsg(msg)             { perror(msg); }

#define errExit(msg)            { perror(msg); exit(EXIT_FAILURE); }

static void
printRlimit(const char *msg, int resource)
{
    struct rlimit rlim;

    if (getrlimit(resource, &rlim) == -1) errExit("getrlimit");

    printf("%s soft=", msg);
    if (rlim.rlim_cur == RLIM_INFINITY)
        printf("infinite");
    else if (rlim.rlim_cur == RLIM_SAVED_CUR)
        printf("unrepresentable");
    else
        printf("%lld", (long long) rlim.rlim_cur);

    printf("; hard=");
    if (rlim.rlim_max == RLIM_INFINITY)
        printf("infinite\n");
    else if (rlim.rlim_max == RLIM_SAVED_MAX)
        printf("unrepresentable");
    else
        printf("%lld\n", (long long) rlim.rlim_max);
} /* printRlimit */

int
main(int argc, char *argv[])
{
    struct rlimit rl;
    printf("sizeof(rl.rlim_cur) = %ld\n", (long) sizeof(rl.rlim_cur));

    /* Show the value of the glibc constant, just for interest */

    printf("RLIM_INFINITY = %llx\n", (unsigned long long) RLIM_INFINITY);

    if (getrlimit(RLIMIT_FSIZE, &rl) == -1) errExit("setrlimit");
    printRlimit("Initial RLIMIT_FSIZE limits          : ", RLIMIT_FSIZE);

#define VAL1 10000
    rl.rlim_cur = VAL1;
    printf("About to set rlim_cur to %lld\n", (long long) rl.rlim_cur);
    if (setrlimit(RLIMIT_FSIZE, &rl) == -1) errExit("setrlimit");
    if (getrlimit(RLIMIT_FSIZE, &rl) == -1) errExit("setrlimit");
    printRlimit("RLIMIT_FSIZE limits after setrlimit(): ", RLIMIT_FSIZE);

#define VAL2 4999222333LL
    rl.rlim_cur = VAL2;
    printf("About to set rlim_cur to %lld\n", (long long) rl.rlim_cur);
    if (setrlimit(RLIMIT_FSIZE, &rl) == -1) errExit("setrlimit");
    if (getrlimit(RLIMIT_FSIZE, &rl) == -1) errExit("setrlimit");
    printRlimit("RLIMIT_FSIZE limits after setrlimit(): ", RLIMIT_FSIZE);

    exit(EXIT_SUCCESS);
} /* main */

$ cc rlimit_large.c 
$ ./a.out
sizeof(rl.rlim_cur) = 8
RLIM_INFINITY = ffffffffffffffff
Initial RLIMIT_FSIZE limits          :  soft=infinite; hard=infinite
About to set rlim_cur to 10000
RLIMIT_FSIZE limits after setrlimit():  soft=10000; hard=infinite
About to set rlim_cur to 4999222333
RLIMIT_FSIZE limits after setrlimit():  soft=infinite; hard=infinite


The last line of output indicates the problem: a limit > (2^32)-1 got turned
into RLIM_INFINITY, even though it is representable in 8 bytes. It's a kernel
problem, but glibc's wrappers could now workaround that kernel problem by using
prlimit().

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
  2010-11-08 20:16 ` [Bug libc/12201] " drepper.fsp at gmail dot com
  2010-11-11  5:34 ` mtk.manpages at gmail dot com
@ 2010-11-11  9:09 ` drepper.fsp at gmail dot com
  2010-12-26 12:55 ` drepper.fsp at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: drepper.fsp at gmail dot com @ 2010-11-11  9:09 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12201

--- Comment #3 from Ulrich Drepper <drepper.fsp at gmail dot com> 2010-11-11 09:09:37 UTC ---
If you would only learn to express yourself correctly and concisely you could
save yourself work.

Why on earth would you say setrlimit has problems if you really mean
setrlimit64?  That's not at all the same code.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
                   ` (2 preceding siblings ...)
  2010-11-11  9:09 ` drepper.fsp at gmail dot com
@ 2010-12-26 12:55 ` drepper.fsp at gmail dot com
  2014-02-16 18:24 ` jackie.rosen at hushmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: drepper.fsp at gmail dot com @ 2010-12-26 12:55 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12201

Ulrich Drepper <drepper.fsp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Ulrich Drepper <drepper.fsp at gmail dot com> 2010-12-26 01:13:06 UTC ---
I checked in a patch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
                   ` (3 preceding siblings ...)
  2010-12-26 12:55 ` drepper.fsp at gmail dot com
@ 2014-02-16 18:24 ` jackie.rosen at hushmail dot com
  2014-05-28 19:43 ` schwab at sourceware dot org
  2014-06-30  6:29 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 18:24 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12201

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #5 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
                   ` (4 preceding siblings ...)
  2014-02-16 18:24 ` jackie.rosen at hushmail dot com
@ 2014-05-28 19:43 ` schwab at sourceware dot org
  2014-06-30  6:29 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: schwab at sourceware dot org @ 2014-05-28 19:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12201

Andreas Schwab <schwab at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jackie.rosen at hushmail dot com   |

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/12201] Fix setrlimit/getrlimit  32-bit platforms for limits > 2^32-1
  2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
                   ` (5 preceding siblings ...)
  2014-05-28 19:43 ` schwab at sourceware dot org
@ 2014-06-30  6:29 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-06-30  6:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=12201

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-30  6:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-07 15:02 [Bug libc/12201] New: Fix setrlimit/getrlimit 32-bit platforms for limits > 2^32-1 mtk.manpages at gmail dot com
2010-11-08 20:16 ` [Bug libc/12201] " drepper.fsp at gmail dot com
2010-11-11  5:34 ` mtk.manpages at gmail dot com
2010-11-11  9:09 ` drepper.fsp at gmail dot com
2010-12-26 12:55 ` drepper.fsp at gmail dot com
2014-02-16 18:24 ` jackie.rosen at hushmail dot com
2014-05-28 19:43 ` schwab at sourceware dot org
2014-06-30  6:29 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).