Skip to contentSkip to conversation

Question about sys32_ioctl()

DISCUSSION Thierry Lafage 2 participants 2 messages Apr 2, 1999

lore
Share & tools
lore
#0 lore raw

Hello,

Nobody answered the question I posted yesterday, so I re-post it now in case it was taken as a 1st april joke ;-). But this was not, even if it sounds stupid from me to put my nose in the kernel sources...

The sys32_ioctl() code contains things I really do not understand, but since I applied the modification I propose below, I would like to know if it is a bad thing for the kernel stability and/or mechanisms. And if it is, I apologize for the mailing lists pollution (as I should do every time I post here).

Thierry Lafage.

------- Start of forwarded message -------

Hello,

I have made a personal char device driver. For the device, I would like to add new ioctl commands (I have read the file "Documentation/ioctl-number.txt" for that). But with sparc32 user programs, the new ioctl commands cannot be serviced by my char driver:

sys32_ioctl: Unknown cmd fd(3) cmd(2000ee00) arg(00000000)

When looking in the code "arch/sparc64/kernel/ioctl32.c", the sys32_ioctl() function never calls such added cmds:

asmlinkage int sys32_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) {
[...]

        switch (cmd) {
[...]
        default:
                do {
                        static int count = 0;
                        if (++count <= 20)
                                printk("sys32_ioctl: Unknown cmd fd(%d) "
                                       "cmd(%08x) arg(%08x)\n",
                                       (int)fd, (unsigned int)cmd, (unsigned int)arg);
                } while(0);
                error = -EINVAL;
                break;
        }
out:
        unlock_kernel();
        return error;
}

Would it be stupid to add something like what follows to the default case (inspired from "fs/ioctl.c: sys_ioctl(...)")?

if (filp->f_op && filp->f_op->ioctl && filp->f_dentry && filp->f_dentry->d_inode)

	       error = filp->f_op->ioctl(filp->f_dentry->d_inode, filp, cmd, arg);

Thierry Lafage.
- -
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of the message to [email protected] ------- End of forwarded message -------

#1 lore raw

Date: Fri, 2 Apr 1999 17:35:54 +0200
From: Thierry Lafage <[email protected]>

The sys32_ioctl() code contains things I really do not understand, but since I applied the modification I propose below, I would like to know if it is a bad thing for the kernel stability and/or mechanisms.

I might put this in, but I really don't think I will because the core problem is that this will let through ioctl's which need 32bit-->64bit translation on their arguments and we'll have a hard time finding them with the change in there which you propose.

Your driver may be OK, but other people's will surely not.

So just get your driver merged into the kernel, and then I'll know about your ioctl's and can add them explicitly to the sys32_ioctl() switch statement and this whole problem is solved.

Later,
David S. Miller
[email protected]