[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210212192658.3476137-1-dmitry.baryshkov@linaro.org>
Date: Fri, 12 Feb 2021 22:26:58 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Jonathan Marek <jonathan@...ek.ca>, stable@...r.kernel.org
Subject: [PATCH v2] misc: fastrpc: restrict user apps from sending kernel RPC messages
Verify that user applications are not using the kernel RPC message
handle to restrict them from directly attaching to guest OS on the
remote subsystem. This is a port of CVE-2019-2308 fix.
Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method")
Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: Jonathan Marek <jonathan@...ek.ca>
Cc: stable@...r.kernel.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
---
Changes since v1:
- changed to dev_warn_ratelimited to prevent userspace from flooding
kernel log
drivers/misc/fastrpc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index f12e909034ac..beda610e6b30 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -950,6 +950,11 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
if (!fl->cctx->rpdev)
return -EPIPE;
+ if (handle == FASTRPC_INIT_HANDLE && !kernel) {
+ dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle);
+ return -EPERM;
+ }
+
ctx = fastrpc_context_alloc(fl, kernel, sc, args);
if (IS_ERR(ctx))
return PTR_ERR(ctx);
--
2.30.0
Powered by blists - more mailing lists