提交 9c6bf9c7 编写于 作者: E Ed Swierk 提交者: Riku Voipio

linux-user: Fix ioctl cmd type mismatch on 64-bit targets

linux-user passes the cmd argument of the ioctl syscall as a signed long,
but compares it to an unsigned int when iterating through the ioctl_entries
list.  When the cmd is a large value like 0x80047476 (TARGET_TIOCSWINSZ on
mips64) it gets sign-extended to 0xffffffff80047476, causing the comparison
to fail and resulting in lots of spurious "Unsupported ioctl" errors.
Changing the target_cmd field in the ioctl_entries list to a signed int
causes those values to be sign-extended as well during the comparison.
Signed-off-by: NEd Swierk <eswierk@skyportsystems.com>
Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
上级 95018018
......@@ -3278,7 +3278,7 @@ typedef abi_long do_ioctl_fn(const IOCTLEntry *ie, uint8_t *buf_temp,
int fd, abi_long cmd, abi_long arg);
struct IOCTLEntry {
unsigned int target_cmd;
int target_cmd;
unsigned int host_cmd;
const char *name;
int access;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册