Page MenuHomeFreeBSD

its_cmd_send may return prior to command being completed
ClosedPublic

Authored by wma_semihalf.com on Aug 20 2015, 7:04 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 5:45 AM
Unknown Object (File)
Fri, Nov 29, 8:26 PM
Unknown Object (File)
Oct 15 2024, 8:20 AM
Unknown Object (File)
Oct 6 2024, 4:45 AM
Unknown Object (File)
Oct 3 2024, 12:12 PM
Unknown Object (File)
Oct 3 2024, 8:34 AM
Unknown Object (File)
Oct 1 2024, 12:13 PM
Unknown Object (File)
Sep 30 2024, 11:32 PM
Subscribers

Details

Reviewers
None
Group Reviewers
arm64
Commits
rS287164: Fix race condition in its_cmd_send()
Summary
its_cmd_wait_completion has been called to await command being completed
with a cmd_last argument taken from gic_v3_its_softc->its_cmdq_write,
which should be last command allocated; this would work with one core
environment, but in mlti-core environment this varible may be altered
as soon as lock is released (by another allocation) from sc inside
its_cmd_send, just before its_cmd_wait_completion is called;
because its_cmdq_write points into ring buffer, it might happen that
its_cmd_wait_completion decides that command has been comleted,
not because it has been returned by GIC as completed, but because
the range it has been compared to (cmd_last) has changed to fulfill
the condition for completion.  This would brake synchronization with other
commands as its_cmd_send would be expected to return only on the command
that it has been sending has completed.
Simple solution to that was just copy the pointer gic_v3_its_softc->its_cmdq_write
to temporary variable and provided it to its_cmd_wait_completion as
cmd_last (when there is mutex still locked around sc); this way changes
to its_cmdq_write pointer would not alter the completion condition
in its_cmd_wait_completion.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wma_semihalf.com retitled this revision from to its_cmd_send may return prior to command being completed.
wma_semihalf.com updated this object.
wma_semihalf.com edited the test plan for this revision. (Show Details)
wma_semihalf.com added a reviewer: arm64.
wma_semihalf.com set the repository for this revision to rS FreeBSD src repository - subversion.
This revision was automatically updated to reflect the committed changes.