Re: [PATCH RFC v3 04/10] coredump: add coredump socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian Brauner <brauner@xxxxxxxxxx>
Date: Mon, 05 May 2025 13:13:42 +0200
> @@ -801,6 +846,40 @@ void do_coredump(const kernel_siginfo_t *siginfo)
>  		}
>  		break;
>  	}
> +	case COREDUMP_SOCK: {
> +		struct file *file __free(fput) = NULL;
> +#ifdef CONFIG_UNIX
> +		struct socket *socket;
> +
> +		/*
> +		 * It is possible that the userspace process which is
> +		 * supposed to handle the coredump and is listening on
> +		 * the AF_UNIX socket coredumps. Userspace should just
> +		 * mark itself non dumpable.
> +		 */
> +
> +		retval = sock_create_kern(&init_net, AF_UNIX, SOCK_STREAM, 0, &socket);
> +		if (retval < 0)
> +			goto close_fail;
> +
> +		file = sock_alloc_file(socket, 0, NULL);
> +		if (IS_ERR(file)) {
> +			sock_release(socket);
> +			retval = PTR_ERR(file);
> +			goto close_fail;
> +		}
> +
> +		retval = kernel_connect(socket,
> +					(struct sockaddr *)(&coredump_unix_socket),
> +					COREDUMP_UNIX_SOCKET_ADDR_SIZE, 0);

This blocks forever if the listener's accept() queue is full.

I think we don't want that and should pass O_NONBLOCK.

To keep the queue clean is userspace responsibility, and we don't
need to care about a weird user.


> +		if (retval)
> +			goto close_fail;
> +
> +		cprm.limit = RLIM_INFINITY;
> +#endif
> +		cprm.file = no_free_ptr(file);
> +		break;
> +	}
>  	default:
>  		WARN_ON_ONCE(true);
>  		retval = -EINVAL;




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux