Re: [discuss] Re: unregister_ioctl32_conversion and modules. ioct l32 revisited.

From: Michael S. Tsirkin
Date: Wed Jan 05 2005 - 10:45:45 EST


Hello!
Quoting r. Arnd Bergmann (arnd@xxxxxxxx) "Re: [discuss] Re: unregister_ioctl32_conversion and modules. ioct l32 revisited.":
> On Sünndag 26 Dezember 2004 23:26, Chris Wedgwood wrote:
> > > It's an internal error code as Arnd pointed out.
> >
> > can we be sure this will never escape to userspace? i can think of
> > somewhere else we already do this (EFSCORRUPTED) and it does (somewhat
> > deliberately escape to userspace) and this causes confusion from time
> > to time when applications see 'errno == 990'
>
> It's safe for the compat ioctl case. If someone wants to use the
> same function for the compat and native handler, it would be a bug
> to return -ENOIOCTLCMD from that handler with the current code.
>
> To work around this, we could either convert -ENOIOCTLCMD to -EINVAL
> when returning from sys_ioctl(). Or we could WARN_ON(err ==
> -ENOIOCTLCMD)
> for the native path in order to make the intention clear.
>
> Arnd <><

You mean like this?

Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxxxxxx>
--- linux-2.6.10/fs/ioctl.c.ok 2005-01-05 21:13:46.165718632 +0200
+++ linux-2.6.10/fs/ioctl.c 2005-01-05 21:14:09.341195424 +0200
@@ -162,7 +162,7 @@ asmlinkage long sys_ioctl(unsigned int f
out:
fput_light(filp, fput_needed);
out2:
- return error;
+ return error==-ENOIOCTLCMD?-ENOTTY:error;
}

/*
--- linux-2.6.10/fs/compat.c.ok 2005-01-05 21:15:34.221291688 +0200
+++ linux-2.6.10/fs/compat.c 2005-01-05 21:16:04.922624376 +0200
@@ -476,7 +476,7 @@ asmlinkage long compat_sys_ioctl(unsigne
out:
fput_light(filp, fput_needed);
out2:
- return error;
+ return error==-ENOIOCTLCMD?-ENOTTY:error;
}

static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/