nanovms / nanos

A kernel designed to run one and only one application in a virtualized environment
https://nanos.org
Apache License 2.0
2.64k stars 137 forks source link

Aarch64 cpu_init(): enable userspace access to CNTVCT_EL0 register #1949

Closed francescolavra closed 1 year ago

francescolavra commented 1 year ago

Aarch64 user programs may execute code that accesses system registers such as CNTVCT_EL0 (Counter-timer Virtual Count Register); for example the _armv7_tick function in the OpenSSL library (at https://github.com/openssl/openssl/blob/master/crypto/arm64cpuid.pl) reads such register. With the existing kernel code, accessing the CNTVCT_EL0 register from the user program triggers an exception; this change modifies the aarch64 CPU initialization code so that EL0 accesses to the frequency register and virtual counter registers are not trapped; this fixes an issue where NodeJS v18.10.0 would fail during startup when run on aarch64.