Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528547pxf; Mon, 15 Mar 2021 11:34:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKhMbaJUWuBDRumlUwlPjjI8k9IjZJKDgP5zcKkidDbRBUUp8mCzkmUuuH3nWZrV6pUSHC X-Received: by 2002:a05:6402:cb8:: with SMTP id cn24mr31920823edb.105.1615833249750; Mon, 15 Mar 2021 11:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833249; cv=none; d=google.com; s=arc-20160816; b=kbFgUz+lyuKSMXna1dHpCsCPNtINlWGD7M5hBo0y5QqqLDreetx179K70vuHL5gAFj LRYBkWQihQLPsEPZYaiICVnAIqpjceYKgk3IVzOA86Fm5dDO5KYyYE0hUaXkEjcMPkzN oKPOn/PjX7iq+HKrvY43x+d84hp4JMfqSYrL10xzzu3BsD9ESKE68BL586x5qD+l4GMz KslThJXC936Vtk/UJhKV0uMuED5ukIP4YcVyFiXAFIyuCNQoFgQpFp017b2pUbxw7J5z +Tcjxi/2+FBL4teXUVk9nrZl9WkALHf9ciBMZF4fxBVIS2WCfejoFfoEzaTslELc54qv Kovg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=596ZkdI+z25ZCJRDDhhZUEUt28J0A49DnxADS4OyxoU=; b=iInj91opodhjcsg5gtrGERLT6/GRJzqhNmhqINlX+vzIuoQdkxWWfhL2VF+43NHeWO HO5Z/jFgF2+mA3qehzKt5UKmdL/bJ7Q02hmlSqfITltV5eh+hnJhrCtjNp3fTF785QKQ 1AHRXSb0RhDymy8mCBbPiolfsq8wb6buGcTKZNJqTYqsoloSMPiWGVKcU9DYBrn2IqDN 3gzOrrGt0HPDJnb9ZMUfHlMzWTcJXJ0G60hQxhZ/V7so7YzRZwOjO8Xavz973HEkcxJe ulGoB+9//0Vpt08fb7eZ33Q9zvuTq2VjE73xIocRF27u/4+bOzPDXK8GOiGJIrysulPO /dMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RnmDYhIJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si10764125edd.260.2021.03.15.11.33.47; Mon, 15 Mar 2021 11:34:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RnmDYhIJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237984AbhCOOmJ (ORCPT + 99 others); Mon, 15 Mar 2021 10:42:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:49418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234128AbhCOOC6 (ORCPT ); Mon, 15 Mar 2021 10:02:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0974F64EEE; Mon, 15 Mar 2021 14:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816978; bh=pahPprvgMlC98Q1N7i19LIWDb7xGXm3jUnB5rspMKQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RnmDYhIJYCKZL/jNUY1WM55Ai+mulZLZLmMSP3dBBWspKILzGtQLwxHr6taV6h3b+ HJJKi4AdFMgTEjGXaYlqeKO8VVf2wrjcGaSILVReTAfWDVc1pbxnuPdFkvZSKiBVyy AYNjHAtq4TAkseynAUerv0ZdnKCwoSP9NnlXNMvk= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Jonathan Marek , Dmitry Baryshkov Subject: [PATCH 5.10 224/290] misc: fastrpc: restrict user apps from sending kernel RPC messages Date: Mon, 15 Mar 2021 14:55:17 +0100 Message-Id: <20210315135549.545419195@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Dmitry Baryshkov commit 20c40794eb85ea29852d7bc37c55713802a543d6 upstream. 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 Cc: Jonathan Marek Cc: stable@vger.kernel.org Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20210212192658.3476137-1-dmitry.baryshkov@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/fastrpc.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -948,6 +948,11 @@ static int fastrpc_internal_invoke(struc 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);