Re: [darwin-kernel] devfs_make_node mutilates pathname on Leopard?
Re: [darwin-kernel] devfs_make_node mutilates pathname on Leopard?
- Subject: Re: [darwin-kernel] devfs_make_node mutilates pathname on Leopard?
- From: Terry Lambert <email@hidden>
- Date: Wed, 12 Dec 2007 09:15:43 -0800
On Dec 12, 2007, at 8:27 AM, Steve Checkoway <email@hidden> wrote:
On Dec 12, 2007, at 8:17 AM, Alexander v. Below wrote:
under OS X 10.5, when I install a file system device with
procDevice = devfs_make_node(myDevice, DEVFS_CHAR, UID_ROOT,
GID_WHEEL, 0666, path)
where "path" is an actual path (like foo/bar/myDevice), then the
device gets created in /dev/fo/ba/myDevice. This does not happen in
10.4
Is this just a plain bug, or am I doing something wrong?
This has come up a number of times on the list recently. As I
recall, this is both not supported and an off-by-one error
introduced when switching from some standard library function to
some supposedly "safe" version which was supposed to prevent these
sorts of errors. See the list archive for more details.
Specifically, creation of subdirectories in /dev is not officially
supported, don't do that.
The change of function precludes kernel buffer overflow based crashes
for some device drivers using name information supplied from user
space. Even with the "off by one" introduced in the changeover, the
buffet overrun is avoided, which is a good thing for kernel stability.
In general, device node length is constrained overall to a value
"reasonable" for a single path component, which means the more /'s you
used, the shorter the name allowed for the eventual device anyway. I
think the overall limit is something like 32 characters; if that's not
exactly correct, whatever it is is a heck of a lot smaller than
PATH_MAX at 1024 bytes.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden