diff mbox

C11 threads ABI questions - enum values

Message ID 20141005162317.GA12566@lst.de
State New
Headers show

Commit Message

Christoph Hellwig Oct. 5, 2014, 4:23 p.m. UTC
On Sun, Oct 05, 2014 at 12:13:58PM -0400, Rich Felker wrote:
> Yes, the lack of support for fchown, fchmod, fstat, fstatfs, fchdir,

fstat, fstatfs and fchdir are already support on O_PATH descriptos, and
below is an untested patch for fchmod and fchown.

Comments

Christoph Hellwig Oct. 23, 2014, 8 a.m. UTC | #1
On Sun, Oct 05, 2014 at 06:23:17PM +0200, Christoph Hellwig wrote:
> On Sun, Oct 05, 2014 at 12:13:58PM -0400, Rich Felker wrote:
> > Yes, the lack of support for fchown, fchmod, fstat, fstatfs, fchdir,
> 
> fstat, fstatfs and fchdir are already support on O_PATH descriptos, and
> below is an untested patch for fchmod and fchown.

Can you verify that this is enough to get full O_SEARCH semantics from
the kernel?  I can submit this one ASAP, and then we can try to help to
make the new execveat suitable for O_EXEC.
Rich Felker Oct. 23, 2014, 4:37 p.m. UTC | #2
On Thu, Oct 23, 2014 at 10:00:34AM +0200, Christoph Hellwig wrote:
> On Sun, Oct 05, 2014 at 06:23:17PM +0200, Christoph Hellwig wrote:
> > On Sun, Oct 05, 2014 at 12:13:58PM -0400, Rich Felker wrote:
> > > Yes, the lack of support for fchown, fchmod, fstat, fstatfs, fchdir,
> > 
> > fstat, fstatfs and fchdir are already support on O_PATH descriptos, and
> > below is an untested patch for fchmod and fchown.
> 
> Can you verify that this is enough to get full O_SEARCH semantics from
> the kernel?  I can submit this one ASAP, and then we can try to help to
> make the new execveat suitable for O_EXEC.

I've got a lot of things I'm working on at the moment, but I'll try to
give it a test maybe early next week. Is that soon enough?

Rich
Rich Felker Oct. 23, 2014, 4:38 p.m. UTC | #3
On Thu, Oct 23, 2014 at 12:37:23PM -0400, Rich Felker wrote:
> On Thu, Oct 23, 2014 at 10:00:34AM +0200, Christoph Hellwig wrote:
> > On Sun, Oct 05, 2014 at 06:23:17PM +0200, Christoph Hellwig wrote:
> > > On Sun, Oct 05, 2014 at 12:13:58PM -0400, Rich Felker wrote:
> > > > Yes, the lack of support for fchown, fchmod, fstat, fstatfs, fchdir,
> > > 
> > > fstat, fstatfs and fchdir are already support on O_PATH descriptos, and
> > > below is an untested patch for fchmod and fchown.
> > 
> > Can you verify that this is enough to get full O_SEARCH semantics from
> > the kernel?  I can submit this one ASAP, and then we can try to help to
> > make the new execveat suitable for O_EXEC.
> 
> I've got a lot of things I'm working on at the moment, but I'll try to
> give it a test maybe early next week. Is that soon enough?

Hmm, looking again it looks like it's not so much a matter of testing
the patch as verifying that there are no other missing cases. Is that
right? Let me know if I'm misunderstanding what you want.

Rich
Christoph Hellwig Oct. 23, 2014, 4:58 p.m. UTC | #4
On Thu, Oct 23, 2014 at 12:38:33PM -0400, Rich Felker wrote:
> > I've got a lot of things I'm working on at the moment, but I'll try to
> > give it a test maybe early next week. Is that soon enough?
> 
> Hmm, looking again it looks like it's not so much a matter of testing
> the patch as verifying that there are no other missing cases. Is that
> right? Let me know if I'm misunderstanding what you want.

I'm pretty sure that patch works for those two syscalls, but independent
verification is always welcome.  The more important bit would be a list
of remaining workaround you have to implement O_SEARCH (I think that should be
it) and O_EXEC.  For O_EXEC I suspect right now you don't have any other
workaround either given the /proc based fexecve implementation, but just
at the same time we're now getting a syscall for that one, so we'll have
to take care of that.  For O_EXEC with a syscall-based fexecve we'll
probably need the O_PATH|3 defintion and some hacky looking code in the
kernel I fear, so it would be great if you could bring that up in the
current discussion of the execveat system call.
diff mbox

Patch

diff --git a/fs/open.c b/fs/open.c
index d6fd3ac..ee24720 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -512,7 +512,7 @@  out_unlock:
 
 SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
 {
-	struct fd f = fdget(fd);
+	struct fd f = fdget_raw(fd);
 	int err = -EBADF;
 
 	if (f.file) {
@@ -633,7 +633,7 @@  SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group
 
 SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
 {
-	struct fd f = fdget(fd);
+	struct fd f = fdget_raw(fd);
 	int error = -EBADF;
 
 	if (!f.file)