au-ts / sddf

A collection of interfaces, libraries and tools for writing device drivers for seL4 that allow accessing devices securely and with low overhead.
Other
17 stars 14 forks source link

Block Virtualiser Fault with cache_clean #182

Closed midnightveil closed 1 month ago

midnightveil commented 1 month ago

The cache clean function:

https://github.com/au-ts/sddf/blob/11b026912075f9acf446194aac52a8ff1bcf30cb/util/cache.c#L58-L67

Being called by the virtualiser here:

https://github.com/au-ts/sddf/blob/11b026912075f9acf446194aac52a8ff1bcf30cb/blk/components/virt.c#L337

When waiting on my SD card driver for long enough, is eventually called with the arguments:

cache_clean(0x407fa000, 0x40800000);

Which then faults as clean_by_va(0x40800000) is called.

Screenshot from 2024-07-31 13-53-23

Replacing LINE_INDEX(end) + 1 with just LINE_INDEX(end) does prevent further faults, but the code this was taken from in seL4 does this as well.

https://github.com/seL4/seL4/blob/c679fe77d6441cd412dd253d953ee833dd25d740/src/arch/arm/machine/cache.c#L15-L24

midnightveil commented 1 month ago

Confirmed this is fixed now.