lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211031105004.GA12092@dcvr>
Date:   Sun, 31 Oct 2021 10:50:04 +0000
From:   Eric Wong <e@...24.org>
To:     Sargun Dhillon <sargun@...gun.me>
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
        willy@...radead.org, arnd@...nel.org,
        Willem de Bruijn <willemb@...gle.com>
Subject: Re: epoll may leak events on dup

Sargun Dhillon <sargun@...gun.me> wrote:
> On Sun, Oct 31, 2021 at 07:39:23AM +0000, Eric Wong wrote:
> > CRIU?  Checkpoint/Restore In Userspace?
> > Sargun Dhillon <sargun@...gun.me> wrote:
> > 
> Right, in CRIU, epoll is restored by manually cloning the FDs to the
> right spot, and re-installing the events into epoll. This requires:
> 0. Getting the original epoll FD
> 1. Fetching / recreating the original FD
> 2. dup2'ing it to right spot (and avoiding overwriting the original epoll FD)
> 3. EPOLL_CTL_ADD'ing the FD back in.

OK, am I understanding it's something like:

	int tmp_fd = epoll_create1(...);
	if (tmp_fd != orig_epfd) {
		dup2(tmp_fd, orig_epfd);
		close(tmp_fd);
	}

	for (/* loop over original FDs: */) {
		tmp_fd = socket(...);
		if (tmpfd != orig_sfd) {
			dup2(tmp_fd, orig_sfd);
			close(tmp_fd);
		}
		epoll_ctl(orig_epfd, EPOLL_CTL_ADD, orig_sfd, ...);
	}

Is that close to what CRIU is doing?
In no place does tmp_fd end up in the epoll rbtree, there.
Everything is keyed w/ orig_sfd and it's underlying file.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ