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:	Fri, 23 Jan 2015 12:37:09 -0600
From:	Tom Zanussi <tom.zanussi@...ux.intel.com>
To:	josh@...htriplett.org
Cc:	linux-kernel@...r.kernel.org,
	Tom Zanussi <tom.zanussi@...ux.intel.com>
Subject: [PATCH 03/10] drivers/char: Support compiling out /dev/port

There's already a CONFIG_DEVPORT option, but it isn't accessible to
users.  Give it some menu and help text and allow it to be toggled
off.

Aside from giving embedded systems that don't need it the ability to
turn it off, it also allows the code shared between it and other
options to be compiled out (open_port() shared with /dev/mem, and
memory_lseek() shared with /dev/mem and /dev/kmem; both functions have
been changed to __maybe_unused for when all of the above are compiled
out).

bloat-o-meter (based on tinyconfig):

add/remove: 0/3 grow/shrink: 0/0 up/down: 0/-330 (-330)
function                                     old     new   delta
read_port                                     98       -     -98
write_port                                   116       -    -116
port_fops                                    116       -    -116

bloat-o-meter showing the difference between both CONFIG_DEVKMEM and
CONFIG_DEVMEM off and that plus CONFIG_DEVPORT off:

add/remove: 0/5 grow/shrink: 0/0 up/down: 0/-471 (-471)
function                                     old     new   delta
open_port                                     19       -     -19
read_port                                     98       -     -98
write_port                                   116       -    -116
port_fops                                    116       -    -116
memory_lseek                                 122       -    -122

So with all three configured out, we see the mutually shared open_port
and memory_lseek drop out.

Signed-off-by: Tom Zanussi <tom.zanussi@...ux.intel.com>
---
 drivers/char/Kconfig | 7 ++++++-
 drivers/char/mem.c   | 5 +++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 73e2bb8..5a6c060 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -595,11 +595,16 @@ config TELCLOCK
 	  controlling the behavior of this hardware.
 
 config DEVPORT
-	bool
+	bool "/dev/port virtual device support"
 	depends on !M68K
 	depends on ISA || PCI
 	depends on DEVMEM_BASE
 	default y
+	help
+	  Say Y here if you want to support the /dev/port device. The
+	  /dev/port device is a character device that allows userspace
+	  access to I/O ports, which may be needed by some programs.
+	  When in doubt, say "Y".
 
 source "drivers/s390/char/Kconfig"
 
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 9b7b04e..5944d87 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -682,7 +682,8 @@ static loff_t null_lseek(struct file *file, loff_t offset, int orig)
  * also note that seeking relative to the "end of file" isn't supported:
  * it has no meaning, so it returns -EINVAL.
  */
-static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
+static loff_t __maybe_unused memory_lseek(struct file *file, loff_t offset,
+					  int orig)
 {
 	loff_t ret;
 
@@ -707,7 +708,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig)
 	return ret;
 }
 
-static int open_port(struct inode *inode, struct file *filp)
+static int __maybe_unused open_port(struct inode *inode, struct file *filp)
 {
 	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
 }
-- 
1.9.3

--
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