seL4 / seL4_libs

No-assurance libraries for rapid-prototyping of seL4 apps.
https://docs.sel4.systems
Other
52 stars 62 forks source link

Do not disable counters when reading on aarch64 #32

Closed xurtis closed 2 years ago

xurtis commented 3 years ago

If the cycle counter is disabled during a read, the operation can be preempted and lose the count of cycles for the duration of the preemption.

kent-mcleod commented 3 years ago

Should armv7 also be updated in the same way?

xurtis commented 3 years ago

armv7 performs this check in the kernel using the API to execute a function in the kernel. As this is performed while the kernel lock is held and while interrupts are disabled, it cannot be preempted.

kent-mcleod commented 3 years ago

armv7 performs this check in the kernel using the API to execute a function in the kernel. As this is performed while the kernel lock is held and while interrupts are disabled, it cannot be preempted.

Can you show me where, because from what I can see, it accesses the register directly from userlevel: https://github.com/seL4/seL4_libs/blob/master/libsel4bench/arch_include/arm/armv/armv7-a/sel4bench/armv/sel4bench.h#L91

xurtis commented 3 years ago

Not sure where I saw it. You're right, the issue is also an ARMv7.

axel-h commented 2 years ago

any plans to merge this?