Skip to content

Add xtest for RISC-V Zicfilp landing-pad user mode enforcement - #864

Open
raymo200915 wants to merge 3 commits into
OP-TEE:masterfrom
raymo200915:rp022-m6
Open

raymo200915 wants to merge 3 commits into
OP-TEE:masterfrom
raymo200915:rp022-m6

Conversation

@raymo200915

@raymo200915 raymo200915 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

This series adds xtest 1049 to exercise RISC-V Zicfilp landing-pad enforcement in user mode. It uses a guarded TA, an unmarked TA and an unmarked shared library to verify that OP-TEE applies the expected policy to each TA. The test components are selected for RV64 TA builds with CFG_TA_ZICFILP=y.

The three commits cover:

Indirect branches and loading policy. A compiler-generated indirect call to a valid landing pad succeeds. An indirect jump to a target without a landing pad terminates the guarded TA, including when the TA has not used the FPU. OP-TEE can then open a fresh session. The same kind of jump succeeds in the unmarked TA, while the guarded TA rejects the unmarked library through dlopen().

TA context switches. The test keeps an unmarked TA session open and alternates between it and fresh guarded TA sessions. After each switch, it verifies that the unmarked TA can still call its target and that the guarded TA still faults on a missing landing pad.

TA-to-TA calls and RPC. The test exercises calls in both directions between guarded and unmarked TAs. It verifies the caller’s landing-pad policy after the callee returns and after TEE_Wait() suspends and resumes the caller through RPC.

xtest 1049 passed on QEMU RV64 with both GCC and LLVM, using the companion optee_os Zicfilp series (OP-TEE/optee_os#8328) with CFG_CORE_ZICFILP=y and CFG_TA_ZICFILP=y.

Running environment: QEMU 10.1.93, built using GCC 15.3.0 with GNU Binutils 2.45.1, or LLVM/Clang 22.1.8.

Add RISC-V-only xtest coverage for Zicfilp landing pads. A protected
TA verifies a compiler-generated indirect call and checks that a jump to
a hand-written non-LPAD target terminates only the offending TA.

Exercise the same fault before the TA uses the FPU, verify that OP-TEE
continues to service a new TA after the fault, and verify the two loading
policies: an unmarked main TA runs unguarded while a protected TA rejects
an unmarked shared library loaded with dlopen().

Signed-off-by: Raymond Mao <raymond.mao@riscstar.com>
Alternate between a protected TA and an unmarked TA while keeping
the unmarked TA session open. Check that a non-LPAD target succeeds
in the unmarked TA and still faults in the protected TA after each
switch.

Repeat the sequence with a new protected TA after each expected
fault to exercise restoration of the landing-pad enforcement state.

Signed-off-by: Raymond Mao <raymond.mao@riscstar.com>
Check landing-pad enforcement after calls between protected and
unmarked TAs in both directions. Verify that the caller retains its
own policy after the callee returns.

Exercise the same policies after TEE_Wait(), which suspends and
resumes the secure thread through RPC.

Signed-off-by: Raymond Mao <raymond.mao@riscstar.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants