* two more fixes for sysctl
@ 2020-06-09 17:08 Christoph Hellwig
2020-06-09 17:08 ` [PATCH 1/2] cdrom: fix an incorrect __user annotation on cdrom_sysctl_info Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-06-09 17:08 UTC (permalink / raw)
To: Alexander Viro
Cc: Luis Chamberlain, Kees Cook, Iurii Zaikin, linux-fsdevel, linux-kernel
Hi Al,
two more fixes for the kernel pointers in the sysctl handlers.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] cdrom: fix an incorrect __user annotation on cdrom_sysctl_info
2020-06-09 17:08 two more fixes for sysctl Christoph Hellwig
@ 2020-06-09 17:08 ` Christoph Hellwig
2020-06-09 17:08 ` [PATCH 2/2] sysctl: reject gigantic reads/write to sysctl files Christoph Hellwig
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-06-09 17:08 UTC (permalink / raw)
To: Alexander Viro
Cc: Luis Chamberlain, Kees Cook, Iurii Zaikin, linux-fsdevel,
linux-kernel, build test robot
No user pointers for sysctls anymore.
Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Reported-by: build test robot <lkp@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/cdrom/cdrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index e3bbe108eb542f..410060812e9dbf 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -3518,7 +3518,7 @@ static int cdrom_print_info(const char *header, int val, char *info,
}
static int cdrom_sysctl_info(struct ctl_table *ctl, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+ void *buffer, size_t *lenp, loff_t *ppos)
{
int pos;
char *info = cdrom_sysctl_settings.info;
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] sysctl: reject gigantic reads/write to sysctl files
2020-06-09 17:08 two more fixes for sysctl Christoph Hellwig
2020-06-09 17:08 ` [PATCH 1/2] cdrom: fix an incorrect __user annotation on cdrom_sysctl_info Christoph Hellwig
@ 2020-06-09 17:08 ` Christoph Hellwig
2020-06-09 17:30 ` two more fixes for sysctl Luis Chamberlain
2020-06-10 4:28 ` Al Viro
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-06-09 17:08 UTC (permalink / raw)
To: Alexander Viro
Cc: Luis Chamberlain, Kees Cook, Iurii Zaikin, linux-fsdevel,
linux-kernel, Vegard Nossum
Instead of triggering a WARN_ON deep down in the page allocator just
give up early on allocations that are way larger than the usual sysctl
values.
Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/proc/proc_sysctl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index df2143e05c571e..08c33bd1642dcd 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -564,6 +564,10 @@ static ssize_t proc_sys_call_handler(struct file *filp, void __user *ubuf,
if (!table->proc_handler)
goto out;
+ /* don't even try if the size is too large */
+ if (count > KMALLOC_MAX_SIZE)
+ return -ENOMEM;
+
if (write) {
kbuf = memdup_user_nul(ubuf, count);
if (IS_ERR(kbuf)) {
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: two more fixes for sysctl
2020-06-09 17:08 two more fixes for sysctl Christoph Hellwig
2020-06-09 17:08 ` [PATCH 1/2] cdrom: fix an incorrect __user annotation on cdrom_sysctl_info Christoph Hellwig
2020-06-09 17:08 ` [PATCH 2/2] sysctl: reject gigantic reads/write to sysctl files Christoph Hellwig
@ 2020-06-09 17:30 ` Luis Chamberlain
2020-06-10 4:28 ` Al Viro
3 siblings, 0 replies; 5+ messages in thread
From: Luis Chamberlain @ 2020-06-09 17:30 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Alexander Viro, Kees Cook, Iurii Zaikin, linux-fsdevel, linux-kernel
On Tue, Jun 09, 2020 at 07:08:17PM +0200, Christoph Hellwig wrote:
> Hi Al,
>
> two more fixes for the kernel pointers in the sysctl handlers.
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: two more fixes for sysctl
2020-06-09 17:08 two more fixes for sysctl Christoph Hellwig
` (2 preceding siblings ...)
2020-06-09 17:30 ` two more fixes for sysctl Luis Chamberlain
@ 2020-06-10 4:28 ` Al Viro
3 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2020-06-10 4:28 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Luis Chamberlain, Kees Cook, Iurii Zaikin, linux-fsdevel, linux-kernel
On Tue, Jun 09, 2020 at 07:08:17PM +0200, Christoph Hellwig wrote:
> Hi Al,
>
> two more fixes for the kernel pointers in the sysctl handlers.
Applied and pushed. Let me beat it up a bit, if it survives - to
Linus it goes...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-10 4:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 17:08 two more fixes for sysctl Christoph Hellwig
2020-06-09 17:08 ` [PATCH 1/2] cdrom: fix an incorrect __user annotation on cdrom_sysctl_info Christoph Hellwig
2020-06-09 17:08 ` [PATCH 2/2] sysctl: reject gigantic reads/write to sysctl files Christoph Hellwig
2020-06-09 17:30 ` two more fixes for sysctl Luis Chamberlain
2020-06-10 4:28 ` Al Viro
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 NNTP newsgroup(s).