From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934639AbdBQQxY (ORCPT ); Fri, 17 Feb 2017 11:53:24 -0500 Received: from mail-vk0-f52.google.com ([209.85.213.52]:34651 "EHLO mail-vk0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934066AbdBQQxV (ORCPT ); Fri, 17 Feb 2017 11:53:21 -0500 MIME-Version: 1.0 In-Reply-To: <20170217083324.627615532@openvz.org> References: <20170217083324.627615532@openvz.org> From: Andy Lutomirski Date: Fri, 17 Feb 2017 08:52:59 -0800 Message-ID: Subject: Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number To: Cyrill Gorcunov Cc: Linux FS Devel , "linux-kernel@vger.kernel.org" , Linux API , Al Viro , Andrew Morton , Andrew Vagin , Pavel Emelyanov , Michael Kerrisk , Kirill Kolyshkin , Andrey Vagin Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 17, 2017 at 12:30 AM, Cyrill Gorcunov wrote: > When we checkpoint a process we look into /proc//fdinfo/ of eventpoll > file and parse target files list from there. In most situations this is fine > because target file is present in the /proc//fd/ list. But in case if file > descriptor was dup'ed or transferred via unix socket and closed after, > it might not be in the list and we can't figure out which file descriptor > to pass into epoll_ctl call. > > To resolve this tie lets add EPOLL_CTL_DUP operation which simply takes > target file descriptor number and installs it into a caller's file table, > thus we can use kcmp() syscall and figure out which exactly file to be > added into eventpoll on restore procedure. This is a scary thing to let an unprivileged process do. I'm wondering if there might be a nicer way to address this using a better interface in /proc. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number Date: Fri, 17 Feb 2017 08:52:59 -0800 Message-ID: References: <20170217083324.627615532@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <20170217083324.627615532-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Cyrill Gorcunov Cc: Linux FS Devel , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Linux API , Al Viro , Andrew Morton , Andrew Vagin , Pavel Emelyanov , Michael Kerrisk , Kirill Kolyshkin , Andrey Vagin List-Id: linux-api@vger.kernel.org On Fri, Feb 17, 2017 at 12:30 AM, Cyrill Gorcunov wrote: > When we checkpoint a process we look into /proc//fdinfo/ of eventpoll > file and parse target files list from there. In most situations this is fine > because target file is present in the /proc//fd/ list. But in case if file > descriptor was dup'ed or transferred via unix socket and closed after, > it might not be in the list and we can't figure out which file descriptor > to pass into epoll_ctl call. > > To resolve this tie lets add EPOLL_CTL_DUP operation which simply takes > target file descriptor number and installs it into a caller's file table, > thus we can use kcmp() syscall and figure out which exactly file to be > added into eventpoll on restore procedure. This is a scary thing to let an unprivileged process do. I'm wondering if there might be a nicer way to address this using a better interface in /proc.