Upper limit for sysctl fs.file-max

2019-05-01 Thread David Laight
The normal default for fs.file-max (the maximum number of file structures) is 1/10240th of the available memory. However it seems to be possible to set fs.file-max to any value up to 2^64-1. While all 'large' values are effectively the same this seems rather excessive here. Problems a

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-04 Thread Matteo Croce
On Thu, Apr 4, 2019 at 4:09 PM Christian Brauner wrote: > > On Wed, Apr 03, 2019 at 07:08:47PM +0200, Matteo Croce wrote: > > On Wed, Apr 3, 2019 at 6:40 PM Matteo Croce wrote: > > > > > > On Wed, Apr 3, 2019 at 5:51 PM Matthew Wilcox wrote: > > > > > > > > On Wed, Apr 03, 2019 at 05:24:26PM +02

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-04 Thread Christian Brauner
On Wed, Apr 03, 2019 at 07:08:47PM +0200, Matteo Croce wrote: > On Wed, Apr 3, 2019 at 6:40 PM Matteo Croce wrote: > > > > On Wed, Apr 3, 2019 at 5:51 PM Matthew Wilcox wrote: > > > > > > On Wed, Apr 03, 2019 at 05:24:26PM +0200, Matteo Croce wrote: > > > > On Wed, Apr 3, 2019 at 4:02 PM Christia

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Matteo Croce
On Wed, Apr 3, 2019 at 7:41 PM Kees Cook wrote: > > On Thu, Mar 28, 2019 at 6:03 AM Matteo Croce wrote: > > > > fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which > > accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285 > >

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Kees Cook
On Thu, Mar 28, 2019 at 6:03 AM Matteo Croce wrote: > > fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which > accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285 > ("sysctl: handle overflow for file-max") assigns &zero, wh

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Matteo Croce
On Wed, Apr 3, 2019 at 6:40 PM Matteo Croce wrote: > > On Wed, Apr 3, 2019 at 5:51 PM Matthew Wilcox wrote: > > > > On Wed, Apr 03, 2019 at 05:24:26PM +0200, Matteo Croce wrote: > > > On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner > > > wrote: > > > > Yeah, maybe but it still feels cleaner an

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Matteo Croce
On Wed, Apr 3, 2019 at 5:51 PM Matthew Wilcox wrote: > > On Wed, Apr 03, 2019 at 05:24:26PM +0200, Matteo Croce wrote: > > On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner > > wrote: > > > Yeah, maybe but it still feels cleaner and more obvious to just add: > > > > > > static long long_zero; > >

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Matthew Wilcox
On Wed, Apr 03, 2019 at 05:24:26PM +0200, Matteo Croce wrote: > On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner wrote: > > Yeah, maybe but it still feels cleaner and more obvious to just add: > > > > static long long_zero; > > > > given that most callers actually seem to want an (unsigned) int. >

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Matteo Croce
On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner wrote: > > On Thu, Mar 28, 2019 at 02:03:06PM +0100, Matteo Croce wrote: > > fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which > > accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285 &g

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Christian Brauner
On Thu, Mar 28, 2019 at 02:03:06PM +0100, Matteo Croce wrote: > fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which > accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285 > ("sysctl: handle overflow for file-max") assigns &zero, which

Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-04-03 Thread Matteo Croce
On Thu, Mar 28, 2019 at 2:03 PM Matteo Croce wrote: > > fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which > accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285 > ("sysctl: handle overflow for file-max") assigns &zero, wh

[PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max

2019-03-28 Thread Matteo Croce
fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285 ("sysctl: handle overflow for file-max") assigns &zero, which is an int, to extra1, generating the following KASAN report. Fix this by chan

Re: fs.file-max

2001-05-08 Thread Nathan Straz
On Tue, May 08, 2001 at 10:03:23AM +, Federico Edelman Anaya wrote: > What can I do to test the FD limit? ... Because, the FD limit is set in > /proc/sys/fs/file-max, sample: > > echo "2048" > /proc/sys/fs/file-max > ulimit -n 8192 > > In this case ... the FD limit = 8192 :( ... when the lim

Re: fs.file-max

2001-05-08 Thread Federico Edelman Anaya
Dan: Hi ... Dan Kegel wrote: > Federico Edelman Anaya ([EMAIL PROTECTED]) wrote: > > > What can I do to test the FD limit? ... Because, the FD limit is set in > > /proc/sys/fs/file-max, sample: > > > > echo "2048" > /proc/sys/fs/file-max > > That sets the systemwide limit to 2048. Ok ... >

Re: fs.file-max

2001-05-08 Thread Dan Kegel
Federico Edelman Anaya ([EMAIL PROTECTED]) wrote: > What can I do to test the FD limit? ... Because, the FD limit is set in > /proc/sys/fs/file-max, sample: > > echo "2048" > /proc/sys/fs/file-max That sets the systemwide limit to 2048. > ulimit -n 8192 That sets the per-process limit (

fs.file-max

2001-05-08 Thread Federico Edelman Anaya
Hi! ... In a Linux Kernel ... What can I do to test the FD limit? ... Because, the FD limit is set in /proc/sys/fs/file-max, sample: echo "2048" > /proc/sys/fs/file-max ulimit -n 8192 In this case ... the FD limit = 8192 :( ... when the limit should be 2048? I wrote a perl script for the test