[Devel] [PATCH RHEL10 COMMIT] ms/net, pidfd: report EINVAL for ESRCH

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 24 15:05:15 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.8.vz10
------>
commit 24567fd12e301d424740a02cfbf67f761cb6b74d
Author: Christian Brauner <brauner at kernel.org>
Date:   Wed Apr 16 22:05:40 2025 +0200

    ms/net, pidfd: report EINVAL for ESRCH
    
    dbus-broker relies -EINVAL being returned to indicate ESRCH in [1].
    This causes issues for some workloads as reported in [2].
    Paper over it until this is fixed in userspace.
    
    Link: https://lore.kernel.org/20250416-gegriffen-tiefbau-70cfecb80ac8@brauner
    Link: https://github.com/bus1/dbus-broker/blob/5d34d91b138fc802a016aa68c093eb81ea31139c/src/util/sockopt.c#L241 [1]
    Link: https://lore.kernel.org/20250415223454.GA1852104@ax162 [2]
    Tested-by: Nathan Chancellor <nathan at kernel.org>
    Signed-off-by: Christian Brauner <brauner at kernel.org>
    
    (cherry picked from commit b590c928cca7bdc7fd580d52e42bfdc3ac5eeacb)
    https://virtuozzo.atlassian.net/browse/VSTOR-142602
    Feature: fix ms/net
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/core/sock.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 7152c2f70792..5281899aaafd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1914,8 +1914,16 @@ int sk_getsockopt(struct sock *sk, int level, int optname,
 
 		pidfd = pidfd_prepare(peer_pid, 0, &pidfd_file);
 		put_pid(peer_pid);
-		if (pidfd < 0)
+		if (pidfd < 0) {
+			/*
+			 * dbus-broker relies on -EINVAL being returned
+			 * to indicate ESRCH. Paper over it until this
+			 * is fixed in userspace.
+			 */
+			if (pidfd == -ESRCH)
+				pidfd = -EINVAL;
 			return pidfd;
+		}
 
 		if (copy_to_sockptr(optval, &pidfd, len) ||
 		    copy_to_sockptr(optlen, &len, sizeof(int))) {


More information about the Devel mailing list