mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
fix(cpu_region_protect): set DROM mask PMP entry to read-only
PMP entry 3 (SOC_DROM_MASK_HIGH, TOR mode) in the memprot path was incorrectly granted RW permission on esp32h21 and esp32c61. The mask ROM data region is inherently read-only; remove the W bit. Also added necessary tests to check voilations and re-enabled tests for ESP32P4
This commit is contained in:
@@ -2149,6 +2149,52 @@ def test_irom_reg_write_violation(dut: PanicTestDut, test_func_name: str) -> Non
|
||||
dut.expect_cpu_reset()
|
||||
|
||||
|
||||
def irom_mask_reg_write_violation(dut: PanicTestDut, test_func_name: str) -> None:
|
||||
dut.run_test_func(test_func_name)
|
||||
dut.expect_gme('Store access fault')
|
||||
dut.expect_reg_dump(0)
|
||||
dut.expect_cpu_reset()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'config,target',
|
||||
[
|
||||
('memprot_esp32c5', 'esp32c5'),
|
||||
('memprot_esp32c6', 'esp32c6'),
|
||||
('memprot_esp32c61', 'esp32c61'),
|
||||
('memprot_esp32h2', 'esp32h2'),
|
||||
('memprot_esp32p4', 'esp32p4'),
|
||||
],
|
||||
indirect=['config', 'target'],
|
||||
)
|
||||
def test_irom_mask_reg_write_violation(dut: PanicTestDut, test_func_name: str) -> None:
|
||||
irom_mask_reg_write_violation(dut, test_func_name)
|
||||
|
||||
|
||||
def drom_mask_reg_write_violation(dut: PanicTestDut, test_func_name: str) -> None:
|
||||
dut.run_test_func(test_func_name)
|
||||
dut.expect_gme('Store access fault')
|
||||
dut.expect_reg_dump(0)
|
||||
dut.expect_cpu_reset()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'config,target',
|
||||
[
|
||||
('memprot_esp32c5', 'esp32c5'),
|
||||
('memprot_esp32c6', 'esp32c6'),
|
||||
('memprot_esp32c61', 'esp32c61'),
|
||||
('memprot_esp32h2', 'esp32h2'),
|
||||
('memprot_esp32p4', 'esp32p4'),
|
||||
],
|
||||
indirect=['config', 'target'],
|
||||
)
|
||||
def test_drom_mask_reg_write_violation(dut: PanicTestDut, test_func_name: str) -> None:
|
||||
drom_mask_reg_write_violation(dut, test_func_name)
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize(
|
||||
'config,target',
|
||||
|
||||
Reference in New Issue
Block a user