Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3664021pxb; Mon, 24 Jan 2022 14:48:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZpdOZKvKJ9VDtzXcsoWqBEhBW4Ry87c4dEdrC0DNtW/cBs6Kbl0oQTbLbmRr3GroLCxDF X-Received: by 2002:a63:b20d:: with SMTP id x13mr13320741pge.310.1643064512620; Mon, 24 Jan 2022 14:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064512; cv=none; d=google.com; s=arc-20160816; b=CzCHaf/Ybnm9gO2WZWilApzMbMtP+aY4Ivgz0ov0pBXs4SZbbsu2tasgWBPzVeY3rs 6E3wcvzYuUVWrPcygrKRiRWcAq0R0lU5PhuC9JyPmV+YJhDVZljvXy3zJNbgU+5Jos8E umGg0fRriz6EmdZCmQP1jshPKkLWin2llOfCeIVflCsvzQisciebER+Z0FipmtvJt1TF lFrbEMZPX+OTSqoD5ByqpMs2qCtsiIzTajFX9DrZskQX75z6+QMqm6R7zyaMy4y8GVSQ KwRwCDKxjAI5BIMRQG6CF2Gfq59OOFdlFTFrVKRww9PnTFbBKH/xNigxrPA5aJ12VD1Q sLHw== 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=pb2YCSv21Bly1mK3rzYe0fGdFaVEys8OXJOj47sOfOg=; b=vYlXKQ6rvloY678QnVAiGMN6+8P4RFVvQdrc3dmaVwXJsRmPZBDWAzud4Ds4COGUPp +tlcckKluAmXbueKq3yEMqeI8u292MFRmhCUdHkYBr6u5hRDUNXuyL2pKb3W3zm5yPM9 iguYpJTTPA01ofSBHbg1QU+wUS5FIVRdjZ1BNHSUMYuLDuoNQTxzfH8GLeWrVbtkIBSw +S07XVBCT3UlED+WUuSCbYbQxAwu7L69235l/fobkYZkykRlYPnOycuE5o40wtqbGgkX 62jzZcDNCHTWO/uuGFzJUzHV92b5Drr5FF+G5f6FWdqlUbvnVE6NcEe9x55SPnmeXJFb 7cVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0NVjfvdm; 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 q20si4281322pgt.648.2022.01.24.14.48.20; Mon, 24 Jan 2022 14:48:32 -0800 (PST) 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=0NVjfvdm; 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 S1838419AbiAXWqg (ORCPT + 99 others); Mon, 24 Jan 2022 17:46:36 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59280 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1457281AbiAXVlW (ORCPT ); Mon, 24 Jan 2022 16:41:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBED961522; Mon, 24 Jan 2022 21:41:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2B23C340E4; Mon, 24 Jan 2022 21:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060479; bh=XbyaGW1gqADsww7T0qAFwZ8XUk1w+jGvXRbXA7KpCY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0NVjfvdm11zK8XjuAP8GvrlNm+KA60Iqcm0QINtafydYLw0vEdF18La9k8G1oevWK 9r2l+Nu692HocUMtAZRLb0Iaz4Xt6HZApHCSrD9plXYFJLQeimiM4YrGZ+srH0Xxu+ h5uf6HnpTOLJoCmDQnwWZrmtownsKPsWSKq5J1eU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Stephen Boyd Subject: [PATCH 5.16 0961/1039] clk: Emit a stern warning with writable debugfs enabled Date: Mon, 24 Jan 2022 19:45:50 +0100 Message-Id: <20220124184157.595793021@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Stephen Boyd commit 489a71964f9d74e697a12cd0ace20ed829eb1f93 upstream. We don't want vendors to be enabling this part of the clk code and shipping it to customers. Exposing the ability to change clk frequencies and parents via debugfs is potentially damaging to the system if folks don't know what they're doing. Emit a strong warning so that the message is clear: don't enable this outside of development systems. Fixes: 37215da5553e ("clk: Add support for setting clk_rate via debugfs") Cc: Geert Uytterhoeven Link: https://lore.kernel.org/r/20211210014237.2130300-1-sboyd@kernel.org Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/clk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3343,6 +3343,24 @@ static int __init clk_debug_init(void) { struct clk_core *core; +#ifdef CLOCK_ALLOW_WRITE_DEBUGFS + pr_warn("\n"); + pr_warn("********************************************************************\n"); + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); + pr_warn("** **\n"); + pr_warn("** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **\n"); + pr_warn("** **\n"); + pr_warn("** This means that this kernel is built to expose clk operations **\n"); + pr_warn("** such as parent or rate setting, enabling, disabling, etc. **\n"); + pr_warn("** to userspace, which may compromise security on your system. **\n"); + pr_warn("** **\n"); + pr_warn("** If you see this message and you are not debugging the **\n"); + pr_warn("** kernel, report this immediately to your vendor! **\n"); + pr_warn("** **\n"); + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); + pr_warn("********************************************************************\n"); +#endif + rootdir = debugfs_create_dir("clk", NULL); debugfs_create_file("clk_summary", 0444, rootdir, &all_lists,