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-next>] [day] [month] [year] [list]
Date:	Wed, 17 Nov 2010 15:37:31 -0600
From:	Timur Tabi <timur@...escale.com>
To:	Arnd Bergmann <arnd@...db.de>, Greg Kroah-Hartman <gregkh@...e.de>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
CC:	Scott Wood <scottwood@...escale.com>,
	Stuart Yoder <stuart.yoder@...escale.com>
Subject: How do I choose an arbitrary minor number for my tty device?

Arnd and Greg,

I'm working on a TTY driver for a virtual device that we call "byte channels".
This are likes pipes, but they go through an ePAPR hypervisor.

The hypervisor declares byte channels as nodes in a device tree.  Each byte
channel has a unique 32-bit number called a "handle", and this handle is
specified in the node for that device tree.  Applications are expected to scan
the device tree to look for the node they want, and then extract the handle from
that node.

The problem I have is that the handles are, from Linux's perspective, arbitrary
and sparsely assigned.  For example, we could have four byte channels with
handles of 2, 8, 73, and 74.

What I would like is for the minor number for each tty device to be the byte
channel handle.  Or the byte channel could be in the /dev name.  Either way,
applications can figure out which /dev entry to open in order to communicate
with a given byte channel.

Unfortunately, the only way I know how to do this is to create a separate tty
driver instance for each byte channel.  This is because of this code in
tty_register_driver:

	if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM) && driver->num) {
		p = kzalloc(driver->num * 2 * sizeof(void *), GFP_KERNEL);
		if (!p)
			return -ENOMEM;
	}

The 'index' passed to tty_register_device() is added to minor_start to create
the /dev entry, and it's added to name_base to create the name.  If I specify a
very large number for driver->num, then tty_register_driver will create a large
but sparsely-populated array.

Would you be okay with creating a separate driver for each byte channel, or is
there a better way to do what I want?

--
Timur Tabi
Linux kernel developer at Freescale

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