Re: [RFC] ->poll() bugs
From: Al Viro
Date: Sat Mar 07 2015 - 16:03:38 EST
On Sat, Mar 07, 2015 at 12:53:14PM -0800, Linus Torvalds wrote:
> On Sat, Mar 7, 2015 at 12:44 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Most of the catch consists of ->poll() instances that return -E...; there's
> > also an unpleasant mess in net/9p/trans_fd.c and a braino in sunrpc
> > unexpectedly caught by the same annotations.
>
> Hmm. I do wonder if we should just *allow* ->poll() to return an
> error, and just turn it into "all bits set"?
>
> But if getting sparse to catch them all isn't *too* painful and the
> patch doesn't end up being horribly big, then I guess that's ok.
>
> > Linus, what do you think about putting those annotations into mainline during
> > the next cycle?
>
> Just how big is that annotation patch? We have a *lot* of poll
> functions, don't we?
Several hundreds over the entire tree.
> If they all need to be changed, just how bad is
> the noise for that?
One or two lines per function. Either just the return type (i.e.
s/unsigned int/__poll_t/ in declaration) or that plus local variable
used to build the return value - something like unsigned int mask = 0;
turning into __poll_t mask = 0. See vfs.git#poll; I'm NOT proposing
to pull it right now, but pull request would contain the following:
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git poll
Shortlog:
Al Viro (20):
switch poll.h to generic-y where possible
annotate POLL... constants and ->poll() return value
annotate poll_table_struct->_key and poll_table_entry->key
annotate wake_..._poll() last argument
fs: annotate ->poll() instances
annotate proto_ops ->poll()
annotate proto_ops ->poll() instances
net: annotate file_operations ->poll() instances
kernel: annotate ->poll() instances
annotate posix clock
annotate security/
annotate mm/
annotate ipc/
annotate drivers/media and its users
annotate sound/
annotate tty
annotate assorted drivers
missed tomoyo annotation
VFS annotations
annotations around wakeup callbacks
Diffstat:
arch/alpha/include/asm/Kbuild | 1 +
arch/alpha/include/uapi/asm/poll.h | 1 -
arch/blackfin/include/uapi/asm/poll.h | 4 +--
arch/cris/include/asm/Kbuild | 1 +
arch/cris/include/uapi/asm/poll.h | 1 -
arch/frv/include/uapi/asm/poll.h | 2 +-
arch/ia64/include/asm/Kbuild | 1 +
arch/ia64/include/uapi/asm/poll.h | 1 -
arch/m32r/include/asm/Kbuild | 1 +
arch/m32r/include/uapi/asm/poll.h | 1 -
arch/m68k/include/uapi/asm/poll.h | 2 +-
arch/microblaze/include/asm/Kbuild | 1 +
arch/microblaze/include/uapi/asm/poll.h | 1 -
arch/mips/include/uapi/asm/poll.h | 2 +-
arch/mn10300/include/asm/Kbuild | 1 +
arch/mn10300/include/uapi/asm/poll.h | 1 -
arch/powerpc/include/asm/Kbuild | 1 +
arch/powerpc/include/uapi/asm/poll.h | 1 -
arch/s390/include/asm/Kbuild | 1 +
arch/s390/include/uapi/asm/poll.h | 1 -
arch/score/include/asm/Kbuild | 1 +
arch/score/include/uapi/asm/poll.h | 6 ----
arch/sparc/include/uapi/asm/poll.h | 8 ++---
arch/x86/include/asm/Kbuild | 1 +
arch/x86/include/uapi/asm/poll.h | 1 -
arch/xtensa/include/uapi/asm/poll.h | 4 +--
block/bsg.c | 4 +--
crypto/algif_skcipher.c | 6 ++--
drivers/android/binder.c | 2 +-
drivers/bluetooth/hci_ldisc.c | 2 +-
drivers/bluetooth/hci_vhci.c | 2 +-
drivers/char/hpet.c | 2 +-
drivers/char/ipmi/ipmi_devintf.c | 4 +--
drivers/char/ipmi/ipmi_watchdog.c | 4 +--
drivers/char/pcmcia/cm4040_cs.c | 4 +--
drivers/char/ppdev.c | 4 +--
drivers/char/random.c | 4 +--
drivers/char/virtio_console.c | 4 +--
drivers/char/xillybus/xillybus_core.c | 4 +--
drivers/dma-buf/dma-buf.c | 6 ++--
drivers/firewire/core-cdev.c | 4 +--
drivers/firewire/nosy.c | 4 +--
drivers/gpu/drm/drm_fops.c | 4 +--
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 2 +-
drivers/gpu/vga/vgaarb.c | 2 +-
drivers/hid/hid-debug.c | 2 +-
drivers/hid/hid-roccat.c | 2 +-
drivers/hid/hidraw.c | 2 +-
drivers/hid/uhid.c | 2 +-
drivers/hid/usbhid/hiddev.c | 2 +-
drivers/iio/iio_core.h | 2 +-
drivers/iio/industrialio-buffer.c | 2 +-
drivers/iio/industrialio-event.c | 4 +--
drivers/infiniband/core/ucm.c | 4 +--
drivers/infiniband/core/ucma.c | 4 +--
drivers/infiniband/core/user_mad.c | 4 +--
drivers/infiniband/core/uverbs_main.c | 4 +--
drivers/infiniband/hw/ipath/ipath_file_ops.c | 23 +++++++-------
drivers/infiniband/hw/qib/qib_file_ops.c | 14 ++++-----
drivers/input/evdev.c | 4 +--
drivers/input/input.c | 2 +-
drivers/input/joydev.c | 2 +-
drivers/input/misc/uinput.c | 2 +-
drivers/input/mousedev.c | 4 +--
drivers/input/serio/serio_raw.c | 4 +--
drivers/isdn/capi/capi.c | 4 +--
drivers/isdn/divert/divert_procfs.c | 4 +--
drivers/isdn/hardware/eicon/divamnt.c | 4 +--
drivers/isdn/hardware/eicon/divasi.c | 4 +--
drivers/isdn/hardware/eicon/divasmain.c | 2 +-
drivers/isdn/hardware/eicon/divasproc.c | 2 +-
drivers/isdn/hysdn/hysdn_proclog.c | 4 +--
drivers/isdn/i4l/isdn_common.c | 4 +--
drivers/isdn/i4l/isdn_ppp.c | 4 +--
drivers/isdn/i4l/isdn_ppp.h | 2 +-
drivers/isdn/mISDN/timerdev.c | 4 +--
drivers/md/md.c | 4 +--
drivers/media/common/saa7146/saa7146_fops.c | 8 ++---
drivers/media/common/siano/smsdvb-debugfs.c | 7 ++---
drivers/media/dvb-core/dmxdev.c | 8 ++---
drivers/media/dvb-core/dvb_ca_en50221.c | 4 +--
drivers/media/dvb-core/dvb_frontend.c | 2 +-
drivers/media/firewire/firedtv-ci.c | 2 +-
drivers/media/media-devnode.c | 2 +-
drivers/media/pci/bt8xx/bttv-driver.c | 12 ++++----
drivers/media/pci/cx18/cx18-fileops.c | 4 +--
drivers/media/pci/cx18/cx18-fileops.h | 2 +-
drivers/media/pci/ddbridge/ddbridge-core.c | 4 +--
drivers/media/pci/ivtv/ivtv-fileops.c | 10 +++---
drivers/media/pci/ivtv/ivtv-fileops.h | 4 +--
drivers/media/pci/meye/meye.c | 4 +--
drivers/media/pci/saa7134/saa7134-video.c | 4 +--
drivers/media/pci/saa7164/saa7164-encoder.c | 4 +--
drivers/media/pci/saa7164/saa7164-vbi.c | 4 +--
drivers/media/pci/ttpci/av7110_av.c | 8 ++---
drivers/media/pci/ttpci/av7110_ca.c | 4 +--
drivers/media/pci/zoran/zoran_driver.c | 5 +--
drivers/media/platform/blackfin/bfin_capture.c | 4 +--
drivers/media/platform/davinci/vpfe_capture.c | 2 +-
drivers/media/platform/exynos-gsc/gsc-m2m.c | 4 +--
drivers/media/platform/fsl-viu.c | 4 +--
drivers/media/platform/m2m-deinterlace.c | 4 +--
drivers/media/platform/marvell-ccic/mcam-core.c | 4 +--
drivers/media/platform/mx2_emmaprp.c | 4 +--
drivers/media/platform/omap/omap_vout.c | 2 +-
drivers/media/platform/omap3isp/ispvideo.c | 4 +--
drivers/media/platform/s3c-camif/camif-capture.c | 4 +--
drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 +--
drivers/media/platform/s5p-tv/mixer_video.c | 4 +--
drivers/media/platform/sh_veu.c | 2 +-
drivers/media/platform/sh_vou.c | 4 +--
drivers/media/platform/soc_camera/atmel-isi.c | 2 +-
drivers/media/platform/soc_camera/mx2_camera.c | 2 +-
drivers/media/platform/soc_camera/mx3_camera.c | 2 +-
drivers/media/platform/soc_camera/rcar_vin.c | 2 +-
.../platform/soc_camera/sh_mobile_ceu_camera.c | 2 +-
drivers/media/platform/soc_camera/soc_camera.c | 4 +--
drivers/media/platform/timblogiw.c | 2 +-
drivers/media/platform/via-camera.c | 2 +-
drivers/media/platform/vivid/vivid-core.c | 2 +-
drivers/media/platform/vivid/vivid-radio-rx.c | 2 +-
drivers/media/platform/vivid/vivid-radio-rx.h | 2 +-
drivers/media/platform/vivid/vivid-radio-tx.c | 2 +-
drivers/media/platform/vivid/vivid-radio-tx.h | 2 +-
drivers/media/radio/radio-cadet.c | 4 +--
drivers/media/radio/radio-si476x.c | 6 ++--
drivers/media/radio/radio-wl1273.c | 2 +-
drivers/media/radio/si470x/radio-si470x-common.c | 6 ++--
drivers/media/radio/wl128x/fmdrv_v4l2.c | 2 +-
drivers/media/rc/lirc_dev.c | 4 +--
drivers/media/usb/cpia2/cpia2.h | 4 +--
drivers/media/usb/cpia2/cpia2_core.c | 4 +--
drivers/media/usb/cpia2/cpia2_v4l.c | 4 +--
drivers/media/usb/cx231xx/cx231xx-417.c | 6 ++--
drivers/media/usb/cx231xx/cx231xx-video.c | 6 ++--
drivers/media/usb/gspca/gspca.c | 6 ++--
drivers/media/usb/hdpvr/hdpvr-video.c | 6 ++--
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 4 +--
drivers/media/usb/stkwebcam/stk-webcam.c | 4 +--
drivers/media/usb/tm6000/tm6000-video.c | 10 +++---
drivers/media/usb/uvc/uvc_queue.c | 4 +--
drivers/media/usb/uvc/uvc_v4l2.c | 2 +-
drivers/media/usb/uvc/uvcvideo.h | 2 +-
drivers/media/usb/zr364xx/zr364xx.c | 4 +--
drivers/media/v4l2-core/v4l2-ctrls.c | 2 +-
drivers/media/v4l2-core/v4l2-dev.c | 4 +--
drivers/media/v4l2-core/v4l2-mem2mem.c | 10 +++---
drivers/media/v4l2-core/v4l2-subdev.c | 2 +-
drivers/media/v4l2-core/videobuf-core.c | 10 +++---
drivers/media/v4l2-core/videobuf2-core.c | 10 +++---
drivers/misc/hpilo.c | 2 +-
drivers/misc/lis3lv02d/lis3lv02d.c | 2 +-
drivers/misc/mei/amthif.c | 4 +--
drivers/misc/mei/main.c | 4 +--
drivers/misc/mei/mei_dev.h | 2 +-
drivers/misc/mic/host/mic_fops.c | 4 +--
drivers/misc/mic/host/mic_fops.h | 2 +-
drivers/misc/phantom.c | 4 +--
drivers/misc/vmw_vmci/vmci_host.c | 4 +--
drivers/net/macvtap.c | 4 +--
drivers/net/ppp/ppp_async.c | 2 +-
drivers/net/ppp/ppp_generic.c | 4 +--
drivers/net/ppp/ppp_synctty.c | 2 +-
drivers/net/tun.c | 4 +--
drivers/net/wireless/rt2x00/rt2x00debug.c | 2 +-
drivers/platform/goldfish/goldfish_pipe.c | 4 +--
drivers/platform/x86/sony-laptop.c | 2 +-
drivers/pps/pps.c | 2 +-
drivers/ptp/ptp_chardev.c | 2 +-
drivers/ptp/ptp_private.h | 2 +-
drivers/rtc/rtc-dev.c | 2 +-
drivers/scsi/mpt2sas/mpt2sas_ctl.c | 2 +-
drivers/scsi/mpt3sas/mpt3sas_ctl.c | 2 +-
drivers/scsi/sg.c | 4 +--
drivers/staging/android/sync.c | 2 +-
drivers/staging/comedi/comedi_fops.c | 4 +--
drivers/staging/comedi/drivers/serial2002.c | 2 +-
drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 +--
drivers/staging/media/bcm2048/radio-bcm2048.c | 4 +--
drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +-
drivers/staging/media/dt3155v4l/dt3155v4l.c | 4 +--
drivers/staging/media/lirc/lirc_parallel.c | 2 +-
drivers/staging/media/lirc/lirc_sir.c | 4 +--
drivers/staging/media/lirc/lirc_zilog.c | 4 +--
drivers/staging/media/omap4iss/iss_video.c | 2 +-
drivers/staging/ozwpan/ozcdev.c | 4 +--
drivers/staging/speakup/speakup_soft.c | 4 +--
drivers/tty/n_gsm.c | 4 +--
drivers/tty/n_hdlc.c | 6 ++--
drivers/tty/n_r3964.c | 6 ++--
drivers/tty/n_tty.c | 4 +--
drivers/tty/tty_io.c | 8 ++---
drivers/tty/vt/vc_screen.c | 4 +--
drivers/uio/uio.c | 2 +-
drivers/usb/class/cdc-wdm.c | 4 +--
drivers/usb/class/usblp.c | 4 +--
drivers/usb/core/devices.c | 2 +-
drivers/usb/core/devio.c | 4 +--
drivers/usb/gadget/function/f_fs.c | 4 +--
drivers/usb/gadget/function/f_hid.c | 4 +--
drivers/usb/gadget/function/uvc_queue.c | 4 +--
drivers/usb/gadget/function/uvc_queue.h | 2 +-
drivers/usb/gadget/function/uvc_v4l2.c | 2 +-
drivers/usb/gadget/legacy/inode.c | 4 +--
drivers/usb/gadget/legacy/printer.c | 4 +--
drivers/usb/misc/iowarrior.c | 4 +--
drivers/usb/misc/ldusb.c | 4 +--
drivers/usb/misc/legousbtower.c | 6 ++--
drivers/usb/mon/mon_bin.c | 4 +--
drivers/vfio/pci/vfio_pci_intrs.c | 4 +--
drivers/vhost/vhost.c | 8 ++---
drivers/vhost/vhost.h | 4 +--
drivers/xen/evtchn.c | 4 +--
drivers/xen/mcelog.c | 2 +-
drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +-
fs/cachefiles/daemon.c | 10 +++---
fs/coda/psdev.c | 4 +--
fs/dlm/plock.c | 4 +--
fs/dlm/user.c | 2 +-
fs/ecryptfs/miscdev.c | 4 +--
fs/eventfd.c | 4 +--
fs/eventpoll.c | 6 ++--
fs/fcntl.c | 4 +--
fs/fuse/dev.c | 4 +--
fs/fuse/file.c | 2 +-
fs/fuse/fuse_i.h | 2 +-
fs/kernfs/file.c | 2 +-
fs/notify/fanotify/fanotify_user.c | 4 +--
fs/notify/inotify/inotify_user.c | 4 +--
fs/ocfs2/dlmfs/dlmfs.c | 4 +--
fs/pipe.c | 4 +--
fs/proc/inode.c | 6 ++--
fs/proc/kmsg.c | 2 +-
fs/proc/proc_sysctl.c | 4 +--
fs/proc_namespace.c | 4 +--
fs/select.c | 23 ++++++--------
fs/signalfd.c | 4 +--
fs/timerfd.c | 4 +--
include/drm/drmP.h | 2 +-
include/linux/dma-buf.h | 2 +-
include/linux/fs.h | 2 +-
include/linux/net.h | 2 +-
include/linux/poll.h | 10 +++---
include/linux/posix-clock.h | 2 +-
include/linux/ring_buffer.h | 2 +-
include/linux/skbuff.h | 4 +--
include/linux/tty_ldisc.h | 2 +-
include/linux/wait.h | 10 +++---
include/media/lirc_dev.h | 2 +-
include/media/media-devnode.h | 2 +-
include/media/soc_camera.h | 2 +-
include/media/v4l2-ctrls.h | 2 +-
include/media/v4l2-dev.h | 2 +-
include/media/v4l2-mem2mem.h | 4 +--
include/media/videobuf-core.h | 2 +-
include/media/videobuf2-core.h | 4 +--
include/net/bluetooth/bluetooth.h | 2 +-
include/net/inet_connection_sock.h | 2 +-
include/net/iucv/af_iucv.h | 4 +--
include/net/sctp/sctp.h | 3 +-
include/net/sock.h | 4 +--
include/net/tcp.h | 4 +--
include/net/udp.h | 2 +-
include/sound/hwdep.h | 2 +-
include/sound/info.h | 2 +-
include/uapi/asm-generic/poll.h | 36 +++++++++++++---------
include/uapi/linux/types.h | 6 ++++
ipc/mqueue.c | 4 +--
kernel/events/core.c | 4 +--
kernel/printk/printk.c | 4 +--
kernel/relay.c | 4 +--
kernel/time/posix-clock.c | 4 +--
kernel/trace/ring_buffer.c | 2 +-
kernel/trace/trace.c | 6 ++--
mm/memcontrol.c | 2 +-
mm/swapfile.c | 2 +-
net/atm/common.c | 4 +--
net/atm/common.h | 2 +-
net/batman-adv/debugfs.c | 2 +-
net/batman-adv/icmp_socket.c | 2 +-
net/bluetooth/af_bluetooth.c | 7 ++---
net/caif/caif_socket.c | 6 ++--
net/core/datagram.c | 7 ++---
net/core/sock.c | 2 +-
net/dccp/dccp.h | 3 +-
net/dccp/proto.c | 5 ++-
net/decnet/af_decnet.c | 4 +--
net/ipv4/tcp.c | 4 +--
net/ipv4/udp.c | 4 +--
net/irda/af_irda.c | 6 ++--
net/irda/irnet/irnet_ppp.c | 8 ++---
net/irda/irnet/irnet_ppp.h | 2 +-
net/iucv/af_iucv.c | 8 ++---
net/netlink/af_netlink.c | 6 ++--
net/nfc/llcp_sock.c | 8 ++---
net/packet/af_packet.c | 6 ++--
net/phonet/socket.c | 6 ++--
net/rds/af_rds.c | 6 ++--
net/rfkill/core.c | 4 +--
net/rxrpc/af_rxrpc.c | 6 ++--
net/sctp/socket.c | 4 +--
net/socket.c | 7 ++---
net/sunrpc/cache.c | 10 +++---
net/sunrpc/rpc_pipe.c | 4 +--
net/tipc/socket.c | 6 ++--
net/unix/af_unix.c | 15 ++++-----
net/vmw_vsock/af_vsock.c | 6 ++--
security/tomoyo/audit.c | 2 +-
security/tomoyo/common.c | 4 +--
security/tomoyo/common.h | 6 ++--
security/tomoyo/securityfs_if.c | 2 +-
sound/core/compress_offload.c | 6 ++--
sound/core/control.c | 4 +--
sound/core/hwdep.c | 2 +-
sound/core/info.c | 4 +--
sound/core/init.c | 2 +-
sound/core/oss/pcm_oss.c | 4 +--
sound/core/pcm_native.c | 8 ++---
sound/core/rawmidi.c | 4 +--
sound/core/seq/oss/seq_oss.c | 4 +--
sound/core/seq/oss/seq_oss_device.h | 2 +-
sound/core/seq/oss/seq_oss_rw.c | 4 +--
sound/core/seq/seq_clientmgr.c | 4 +--
sound/core/timer.c | 4 +--
sound/firewire/bebob/bebob_hwdep.c | 4 +--
sound/firewire/dice/dice-hwdep.c | 4 +--
sound/firewire/fireworks/fireworks_hwdep.c | 4 +--
sound/firewire/oxfw/oxfw-hwdep.c | 4 +--
sound/oss/dmabuf.c | 6 ++--
sound/oss/midibuf.c | 4 +--
sound/oss/sequencer.c | 4 +--
sound/oss/sound_calls.h | 6 ++--
sound/oss/soundcard.c | 2 +-
sound/usb/mixer_quirks.c | 2 +-
sound/usb/usx2y/us122l.c | 4 +--
sound/usb/usx2y/usX2Yhwdep.c | 4 +--
virt/kvm/eventfd.c | 4 +--
338 files changed, 668 insertions(+), 668 deletions(-)
delete mode 100644 arch/alpha/include/uapi/asm/poll.h
delete mode 100644 arch/cris/include/uapi/asm/poll.h
delete mode 100644 arch/ia64/include/uapi/asm/poll.h
delete mode 100644 arch/m32r/include/uapi/asm/poll.h
delete mode 100644 arch/microblaze/include/uapi/asm/poll.h
delete mode 100644 arch/mn10300/include/uapi/asm/poll.h
delete mode 100644 arch/powerpc/include/uapi/asm/poll.h
delete mode 100644 arch/s390/include/uapi/asm/poll.h
delete mode 100644 arch/score/include/uapi/asm/poll.h
delete mode 100644 arch/x86/include/uapi/asm/poll.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/