From patchwork Mon Jul 17 10:21:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 9844439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 617B360392 for ; Mon, 17 Jul 2017 10:22:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51A9927DCD for ; Mon, 17 Jul 2017 10:22:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 468D627F89; Mon, 17 Jul 2017 10:22:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C176B27DCD for ; Mon, 17 Jul 2017 10:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=JrXZFXDo6KTiomJln4lZCF9MhOYiNgIcIv8uFAtxRtw=; b=ulo GS1JfA29SLgBx8aYo/t7rKBvUJMaSnwdAudh9LeYBdy0TspsGBGD0vY5XPgYz4qFwX8euHUg/t8qD CITiBzGyl7JpOE/bX2gOOYi5eRxoD3XuGIPvxjgiJBqP3DubSkqZnf3L3eUHZDjz1fP9UwWf3V9oh i+V38bLuP1jzXy4OA+TwSliSMjvuXsNjWWhz4vOZ6tQdadqweaRRIhTlgL4PftxuJQYSECUcEVSxZ zaHo1TRWdsFiYLqvHQ/lwKnFGAXvAafHpwddwkCPeII05TVAvKGXhV++ph7v5e+RPr07as6D1qfWR 5ln3dunniM0TuABSTxfnjFn8pdEtQrg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dX3AZ-0006jN-1S; Mon, 17 Jul 2017 10:22:27 +0000 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dX3AU-0006fD-Uq for linux-arm-kernel@lists.infradead.org; Mon, 17 Jul 2017 10:22:25 +0000 Received: by mail-lf0-x22f.google.com with SMTP id w198so15115321lff.2 for ; Mon, 17 Jul 2017 03:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=7ug+QqlAXgt+sAAnOIMm6UbsfmdjPCq/g8pNtlPZeYk=; b=c+t1i0YutCUYQU3YWbh7HAt/CZ8EVTlAULozhSCsvdFEW1AxpMPvCFYwQyrG2lMcLO 734WaJv2blMdi1CcMYVr2jmFqiEBZxXe5OE/ZGUW7Rj5GpznYu4WOEa3ZSWHQa/YygGg Sc/AWXDppaa/hhl/uLylq1rKqwGnpZY635I2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7ug+QqlAXgt+sAAnOIMm6UbsfmdjPCq/g8pNtlPZeYk=; b=MGZGIlMIhBYhgHxmUAE0P0g5RyOIncL6x9BatzZU4ByT+vn3MGzBc+EsuzFHRRqidE zPxFTY+mSk8d+B4wEVe9cCHSQCrklmCQTi6XqWwp50vnRwI7vzeKd2IcTaaxxasT5krL 6RBoea/5/8Yqs/5JSUz/V+KCXwKcFjagZIsb9fWxUQZLzk7QqCm2GIOIK0kIaZuFDrNb WLlHYSCx0xts9/CrC2CaXwIFQdQkf8uJBYHrmVK+m41OKGb/SVsWmJNkbvs2aAMNi++v /y4v3UipkTGJDZ6WvajD906AgxfJ3lIz2EtAMY9gWUBWUS6FvtpuKsGYTH3waddIW7T/ MBxA== X-Gm-Message-State: AIVw110S/zo4fYgGy7yD7sP7Bx6RwABOrVb8MepuLxy9fGegNJYTBG+4 +yZEQu77Agyxg4WL X-Received: by 10.25.196.205 with SMTP id u196mr6702825lff.19.1500286920642; Mon, 17 Jul 2017 03:22:00 -0700 (PDT) Received: from jax.urgonet (h-84-45.A175.priv.bahnhof.se. [79.136.84.45]) by smtp.gmail.com with ESMTPSA id r17sm3739329ljd.38.2017.07.17.03.21.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 03:21:59 -0700 (PDT) From: Jens Wiklander To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tee-dev@lists.linaro.org Subject: [PATCH] tee: indicate privileged dev in gen_caps Date: Mon, 17 Jul 2017 12:21:15 +0200 Message-Id: <1500286875-29888-1-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170717_032223_356751_414F47CF X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Wiklander MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Mirrors the TEE_DESC_PRIVILEGED bit of struct tee_desc:flags into struct tee_ioctl_version_data:gen_caps as TEE_GEN_CAP_PRIVILEGED in tee_ioctl_version() Reviewed-by: Jerome Forissier Signed-off-by: Jens Wiklander --- drivers/tee/tee_core.c | 5 +++++ include/uapi/linux/tee.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 5c60bf4423e6..58a5009eacc3 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -90,8 +90,13 @@ static int tee_ioctl_version(struct tee_context *ctx, struct tee_ioctl_version_data vers; ctx->teedev->desc->ops->get_version(ctx->teedev, &vers); + + if (ctx->teedev->desc->flags & TEE_DESC_PRIVILEGED) + vers.gen_caps |= TEE_GEN_CAP_PRIVILEGED; + if (copy_to_user(uvers, &vers, sizeof(vers))) return -EFAULT; + return 0; } diff --git a/include/uapi/linux/tee.h b/include/uapi/linux/tee.h index 370d8845ab21..688782e90140 100644 --- a/include/uapi/linux/tee.h +++ b/include/uapi/linux/tee.h @@ -49,6 +49,7 @@ #define TEE_MAX_ARG_SIZE 1024 #define TEE_GEN_CAP_GP (1 << 0)/* GlobalPlatform compliant TEE */ +#define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */ /* * TEE Implementation ID