From patchwork Fri Apr 25 16:29:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 29110 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D1D7E203AC for ; Fri, 25 Apr 2014 16:30:07 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id rq2sf8967459pbb.7 for ; Fri, 25 Apr 2014 09:30:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=iwAKYNlQPA00w/n6V+vIhdhjgwOsGzvIm4ke1bCYMeM=; b=G0PM8WPLEnHYqNk+jBN/8HLeXZKWrXShecRBn1mCX6Nqfx1i6UcXKPnxoA3ceZGi/S jV78IxzGEvJaZGxv6gtTpzoZgjfE8ZJqNDU/lEM6gZ+wvXw/7CvveoMH52Gc3yj4QahA zWH2kNjGKS+QsIdrMVNTGszVawG+maLyfrtAnYSFZ2ATvt2dtY+kJR4g198NoGp8qAst RMvf4kZDmXfRW5QDkcJNTQNs8ubRNkkn+Pk3N7FmYSEAPfdTJIyO5kFYUIwmZbHoSeOf jdrM/WvAm9fIb/+QNZEpDw5huY99AoNcVk854Syn7saAYlNvD8YG7dtRG2hEIVl8oUR0 SgBw== X-Gm-Message-State: ALoCoQlZUSWoNhhHP+HI77N4YwVbDMqqe6BsX9Y5PuIrrk1mpQvkpefJmhb8xgAO/s1rQRXgNgvb X-Received: by 10.66.148.10 with SMTP id to10mr3669492pab.12.1398443406419; Fri, 25 Apr 2014 09:30:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.184 with SMTP id g53ls1608577qge.76.gmail; Fri, 25 Apr 2014 09:30:06 -0700 (PDT) X-Received: by 10.58.69.20 with SMTP id a20mr76592veu.63.1398443406224; Fri, 25 Apr 2014 09:30:06 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id bp12si1815059veb.135.2014.04.25.09.30.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Apr 2014 09:30:06 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so4973639vcb.2 for ; Fri, 25 Apr 2014 09:30:06 -0700 (PDT) X-Received: by 10.220.188.10 with SMTP id cy10mr900368vcb.36.1398443406146; Fri, 25 Apr 2014 09:30:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp110918vcb; Fri, 25 Apr 2014 09:30:05 -0700 (PDT) X-Received: by 10.194.236.232 with SMTP id ux8mr7483510wjc.46.1398443405124; Fri, 25 Apr 2014 09:30:05 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id ev10si3921320wjb.137.2014.04.25.09.30.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Apr 2014 09:30:05 -0700 (PDT) Received-SPF: none (google.com: daniel.thompson@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.176; Received: by mail-wi0-f176.google.com with SMTP id r20so2956243wiv.3 for ; Fri, 25 Apr 2014 09:30:04 -0700 (PDT) X-Received: by 10.194.188.41 with SMTP id fx9mr2858826wjc.56.1398443404713; Fri, 25 Apr 2014 09:30:04 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id fw13sm6881026wic.6.2014.04.25.09.30.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Apr 2014 09:30:03 -0700 (PDT) From: Daniel Thompson To: kgdb-bugreport@lists.sourceforge.net, Jason Wessel Cc: patches@linaro.org, linaro-kernel@lists.linaro.org, Daniel Thompson , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Steven Rostedt , Frederic Weisbecker , Ingo Molnar , John Stultz , Anton Vorontsov , Colin Cross , kernel-team@android.com Subject: [RFC v3 9/9] kdb: Allow access to sensitive commands to be restricted by default Date: Fri, 25 Apr 2014 17:29:30 +0100 Message-Id: <1398443370-12668-10-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398443370-12668-1-git-send-email-daniel.thompson@linaro.org> References: <1396453440-16445-1-git-send-email-daniel.thompson@linaro.org> <1398443370-12668-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently kiosk mode must be explicitly requested by the bootloader or userspace. It is convenient to be able to change the default value in a similar manner to CONFIG_MAGIC_SYSRQ_DEFAULT_MASK. Signed-off-by: Daniel Thompson --- kernel/debug/kdb/kdb_main.c | 2 +- lib/Kconfig.kgdb | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 4e9340c..b68f30e 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -47,7 +47,7 @@ #undef MODULE_PARAM_PREFIX #define MODULE_PARAM_PREFIX "kdb." -static int kdb_cmd_enabled; +static int kdb_cmd_enabled = CONFIG_KDB_DEFAULT_ENABLE; module_param_named(cmd_enable, kdb_cmd_enabled, int, 0600); #define GREP_LEN 256 diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb index 358eb81..fbbcff6 100644 --- a/lib/Kconfig.kgdb +++ b/lib/Kconfig.kgdb @@ -73,6 +73,31 @@ config KGDB_KDB help KDB frontend for kernel +config KDB_DEFAULT_ENABLE + hex "KDB: Select kdb command functions to be enabled by default" + depends on KGDB_KDB + default 0x1 + help + Specifiers which kdb commands are enabled by default. This may + be set to 1 or 0 to enable all commands or disable almost all + commands. + + Alternatively the following bitmask applies: + + 0x0002 - allow arbitrary reads from memory and symbol lookup + 0x0004 - allow arbitrary writes to memory + 0x0008 - allow current register state to be inspected + 0x0010 - allow current register state to be modified + 0x0020 - allow passive inspection (backtrace, process list, lsmod) + 0x0040 - allow flow control management (breakpoint, single step) + 0x0080 - enable signalling of processes + 0x0100 - allow machine to be rebooted + + The config option merely sets the default at boot time. Both + issuing 'echo X > /sys/module/kdb/parameters/kdb.cmd_enable' or + setting with kdb.cmd_enable=X kernel command line option will + override the default settings. + config KDB_KEYBOARD bool "KGDB_KDB: keyboard as input device" depends on VT && KGDB_KDB