Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3522193pxf; Mon, 15 Mar 2021 11:25:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdQrG1pHssJeLeosg5fnJQv2vQ2wxAzaYwlJm6YkU8OoGERU9+SFAqm9y24qMznqIEVQfn X-Received: by 2002:a17:906:1a4b:: with SMTP id j11mr25269490ejf.55.1615832738049; Mon, 15 Mar 2021 11:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832738; cv=none; d=google.com; s=arc-20160816; b=CS/YVs2CRmjB/gCLO1dRaUIBdfuNPYXibCOwdn7qS5dko12zWoX+ayUod4rAAeFmgI jaQrRvbb1I4fy1ICJSKhQqeix9fTB6lnmf5NuQvH+laQvb2jaqZxjtwn5iQDB8yxrojC RQc3kqQmUgmNqo9zBJuqK101zLJyec2fQYrgyIU8u5XF0RT/tvd5wB00DjZnRVq6P2NO Dt434msQ2K9CI+uDc3rFL4RE2rzJSZ6KCFz+YzmYwlNT7CtKZoWADkxHxedAhxbo/+Hv l7DpZLb8/GW+e7IghYtx4dxQlbTx98R3TE1nknw5yt+Y9A/vYKZ9GXLNmOT04jw3slc7 CdzQ== 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=42nN4Np2W2vVoiQJk6nUdTI+V/S0euBInGffhVas0QA=; b=hdP8vaBSkiyRwVJy85cV/RFzOkjBLct4nXS5bTiUAQSC7GxSTDuQHKCb5lvIK2zGFX r5NDwd/zn8lQcXH3SbZe5VybZIg9qkcJ7rjY83nYitQt2JTSz/edSQLRRGKpiQXFKlT2 5/oTyJH/mY8OY8wyV7VtAcfTxxZBk1Okn+Jss5guRtrb3F2M2cdYAkcidJszA9G3ekCY 0S/dkTXP3xVKBMi8DAGmrHKa3JrsMdrRhveggSMEAbDX8GFnMd2Z1Zu2IJ8koLnPp6k2 kkzg7Ka9pq3n5GrPaArUSaES+x2VRdBIV1SKURfA838emmFzGpq3ZqGMl64aIrUyYUfX tqOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EFTb1LaG; 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 p15si10371264ejr.236.2021.03.15.11.25.16; Mon, 15 Mar 2021 11:25:38 -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=EFTb1LaG; 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 S238878AbhCOO0T (ORCPT + 99 others); Mon, 15 Mar 2021 10:26:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:36788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233020AbhCOOAe (ORCPT ); Mon, 15 Mar 2021 10:00:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9F09464F2B; Mon, 15 Mar 2021 14:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816812; bh=Ka8gW4bNWcdAax6/0NiwlubvqKWPXd3fZbvk1dYbZoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFTb1LaGYgBGb2grvX4+vMYede4z/fDE0qFqEaHNtZhEucvbIvZ4O+Aj9R+A407V9 zxXxprK4jbGeSk27blAUkAPg6N+8KIOrKRJLkZOCs64KbNnw5ATFe71yR4PqH6eJc4 L3VjRZZ4/2wvWbZqo77aIQe0N0MhIc/YT8WQw3/k= 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.4 126/168] misc: fastrpc: restrict user apps from sending kernel RPC messages Date: Mon, 15 Mar 2021 14:55:58 +0100 Message-Id: <20210315135554.491454698@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 @@ -924,6 +924,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);