blob: 01cf523a82c195d995a32984c25602f59d0cb372 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From f173e99554512c982665c1d5d4b0543421177b09 Mon Sep 17 00:00:00 2001
2From: Imre Kis <imre.kis@arm.com>
3Date: Tue, 26 Jul 2022 17:06:46 +0200
4Subject: [PATCH 24/24] Deny 64 bit FF-A messages in FF-A RPC endpoint
5
6FF-A RPC protocol only allows 32 bit FF-A direct messages thus deny all
764 bit messages in the RPC endpoint.
8
9Signed-off-by: Imre Kis <imre.kis@arm.com>
10Change-Id: I37c95425f80b6e2821b3f6b8649ceba8aa007bce
11
12Upstream-Status: Pending [In review]
13Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
14
15---
16 .../rpc/ffarpc/endpoint/ffarpc_call_ep.c | 31 ++++++++++++-------
17 1 file changed, 20 insertions(+), 11 deletions(-)
18
19diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
20index c024196..3035c16 100644
21--- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
22+++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
23@@ -12,6 +12,7 @@
24 #include <protocols/rpc/common/packed-c/status.h>
25 #include <trace.h>
26 #include <stddef.h>
27+#include <string.h>
28
29 /* TODO: remove this when own ID will be available in libsp */
30 extern uint16_t own_id;
31@@ -260,17 +261,25 @@ void ffa_call_ep_receive(struct ffa_call_ep *call_ep,
32 const struct sp_msg *req_msg,
33 struct sp_msg *resp_msg)
34 {
35- const uint32_t *req_args = req_msg->args.args32;
36- uint32_t *resp_args = resp_msg->args.args32;
37-
38- uint16_t source_id = req_msg->source_id;
39- uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
40-
41- if (FFA_CALL_ARGS_EXTRACT_IFACE(ifaceid_opcode) == FFA_CALL_MGMT_IFACE_ID) {
42- /* It's an RPC layer management request */
43- handle_mgmt_msg(call_ep, source_id, req_args, resp_args);
44+ resp_msg->is_64bit_message = req_msg->is_64bit_message;
45+ memset(&resp_msg->args, 0x00, sizeof(resp_msg->args));
46+
47+ if (!req_msg->is_64bit_message) {
48+ const uint32_t *req_args = req_msg->args.args32;
49+ uint32_t *resp_args = resp_msg->args.args32;
50+ uint16_t source_id = req_msg->source_id;
51+ uint32_t ifaceid_opcode = req_args[SP_CALL_ARGS_IFACE_ID_OPCODE];
52+
53+ if (FFA_CALL_ARGS_EXTRACT_IFACE(ifaceid_opcode) == FFA_CALL_MGMT_IFACE_ID) {
54+ /* It's an RPC layer management request */
55+ handle_mgmt_msg(call_ep, source_id, req_args, resp_args);
56+ } else {
57+ /* Assume anything else is a service request */
58+ handle_service_msg(call_ep, source_id, req_args, resp_args);
59+ }
60 } else {
61- /* Assume anything else is a service request */
62- handle_service_msg(call_ep, source_id, req_args, resp_args);
63+ EMSG("64 bit FF-A messages are not supported by the TS RPC layer");
64+ resp_msg->args.args64[SP_CALL_ARGS_RESP_RPC_STATUS] =
65+ TS_RPC_ERROR_INVALID_PARAMETER;
66 }
67 }
68--
692.17.1
70