Browse Source

Use accessors for tcp->s_ent, return a stub struct if it is NULL

Since code paths are non-trivial, it's an attempt to future-proof
and prevent improper access of tcp->s_ent fields.

* defs.h (struct tcb): Update the description of s_ent field.
(stub_sysent): New declaration.
(tcp_sysent, n_args): New macro functions.
(indirect_ipccall): Use tcp_sysent() instead of tcp->s_ent.
* ipc.c (SYS_FUNC(ipc)): Use n_args() instead of tcp->s_ent->nargs.
* linux/alpha/get_syscall_args.c (get_syscall_args): Likewise.
* linux/bfin/get_syscall_args.c (get_syscall_args): Likewise.
* linux/hppa/get_syscall_args.c (get_syscall_args): Likewise.
* linux/ia64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/microblaze/get_syscall_args.c (get_syscall_args): Likewise.
* linux/mips/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh/get_syscall_args.c (get_syscall_args): Likewise.
* linux/sh64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
* linux/xtensa/get_syscall_args.c (get_syscall_args): Likewise.
* prctl.c (print_prctl_args): Likewise.
* signal.c (SYS_FUNC(sgetmask)): Likewise.
* util.c (printargs, printargs_u, printargs_d): Likewise.
* syscall.c (decode_ipc_subcall, decode_syscall_subcall: Likewise.
(dumpio, tamper_with_syscall_exiting, syscall_entering_decode,
syscall_entering_decode, syscall_entering_trace, syscall_entering_trace,
syscall_exiting_decode, print_syscall_resume, syscall_exiting_trace,
get_syscall_result): Use tcp_sysent() instead of tcp->s_ent.
(stub_sysent): New stub sysent.
(get_scno): Reset scno, s_ent, qual_flg; initialise s->ent from
stub_sysent.
* pathtrace.c (pathtrace_match_set): Use tcp_sysent() instead of
tcp->s_ent.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
Eugene Syromyatnikov 10 months ago
parent
commit
541efab92b

+ 8
- 2
defs.h View File

@@ -206,7 +206,9 @@ struct tcb {
206 206
 	const char *auxstr;	/* Auxiliary info from syscall (see RVAL_STR) */
207 207
 	void *_priv_data;	/* Private data for syscall decoding functions */
208 208
 	void (*_free_priv_data)(void *); /* Callback for freeing priv_data */
209
-	const struct_sysent *s_ent; /* sysent[scno] or dummy struct for bad scno */
209
+	const struct_sysent *s_ent; /* sysent[scno] or a stub struct for bad
210
+				     * scno.  Use tcp_sysent() macro for access.
211
+				     */
210 212
 	const struct_sysent *s_prev_ent; /* for "resuming interrupted SYSCALL" msg */
211 213
 	struct inject_opts *inject_vec[SUPPORTED_PERSONALITIES];
212 214
 	struct timespec stime;	/* System time usage as of last process wait */
@@ -285,6 +287,10 @@ struct tcb {
285 287
 # define syscall_delayed(tcp)	((tcp)->flags & TCB_DELAYED)
286 288
 # define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL)
287 289
 
290
+extern const struct_sysent stub_sysent;
291
+# define tcp_sysent(tcp) (tcp->s_ent ?: &stub_sysent)
292
+# define n_args(tcp) (tcp_sysent(tcp)->nargs)
293
+
288 294
 # include "xlat.h"
289 295
 
290 296
 extern const struct xlat addrfams[];
@@ -355,7 +361,7 @@ extern const struct xlat whence_codes[];
355 361
 # define IOCTL_NUMBER_HANDLED 1
356 362
 # define IOCTL_NUMBER_STOP_LOOKUP 010
357 363
 
358
-# define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL)
364
+# define indirect_ipccall(tcp) (tcp_sysent(tcp)->sys_flags & TRACE_INDIRECT_SUBCALL)
359 365
 
360 366
 enum sock_proto {
361 367
 	SOCK_PROTO_UNKNOWN,

+ 1
- 1
ipc.c View File

@@ -21,7 +21,7 @@ SYS_FUNC(ipc)
21 21
 	printxval_u(ipccalls, call, NULL);
22 22
 
23 23
 	unsigned int i;
24
-	for (i = 1; i < tcp->s_ent->nargs; ++i)
24
+	for (i = 1; i < n_args(tcp); ++i)
25 25
 		tprintf(", %#" PRI_klx, tcp->u_arg[i]);
26 26
 
27 27
 	return RVAL_DECODED;

+ 1
- 1
linux/alpha/get_syscall_args.c View File

@@ -11,7 +11,7 @@ arch_get_syscall_args(struct tcb *tcp)
11 11
 {
12 12
 	unsigned int i;
13 13
 
14
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
14
+	for (i = 0; i < n_args(tcp); ++i)
15 15
 		if (upeek(tcp, REG_A0+i, &tcp->u_arg[i]) < 0)
16 16
 			return -1;
17 17
 	return 1;

+ 1
- 1
linux/bfin/get_syscall_args.c View File

@@ -14,7 +14,7 @@ arch_get_syscall_args(struct tcb *tcp)
14 14
 	};
15 15
 	unsigned int i;
16 16
 
17
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
17
+	for (i = 0; i < n_args(tcp); ++i)
18 18
 		if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0)
19 19
 			return -1;
20 20
 	return 1;

+ 1
- 1
linux/hppa/get_syscall_args.c View File

@@ -11,7 +11,7 @@ arch_get_syscall_args(struct tcb *tcp)
11 11
 {
12 12
 	unsigned int i;
13 13
 
14
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
14
+	for (i = 0; i < n_args(tcp); ++i)
15 15
 		if (upeek(tcp, PT_GR26-4*i, &tcp->u_arg[i]) < 0)
16 16
 			return -1;
17 17
 	return 1;

+ 1
- 1
linux/ia64/get_syscall_args.c View File

@@ -18,7 +18,7 @@ arch_get_syscall_args(struct tcb *tcp)
18 18
 	unsigned long *out0 = ia64_rse_skip_regs(rbs_end, -sof + sol);
19 19
 	unsigned int i;
20 20
 
21
-	for (i = 0; i < tcp->s_ent->nargs; ++i) {
21
+	for (i = 0; i < n_args(tcp); ++i) {
22 22
 		if (umove(tcp,
23 23
 			  (unsigned long) ia64_rse_skip_regs(out0, i),
24 24
 			  &tcp->u_arg[i]) < 0) {

+ 1
- 1
linux/microblaze/get_syscall_args.c View File

@@ -11,7 +11,7 @@ arch_get_syscall_args(struct tcb *tcp)
11 11
 {
12 12
 	unsigned int i;
13 13
 
14
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
14
+	for (i = 0; i < n_args(tcp); ++i)
15 15
 		if (upeek(tcp, (5 + i) * 4, &tcp->u_arg[i]) < 0)
16 16
 			return -1;
17 17
 	return 1;

+ 4
- 4
linux/mips/get_syscall_args.c View File

@@ -21,16 +21,16 @@ arch_get_syscall_args(struct tcb *tcp)
21 21
 	tcp->u_arg[1] = mips_REG_A1;
22 22
 	tcp->u_arg[2] = mips_REG_A2;
23 23
 	tcp->u_arg[3] = mips_REG_A3;
24
-	if (tcp->s_ent->nargs > 4
24
+	if (n_args(tcp) > 4
25 25
 	    && umoven(tcp, mips_REG_SP + 4 * sizeof(tcp->u_arg[0]),
26
-		      (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
26
+		      (n_args(tcp) - 4) * sizeof(tcp->u_arg[0]),
27 27
 		      &tcp->u_arg[4]) < 0) {
28 28
 		/*
29 29
 		 * Let's proceed with the first 4 arguments
30 30
 		 * instead of reporting the failure.
31 31
 		 */
32 32
 		memset(&tcp->u_arg[4], 0,
33
-		       (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]));
33
+		       (n_args(tcp) - 4) * sizeof(tcp->u_arg[0]));
34 34
 	}
35 35
 #else
36 36
 # error unsupported mips abi
@@ -54,7 +54,7 @@ decode_syscall_subcall(struct tcb *tcp)
54 54
 	 * and sync_file_range) requires additional code,
55 55
 	 * see linux/mips/get_syscall_args.c
56 56
 	 */
57
-	if (tcp->s_ent->nargs == MAX_ARGS) {
57
+	if (n_args(tcp) == MAX_ARGS) {
58 58
 		if (umoven(tcp,
59 59
 			   mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]),
60 60
 			   sizeof(tcp->u_arg[0]),

+ 1
- 1
linux/sh/get_syscall_args.c View File

@@ -19,7 +19,7 @@ arch_get_syscall_args(struct tcb *tcp)
19 19
 	};
20 20
 	unsigned int i;
21 21
 
22
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
22
+	for (i = 0; i < n_args(tcp); ++i)
23 23
 		if (upeek(tcp, syscall_regs[i], &tcp->u_arg[i]) < 0)
24 24
 			return -1;
25 25
 	return 1;

+ 1
- 1
linux/sh64/get_syscall_args.c View File

@@ -13,7 +13,7 @@ arch_get_syscall_args(struct tcb *tcp)
13 13
 	static const int syscall_regs[MAX_ARGS] = { 2, 3, 4, 5, 6, 7 };
14 14
 	unsigned int i;
15 15
 
16
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
16
+	for (i = 0; i < n_args(tcp); ++i)
17 17
 		if (upeek(tcp, REG_GENERAL(syscall_regs[i]),
18 18
 			  &tcp->u_arg[i]) < 0)
19 19
 			return -1;

+ 1
- 1
linux/x86_64/get_syscall_args.c View File

@@ -11,7 +11,7 @@ arch_get_syscall_args(struct tcb *tcp)
11 11
 {
12 12
 	if (x86_io.iov_len != sizeof(i386_regs)) {
13 13
 		/* x86-64 or x32 ABI */
14
-		if (tcp->s_ent->sys_flags & COMPAT_SYSCALL_TYPES) {
14
+		if (tcp_sysent(tcp)->sys_flags & COMPAT_SYSCALL_TYPES) {
15 15
 			/*
16 16
 			 * X32 compat syscall: zero-extend from 32 bits.
17 17
 			 * Use truncate_klong_to_current_wordsize(tcp->u_arg[N])

+ 1
- 1
linux/xtensa/get_syscall_args.c View File

@@ -20,7 +20,7 @@ arch_get_syscall_args(struct tcb *tcp)
20 20
 	};
21 21
 	unsigned int i;
22 22
 
23
-	for (i = 0; i < tcp->s_ent->nargs; ++i)
23
+	for (i = 0; i < n_args(tcp); ++i)
24 24
 		if (upeek(tcp, xtensaregs[i], &tcp->u_arg[i]) < 0)
25 25
 			return -1;
26 26
 	return 1;

+ 1
- 1
pathtrace.c View File

@@ -167,7 +167,7 @@ pathtrace_match_set(struct tcb *tcp, struct path_set *set)
167 167
 {
168 168
 	const struct_sysent *s;
169 169
 
170
-	s = tcp->s_ent;
170
+	s = tcp_sysent(tcp);
171 171
 
172 172
 	if (!(s->sys_flags & (TRACE_FILE | TRACE_DESC | TRACE_NETWORK)))
173 173
 		return false;

+ 1
- 1
prctl.c View File

@@ -61,7 +61,7 @@ print_prctl_args(struct tcb *tcp, const unsigned int first)
61 61
 {
62 62
 	unsigned int i;
63 63
 
64
-	for (i = first; i < tcp->s_ent->nargs; ++i)
64
+	for (i = first; i < n_args(tcp); ++i)
65 65
 		tprintf(", %#" PRI_klx, tcp->u_arg[i]);
66 66
 }
67 67
 

+ 2
- 2
signal.c View File

@@ -405,10 +405,10 @@ SYS_FUNC(sgetmask)
405 405
 SYS_FUNC(sigsuspend)
406 406
 {
407 407
 #ifdef MIPS
408
-	print_sigset_addr_len(tcp, tcp->u_arg[tcp->s_ent->nargs - 1],
408
+	print_sigset_addr_len(tcp, tcp->u_arg[n_args(tcp) - 1],
409 409
 			      current_wordsize);
410 410
 #else
411
-	tprint_old_sigmask_val("", tcp->u_arg[tcp->s_ent->nargs - 1]);
411
+	tprint_old_sigmask_val("", tcp->u_arg[n_args(tcp) - 1]);
412 412
 #endif
413 413
 
414 414
 	return RVAL_DECODED;

+ 29
- 22
syscall.c View File

@@ -341,7 +341,7 @@ decode_ipc_subcall(struct tcb *tcp)
341 341
 	tcp->qual_flg = qual_flags(tcp->scno);
342 342
 	tcp->s_ent = &sysent[tcp->scno];
343 343
 
344
-	const unsigned int n = tcp->s_ent->nargs;
344
+	const unsigned int n = n_args(tcp);
345 345
 	unsigned int i;
346 346
 	for (i = 0; i < n; i++)
347 347
 		tcp->u_arg[i] = tcp->u_arg[i + 1];
@@ -361,7 +361,7 @@ dumpio(struct tcb *tcp)
361 361
 		return;
362 362
 
363 363
 	if (is_number_in_set(fd, write_set)) {
364
-		switch (tcp->s_ent->sen) {
364
+		switch (tcp_sysent(tcp)->sen) {
365 365
 		case SEN_write:
366 366
 		case SEN_pwrite:
367 367
 		case SEN_send:
@@ -388,7 +388,7 @@ dumpio(struct tcb *tcp)
388 388
 		return;
389 389
 
390 390
 	if (is_number_in_set(fd, read_set)) {
391
-		switch (tcp->s_ent->sen) {
391
+		switch (tcp_sysent(tcp)->sen) {
392 392
 		case SEN_read:
393 393
 		case SEN_pread:
394 394
 		case SEN_recv:
@@ -548,10 +548,9 @@ syscall_entering_decode(struct tcb *tcp)
548 548
 	int res = get_scno(tcp);
549 549
 	if (res == 0)
550 550
 		return res;
551
-	int scno_good = res;
552 551
 	if (res != 1 || (res = get_syscall_args(tcp)) != 1) {
553 552
 		printleader(tcp);
554
-		tprintf("%s(", scno_good == 1 ? tcp->s_ent->sys_name : "????");
553
+		tprintf("%s(", tcp_sysent(tcp)->sys_name);
555 554
 		/*
556 555
 		 * " <unavailable>" will be added later by the code which
557 556
 		 * detects ptrace errors.
@@ -563,7 +562,7 @@ syscall_entering_decode(struct tcb *tcp)
563 562
  || defined SYS_socket_subcall	\
564 563
  || defined SYS_syscall_subcall
565 564
 	for (;;) {
566
-		switch (tcp->s_ent->sen) {
565
+		switch (tcp_sysent(tcp)->sen) {
567 566
 # ifdef SYS_ipc_subcall
568 567
 		case SEN_ipc:
569 568
 			decode_ipc_subcall(tcp);
@@ -577,7 +576,7 @@ syscall_entering_decode(struct tcb *tcp)
577 576
 # ifdef SYS_syscall_subcall
578 577
 		case SEN_syscall:
579 578
 			decode_syscall_subcall(tcp);
580
-			if (tcp->s_ent->sen != SEN_syscall)
579
+			if (tcp_sysent(tcp)->sen != SEN_syscall)
581 580
 				continue;
582 581
 			break;
583 582
 # endif
@@ -599,7 +598,7 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
599 598
 		 */
600 599
 		tcp->qual_flg &= ~QUAL_INJECT;
601 600
 
602
-		switch (tcp->s_ent->sen) {
601
+		switch (tcp_sysent(tcp)->sen) {
603 602
 			case SEN_execve:
604 603
 			case SEN_execveat:
605 604
 			case SEN_execv:
@@ -631,14 +630,14 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
631 630
 
632 631
 #ifdef ENABLE_STACKTRACE
633 632
 	if (stack_trace_enabled) {
634
-		if (tcp->s_ent->sys_flags & STACKTRACE_CAPTURE_ON_ENTER)
633
+		if (tcp_sysent(tcp)->sys_flags & STACKTRACE_CAPTURE_ON_ENTER)
635 634
 			unwind_tcb_capture(tcp);
636 635
 	}
637 636
 #endif
638 637
 
639 638
 	printleader(tcp);
640
-	tprintf("%s(", tcp->s_ent->sys_name);
641
-	int res = raw(tcp) ? printargs(tcp) : tcp->s_ent->sys_func(tcp);
639
+	tprintf("%s(", tcp_sysent(tcp)->sys_name);
640
+	int res = raw(tcp) ? printargs(tcp) : tcp_sysent(tcp)->sys_func(tcp);
642 641
 	fflush(tcp->outf);
643 642
 	return res;
644 643
 }
@@ -668,7 +667,7 @@ syscall_exiting_decode(struct tcb *tcp, struct timespec *pts)
668 667
 	if ((Tflag || cflag) && !filtered(tcp))
669 668
 		clock_gettime(CLOCK_MONOTONIC, pts);
670 669
 
671
-	if (tcp->s_ent->sys_flags & MEMORY_MAPPING_CHANGE)
670
+	if (tcp_sysent(tcp)->sys_flags & MEMORY_MAPPING_CHANGE)
672 671
 		mmap_notify_report(tcp);
673 672
 
674 673
 	if (filtered(tcp))
@@ -702,7 +701,7 @@ print_syscall_resume(struct tcb *tcp)
702 701
 	    || (tcp->flags & TCB_REPRINT)) {
703 702
 		tcp->flags &= ~TCB_REPRINT;
704 703
 		printleader(tcp);
705
-		tprintf("<... %s resumed>", tcp->s_ent->sys_name);
704
+		tprintf("<... %s resumed>", tcp_sysent(tcp)->sys_name);
706 705
 	}
707 706
 }
708 707
 
@@ -750,7 +749,7 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
750 749
 		if (tcp->sys_func_rval & RVAL_DECODED)
751 750
 			sys_res = tcp->sys_func_rval;
752 751
 		else
753
-			sys_res = tcp->s_ent->sys_func(tcp);
752
+			sys_res = tcp_sysent(tcp)->sys_func(tcp);
754 753
 	}
755 754
 
756 755
 	tprints(") ");
@@ -1237,6 +1236,13 @@ get_syscall_regs(struct tcb *tcp)
1237 1236
 	return get_regs(tcp);
1238 1237
 }
1239 1238
 
1239
+const struct_sysent stub_sysent = {
1240
+	.nargs = MAX_ARGS,
1241
+	.sen = SEN_printargs,
1242
+	.sys_func = printargs,
1243
+	.sys_name = "????",
1244
+};
1245
+
1240 1246
 /*
1241 1247
  * Returns:
1242 1248
  * 0: "ignore this ptrace stop", syscall_entering_decode() should return a "bail
@@ -1248,6 +1254,10 @@ get_syscall_regs(struct tcb *tcp)
1248 1254
 int
1249 1255
 get_scno(struct tcb *tcp)
1250 1256
 {
1257
+	tcp->scno = -1;
1258
+	tcp->s_ent = NULL;
1259
+	tcp->qual_flg = QUAL_RAW | DEFAULT_QUAL_FLAGS;
1260
+
1251 1261
 	if (get_syscall_regs(tcp) < 0)
1252 1262
 		return -1;
1253 1263
 
@@ -1275,14 +1285,11 @@ get_scno(struct tcb *tcp)
1275 1285
 		struct sysent_buf *s = xcalloc(1, sizeof(*s));
1276 1286
 
1277 1287
 		s->tcp = tcp;
1278
-		s->ent.nargs = MAX_ARGS;
1279
-		s->ent.sen = SEN_printargs;
1280
-		s->ent.sys_func = printargs;
1288
+		s->ent = stub_sysent;
1281 1289
 		s->ent.sys_name = s->buf;
1282 1290
 		xsprintf(s->buf, "syscall_%#" PRI_klx, shuffle_scno(tcp->scno));
1283 1291
 
1284 1292
 		tcp->s_ent = &s->ent;
1285
-		tcp->qual_flg = QUAL_RAW | DEFAULT_QUAL_FLAGS;
1286 1293
 
1287 1294
 		set_tcb_priv_data(tcp, s, free_sysent_buf);
1288 1295
 
@@ -1308,7 +1315,7 @@ get_syscall_args(struct tcb *tcp)
1308 1315
 		for (unsigned int i = 0; i < ARRAY_SIZE(tcp->u_arg); ++i)
1309 1316
 			tcp->u_arg[i] = ptrace_sci.entry.args[i];
1310 1317
 #if SUPPORTED_PERSONALITIES > 1
1311
-		if (tcp->s_ent->sys_flags & COMPAT_SYSCALL_TYPES) {
1318
+		if (tcp_sysent(tcp)->sys_flags & COMPAT_SYSCALL_TYPES) {
1312 1319
 			for (unsigned int i = 0; i < ARRAY_SIZE(tcp->u_arg); ++i)
1313 1320
 				tcp->u_arg[i] = (uint32_t) tcp->u_arg[i];
1314 1321
 		}
@@ -1335,7 +1342,7 @@ get_syscall_result(struct tcb *tcp)
1335 1342
 	if (get_syscall_result_regs(tcp) < 0)
1336 1343
 		return -1;
1337 1344
 	get_error(tcp,
1338
-		  (!(tcp->s_ent->sys_flags & SYSCALL_NEVER_FAILS)
1345
+		  (!(tcp_sysent(tcp)->sys_flags & SYSCALL_NEVER_FAILS)
1339 1346
 			|| syscall_tampered(tcp))
1340 1347
                   && !syscall_tampered_nofail(tcp));
1341 1348
 
@@ -1381,7 +1388,7 @@ set_error(struct tcb *tcp, unsigned long new_error)
1381 1388
 		if (ptrace_syscall_info_is_valid())
1382 1389
 			tcp->u_rval = -1;
1383 1390
 		else
1384
-			get_error(tcp, !(tcp->s_ent->sys_flags &
1391
+			get_error(tcp, !(tcp_sysent(tcp)->sys_flags &
1385 1392
 					 SYSCALL_NEVER_FAILS));
1386 1393
 	}
1387 1394
 }
@@ -1405,7 +1412,7 @@ set_success(struct tcb *tcp, kernel_long_t new_rval)
1405 1412
 		if (ptrace_syscall_info_is_valid())
1406 1413
 			tcp->u_error = 0;
1407 1414
 		else
1408
-			get_error(tcp, !(tcp->s_ent->sys_flags &
1415
+			get_error(tcp, !(tcp_sysent(tcp)->sys_flags &
1409 1416
 					 SYSCALL_NEVER_FAILS));
1410 1417
 	}
1411 1418
 }

+ 3
- 3
util.c View File

@@ -1161,7 +1161,7 @@ print_array_ex(struct tcb *const tcp,
1161 1161
 int
1162 1162
 printargs(struct tcb *tcp)
1163 1163
 {
1164
-	const int n = tcp->s_ent->nargs;
1164
+	const int n = n_args(tcp);
1165 1165
 	int i;
1166 1166
 	for (i = 0; i < n; ++i)
1167 1167
 		tprintf("%s%#" PRI_klx, i ? ", " : "", tcp->u_arg[i]);
@@ -1171,7 +1171,7 @@ printargs(struct tcb *tcp)
1171 1171
 int
1172 1172
 printargs_u(struct tcb *tcp)
1173 1173
 {
1174
-	const int n = tcp->s_ent->nargs;
1174
+	const int n = n_args(tcp);
1175 1175
 	int i;
1176 1176
 	for (i = 0; i < n; ++i)
1177 1177
 		tprintf("%s%u", i ? ", " : "",
@@ -1182,7 +1182,7 @@ printargs_u(struct tcb *tcp)
1182 1182
 int
1183 1183
 printargs_d(struct tcb *tcp)
1184 1184
 {
1185
-	const int n = tcp->s_ent->nargs;
1185
+	const int n = n_args(tcp);
1186 1186
 	int i;
1187 1187
 	for (i = 0; i < n; ++i)
1188 1188
 		tprintf("%s%d", i ? ", " : "",

Loading…
Cancel
Save