Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1465619

Summary: kernel/tcmu-runner: fix uio_poll crash during uio device removal
Product: Red Hat Enterprise Linux 7 Reporter: Mike Christie <mchristi>
Component: tcmu-runnerAssignee: Mike Christie <mchristi>
Status: CLOSED NOTABUG QA Contact: Storage QE <storage-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: mchristi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1474188 (view as bug list) Environment:
Last Closed: 2017-09-06 21:56:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1474188    

Description Mike Christie 2017-06-27 19:06:03 UTC
Description of problem:

During uio device removal we hit this trace:

[110889.918952] Call Trace:
[110889.920407]  [<ffffffff812172c7>] do_sys_poll+0x327/0x580
[110889.921844]  [<ffffffff810cdcbc>] ? dequeue_entity+0x11c/0x5d0
[110889.923264]  [<ffffffff810cd7d4>] ? update_curr+0x104/0x190
[110889.924657]  [<ffffffff810ca2de>] ? account_entity_dequeue+0xae/0xd0
[110889.926022]  [<ffffffff810cdcbc>] ? dequeue_entity+0x11c/0x5d0
[110889.927361]  [<ffffffff810ce58e>] ? dequeue_task_fair+0x41e/0x660
[110889.928681]  [<ffffffff810c7735>] ? sched_clock_cpu+0x85/0xc0
[110889.929969]  [<ffffffff81215e00>] ? poll_select_copy_remaining+0x150/0x150
[110889.931248]  [<ffffffff8109b62b>] ? recalc_sigpending+0x1b/0x50
[110889.932493]  [<ffffffff8109b756>] ? dequeue_signal+0x86/0x170
[110889.933721]  [<ffffffff8109e28f>] ? get_signal_to_deliver+0xff/0x5e0
[110889.934935]  [<ffffffff810f4f00>] ? futex_wake+0x90/0x180
[110889.936109]  [<ffffffff8102a467>] ? do_signal+0x57/0x6c0
[110889.937271]  [<ffffffff8133da6d>] ? list_del+0xd/0x30
[110889.938404]  [<ffffffff810b16b1>] ? remove_wait_queue+0x31/0x40
[110889.939531]  [<ffffffff81217569>] do_restart_poll+0x49/0x90
[110889.940641]  [<ffffffff816b423d>] ? int_signal+0x12/0x17
[110889.941710]  [<ffffffff8109e8ef>] sys_restart_syscall+0x1f/0x30
[110889.942753]  [<ffffffff816b3f89>] system_call_fastpath+0x16/0x1b
[110889.943767] Code: ff ff c3 0f 1f 84 00 00 00 00 00 66 66 66 66 90
55 b8 fb ff ff ff 48 89 e5 41 54 53 4c 8b a7 a8 00 00 00 49 8b 1c 24
48 8b 4b 40 <48> 83 b9 d0 01 00 00 00 75 06 5b 41 5c 5d c3 90 48 85 f6
74 19
[110889.945863] RIP  [<ffffffffc0304080>] uio_poll+0x20/0x70 [uio]
[110889.946851]  RSP <ffff88065de8fb08>



It looks like the problem is if the app is shutting down the user of a device and gets a signal while waiting in a poll call (before do_poll has called do_pollfd and that has done a fdget), the app shutting down the device will proceed to do the close on the uio device and the kernel will eventually do a uio_unregister_device which frees the uio device resources. However, the kernel could restart the poll like we see above. The restarted poll call could then race with the app shutdown and call into the uio_poll callout and reference memory freed by uio_unregister_device.

To fix this:

- It looks like the userspace app could use ppoll instead of poll since it does not support restarting poll from the kernel.

- Maybe the poll code could do a fdget/fget on the uio device's fd/file when it decides to the the restart (note uio does not have refcounting so we would need to add that to support this



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info: