mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-07-10 23:18:36 +00:00
include: sbi_domain: Fix permission test macros
The macros to test permissions must perform an exact match of all the
bits in the input with the desired permission bits. Otherwise, the check
returns false positives in those cases where only some of the desired
permissions are set in the input.
Fixes: 6c202c5
("include: sbi: Add Smepmp specific access flags for PMP
entries")
Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
parent
9560fb38fe
commit
b8fb96eceb
1 changed files with 15 additions and 19 deletions
|
@ -74,33 +74,29 @@ struct sbi_domain_memregion {
|
|||
SBI_DOMAIN_MEMREGION_SU_READABLE)
|
||||
|
||||
/* Shared read-only region between M and SU mode */
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUR_MR(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_M_READABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_SU_READABLE))
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUR_MR(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_ACCESS_MASK) == \
|
||||
SBI_DOMAIN_MEMREGION_SHARED_RDONLY)
|
||||
|
||||
/* Shared region: SU execute-only and M read/execute */
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUX_MRX(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_M_READABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_M_EXECUTABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE))
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUX_MRX(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_ACCESS_MASK) == \
|
||||
SBI_DOMAIN_MEMREGION_SHARED_SUX_MRX)
|
||||
|
||||
/* Shared region: SU and M execute-only */
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUX_MX(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_M_EXECUTABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE))
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUX_MX(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_ACCESS_MASK) == \
|
||||
SBI_DOMAIN_MEMREGION_SHARED_SUX_MX)
|
||||
|
||||
/* Shared region: SU and M read/write */
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SURW_MRW(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_M_READABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_M_WRITABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_SU_READABLE) & \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_SU_WRITABLE))
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SURW_MRW(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_ACCESS_MASK) == \
|
||||
SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW)
|
||||
|
||||
/* Shared region: SU read-only and M read/write */
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUR_MRW(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_M_READABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_M_WRITABLE) && \
|
||||
(__flags & SBI_DOMAIN_MEMREGION_SU_READABLE))
|
||||
#define SBI_DOMAIN_MEMREGION_IS_SUR_MRW(__flags) \
|
||||
((__flags & SBI_DOMAIN_MEMREGION_ACCESS_MASK) == \
|
||||
SBI_DOMAIN_MEMREGION_SHARED_SUR_MRW)
|
||||
|
||||
/*
|
||||
* Check if region flags match with any of the above
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue