Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtest: regression 1100: add OCALL tests #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HernanGatta
Copy link

@HernanGatta HernanGatta commented Jun 10, 2020

Add 10 tests that check the behaviour of the OCALL functionality. The tests
in question are detailed below:

OCALL without parameters:

Performs an OCALL without any parameters.

OCALL with value parameters (in/inout/out/in):

Performs an OCALL with value parameters and in parameter directions,
verifying that the values are transferred correctly between normal world
and secure world.

OCALL with memref parameters (in/inout/out/in):

Performs an OCALL with memref parameters and in parameter directions,
verifying that the bufers are transferred correctly between normal world
and secure world.

Close session during OCALL:

Performs an OCALL that closes the session through which the original
function invocation was performed. Ascertains that the OCALL is cancelled
and that the session is closed.

Finalize context during OCALL:

Performs an OCALL that finalizes the context through which the original
function invocation was performed. Ascertains that the OCALL is cancelled
and that the session that was originally used to perform the function
invocation is closed as a result of the context being finalized.

NULL memref param:

Verifies that OCALLs can carry memref parameters with NULL buffers in all
directions.

NULL memref param (mixed params):

Verifies that OCALLs can carry memref parameters with NULL buffers
alongside value and non-NULL memref parameters in various directions.

NULL memref param (invalid params):

Verifies that attempting to perform an OCALL with memref parameters with a
NULL buffer and a non-zero size and with a non-NULL buffer and a zero size
fails at the Internal Core API layer.

OCALL during session open:

Ascertains that the CA can receive an OCALL during session open.

Finalize context during session open OCALL:

Performs an OCALL during session open that finalizes the context via which
the session was being opened, verifies that the OCALL is cancelled, and
that the session fails to open.

Signed-off-by: Hernan Gatta hegatta@microsoft.com

@HernanGatta HernanGatta force-pushed the optee-generic-rpc-support branch 2 times, most recently from 9811147 to 15dc3f2 Compare June 10, 2020 02:18
Copy link
Contributor

@jforissier jforissier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @HernanGatta ,

Thanks for your work on these tests. Please see my comments below.

FYI, I have tested this on QEMUv8 with Clang 9.0.1 out of curiosity, and all went well.

ta/ocall/ta_ocall.c Outdated Show resolved Hide resolved
ta/ocall/ta_ocall.c Outdated Show resolved Hide resolved
ta/ocall/include/ta_ocall.h Outdated Show resolved Hide resolved
ta/ocall/include/ta_ocall_test.h Outdated Show resolved Hide resolved
ta/ocall/include/ta_ocall.h Outdated Show resolved Hide resolved
ta/ocall/ta_ocall.c Outdated Show resolved Hide resolved
ta/ocall/ta_ocall.c Outdated Show resolved Hide resolved
#define TA_UUID TA_OCALL_UUID

#define TA_FLAGS (TA_FLAG_SINGLE_INSTANCE | \
TA_FLAG_MULTI_SESSION | \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MULTI_SESSION flag should not be needed. I mean, I know it is, due to the way the test is written (I tried running without and test_ocall_during_session_open() fails to open a session since the one initially created for the param tests is not closed yet).
I would recommend changing xtest_tee_test_1100() slightly or splitting it in two so that we can make sure OCALLs work in single instance single session TAs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good point, I was also not happy with this. I'll work on it.

host/xtest/regression_1100.c Outdated Show resolved Hide resolved
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 5 days. Note, that you can always re-open a closed pull request at any time.

@jenswi-linaro
Copy link
Contributor

Removed the stale label

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 5 days. Note, that you can always re-open a closed pull request at any time.

@jenswi-linaro
Copy link
Contributor

Removed the stale label

@jbech-linaro
Copy link
Contributor

jbech-linaro commented Aug 17, 2020

I added the label "enhancement", which should prevent the bot from marking this as stale if I configured it correctly. However, I noticed that I only did that change for optee_os. I'll send similar patches to the other optee_xyz gits soon.

@jforissier
Copy link
Contributor

@jbech-linaro good idea. I have added the enhancement label to the optee_os PR too.

@HernanGatta HernanGatta force-pushed the optee-generic-rpc-support branch 3 times, most recently from cf363b9 to 5de1f7b Compare October 19, 2020 06:29
Comment on lines 201 to 203
#ifdef WITH_GP_TESTS
const TEEC_UUID gp_tta_ds_uuid = TA_TTA_DS_UUID;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase error, was removed by commit c1acd29 ("xtest: remove GP test TA UUID")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, thank you!

@jforissier
Copy link
Contributor

With the erroneous GP lines removed:

Acked-by: Jerome Forissier <jerome@forissier.org>

@HernanGatta
Copy link
Author

With the erroneous GP lines removed:

Acked-by: Jerome Forissier <jerome@forissier.org>

Thank you, and applied. I do still have the single instance question to resolve though, so do feel free to rescind the ack.

@jforissier
Copy link
Contributor

With the erroneous GP lines removed:
Acked-by: Jerome Forissier <jerome@forissier.org>

Thank you, and applied. I do still have the single instance question to resolve though, so do feel free to rescind the ack.

No problem, we can take this later.

Add 10 tests that check the behaviour of the OCALL functionality. The tests
in question are detailed below:

OCALL without parameters:
-------------------------
Performs an OCALL without any parameters.

OCALL with value parameters (in/inout/out/in):
----------------------------------------------
Performs an OCALL with value parameters and in parameter directions,
verifying that the values are transferred correctly between normal world
and secure world.

OCALL with memref parameters (in/inout/out/in):
-----------------------------------------------
Performs an OCALL with memref parameters and in parameter directions,
verifying that the bufers are transferred correctly between normal world
and secure world.

Close session during OCALL:
---------------------------
Performs an OCALL that closes the session through which the original
function invocation was performed. Ascertains that the OCALL is cancelled
and that the session is closed.

Finalize context during OCALL:
------------------------------
Performs an OCALL that finalizes the context through which the original
function invocation was performed. Ascertains that the OCALL is cancelled
and that the session that was originally used to perform the function
invocation is closed as a result of the context being finalized.

NULL memref param:
------------------
Verifies that OCALLs can carry memref parameters with NULL buffers in all
directions.

NULL memref param (mixed params):
---------------------------------
Verifies that OCALLs can carry memref parameters with NULL buffers
alongside value and non-NULL memref parameters in various directions.

NULL memref param (invalid params):
-----------------------------------
Verifies that attempting to perform an OCALL with memref parameters with a
NULL buffer and a non-zero size and with a non-NULL buffer and a zero size
fails at the Internal Core API layer.

OCALL during session open:
--------------------------
Ascertains that the CA can receive an OCALL during session open.

Finalize context during session open OCALL:
-------------------------------------------
Performs an OCALL during session open that finalizes the context via which
the session was being opened, verifies that the OCALL is cancelled, and
that the session fails to open.

Signed-off-by: Hernan Gatta <hegatta@microsoft.com>
Acked-by: Jerome Forissier <jerome@forissier.org>
@HernanGatta
Copy link
Author

Latest push is a rebase only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants