Subject: Re: kern/35021: root cannot get/set rlimit information of user processes through sysctl
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Brian de Alwis <bsd@cs.ubc.ca>
List: netbsd-bugs
Date: 11/13/2006 15:40:02
The following reply was made to PR kern/35021; it has been noted by GNATS.

From: Brian de Alwis <bsd@cs.ubc.ca>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/35021: root cannot get/set rlimit information of user processes through sysctl
Date: Mon, 13 Nov 2006 09:36:11 -0600

 Hi Havard,
 
 The bug behaviour I'm reporting in this PR is completely independent
 of the datasize hard/soft semantics.  I apologize for using a
 confusing example; I'm actually a bit mystified as I'm sure I had
 rewritten the PR to only query the datasize settings. 
 
 Here's a better example to illustrate:
 
     $ echo $$
     3037
     $ sudo sysctl proc.3037.rlimit.datasize.hard
     sysctl: proc.3037.rlimit.datasize.hard: sysctl() failed with Operation not permitted
     $ 
 
 The real problem is that root is unable to query the parameters
 for other users, which doesn't seem right (especially since I have
 securelevel > 1).
 
 I noticed the behaviour because my scripts for starting Eclipse
 began failing after upgrading to the latest -current.  These scripts
 used the sysctl's with sudo to raise the datasize limits (which
 was necessary before NetBSD/i386 increased the hard limit on datasize
 to 3GB).
 
 
 And just as an aside:
 >  I think this is actually setting the soft data limit.  Certainly that
 >  matches with what I observe:
 
 That's not the behaviour I see:
 
     $ sysctl -a | grep datasize
     proc.curproc.rlimit.datasize.soft = 393216000
     proc.curproc.rlimit.datasize.hard = 3221225472
     $ ulimit -d 256000
     $ sysctl -a | grep datasize
     proc.curproc.rlimit.datasize.soft = 262144000
     proc.curproc.rlimit.datasize.hard = 262144000
     $ 
 
 `-S' appears necessary to set the softlimit only.
 
 Brian.
 
 -- 
   Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
       "Amusement to an observing mind is study." - Benjamin Disraeli