Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583612

Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number

Path csiph.com!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From Cyrill Gorcunov <gorcunov@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number
Date Fri, 17 Feb 2017 18:20:01 +0100
Message-ID <tbUml-79M-9@gated-at.bofh.it> (permalink)
References <tbMf7-1Su-1@gated-at.bofh.it> <tbU30-6Np-9@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0KZIyzSse8OHuZ+YUOJY2xfCIYDjwM5F80nWIQkgYcQ=; b=bOEEu72KgC4jVtym2Yg/ZRn72E7hNdhy+N/kX3I6v01Nw2BRX+A1dJV+WtzQeT7H1W 9UpoUAlLG+38jlaeF8ykfLgxBg2fmIp5V2QQX1/oQqNDlaE4OuOxYev40WoBcTlRJr/Y d1zzYVJb3YW2TojaqjTcxer8U8WsW3t66vgpl9CFuFTW1+Ksa++ubMrgRyh+7WAs43GY EQb+G28TH9TjJBOaepzVEC7LoZsJSD1Et57XDtQv4iOmaWEr9q2sqHL6uYofScShgXrV xBWsIft5utNbG42lFiPLrJHj4RYopV/lYJ7CjcNcTnEvsTXs1A14+kNuwruiTRGT8YXK Mhyg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0KZIyzSse8OHuZ+YUOJY2xfCIYDjwM5F80nWIQkgYcQ=; b=mZV86kQ4IeJDHIu1P6ZoRJzx5zEC+Xws18rS8dH3ZL1Tx66iOda28Cq9zzlpQC0lPa XlF0bkSF+v5SX+HHqpuDbcapdZiFX/81ttPj0CG5L2mSDQSa+borxwopH2bAqU8uS9EG YF54BJP4mE+hq74FXiMBK0CjGEt+WWeUBVthSu/0JoVSQfxVwpZqyeKbB1OrYy9uVGSL IdS2G2KZRTAFu9ByPTCmlNBnQbV/xqNGzzK0TwepWabktMOqIVeFcPD9ViKkN/ngks+3 l6llg9uaezyIzJgtpZgB8g5XCPp9Wokj1xl9P6JHpqOZproTjIKCb0i+XLOdg97O0VmW J8zQ==
X-Gm-Message-State AMke39kROUtR5hg0QN67337Iv1RbpekpXZDrkw2ypKyagzE6tDcncIsAC2NRbhgblvwzcg==
X-Received by 10.46.0.218 with SMTP id e87mr2334216lji.137.1487351499292; Fri, 17 Feb 2017 09:11:39 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.7.1 (2016-10-04)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 23
Organization linux.* mail to news gateway
X-Original-Cc Linux FS Devel <linux-fsdevel@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Linux API <linux-api@vger.kernel.org>, Al Viro <viro@zeniv.linux.org.uk>, Andrew Morton <akpm@linuxfoundation.org>, Andrew Vagin <avagin@virtuozzo.com>, Pavel Emelyanov <xemul@virtuozzo.com>, Michael Kerrisk <mtk.manpages@gmail.com>, Kirill Kolyshkin <kir@openvz.org>, Andrey Vagin <avagin@openvz.org>
X-Original-Date Fri, 17 Feb 2017 20:11:36 +0300
X-Original-Message-ID <20170217171136.GA23766@uranus>
X-Original-References <20170217083324.627615532@openvz.org> <CALCETrUOaNaS6yAhLM9jLb8PD2eg2ZwXfu4v327aAOy82SbLwg@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1583612

Show key headers only | View raw


On Fri, Feb 17, 2017 at 08:52:59AM -0800, Andy Lutomirski wrote:
> >
> > 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.

Well, I tend to agree. Need to add security checking if the target
file is accessable by a caller. As to better interface to procfs
nothing comes to mind immediately. Another potential problem is that
since it is never guaranteed that target file number listed in fdinfo
matching existing /proc/pid/fd/N, so that I think we will have to
use this dup functionality for every target file, which of course
not that fast. Probably need to think more if I manage to invent
some better and faster interface to find where exactly target file
belong in the whole process tree of a container.

Thanks for pointing about this security problem, Andy!

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 1/2] fs,eventpoll: Add ability to install target file by its number Cyrill Gorcunov <gorcunov@openvz.org> - 2017-02-17 09:40 +0100
  Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number Andy Lutomirski <luto@amacapital.net> - 2017-02-17 18:00 +0100
    Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by  its number Cyrill Gorcunov <gorcunov@gmail.com> - 2017-02-17 18:20 +0100
      Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its number Andy Lutomirski <luto@amacapital.net> - 2017-02-17 18:30 +0100
        Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by  its number Cyrill Gorcunov <gorcunov@gmail.com> - 2017-02-17 19:10 +0100
          Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by its  number Jason Baron <jbaron@akamai.com> - 2017-02-17 19:40 +0100
            Re: [RFC 1/2] fs,eventpoll: Add ability to install target file by  its number Cyrill Gorcunov <gorcunov@gmail.com> - 2017-02-17 20:50 +0100

csiph-web