<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/sunrpc/svc.h, branch v4.9.155</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.155</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.155'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2019-01-16T21:12:33Z</updated>
<entry>
<title>sunrpc: use-after-free in svc_process_common()</title>
<updated>2019-01-16T21:12:33Z</updated>
<author>
<name>Vasily Averin</name>
<email>vvs@virtuozzo.com</email>
</author>
<published>2018-12-24T11:44:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=37c791a031ece3afeb9c8b023397473a5349f171'/>
<id>urn:sha1:37c791a031ece3afeb9c8b023397473a5349f171</id>
<content type='text'>
commit d4b09acf924b84bae77cad090a9d108e70b43643 upstream.

if node have NFSv41+ mounts inside several net namespaces
it can lead to use-after-free in svc_process_common()

svc_process_common()
        /* Setup reply header */
        rqstp-&gt;rq_xprt-&gt;xpt_ops-&gt;xpo_prep_reply_hdr(rqstp); &lt;&lt;&lt; HERE

svc_process_common() can use incorrect rqstp-&gt;rq_xprt,
its caller function bc_svc_process() takes it from serv-&gt;sv_bc_xprt.
The problem is that serv is global structure but sv_bc_xprt
is assigned per-netnamespace.

According to Trond, the whole "let's set up rqstp-&gt;rq_xprt
for the back channel" is nothing but a giant hack in order
to work around the fact that svc_process_common() uses it
to find the xpt_ops, and perform a couple of (meaningless
for the back channel) tests of xpt_flags.

All we really need in svc_process_common() is to be able to run
rqstp-&gt;rq_xprt-&gt;xpt_ops-&gt;xpo_prep_reply_hdr()

Bruce J Fields points that this xpo_prep_reply_hdr() call
is an awfully roundabout way just to do "svc_putnl(resv, 0);"
in the tcp case.

This patch does not initialiuze rqstp-&gt;rq_xprt in bc_svc_process(),
now it calls svc_process_common() with rqstp-&gt;rq_xprt = NULL.

To adjust reply header svc_process_common() just check
rqstp-&gt;rq_prot and calls svc_tcp_prep_reply_hdr() for tcp case.

To handle rqstp-&gt;rq_xprt = NULL case in functions called from
svc_process_common() patch intruduces net namespace pointer
svc_rqst-&gt;rq_bc_net and adjust SVC_NET() definition.
Some other function was also adopted to properly handle described case.

Signed-off-by: Vasily Averin &lt;vvs@virtuozzo.com&gt;
Cc: stable@vger.kernel.org
Fixes: 23c20ecd4475 ("NFS: callback up - users counting cleanup")
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
v2: - added lost extern svc_tcp_prep_reply_hdr()
    - dropped trace_svc_process() changes
    - context fixes in svc_process_common()
Signed-off-by: Vasily Averin &lt;vvs@virtuozzo.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>NFSv4: Fix callback server shutdown</title>
<updated>2017-09-27T12:39:18Z</updated>
<author>
<name>Trond Myklebust</name>
<email>trond.myklebust@primarydata.com</email>
</author>
<published>2017-04-26T15:55:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f609266b12d214437cf9d68245dc27f8d4f69836'/>
<id>urn:sha1:f609266b12d214437cf9d68245dc27f8d4f69836</id>
<content type='text'>
commit ed6473ddc704a2005b9900ca08e236ebb2d8540a upstream.

We want to use kthread_stop() in order to ensure the threads are
shut down before we tear down the nfs_callback_info in nfs_callback_down.

Tested-and-reviewed-by: Kinglong Mee &lt;kinglongmee@gmail.com&gt;
Reported-by: Kinglong Mee &lt;kinglongmee@gmail.com&gt;
Fixes: bb6aeba736ba9 ("NFSv4.x: Switch to using svc_set_num_threads()...")
Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Cc: Jan Hudoba &lt;kernel@jahu.sk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>SUNRPC: Add a server side per-connection limit</title>
<updated>2016-07-13T19:53:48Z</updated>
<author>
<name>Trond Myklebust</name>
<email>trond.myklebust@primarydata.com</email>
</author>
<published>2016-06-24T14:55:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ff3ac5c3dc2323ba54c3d9ef30ef4942a71b251d'/>
<id>urn:sha1:ff3ac5c3dc2323ba54c3d9ef30ef4942a71b251d</id>
<content type='text'>
Allow the user to limit the number of requests serviced through a single
connection, to help prevent faster clients from starving slower clients.

Signed-off-by: Trond Myklebust &lt;trond.myklebust@primarydata.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>mm, fs: remove remaining PAGE_CACHE_* and page_cache_{get,release} usage</title>
<updated>2016-04-04T17:41:08Z</updated>
<author>
<name>Kirill A. Shutemov</name>
<email>kirill.shutemov@linux.intel.com</email>
</author>
<published>2016-04-01T12:29:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ea1754a084760e68886f5b725c8eaada9cc57155'/>
<id>urn:sha1:ea1754a084760e68886f5b725c8eaada9cc57155</id>
<content type='text'>
Mostly direct substitution with occasional adjustment or removing
outdated comments.

Signed-off-by: Kirill A. Shutemov &lt;kirill.shutemov@linux.intel.com&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>nfsd/sunrpc: factor svc_rqst allocation and freeing from sv_nrthreads refcounting</title>
<updated>2015-08-10T20:05:44Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2015-06-08T19:11:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1b6dc1dffbb142de60eb65f6155276ac31ff5474'/>
<id>urn:sha1:1b6dc1dffbb142de60eb65f6155276ac31ff5474</id>
<content type='text'>
In later patches, we'll want to be able to allocate and free svc_rqst
structures without monkeying with the serv-&gt;sv_nrthreads refcount.

Factor those pieces out of their respective functions.

Signed-off-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>nfsd/sunrpc: move pool_mode definitions into svc.h</title>
<updated>2015-08-10T20:05:43Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2015-06-08T19:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d70bc0c67c7aaf0d00084b2f91b44fe1a8ae4e15'/>
<id>urn:sha1:d70bc0c67c7aaf0d00084b2f91b44fe1a8ae4e15</id>
<content type='text'>
In later patches, we're going to need to allow code external to svc.c
to figure out what pool_mode is in use. Move these definitions into
svc.h to prepare for that.

Also, make the svc_pool_map object available and exported so that other
modules can peek in there to get insight into what pool mode is in use.
Likewise, export svc_pool_map_get/put function to make it safe to do so.

Signed-off-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>nfsd/sunrpc: abstract out svc_set_num_threads to sv_ops</title>
<updated>2015-08-10T20:05:43Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2015-06-08T19:08:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=598e2359090d393b01a8e10386dc3056ccfa47ae'/>
<id>urn:sha1:598e2359090d393b01a8e10386dc3056ccfa47ae</id>
<content type='text'>
Add an operation that will do setup of the service. In the case of a
classic thread-based service that means starting up threads. In the case
of a workqueue-based service, the setup will do something different.

Signed-off-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Shirley Ma &lt;shirliey.ma@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>nfsd/sunrpc: turn enqueueing a svc_xprt into a svc_serv operation</title>
<updated>2015-08-10T20:05:42Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2015-06-08T19:06:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b9e13cdfac70e38ade17b53810a36968c5842339'/>
<id>urn:sha1:b9e13cdfac70e38ade17b53810a36968c5842339</id>
<content type='text'>
For now, all services use svc_xprt_do_enqueue, but once we add
workqueue-based service support, we'll need to do something different.

Signed-off-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>nfsd/sunrpc: move sv_module parm into sv_ops</title>
<updated>2015-08-10T20:05:41Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2015-06-08T19:05:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=758f62fff9ad630f05866a1dd6ae9453a7730c2e'/>
<id>urn:sha1:758f62fff9ad630f05866a1dd6ae9453a7730c2e</id>
<content type='text'>
...not technically an operation, but it's more convenient and cleaner
to pass the module pointer in this struct.

Signed-off-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
<entry>
<title>nfsd/sunrpc: move sv_function into sv_ops</title>
<updated>2015-08-10T20:05:41Z</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2015-06-08T19:04:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c369014f1776367269c8fbb5ea8932826d89ce2f'/>
<id>urn:sha1:c369014f1776367269c8fbb5ea8932826d89ce2f</id>
<content type='text'>
Since we now have a container for holding svc_serv operations, move the
sv_function into it as well.

Signed-off-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Tested-by: Shirley Ma &lt;shirley.ma@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</content>
</entry>
</feed>
