Unabuse struct tcb.auxstr
As we've got a proper mechanism that parsers can use for storing private data between entering and exiting stages, all cases of struct tcb.auxstr abuse should go. * btrfs.c (btrfs_ioctl): Use set_tcb_priv_ulong and get_tcb_priv_ulong instead of abusing tcp->auxstr. * file_handle.c (SYS_FUNC(name_to_handle_at)): Likewise. * msghdr.c (SYS_FUNC(recvmsg)): Likewise. * net.c (decode_sockname, SYS_FUNC(recvfrom)): Likewise. * v4l2.c (print_v4l2_queryctrl): Likewise.
This commit is contained in:
parent
7f8ece11c8
commit
b759d276d5
8
btrfs.c
8
btrfs.c
@ -890,10 +890,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
|
||||
if (entering(tcp)) {
|
||||
/* Use subvolume id of the containing root */
|
||||
if (args.treeid == 0)
|
||||
/* abuse of auxstr to retain state */
|
||||
tcp->auxstr = (void *)1;
|
||||
else
|
||||
tcp->auxstr = NULL;
|
||||
set_tcb_priv_ulong(tcp, 1);
|
||||
|
||||
tprints("{treeid=");
|
||||
btrfs_print_objectid(args.treeid);
|
||||
@ -904,8 +901,7 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
|
||||
}
|
||||
|
||||
tprints("{");
|
||||
if (tcp->auxstr) {
|
||||
tcp->auxstr = NULL;
|
||||
if (get_tcb_priv_ulong(tcp)) {
|
||||
tprints("treeid=");
|
||||
btrfs_print_objectid(args.treeid);
|
||||
tprints(", ");
|
||||
|
@ -64,15 +64,11 @@ SYS_FUNC(name_to_handle_at)
|
||||
}
|
||||
tprintf("{handle_bytes=%u", h.handle_bytes);
|
||||
|
||||
/*
|
||||
* Abusing tcp->auxstr as a temporary storage.
|
||||
* Will be used and cleared on syscall exit.
|
||||
*/
|
||||
tcp->auxstr = (void *) (unsigned long) h.handle_bytes;
|
||||
set_tcb_priv_ulong(tcp, h.handle_bytes);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
unsigned int i = (unsigned long) tcp->auxstr;
|
||||
unsigned int i = get_tcb_priv_ulong(tcp);
|
||||
|
||||
if ((!syserror(tcp) || EOVERFLOW == tcp->u_error)
|
||||
&& !umove(tcp, addr, &h)) {
|
||||
@ -93,7 +89,6 @@ SYS_FUNC(name_to_handle_at)
|
||||
}
|
||||
}
|
||||
tprints("}, ");
|
||||
tcp->auxstr = NULL;
|
||||
|
||||
/* mount_id */
|
||||
printnum_int(tcp, tcp->u_arg[3], "%d");
|
||||
|
6
msghdr.c
6
msghdr.c
@ -421,14 +421,12 @@ SYS_FUNC(recvmsg)
|
||||
printfd(tcp, tcp->u_arg[0]);
|
||||
tprints(", ");
|
||||
if (fetch_msghdr_namelen(tcp, tcp->u_arg[1], &msg_namelen)) {
|
||||
/* abuse of auxstr to retain state */
|
||||
tcp->auxstr = (void *) (long) msg_namelen;
|
||||
set_tcb_priv_ulong(tcp, msg_namelen);
|
||||
return 0;
|
||||
}
|
||||
printaddr(tcp->u_arg[1]);
|
||||
} else {
|
||||
msg_namelen = (long) tcp->auxstr;
|
||||
tcp->auxstr = NULL;
|
||||
msg_namelen = get_tcb_priv_ulong(tcp);
|
||||
|
||||
if (syserror(tcp))
|
||||
tprintf("{msg_namelen=%d}", msg_namelen);
|
||||
|
12
net.c
12
net.c
@ -206,8 +206,7 @@ decode_sockname(struct tcb *tcp)
|
||||
printfd(tcp, tcp->u_arg[0]);
|
||||
tprints(", ");
|
||||
if (fetch_socklen(tcp, &ulen, tcp->u_arg[1], tcp->u_arg[2])) {
|
||||
/* abuse of auxstr to retain state */
|
||||
tcp->auxstr = (void *) (long) ulen;
|
||||
set_tcb_priv_ulong(tcp, ulen);
|
||||
return 0;
|
||||
} else {
|
||||
printaddr(tcp->u_arg[1]);
|
||||
@ -217,8 +216,7 @@ decode_sockname(struct tcb *tcp)
|
||||
}
|
||||
}
|
||||
|
||||
ulen = (long) tcp->auxstr;
|
||||
tcp->auxstr = NULL;
|
||||
ulen = get_tcb_priv_ulong(tcp);
|
||||
|
||||
if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &rlen) < 0) {
|
||||
printaddr(tcp->u_arg[1]);
|
||||
@ -308,8 +306,7 @@ SYS_FUNC(recvfrom)
|
||||
printfd(tcp, tcp->u_arg[0]);
|
||||
tprints(", ");
|
||||
if (fetch_socklen(tcp, &ulen, tcp->u_arg[4], tcp->u_arg[5])) {
|
||||
/* abuse of auxstr to retain state */
|
||||
tcp->auxstr = (void *) (long) ulen;
|
||||
set_tcb_priv_ulong(tcp, ulen);
|
||||
}
|
||||
} else {
|
||||
/* buf */
|
||||
@ -325,8 +322,7 @@ SYS_FUNC(recvfrom)
|
||||
printflags(msg_flags, tcp->u_arg[3], "MSG_???");
|
||||
tprints(", ");
|
||||
|
||||
ulen = (long) tcp->auxstr;
|
||||
tcp->auxstr = NULL;
|
||||
ulen = get_tcb_priv_ulong(tcp);
|
||||
|
||||
if (!fetch_socklen(tcp, &rlen, tcp->u_arg[4], tcp->u_arg[5])) {
|
||||
/* from address */
|
||||
|
9
v4l2.c
9
v4l2.c
@ -571,14 +571,15 @@ print_v4l2_queryctrl(struct tcb *tcp, const long arg)
|
||||
tprints("}");
|
||||
return 1;
|
||||
}
|
||||
if (tcp->auxstr)
|
||||
if (get_tcb_priv_ulong(tcp))
|
||||
tprints(" => ");
|
||||
}
|
||||
|
||||
if (entering(tcp) || tcp->auxstr) {
|
||||
if (entering(tcp) || get_tcb_priv_ulong(tcp)) {
|
||||
#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
|
||||
tcp->auxstr = (c.id & V4L2_CTRL_FLAG_NEXT_CTRL) ? "" : NULL;
|
||||
if (tcp->auxstr) {
|
||||
const unsigned long next = c.id & V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||
set_tcb_priv_ulong(tcp, next);
|
||||
if (next) {
|
||||
tprints("V4L2_CTRL_FLAG_NEXT_CTRL|");
|
||||
c.id &= ~V4L2_CTRL_FLAG_NEXT_CTRL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user