[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200421074241.GB15772@lst.de>
Date: Tue, 21 Apr 2020 09:42:41 +0200
From: Christoph Hellwig <hch@....de>
To: Matthew Wilcox <willy@...radead.org>
Cc: Christoph Hellwig <hch@....de>, Kees Cook <keescook@...omium.org>,
Iurii Zaikin <yzaikin@...gle.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org
Subject: Re: [PATCH 6/6] sysctl: pass kernel pointers to ->proc_handler
On Fri, Apr 17, 2020 at 11:17:18AM -0700, Matthew Wilcox wrote:
> > if (error)
> > - goto out;
> > + goto out_free_buf;
> >
> > /* careful: calling conventions are nasty here */
>
> I think this comment can go now ;-)
It actually long predates the set_fs that was only added for BPF,
and goes back to:
330d57fb98a91 ("[PATCH] Fix sysctl unregistration oops (CVE-2005-2709)")
in the history.git tree.
> > - } else {
> > - error = table->proc_handler(table, write, buf, &count, ppos);
> > - }
> > + error = table->proc_handler(table, write, kbuf, &count, ppos);
> > + if (error)
> > + goto out_free_buf;
> > +
> > + error = -EFAULT;
> > + if (copy_to_user(ubuf, kbuf, count))
> > + goto out_free_buf;
>
> Can we skip this if !write? Indeed, don't we have to in case the user has
> passed a pointer to a read-only memory page?
Indeed.
Powered by blists - more mailing lists