All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: Olga Kornievskaia <okorniev@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] fsidd: require root credentials on abstract socket
Date: Wed, 16 Sep 2026 10:19:20 -0400	[thread overview]
Message-ID: <3c533de0-da68-4e21-a410-26a9496f7db6@redhat.com> (raw)
In-Reply-To: <20260907011328.21425-1-okorniev@redhat.com>



On 9/6/26 9:13 PM, Olga Kornievskaia wrote:
> fsidd listens on an abstract UNIX domain socket which has no
> filesystem-level access control.  Any local unprivileged user can
> connect and issue mutating commands (get_or_create_fsidnum) that
> grow the reexport database without limit, degrading mountd
> performance.
> 
> Add a SO_PEERCRED check to reject connections from non-root
> clients.  The only legitimate client is mountd, which runs as root.
> 
> Fixes: 6fd2732d ("export: Add fsidd")
> Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
After all the recent fsidd changes this patch did
apply cleanly..

Committed... (tag: nfs-utils-2-9-3-rc4)

steved.
> ---
>   support/reexport/fsidd.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/support/reexport/fsidd.c b/support/reexport/fsidd.c
> index 9b80b451..c714386e 100644
> --- a/support/reexport/fsidd.c
> +++ b/support/reexport/fsidd.c
> @@ -7,6 +7,7 @@
>   #include <dlfcn.h>
>   #endif
>   #include <event2/event.h>
> +#include <sys/socket.h>
>   #include <sys/un.h>
>   #include <unistd.h>
>   
> @@ -147,6 +148,8 @@ static void srv_cb(evutil_socket_t fd, short ev, void *d)
>   {
>   	int cl = accept4(fd, NULL, NULL, SOCK_NONBLOCK);
>   	struct event *client_ev;
> +	struct ucred cred;
> +	socklen_t clen = sizeof(cred);
>   
>   	if (cl == -1) {
>   		if (errno == EMFILE || errno == ENFILE || errno == ENOMEM ||
> @@ -162,6 +165,12 @@ static void srv_cb(evutil_socket_t fd, short ev, void *d)
>   	(void)ev;
>   	(void)d;
>   
> +	if (getsockopt(cl, SOL_SOCKET, SO_PEERCRED, &cred, &clen) < 0 ||
> +	    cred.uid != 0) {
> +		close(cl);
> +		return;
> +	}
> +
>   	client_ev = event_new(evbase, cl, EV_READ | EV_PERSIST | EV_CLOSED, client_cb, event_self_cbarg());
>   	if (!client_ev || event_add(client_ev, NULL) == -1) {
>   		if (client_ev)


      parent reply	other threads:[~2026-09-16 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  1:13 [PATCH 1/1] fsidd: require root credentials on abstract socket Olga Kornievskaia
2026-09-07  1:13 ` [PATCH 1/3] libtirpc: Fix use-after-free in xdr_pmaplist() XDR_FREE path Olga Kornievskaia
2026-09-13  3:48   ` Steve Dickson
2026-09-07  1:13 ` [PATCH 2/3] libtirpc: limit XDR decode node count Olga Kornievskaia
2026-09-13  3:48   ` Steve Dickson
2026-09-07  1:13 ` [PATCH 3/3] libtirpc: Bound maxsize in xdr_rpc_gss_unwrap_data() decode calls Olga Kornievskaia
2026-09-13  3:49   ` Steve Dickson
2026-09-13  3:47 ` [PATCH 1/1] fsidd: require root credentials on abstract socket Steve Dickson
2026-09-16 14:19 ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c533de0-da68-4e21-a410-26a9496f7db6@redhat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=okorniev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.