lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Sep 2013 18:08:34 -0500
From:	danielfsantos@....net
To:	linux-kbuild <linux-kbuild@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Michal Marek <mmarek@...e.cz>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	David Howells <dhowells@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	George Spelvin <linux@...izon.com>
Cc:	Daniel Santos <daniel.santos@...ox.com>
Subject: [PATCH 2/5] lib: Add .config options for error strings in printks

This adds to lib/Kconfig.debug the options for printk messages to
display either error number only (the current behavior), number and
error name or number, name and description. These options in turn select
STRERROR_NAME and STRERROR as needed, so I'm not adding any direct
options to enable those, although it can be added later if somebody
needs strerror() or strerror_name() when not enabled in printks.

kconfg

Signed-off-by: Daniel Santos <daniel.santos@...ox.com>
---
 lib/Kconfig.debug | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index c9eef36..919f371 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -58,6 +58,7 @@ config DYNAMIC_DEBUG
 	  implicitly compiles in all pr_debug() and dev_dbg() calls, which
 	  enlarges the kernel text size by about 2%.
 
+
 	  If a source file is compiled with DEBUG flag set, any
 	  pr_debug() calls in it are enabled by default, but can be
 	  disabled at runtime as below.  Note that DEBUG flag is
@@ -113,6 +114,58 @@ config DYNAMIC_DEBUG
 
 	  See Documentation/dynamic-debug-howto.txt for additional information.
 
+choice
+	prompt "Display errors in printk as"
+	default PRINTK_ERROR_CODES_ONLY
+	depends on PRINTK
+	help
+	  This option tells printk how to display error codes when
+	  formatted with the %de format code (a Linux printk extension).
+	  Error codes are most commonly passed to userspace when syscalls
+	  return where they are then translated into localized descrptions
+	  via libc's strerror(), perror(), etc.  However, many error
+	  conditions (for drivers and such) are only reported via printks
+	  where there is no such userspace mechanism to reliably translate
+	  error numbers into something a little more human.
+
+	  This option allows you to perform that translation in the kernel,
+	  at the cost of a slightly larger kernel. Note that no native
+	  language support is currently, or may ever be provided.
+
+	  If unsure, choose "Error codes only".
+
+config PRINTK_ERROR_CODES_ONLY
+	bool "Error codes only"
+	help
+	  Just display the error number.
+
+config PRINTK_ERROR_NAMES
+	bool "Error names"
+	select STRERROR_NAME
+	help
+	  This option causes printk messages containing an error code to
+	  print the name of the error in addition to the error number.
+	  Enabling this adds about 2k. Example: -22 (EINVAL)
+
+config PRINTK_ERROR_DESCS
+	bool "Full descrptions"
+	select STRERROR
+	select STRERROR_NAME
+	help
+	  This option causes printk messages containing an error code to
+	  print the description of errors (in addition to the name and
+	  number) and can be helpful for those with aversions to search
+	  engines. Enabling this adds about 6k over error codes alone.
+	  Example: -90 (EMSGSIZE: Message too long)
+
+endchoice
+
+config STRERROR
+	bool
+
+config STRERROR_NAME
+	bool
+
 endmenu # "printk and dmesg options"
 
 menu "Compile-time checks and compiler options"
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ