From patchwork Tue May 6 13:03:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 29707 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 40D0E20534 for ; Tue, 6 May 2014 13:05:00 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rl12sf49673136iec.10 for ; Tue, 06 May 2014 06:04:59 -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=WKFNaHwVTYCtHFDtR5Lb66QR0o/5SqIcrfdFtQLbyy4=; b=j6JKRUCfuVlyif/7ZKH4WKXO1skp18lzkWpeVmOxh92G2x62hePi/K631014nj1ugk mu565UkzEiTxrLYImcEjjANKd56f1+0XS633Kg5eiDTTtYPh4AQKQquPOHRSiXS4ayNe 6Lkol+sX//8BNX3xTXrHTvGYCjK8IR4E2wfKJ5WV9aSsDI/M3HuUfzGUFU6wGnjfbWny Gwl7zohi1JIZsragTIvir1aRH/Vqm2da9ufBYygbygylTtHSHp7ljj+I0PQnudqPuV6J ez5eXVSdFqkwIYh++ZD3RzMvtGas4cGrTjK5BSrJf5KG7H/IW+nbJg+3hJYkX1QUijlC 9pbA== X-Gm-Message-State: ALoCoQnde8ulIvMJYsK21SlyHEYT222A9IA5PJUimDjtWDXIALlfGwfnjUJwstgTsQU84pZipcDG X-Received: by 10.50.93.101 with SMTP id ct5mr1077620igb.7.1399381499749; Tue, 06 May 2014 06:04:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.200 with SMTP id l66ls2823533qgf.33.gmail; Tue, 06 May 2014 06:04:59 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr7683641vcb.24.1399381499609; Tue, 06 May 2014 06:04:59 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id tz5si2299937vdc.187.2014.05.06.06.04.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 06:04:59 -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.128.179; Received: by mail-ve0-f179.google.com with SMTP id oy12so7392473veb.24 for ; Tue, 06 May 2014 06:04:59 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr33238423vcb.0.1399381499496; Tue, 06 May 2014 06:04:59 -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 ib8csp221770vcb; Tue, 6 May 2014 06:04:59 -0700 (PDT) X-Received: by 10.180.212.107 with SMTP id nj11mr21109130wic.40.1399381493027; Tue, 06 May 2014 06:04:53 -0700 (PDT) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by mx.google.com with ESMTPS id jz10si5646745wjc.124.2014.05.06.06.04.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 06:04:53 -0700 (PDT) Received-SPF: none (google.com: daniel.thompson@linaro.org does not designate permitted sender hosts) client-ip=74.125.82.41; Received: by mail-wg0-f41.google.com with SMTP id z12so3703046wgg.12 for ; Tue, 06 May 2014 06:04:52 -0700 (PDT) X-Received: by 10.194.48.100 with SMTP id k4mr7832043wjn.49.1399381492505; Tue, 06 May 2014 06:04:52 -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 by1sm21966350wjc.26.2014.05.06.06.04.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 May 2014 06:04:51 -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: [PATCH v4 9/9] kdb: Allow access to sensitive commands to be restricted by default Date: Tue, 6 May 2014 14:03:49 +0100 Message-Id: <1399381429-16194-10-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1399381429-16194-1-git-send-email-daniel.thompson@linaro.org> References: <1398443370-12668-1-git-send-email-daniel.thompson@linaro.org> <1399381429-16194-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 4a82dc3..72dd06d 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