Deny 64 bit FF-A messages in FF-A RPC endpoint
FF-A RPC protocol only allows 32 bit FF-A direct messages thus deny all
64 bit messages in the RPC endpoint.
Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: I37c95425f80b6e2821b3f6b8649ceba8aa007bce
diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
index c024196..3035c16 100644
--- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
+++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
@@ -12,6 +12,7 @@
#include <protocols/rpc/common/packed-c/status.h>
#include <trace.h>
#include <stddef.h>
+#include <string.h>
/* TODO: remove this when own ID will be available in libsp */
extern uint16_t own_id;
@@ -260,17 +261,25 @@
const struct sp_msg *req_msg,
struct sp_msg *resp_msg)
{
- const uint32_t *req_args = req_msg->args.args32;
- uint32_t *resp_args = resp_msg->args.args32;
+ resp_msg->is_64bit_message = req_msg->is_64bit_message;
+ memset(&resp_msg->args, 0x00, sizeof(resp_msg->args));
- uint16_t source_id = req_msg->source_id;
- uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
+ if (!req_msg->is_64bit_message) {
+ const uint32_t *req_args = req_msg->args.args32;
+ uint32_t *resp_args = resp_msg->args.args32;
+ uint16_t source_id = req_msg->source_id;
+ uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
- if (FFA_CALL_ARGS_EXTRACT_IFACE(ifaceid_opcode) == FFA_CALL_MGMT_IFACE_ID) {
- /* It's an RPC layer management request */
- handle_mgmt_msg(call_ep, source_id, req_args, resp_args);
+ if (FFA_CALL_ARGS_EXTRACT_IFACE(ifaceid_opcode) == FFA_CALL_MGMT_IFACE_ID) {
+ /* It's an RPC layer management request */
+ handle_mgmt_msg(call_ep, source_id, req_args, resp_args);
+ } else {
+ /* Assume anything else is a service request */
+ handle_service_msg(call_ep, source_id, req_args, resp_args);
+ }
} else {
- /* Assume anything else is a service request */
- handle_service_msg(call_ep, source_id, req_args, resp_args);
+ EMSG("64 bit FF-A messages are not supported by the TS RPC layer");
+ resp_msg->args.args64[SP_CALL_ARGS_RESP_RPC_STATUS] =
+ TS_RPC_ERROR_INVALID_PARAMETER;
}
}