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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180111052200.GJ13338@ZenIV.linux.org.uk>
Date:   Thu, 11 Jan 2018 05:22:00 +0000
From:   Al Viro <viro@...IV.linux.org.uk>
To:     Christoph Hellwig <hch@....de>
Cc:     Avi Kivity <avi@...lladb.com>, linux-aio@...ck.org,
        linux-fsdevel@...r.kernel.org, netdev@...r.kernel.org,
        linux-api@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/32] fs: introduce new ->get_poll_head and ->poll_mask
 methods

On Wed, Jan 10, 2018 at 09:04:16PM +0000, Al Viro wrote:
> On Wed, Jan 10, 2018 at 04:58:24PM +0100, Christoph Hellwig wrote:
> > ->get_poll_head returns the waitqueue that the poll operation is going
> > to sleep on.  Note that this means we can only use a single waitqueue
> > for the poll, unlike some current drivers that use two waitqueues for
> > different events.  But now that we have keyed wakeups and heavily use
> > those for poll there aren't that many good reason left to keep the
> > multiple waitqueues, and if there are any ->poll is still around, the
> > driver just won't support aio poll.
> 
> There's another problem with that - currently ->poll() may tell you "sod off,
> I've got nothing for you to sleep on, eat your POLLHUP|POLLERR|something
> and don't pester me again".  With your API that's hard to express sanely.
> 
> Another piece of fun related to that is handling of disconnects in general -
> 
> static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts)
> {
>         struct proc_dir_entry *pde = PDE(file_inode(file));
>         __poll_t rv = DEFAULT_POLLMASK;
>         __poll_t (*poll)(struct file *, struct poll_table_struct *);
>         if (use_pde(pde)) {
>                 poll = pde->proc_fops->poll;
>                 if (poll)
>                         rv = poll(file, pts);
>                 unuse_pde(pde);
>         }
>         return rv;
> }
> 
> and similar in sysfs.  
> 
> Note, BTW, the places like wait->_qproc = NULL; in do_select() and its ilk.
> Some of them are "don't bother putting me on any queues, I won't be sleeping
> anyway".  Some are "I'm already on all queues I care about, I'm going to
> sleep now and the query everything again once woken up".  It would be nice
> to have the method splitup reflect that kind of logics...
> 
> What about af_alg_poll(), BTW?  Looks like you've missed that one...
> 
> Another thing: IMO file_can_poll() should use FMODE_CAN_POLL - either as
> "true if set, otherwise check ->f_op and set accordingly" or set in
> do_dentry_open() and just check it in file_can_poll()...

Whee...  The very first ->poll() instance in alphabetic order on pathnames:
in arch/cris/arch-v10/drivers/gpio.c

static __poll_t gpio_poll(struct file *file, poll_table *wait)
{
        __poll_t mask = 0;
        struct gpio_private *priv = file->private_data;
        unsigned long data;
        unsigned long flags;

        spin_lock_irqsave(&gpio_lock, flags);

        poll_wait(file, &priv->alarm_wq, wait);

IOW, we are doing poll_wait() (== possible GFP_KERNEL __get_free_page()) under
a spinlock...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ