Thread View: news.software.nntp
15 messages
15 total messages
Started by Mark Walter
Sun, 11 Apr 1999 00:00
setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Mark Walter
Date: Sun, 11 Apr 1999 00:00
Date: Sun, 11 Apr 1999 00:00
29 lines
1699 bytes
1699 bytes
My errlog for INN 1.7.2 on RH5.2 is showing the following errors: /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_STACK, RLIM_INFINITY): Operation not permitted /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY): Operation not permitted I found a man entry for setrlimit and read that a possible error for this call may be if "...a non-superuser tries to use setrlimit() to increase the soft or hard limit above the current hard limit..." Assuming this to be the case, I checked the user and group of startinnfeed and found that the user for startinnfeed is root and the group is news. Of course, I suppose startinnfeed could have been started in some other security context via su in a startup script. I checked the errata for RH5.1 and there were some startinnfeed fixes but nothing for RH5.2. Also, I read about some bug relating to setrlimit in older versions of the kernel (<=2.0.29) but I haven't read about anything in this regard for my particular kernel (2.0.36) Does anyone have any ideas? Thanks, Mark
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Mark Walter
Date: Sun, 11 Apr 1999 00:00
Date: Sun, 11 Apr 1999 00:00
29 lines
1540 bytes
1540 bytes
Damn! I'm getting sloppy. I thought I had checked that but I must have been reading some other file. Anyway, I made startinnfeed setuid root. I'm betting that will solve the problem. :) Thanks, Russ! (This is getting to be a habit!) Mark Russ Allbery <rra@stanford.edu> wrote in message news:yllnfykc9c.fsf@windlord.stanford.edu... > Mark Walter <mark@guiware.com> writes: > > > My errlog for INN 1.7.2 on RH5.2 is showing the following errors: > > > /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_STACK, RLIM_INFINITY): > > Operation not permitted > > /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY): > > Operation not permitted > > startinnfeed should be setuid root. Is it? > > -- > Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Russ Allbery
Date: Sun, 11 Apr 1999 00:00
Date: Sun, 11 Apr 1999 00:00
40 lines
2731 bytes
2731 bytes
Arthur Hagen <art@flying.broomstick.com> writes:
> Even with startinnfeed suid root, you'll get this error on HP-UX unless
> you've patched the source (or patched the kernel). You can change the
> rlim_max parameter, but not the rlim_cur parameter. So the rlim_cur
> parameter should be set to the value of getrlimit() on HP-UX.
Well, that makes no sense whatsoever. What good does it do to raise the
hard limit if you can't raise the soft limit? And why would an operating
system keep you from raising the soft limit when it lets you raise the
soft limit?
The man page certainly doesn't reflect this; it says:
Each call to either getrlimit() or setrlimit() identifies a specific
resource to be operated upon as well as a resource limit. A
resource limit is represented by an rlimit structure. The rlim_cur
member specifies the current or soft limit and the rlim_max member
specifies the maximum or hard limit. Soft limits may be changed by
a process to any value that is less than or equal to the hard limit.
A process may (irreversibly) lower its hard limit to any value that
is greater than or equal to the soft limit. Only a process with
appropriate privileges can raise a hard limit. Both hard and soft
limits can be changed in a single call to setrlimit() subject to the
constraints described above.
So you should be able to raise them both to INFINITY, if you're root, and
do it in the same call. If you just raise the hard limit without raising
the soft limit, you're not actually accomplishing anything worthwhile.
Is it because you can't actually set a limit of INFINITY for file
descriptors and instead it gets set to something smaller and then the
INFINITY soft limit is higher than the hard limit? (If so, the right fix
is to do two setrlimit() calls, the first setting the max and then the
second setting the soft limit to whatever the max ends up being.)
--
Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Russ Allbery
Date: Sun, 11 Apr 1999 00:00
Date: Sun, 11 Apr 1999 00:00
23 lines
1249 bytes
1249 bytes
Bettina Fink <laura@terpen.tin.org> writes: > I had the same with an self-compilied innfeed on Linux. > Get the innfeed sources, change the RLIMIT_NOFILE section in > startinnfeed.c to: > setrlimit(RLIMIT_NOFILE, &rl); > #if 0 > if (setrlimit(RLIMIT_NOFILE, &rl) == -1) > (void)fprintf(stderr, "%s: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY): %s\n", > *av, strerror (errno)); > #endif > Recompile, be happy. Er... isn't that just removing the reporting of a legitimate error? Why is setrlimit() failing on Linux? -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Russ Allbery
Date: Sun, 11 Apr 1999 00:00
Date: Sun, 11 Apr 1999 00:00
15 lines
1030 bytes
1030 bytes
Mark Walter <mark@guiware.com> writes: > My errlog for INN 1.7.2 on RH5.2 is showing the following errors: > /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_STACK, RLIM_INFINITY): > Operation not permitted > /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY): > Operation not permitted startinnfeed should be setuid root. Is it? -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Russ Allbery
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
21 lines
1353 bytes
1353 bytes
Bettina Fink <laura@terpen.tin.org> writes: > From setrlimit(2): > EPERM A non-superuser tries to use setrlimit() to > increase the soft or hard limit above the current > hard limit, As startinnfeed is running as root, this shouldn't be a problem. > or a superuser tries to increase RLIMIT_NOFILE above the > current kernel maximum. As it's setting it to INFINITY, this shouldn't be a problem either, as that should simply make it the largest possible value for the current kernel compile. So I'm still confused. -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Bettina Fink
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
24 lines
1386 bytes
1386 bytes
Mark Walter <mark@guiware.com> wrote:
> My errlog for INN 1.7.2 on RH5.2 is showing the following errors:
>
> /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_STACK, RLIM_INFINITY):
> Operation not permitted
> /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY):
> Operation not permitted
I had the same with an self-compilied innfeed on Linux.
Get the innfeed sources, change the RLIMIT_NOFILE section in
startinnfeed.c to:
setrlimit(RLIMIT_NOFILE, &rl);
#if 0
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
(void)fprintf(stderr, "%s: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY): %s\n",
*av, strerror (errno));
#endif
Recompile, be happy.
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Bettina Fink
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
24 lines
1559 bytes
1559 bytes
Russ Allbery <rra@stanford.edu> wrote:
> Er... isn't that just removing the reporting of a
> legitimate error?
Yes. But I just wanted to get rid off the error messages
until I had time to find and fix the problem without re-
compiling then. :-) Lazy hack.
> Why is setrlimit() failing on Linux?
From setrlimit(2):
EPERM A non-superuser tries to use setrlimit() to
increase the soft or hard limit above the current
hard limit, or a superuser tries to increase
RLIMIT_NOFILE above the current kernel maximum.
The innfeed shipped with INN-2.2 does it better than the
older versions (I have only one box left running an older
version and that box is on Solaris), it checks a lot of
things before trying to set or increase something.
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Bettina Fink
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
15 lines
1341 bytes
1341 bytes
Russ Allbery <rra@stanford.edu> wrote: >> From setrlimit(2): >> [EPERM] >> or a superuser tries to increase RLIMIT_NOFILE above the >> current kernel maximum. > > As it's setting it to INFINITY, this shouldn't be a problem either, as > that should simply make it the largest possible value for the current > kernel compile. So I'm still confused. Linux seems not to accept "INFINITY" in connection with "maximum number of open files", it seems to demand an explicit number.
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Arthur Hagen
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
103 lines
4198 bytes
4198 bytes
In article <ylvhf2fr7c.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> writes:
> Arthur Hagen <art@flying.broomstick.com> writes:
>
> > Even with startinnfeed suid root, you'll get this error on HP-UX unless
> > you've patched the source (or patched the kernel). You can change the
> > rlim_max parameter, but not the rlim_cur parameter. So the rlim_cur
> > parameter should be set to the value of getrlimit() on HP-UX.
>
> Well, that makes no sense whatsoever. What good does it do to raise the
> hard limit if you can't raise the soft limit? And why would an operating
> system keep you from raising the soft limit when it lets you raise the
> soft limit?
The rlim_cur applies to the running task, and my wild guess is that
HP-UX will only let you change the behaviour of future tasks.
I should try to fork/vfork off a few tasks to see what happens to them.
> So you should be able to raise them both to INFINITY, if you're root, and
> do it in the same call. If you just raise the hard limit without raising
> the soft limit, you're not actually accomplishing anything worthwhile.
>
> Is it because you can't actually set a limit of INFINITY for file
> descriptors and instead it gets set to something smaller and then the
> INFINITY soft limit is higher than the hard limit? (If so, the right fix
> is to do two setrlimit() calls, the first setting the max and then the
> second setting the soft limit to whatever the max ends up being.)
Doing two setrlimit calls won't help much. A small test program to
verify this:
--- cut here ---
#include <sys/resource.h> /* setrlimit */
#include <errno.h>
int main(int argc, char **argv)
{
struct rlimit rl;
puts("\nRLIMIT_DATA:");
getrlimit(RLIMIT_DATA,&rl);
printf("rlim_cur: %x\n",rl.rlim_cur);
printf("rlim_max: %x\n",rl.rlim_max);
rl.rlim_max = RLIM_INFINITY;
puts("\nsetrlimit(RLIMIT_DATA,&rl) for rlimit_max=RLIM_INFINITY:");
if (setrlimit(RLIMIT_DATA, &rl) == -1)
printf("failed: %s\n",strerror(errno));
else
puts("ok");
puts("\nRLIMIT_DATA:");
getrlimit(RLIMIT_DATA,&rl);
printf("rlim_cur: %x\n",rl.rlim_cur);
printf("rlim_max: %x\n",rl.rlim_max);
rl.rlim_cur = RLIM_INFINITY;
puts("\nsetrlimit(RLIMIT_DATA,&rl) for rlimit_cur=RLIM_INFINITY:");
if (setrlimit(RLIMIT_DATA, &rl) == -1)
printf("failed: %s\n",strerror(errno));
else
puts("ok");
puts("\nRLIMIT_DATA:");
getrlimit(RLIMIT_DATA,&rl);
printf("rlim_cur: %x\n",rl.rlim_cur);
printf("rlim_max: %x\n",rl.rlim_max);
exit(0);
}
--- cut here ---
The program output is as follows (when run as root):
RLIMIT_DATA:
rlim_cur: 4000000
rlim_max: 4000000
setrlimit(RLIMIT_DATA,&rl) for rlimit_max=RLIM_INFINITY:
ok
RLIMIT_DATA:
rlim_cur: 4000000
rlim_max: 7fffffff
setrlimit(RLIMIT_DATA,&rl) for rlimit_cur=RLIM_INFINITY:
failed: Invalid argument
RLIMIT_DATA:
rlim_cur: 4000000
rlim_max: 7fffffff
Same thing happens if you try to set both cur and max at once (as in
innstart), and with any value of rlim_cur higher than the one returned
from getrlimit. You won't be allowed to raise it in any way.
HP-UX 10.20, latest recommended patches all installed.
Regards,
--
*Art
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Arthur Hagen
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
45 lines
2291 bytes
2291 bytes
In article <yllnfykc9c.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> writes: > Mark Walter <mark@guiware.com> writes: > > > My errlog for INN 1.7.2 on RH5.2 is showing the following errors: > > > /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_STACK, RLIM_INFINITY): > > Operation not permitted > > /usr/lib/news/bin/startinnfeed: setrlimit(RLIMIT_NOFILE, RLIM_INFINITY): > > Operation not permitted > > startinnfeed should be setuid root. Is it? Even with startinnfeed suid root, you'll get this error on HP-UX unless you've patched the source (or patched the kernel). You can change the rlim_max parameter, but not the rlim_cur parameter. So the rlim_cur parameter should be set to the value of getrlimit() on HP-UX. Here's a diff for startinnfeed.c fixing this for HP-UX for inn-2.2 (sorry, I don't have the 1.7.2 source, but I'm sure Mark will figure it out from the diff. Not a lot has changed in this part of startinnfeed from 1.x to 2.x anyhow). 50c50,54 < rl.rlim_cur = rl.rlim_max = RLIM_INFINITY; --- > /* rl.rlim_cur = rl.rlim_max = RLIM_INFINITY; */ > /* Fix for HP-UX 10.20, which won't let us raise rlim_cur at this > time: */ > getrlimit(RLIMIT_DATA,&rl); > rl.rlim_max = RLIM_INFINITY; 54a59,63 > > /* Continuation of fix for HP-UX 10.20 as mentioned above */ > getrlimit(RLIMIT_STACK,&rl); > rl.rlim_max = RLIM_INFINITY; > Regards, -- *Art
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Russ Allbery
Date: Tue, 13 Apr 1999 00:00
Date: Tue, 13 Apr 1999 00:00
34 lines
2245 bytes
2245 bytes
Arthur Hagen <art@flying.broomstick.com> writes: > The rlim_cur applies to the running task, and my wild guess is that > HP-UX will only let you change the behaviour of future tasks. I should > try to fork/vfork off a few tasks to see what happens to them. That doesn't make sense either... rlim_cur should simply be the soft limit, and it should be inherited by child processes. I've never heard of setting limits only for the behavior of future tasks; Unix normally doesn't work like that. > Doing two setrlimit calls won't help much. A small test program to > verify this: I modified your program to deal with the file descriptor limit, since that's what one mostly cares about with news servers, and it turns out that, apparently like Linux, you can't set the limit to RLIM_INFINITY (even the hard limit). I'm not sure what the upper limit *is*, though, since I was able to set it to values as high as 32000. Linux, on the other hand, didn't let me set it higher than 256 (this is with a 2.0.x kernel). Anyway, for file descriptors, it looks to me like the right thing to do on HP-UX may be to simply raise the soft limit to the same as the hard limit. I wonder if it wouldn't be good to do that on all platforms regardless of configuration settings, since that isn't a privileged operation and it's hard to imagine when that could possibly be wrong (it just might not be enough). -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Arthur Hagen
Date: Wed, 14 Apr 1999 00:00
Date: Wed, 14 Apr 1999 00:00
15 lines
1443 bytes
1443 bytes
In article <ylhfqk6my3.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> writes: > Anyway, for file descriptors, it looks to me like the right thing to do on > HP-UX may be to simply raise the soft limit to the same as the hard limit. The problem with HP-UX is that you're not allowed to raise the soft limit, so this won't help much. Unless file descriptors are handled differently from data/stack. Regards, -- *Art
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Ralf Döblitz
Date: Wed, 14 Apr 1999 00:00
Date: Wed, 14 Apr 1999 00:00
22 lines
1925 bytes
1925 bytes
Russ Allbery <rra@stanford.edu> wrote:
[...]
>Linux, on the other hand, didn't let me set it higher than 256 (this is
>with a 2.0.x kernel).
From the kernel source:
if (resource == RLIMIT_NOFILE) {
if (new_rlim.rlim_cur > NR_OPEN || new_rlim.rlim_max > NR_OPEN)
return -EPERM;
}
So Linux doesn't accept values larger than the compiled in total number
of filehandles. Calling setrlimit with NR_OPEN instead of RLIM_INFINITY
should work (but this is the default setting anyway).
Ralf
--
Ralf D�blitz * Schapenstr. 6 * 38104 Braunschweig * Germany
Phone: +49-531-2361223 Fax: +49-531-2361224 mailto:doeblitz@gmx.de
Homepage: http://www.escape.de/users/selene/
Re: setrlimit(RLIMIT_STACK, RLIM_INFINITY) error in INN 1.7.2 errlog (on RH5.2)
Author: Russ Allbery
Date: Wed, 14 Apr 1999 00:00
Date: Wed, 14 Apr 1999 00:00
19 lines
1492 bytes
1492 bytes
Arthur Hagen <art@flying.broomstick.com> writes: > Russ Allbery <rra@stanford.edu> writes: >> Anyway, for file descriptors, it looks to me like the right thing to do >> on HP-UX may be to simply raise the soft limit to the same as the hard >> limit. > The problem with HP-UX is that you're not allowed to raise the soft > limit, so this won't help much. Unless file descriptors are handled > differently from data/stack. I have no clue what's up with the data/stack stuff, but my test program was successfully raising the soft limit for file descriptors without any trouble. -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads