<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/lockd/svc.c, branch linux-6.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-06-12T16:16:34Z</updated>
<entry>
<title>lockd: drop inappropriate svc_get() from locked_get()</title>
<updated>2023-06-12T16:16:34Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2023-06-02T21:14:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=665e89ab7c5af1f2d260834c861a74b01a30f95f'/>
<id>urn:sha1:665e89ab7c5af1f2d260834c861a74b01a30f95f</id>
<content type='text'>
The below-mentioned patch was intended to simplify refcounting on the
svc_serv used by locked.  The goal was to only ever have a single
reference from the single thread.  To that end we dropped a call to
lockd_start_svc() (except when creating thread) which would take a
reference, and dropped the svc_put(serv) that would drop that reference.

Unfortunately we didn't also remove the svc_get() from
lockd_create_svc() in the case where the svc_serv already existed.
So after the patch:
 - on the first call the svc_serv was allocated and the one reference
   was given to the thread, so there are no extra references
 - on subsequent calls svc_get() was called so there is now an extra
   reference.
This is clearly not consistent.

The inconsistency is also clear in the current code in lockd_get()
takes *two* references, one on nlmsvc_serv and one by incrementing
nlmsvc_users.   This clearly does not match lockd_put().

So: drop that svc_get() from lockd_get() (which used to be in
lockd_create_svc().

Reported-by: Ido Schimmel &lt;idosch@idosch.org&gt;
Closes: https://lore.kernel.org/linux-nfs/ZHsI%2FH16VX9kJQX1@shredder/T/#u
Fixes: b73a2972041b ("lockd: move lockd_start_svc() call into lockd_create_svc()")
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Tested-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'nfsd-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux</title>
<updated>2023-05-17T16:56:01Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2023-05-17T16:56:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1b66c114d161a457897d269420c74620c032135c'/>
<id>urn:sha1:1b66c114d161a457897d269420c74620c032135c</id>
<content type='text'>
Pull nfsd fixes from Chuck Lever:

 - A collection of minor bug fixes

* tag 'nfsd-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  NFSD: Remove open coding of string copy
  SUNRPC: Fix trace_svc_register() call site
  SUNRPC: always free ctxt when freeing deferred request
  SUNRPC: double free xprt_ctxt while still in use
  SUNRPC: Fix error handling in svc_setup_socket()
  SUNRPC: Fix encoding of accepted but unsuccessful RPC replies
  lockd: define nlm_port_min,max with CONFIG_SYSCTL
  nfsd: define exports_proc_ops with CONFIG_PROC_FS
  SUNRPC: Avoid relying on crypto API to derive CBC-CTS output IV
</content>
</entry>
<entry>
<title>lockd: define nlm_port_min,max with CONFIG_SYSCTL</title>
<updated>2023-05-02T19:47:33Z</updated>
<author>
<name>Tom Rix</name>
</author>
<published>2023-05-02T18:07:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fc412a6196a6f46ece0e6e6b118556464f165800'/>
<id>urn:sha1:fc412a6196a6f46ece0e6e6b118556464f165800</id>
<content type='text'>
gcc with W=1 and ! CONFIG_SYSCTL
fs/lockd/svc.c:80:51: error: ‘nlm_port_max’ defined but not used [-Werror=unused-const-variable=]
   80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
      |                                                   ^~~~~~~~~~~~
fs/lockd/svc.c:80:33: error: ‘nlm_port_min’ defined but not used [-Werror=unused-const-variable=]
   80 | static const int                nlm_port_min = 0, nlm_port_max = 65535;
      |                                 ^~~~~~~~~~~~

The only use of these variables is when CONFIG_SYSCTL
is defined, so their definition should be likewise conditional.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>lockd: simplify two-level sysctl registration for nlm_sysctls</title>
<updated>2023-04-13T18:49:35Z</updated>
<author>
<name>Luis Chamberlain</name>
</author>
<published>2023-03-10T08:37:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=37b768ce3d23f79cef906aaf7427dd345b57f477'/>
<id>urn:sha1:37b768ce3d23f79cef906aaf7427dd345b57f477</id>
<content type='text'>
There is no need to declare two tables to just create directories,
this can be easily be done with a prefix path with register_sysctl().

Simplify this registration.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'sysctl-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux</title>
<updated>2023-02-23T22:16:56Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2023-02-23T22:16:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fcc77d7c8ef6478844547d50dd3d03270c86116c'/>
<id>urn:sha1:fcc77d7c8ef6478844547d50dd3d03270c86116c</id>
<content type='text'>
Pull sysctl update from Luis Chamberlain:
 "Just one fix which just came in.

  Sadly the eager beavers willing to help with the sysctl moves have
  slowed"

* tag 'sysctl-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
  sysctl: fix proc_dobool() usability
</content>
</entry>
<entry>
<title>sysctl: fix proc_dobool() usability</title>
<updated>2023-02-21T21:34:07Z</updated>
<author>
<name>Ondrej Mosnacek</name>
</author>
<published>2023-02-10T14:58:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f1aa2eb5ea05ccd1fd92d235346e60e90a1ed949'/>
<id>urn:sha1:f1aa2eb5ea05ccd1fd92d235346e60e90a1ed949</id>
<content type='text'>
Currently proc_dobool expects a (bool *) in table-&gt;data, but sizeof(int)
in table-&gt;maxsize, because it uses do_proc_dointvec() directly.

This is unsafe for at least two reasons:
1. A sysctl table definition may use { .data = &amp;variable, .maxsize =
   sizeof(variable) }, not realizing that this makes the sysctl unusable
   (see the Fixes: tag) and that they need to use the completely
   counterintuitive sizeof(int) instead.
2. proc_dobool() will currently try to parse an array of values if given
   .maxsize &gt;= 2*sizeof(int), but will try to write values of type bool
   by offsets of sizeof(int), so it will not work correctly with neither
   an (int *) nor a (bool *). There is no .maxsize validation to prevent
   this.

Fix this by:
1. Constraining proc_dobool() to allow only one value and .maxsize ==
   sizeof(bool).
2. Wrapping the original struct ctl_table in a temporary one with .data
   pointing to a local int variable and .maxsize set to sizeof(int) and
   passing this one to proc_dointvec(), converting the value to/from
   bool as needed (using proc_dou8vec_minmax() as an example).
3. Extending sysctl_check_table() to enforce proc_dobool() expectations.
4. Fixing the proc_dobool() docstring (it was just copy-pasted from
   proc_douintvec, apparently...).
5. Converting all existing proc_dobool() users to set .maxsize to
   sizeof(bool) instead of sizeof(int).

Fixes: 83efeeeb3d04 ("tty: Allow TIOCSTI to be disabled")
Fixes: a2071573d634 ("sysctl: introduce new proc handler proc_dobool")
Signed-off-by: Ondrej Mosnacek &lt;omosnace@redhat.com&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Use per-CPU counters to tally server RPC counts</title>
<updated>2023-02-20T14:20:32Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-01-10T15:31:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=65ba3d2425bf51165b6e88509c632bd15d12883d'/>
<id>urn:sha1:65ba3d2425bf51165b6e88509c632bd15d12883d</id>
<content type='text'>
 - Improves counting accuracy
 - Reduces cross-CPU memory traffic

Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Refactor RPC server dispatch method</title>
<updated>2023-02-20T14:20:31Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-01-08T16:30:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cee4db19452467eef8ab93c6eb6a3a84d11d25d7'/>
<id>urn:sha1:cee4db19452467eef8ab93c6eb6a3a84d11d25d7</id>
<content type='text'>
Currently, svcauth_gss_accept() pre-reserves response buffer space
for the RPC payload length and GSS sequence number before returning
to the dispatcher, which then adds the header's accept_stat field.

The problem is the accept_stat field is supposed to go before the
length and seq_num fields. So svcauth_gss_release() has to relocate
the accept_stat value (see svcauth_gss_prepare_to_wrap()).

To enable these fields to be added to the response buffer in the
correct (final) order, the pointer to the accept_stat has to be made
available to svcauth_gss_accept() so that it can set it before
reserving space for the length and seq_num fields.

As a first step, move the pointer to the location of the accept_stat
field into struct svc_rqst.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Push svcxdr_init_encode() into svc_process_common()</title>
<updated>2023-02-20T14:20:27Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-01-08T16:29:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8dd41d70f331c342842e8d349d7a1f73b0ba7ccd'/>
<id>urn:sha1:8dd41d70f331c342842e8d349d7a1f73b0ba7ccd</id>
<content type='text'>
Now that all vs_dispatch functions invoke svcxdr_init_encode(), it
is common code and can be pushed down into the generic RPC server.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Push svcxdr_init_decode() into svc_process_common()</title>
<updated>2023-02-20T14:20:09Z</updated>
<author>
<name>Chuck Lever</name>
</author>
<published>2023-01-02T17:05:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dba5eaa46b0282cb9607d362c8887dfcb44bfd2e'/>
<id>urn:sha1:dba5eaa46b0282cb9607d362c8887dfcb44bfd2e</id>
<content type='text'>
Now that all vs_dispatch functions invoke svcxdr_init_decode(), it
is common code and can be pushed down into the generic RPC server.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
</content>
</entry>
</feed>
