Subject: Re: mkdir with trailing / (patch proposed)
To: Julio Merino <email@example.com>
From: Bill Sommerfeld <firstname.lastname@example.org>
Date: 04/28/2002 16:16:47
first, an meta-comment: patches mangled quoted-unprintably by MIME are
really hard to read; there's no apparent reason for the message you
sent to have been MIME-encoded.
The patch in question is incorrect in multiple ways.
1) it references a system call argument in the user address space
using memcpy rather than copyin/copyinstr,
2) it may cause a kernel mode page fault in the event that there
aren't PATH_MAX valid bytes after the start of the "path" argument,
3) uses UIO_USERSPACE to refer to kernel-space memory (the
newly-allocated "path" variable). (if this code appears to work *at
all*, it suggests that there's a bug in that platform's copyinstr() --
it should return EFAULT when presented with a kernel-space address).
A more correct way to do this would involve the introduction of a new
namei operational flag, passing that from mkdir(), and if that flag is
set, trimming the trailing slashes off the pathname early in namei().