aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorCen Zhang <zzzccc427@gmail.com>2026-03-18 11:48:10 +0800
committerDenis Efremov (Oracle) <efremov@linux.com>2026-10-05 18:59:41 +0400
commit9dfafe7ed037eb3fdd102e7a4241a7cfe4f688e5 (patch)
treed67fe3d9c64bbe8f23b36feec986bc383a49e352 /scripts/Makefile.thinlto
parentfloppy: unregister platform device on add_disk failure (diff)
floppy: annotate data-races around command_status and floppy_work_fn
command_status is accessed by multiple contexts: - generic_done() and do_wakeup() write it from the floppy workqueue context. - wait_til_done() reads it in wait_event conditions without holding fdc_busy. - is_alive() reads it locklessly to check driver liveness. - floppy_queue_rq(), lock_fdc(), and unlock_fdc() write it during FDC ownership transitions. There is currently no LKMM annotation for these concurrent accesses since command_status relies on the deprecated volatile qualifier. Remove volatile and use READ_ONCE()/WRITE_ONCE() on every access to command_status to provide proper LKMM data-race annotations. Also annotate floppy_work_fn with WRITE_ONCE() in schedule_bh() and READ_ONCE() in floppy_work_workfn(), and current_type[drive] with READ_ONCE() in drive_no_geom() where it can be read without holding the FDC lock. The races were found by our tools: 1) command_status: generic_done (write) vs wait_til_done (read) ============ DATARACE ============ Function: generic_done+0x54/0xa0 drivers/block/floppy.c:985 Function: success_and_wakeup+0xeb/0x1e0 drivers/block/floppy.c:2046 Function: setup_rw_floppy+0x15dc/0x1d80 drivers/block/floppy.c:1046 Function: floppy_ready+0x2630/0x4000 Function: floppy_work_workfn+0x56/0x70 drivers/block/floppy.c:1012 Function: process_one_work kernel/workqueue.c:3236 [inline] Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319 ============OTHER_INFO============ Function: wait_til_done+0x134/0x740 drivers/block/floppy.c:2026 Function: poll_drive+0x1fa/0x2a0 Function: fd_ioctl+0x13c8/0x1da0 drivers/block/floppy.c:3873 Function: blkdev_ioctl+0x421/0x510 block/ioctl.c:705 Function: vfs_ioctl fs/ioctl.c:51 [inline] Function: __do_sys_ioctl fs/ioctl.c:598 [inline] Function: __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584 =================END============== 2) current_type[drive]: drive_no_geom (read) vs set_geometry (write) ============ DATARACE ============ Function: drive_no_geom drivers/block/floppy.c:606 [inline] Function: floppy_check_events+0x9c9/0xcf0 drivers/block/floppy.c:4187 Function: disk_check_events+0xca/0x4d0 block/disk-events.c:193 Function: process_one_work kernel/workqueue.c:3236 [inline] Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319 Function: worker_thread+0xb97/0x11d0 kernel/workqueue.c:3400 Function: kthread+0x3d4/0x800 kernel/kthread.c:463 ============OTHER_INFO============ Function: set_geometry+0xe1d/0x1980 drivers/block/floppy.c:2237 Function: fd_ioctl+0xff4/0x1da0 drivers/block/floppy.c:3912 Function: blkdev_ioctl+0x421/0x510 block/ioctl.c:705 Function: vfs_ioctl fs/ioctl.c:51 [inline] Function: __do_sys_ioctl fs/ioctl.c:598 [inline] Function: __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584 =================END============== 3) floppy_work_fn: schedule_bh (write) vs floppy_interrupt->schedule_bh (write) ============ DATARACE ============ Function: schedule_bh drivers/block/floppy.c:1005 [inline] Function: do_wakeup+0x19c/0x220 drivers/block/floppy.c:3219 Function: success_and_wakeup+0x192/0x1e0 drivers/block/floppy.c:1994 Function: setup_rw_floppy+0x15dc/0x1d80 drivers/block/floppy.c:1046 Function: floppy_ready+0x2630/0x4000 Function: floppy_work_workfn+0x56/0x70 drivers/block/floppy.c:1012 Function: process_one_work kernel/workqueue.c:3236 [inline] Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319 ============OTHER_INFO============ Function: floppy_interrupt+0xbf4/0x1220 Function: floppy_hardint+0x432/0x630 Function: __handle_irq_event_percpu+0x10a/0x5d0 kernel/irq/handle.c:158 Function: handle_irq_event+0x8b/0x1e0 kernel/irq/handle.c:210 Function: handle_edge_irq+0x223/0x9f0 kernel/irq/chip.c:855 =================END============== Signed-off-by: Cen Zhang <zzzccc427@gmail.com> Link: https://patch.msgid.link/20260318034810.3089217-1-zzzccc427@gmail.com Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions