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
Unknown Object (File)
Thu, Dec 26, 9:45 AM
Unknown Object (File)
Fri, Dec 13, 10:12 AM
Unknown Object (File)
Tue, Dec 10, 10:20 PM
Unknown Object (File)
Fri, Nov 29, 9:51 PM
Unknown Object (File)
Nov 20 2024, 1:50 PM
Unknown Object (File)
Nov 18 2024, 12:09 PM
Unknown Object (File)
Nov 13 2024, 1:18 AM
Unknown Object (File)
Oct 31 2024, 2:08 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 Skipped
Unit
Tests Skipped

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.