Page MenuHomeFreeBSD

Add barrier in buf ring peek function to prevent race in ARM and ARM64
ClosedPublic

Authored by mk_semihalf.com on Apr 17 2019, 9:06 AM.
Referenced Files
F102899806: D19932.diff
Mon, Nov 18, 12:09 PM
Unknown Object (File)
Wed, Nov 13, 1:18 AM
Unknown Object (File)
Thu, Oct 31, 2:08 PM
Unknown Object (File)
Mon, Oct 28, 3:18 AM
Unknown Object (File)
Oct 19 2024, 8:48 AM
Unknown Object (File)
Oct 19 2024, 6:17 AM
Unknown Object (File)
Oct 9 2024, 7:03 AM
Unknown Object (File)
Sep 30 2024, 6:32 PM

Details

Summary

The barrier is required on ARM and ARM64 to prevent reording of data
fetch, which could cause race between drbr_enqueue and drbr_peek.

If the buffer will be fetched in drbr_peek before checking if there are
buffers in the drbr ring, the invalid memory address could be stored, but the
condition could be true if the buffer will be added in the meantime in
the drbr_enqueue.
This will cause in returning invalid buffer address by drbr_peek.

Diff Detail

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

Event Timeline

Mark the code as ARM/ARM64 specific and change barrier, to order only loads.

Remove spurious comment about barrier

Yet another reincarnation of https://reviews.freebsd.org/rS302292 this time in peak_clear_sc
If no objections, I will commit this next week.

This revision is now accepted and ready to land.Apr 19 2019, 6:08 AM
This revision was automatically updated to reflect the committed changes.