Skip to content

Commit

Permalink
core: rename mattr_uflags_to_str()
Browse files Browse the repository at this point in the history
Renames mattr_uflags_to_str() to mattr_perm_to_str() and report all
permission bits using a 7 bytes long string instead.

This allows observing the permissions of the minimal kernel mapping
added to the user space context.

Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Andrew Davis <andrew.davis@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jenswi-linaro authored and jforissier committed Jan 10, 2018
1 parent 21a7f5c commit 1df3ba0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions core/arch/arm/kernel/user_ta.c
Expand Up @@ -501,7 +501,7 @@ static void user_ta_enter_close_session(struct tee_ta_session *s)
static void user_ta_dump_state(struct tee_ta_ctx *ctx)
{
struct user_ta_ctx *utc __maybe_unused = to_user_ta_ctx(ctx);
char flags[4] = { '\0', };
char flags[7] = { '\0', };
size_t n;

EMSG_RAW(" arch: %s load address: 0x%x ctx-idr: %d",
Expand All @@ -517,8 +517,8 @@ static void user_ta_dump_state(struct tee_ta_ctx *ctx)
mobj_get_pa(utc->mmu->regions[n].mobj,
utc->mmu->regions[n].offset, 0, &pa);

mattr_uflags_to_str(flags, sizeof(flags),
utc->mmu->regions[n].attr);
mattr_perm_to_str(flags, sizeof(flags),
utc->mmu->regions[n].attr);
EMSG_RAW(" region %zu: va %#" PRIxVA " pa %#" PRIxPA
" size %#zx flags %s",
n, utc->mmu->regions[n].va, pa,
Expand Down
9 changes: 6 additions & 3 deletions core/include/mm/tee_mmu_types.h
Expand Up @@ -95,15 +95,18 @@ struct tee_mmu_info {
unsigned int asid;
};

static inline void mattr_uflags_to_str(char *str, size_t size, uint32_t attr)
static inline void mattr_perm_to_str(char *str, size_t size, uint32_t attr)
{
if (size < 4)
if (size < 7)
return;

str[0] = (attr & TEE_MATTR_UR) ? 'r' : '-';
str[1] = (attr & TEE_MATTR_UW) ? 'w' : '-';
str[2] = (attr & TEE_MATTR_UX) ? 'x' : '-';
str[3] = '\0';
str[3] = (attr & TEE_MATTR_PR) ? 'R' : '-';
str[4] = (attr & TEE_MATTR_PW) ? 'W' : '-';
str[5] = (attr & TEE_MATTR_PX) ? 'X' : '-';
str[6] = '\0';
}

#endif

0 comments on commit 1df3ba0

Please sign in to comment.