linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/3] fs,epoll: Add ability to call kcmp to find target files
@ 2017-02-21 16:59 Cyrill Gorcunov
  2017-02-21 20:32 ` Jason Baron
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2017-02-21 16:59 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, linux-api
  Cc: viro, akpm, avagin, xemul, mtk.manpages, kir, gorcunov, luto, jbaron

Hi! In previous series EPOLL_CTL_DUP operation has been discussed
but considered as potentially scary. So here is an another approach:

 - extend fdinfo of epoll files with inode, device and file position
   for every target, which allow the reader to gather targets with
   this bundle as a key for primary sorting

 - extent kcmp to check if some particular file is matching one
   sitting inside epoll queue (duplicate numbers are resolved with
   offset parameter)

Please take a look once time permit. Note that I did only basic
testing (without CRIU) but it should fit our needs because we
sort and lookup regualr files by same scheme. So I'm about to
implemet full criu support for this new kernel features in
a couple of days thus any comments are *higly* appreciated.

NB: Initially I added

	if (file_ns_capable(epi->ffd.file, ns, CAP_SYS_ADMIN))

into fdinfo output to check if caller is allowed to see
target ino/dev/pos but dropped it later because if process
is added file descriptor into epoll queue it mean fdstat
and such already can be called and this information is
already obtained, so I don't this it's information
disclosure.

	Cyrill

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 0/3] fs,epoll: Add ability to call kcmp to find target files
  2017-02-21 16:59 [RFC 0/3] fs,epoll: Add ability to call kcmp to find target files Cyrill Gorcunov
@ 2017-02-21 20:32 ` Jason Baron
  2017-02-21 20:54   ` Cyrill Gorcunov
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Baron @ 2017-02-21 20:32 UTC (permalink / raw)
  To: Cyrill Gorcunov, linux-fsdevel, linux-kernel, linux-api
  Cc: viro, akpm, avagin, xemul, mtk.manpages, kir, luto

On 02/21/2017 11:59 AM, Cyrill Gorcunov wrote:
> Hi! In previous series EPOLL_CTL_DUP operation has been discussed
> but considered as potentially scary. So here is an another approach:
>
>  - extend fdinfo of epoll files with inode, device and file position
>    for every target, which allow the reader to gather targets with
>    this bundle as a key for primary sorting
>
>  - extent kcmp to check if some particular file is matching one
>    sitting inside epoll queue (duplicate numbers are resolved with
>    offset parameter)
>

Hi,

Since an epoll fd can be added to another epoll fd, I'm wondering if you 
have enough data here to figure that out. The inode is the 
'anon_inode_inode', so I'm wondering if that is sufficient to 
distinguish it from other anonymous inodes, or if an extra bit is 
required to indicate if the target file is in fact and epoll fd.

Thanks,

-Jason

> Please take a look once time permit. Note that I did only basic
> testing (without CRIU) but it should fit our needs because we
> sort and lookup regualr files by same scheme. So I'm about to
> implemet full criu support for this new kernel features in
> a couple of days thus any comments are *higly* appreciated.
>
> NB: Initially I added
>
> 	if (file_ns_capable(epi->ffd.file, ns, CAP_SYS_ADMIN))
>
> into fdinfo output to check if caller is allowed to see
> target ino/dev/pos but dropped it later because if process
> is added file descriptor into epoll queue it mean fdstat
> and such already can be called and this information is
> already obtained, so I don't this it's information
> disclosure.
>
> 	Cyrill
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 0/3] fs,epoll: Add ability to call kcmp to find target files
  2017-02-21 20:32 ` Jason Baron
@ 2017-02-21 20:54   ` Cyrill Gorcunov
  2017-02-28 17:11     ` Cyrill Gorcunov
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2017-02-21 20:54 UTC (permalink / raw)
  To: Jason Baron
  Cc: linux-fsdevel, linux-kernel, linux-api, viro, akpm, avagin,
	xemul, mtk.manpages, kir, luto

On Tue, Feb 21, 2017 at 03:32:21PM -0500, Jason Baron wrote:
> Hi,
> 
> Since an epoll fd can be added to another epoll fd, I'm wondering if you
> have enough data here to figure that out. The inode is the
> 'anon_inode_inode', so I'm wondering if that is sufficient to distinguish it
> from other anonymous inodes, or if an extra bit is required to indicate if
> the target file is in fact and epoll fd.

I think it should be ebough (together with sdev and pos). But will
look more closely tomorrow once I sit implementing criu support :)
(that's why it is early rfc, to gather comments)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 0/3] fs,epoll: Add ability to call kcmp to find target files
  2017-02-21 20:54   ` Cyrill Gorcunov
@ 2017-02-28 17:11     ` Cyrill Gorcunov
  0 siblings, 0 replies; 4+ messages in thread
From: Cyrill Gorcunov @ 2017-02-28 17:11 UTC (permalink / raw)
  To: Jason Baron
  Cc: linux-fsdevel, linux-kernel, linux-api, viro, akpm, avagin,
	xemul, mtk.manpages, kir, luto

On Tue, Feb 21, 2017 at 11:54:34PM +0300, Cyrill Gorcunov wrote:
> 
> I think it should be ebough (together with sdev and pos). But will
> look more closely tomorrow once I sit implementing criu support :)
> (that's why it is early rfc, to gather comments)

FWIW, yes, it is enough for primary sorting key. Once it matches
the key from other anon block we use kcmp call to find exact
match (kid_epoll_lookup lookups over primary keys generated by
inode/sdev/pos, and then using kcmp we walk over files)

https://github.com/cyrillos/criu/blob/epoll-tgt-3/criu/kcmp-ids.c#L158

	Cyrill

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-28 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 16:59 [RFC 0/3] fs,epoll: Add ability to call kcmp to find target files Cyrill Gorcunov
2017-02-21 20:32 ` Jason Baron
2017-02-21 20:54   ` Cyrill Gorcunov
2017-02-28 17:11     ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).