public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/30992] New: alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM
@ 2023-10-23 20:38 matoro_bugzilla_glibc at matoro dot tk
  2023-10-23 20:38 ` [Bug libc/30992] " matoro_bugzilla_glibc at matoro dot tk
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: matoro_bugzilla_glibc at matoro dot tk @ 2023-10-23 20:38 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 30992
           Summary: alpha: setrlimit() with negative values besides
                    RLIM_INFINITY returns EPERM
           Product: glibc
           Version: 2.38
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: matoro_bugzilla_glibc at matoro dot tk
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Alpha on Linux has a special value for RLIM_INFINITY such that there is a dead
space of invalid values that when submitted as arguments to setrlimit(), return
EPERM.  Cpython has a test case which calls setrlimit() with argument -2, which
it expects to succeed.  This fails on alpha because while -1 == RLIM_INFINITY,
-2 wraps around to this dead zone.

Previously there was a patch proposed to make all these values equivalent to
RLIM_INFINITY.  This will break the assumption that setting a value with
setrlimit() will then return the same value later with getrlimit(), but I could
not find anywhere that explicitly states this to be a guaranteed safe
assumption to make.

Downstream issue:  https://bugs.gentoo.org/653850

Last mailing list update: 
https://sourceware.org/pipermail/libc-alpha/2022-October/142589.html

Proposed patch:
---
 sysdeps/unix/sysv/linux/alpha/getrlimit64.c | 4 ++--
 sysdeps/unix/sysv/linux/alpha/setrlimit64.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
index c195f5b55c..40f3e6bdff 100644
--- a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
+++ b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
@@ -38,11 +38,11 @@ __old_getrlimit64 (enum __rlimit_resource resource,
   if (__getrlimit64 (resource, &krlimits) < 0)
     return -1;

-  if (krlimits.rlim_cur == RLIM64_INFINITY)
+  if (krlimits.rlim_cur >= OLD_RLIM64_INFINITY)
     rlimits->rlim_cur = OLD_RLIM64_INFINITY;
   else
     rlimits->rlim_cur = krlimits.rlim_cur;
-  if (krlimits.rlim_max == RLIM64_INFINITY)
+  if (krlimits.rlim_max >= OLD_RLIM64_INFINITY)
     rlimits->rlim_max = OLD_RLIM64_INFINITY;
   else
     rlimits->rlim_max = krlimits.rlim_max;
diff --git a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
index 421616ed20..4e88540a48 100644
--- a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
@@ -35,11 +35,11 @@ __old_setrlimit64 (enum __rlimit_resource resource,
 {
   struct rlimit64 krlimits;

-  if (rlimits->rlim_cur == OLD_RLIM64_INFINITY)
+  if (rlimits->rlim_cur >= OLD_RLIM64_INFINITY)
     krlimits.rlim_cur = RLIM64_INFINITY;
   else
     krlimits.rlim_cur = rlimits->rlim_cur;
-  if (rlimits->rlim_max == OLD_RLIM64_INFINITY)
+  if (rlimits->rlim_max >= OLD_RLIM64_INFINITY)
     krlimits.rlim_max = RLIM64_INFINITY;
   else
     krlimits.rlim_max = rlimits->rlim_max;
-- 
2.35.1

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

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

* [Bug libc/30992] alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM
  2023-10-23 20:38 [Bug libc/30992] New: alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM matoro_bugzilla_glibc at matoro dot tk
@ 2023-10-23 20:38 ` matoro_bugzilla_glibc at matoro dot tk
  2023-10-23 20:38 ` matoro_bugzilla_glibc at matoro dot tk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: matoro_bugzilla_glibc at matoro dot tk @ 2023-10-23 20:38 UTC (permalink / raw)
  To: glibc-bugs

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

matoro <matoro_bugzilla_glibc at matoro dot tk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aurelien at aurel32 dot net,
                   |                            |matoro_bugzilla_glibc@mator
                   |                            |o.tk

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

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

* [Bug libc/30992] alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM
  2023-10-23 20:38 [Bug libc/30992] New: alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM matoro_bugzilla_glibc at matoro dot tk
  2023-10-23 20:38 ` [Bug libc/30992] " matoro_bugzilla_glibc at matoro dot tk
@ 2023-10-23 20:38 ` matoro_bugzilla_glibc at matoro dot tk
  2023-10-23 21:07 ` sam at gentoo dot org
  2023-10-23 21:07 ` sam at gentoo dot org
  3 siblings, 0 replies; 5+ messages in thread
From: matoro_bugzilla_glibc at matoro dot tk @ 2023-10-23 20:38 UTC (permalink / raw)
  To: glibc-bugs

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

matoro <matoro_bugzilla_glibc at matoro dot tk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://sourceware.org/pipe
                   |                            |rmail/libc-alpha/2022-Octob
                   |                            |er/142589.html

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

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

* [Bug libc/30992] alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM
  2023-10-23 20:38 [Bug libc/30992] New: alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM matoro_bugzilla_glibc at matoro dot tk
  2023-10-23 20:38 ` [Bug libc/30992] " matoro_bugzilla_glibc at matoro dot tk
  2023-10-23 20:38 ` matoro_bugzilla_glibc at matoro dot tk
@ 2023-10-23 21:07 ` sam at gentoo dot org
  2023-10-23 21:07 ` sam at gentoo dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gentoo dot org @ 2023-10-23 21:07 UTC (permalink / raw)
  To: glibc-bugs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

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

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

* [Bug libc/30992] alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM
  2023-10-23 20:38 [Bug libc/30992] New: alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM matoro_bugzilla_glibc at matoro dot tk
                   ` (2 preceding siblings ...)
  2023-10-23 21:07 ` sam at gentoo dot org
@ 2023-10-23 21:07 ` sam at gentoo dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gentoo dot org @ 2023-10-23 21:07 UTC (permalink / raw)
  To: glibc-bugs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugs.gentoo.org/sho
                   |                            |w_bug.cgi?id=653850

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

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

end of thread, other threads:[~2023-10-23 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 20:38 [Bug libc/30992] New: alpha: setrlimit() with negative values besides RLIM_INFINITY returns EPERM matoro_bugzilla_glibc at matoro dot tk
2023-10-23 20:38 ` [Bug libc/30992] " matoro_bugzilla_glibc at matoro dot tk
2023-10-23 20:38 ` matoro_bugzilla_glibc at matoro dot tk
2023-10-23 21:07 ` sam at gentoo dot org
2023-10-23 21:07 ` sam at gentoo dot org

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).