Local DoS on single_open?
single_open() requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?
Quoted 6 lines · Keith Owens
single_open()requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?
ulimit?
Quoted 10 lines · Nick Piggin
Quoted 6 lines · Keith Owens
single_open()requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?ulimit?
ulimit has no effect on kmalloc usage.
Quoted 11 lines · Keith Owens
Quoted 9 lines · Nick Piggin
Quoted 6 lines · Keith Owens
single_open()requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?
Quoted 3 lines
Quoted 1 line
ulimit?
ulimit has no effect on kmalloc usage.
You do realize that struct file is also kmalloc'ed? So are dentries and inodes, for that matter. It's the same situation as with pipes and sockets.
Quoted 4 lines · Keith Owens
single_open()requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?
Size of that buffer is limited. IOW, it's not different from opening e.g. a shitload of pipes or sockets.
Quoted 8 lines · On Thu, 11 Sep 2003 05:55:07 +0100, [email protected]…
Quoted 4 lines · Keith Owens
single_open()requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?Size of that buffer is limited. IOW, it's not different from opening e.g. a shitload of pipes or sockets.
In some cases, the buffer size is set to hold _all_ of the output for that particular /proc file and will be much larger than the data reserved for files and sockets. It is a difference in scale.
fs/proc/proc_misc.c stat_openfs/proc/proc_misc.c interrupts_openkernel/dma.c proc_dma_open
All those functions will kmalloc a reasonably sized buffer then let the user control the lifetime of that buffer. Looks like a recipe for a local DoS to me.
Quoted 15 lines · Keith Owens
Quoted 8 lines · On Thu, 11 Sep 2003 05:55:07 +0100, [email protected]…
Quoted 4 lines · Keith Owens
single_open()requires the kernel to kmalloc a buffer which lives until the userspace caller closes the file. What prevents a malicious user opening the same /proc entry multiple times, allocating lots of kmalloc space and causing a local DoS?Size of that buffer is limited. IOW, it's not different from opening e.g. a shitload of pipes or sockets.
In some cases, the buffer size is set to hold _all_ of the output for that particular /proc file and will be much larger than the data reserved for files and sockets. It is a difference in scale.
Quoted 7 lines
fs/proc/proc_misc.cstat_openfs/proc/proc_misc.cinterrupts_openkernel/dma.cproc_dma_openAll those functions will kmalloc a reasonably sized buffer then let the user control the lifetime of that buffer. Looks like a recipe for a local DoS to me.
struct file: 256 bytes due to cacheline alignment
struct dentry: 128 bytes, IIRC
struct inode: either 256 bytes or 512 bytes.
struct socket and struct sock: bugger if I remember, but it's not small.