[PATCH 4/6] ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op

Dmitry V. Levin ldv at strace.io
Thu Jan 9 11:14:34 UTC 2025


On Thu, Jan 09, 2025 at 11:41:47AM +0100, Oleg Nesterov wrote:
> On 01/08, Dmitry V. Levin wrote:
> >
> > +ptrace_get_syscall_info_op(struct task_struct *child)
> >  {
> ...
> >  	case SIGTRAP | 0x80:
> >  		switch (child->ptrace_message) {
> >  		case PTRACE_EVENTMSG_SYSCALL_ENTRY:
> > -			actual_size = ptrace_get_syscall_info_entry(child, regs,
> > -								    &info);
> > -			break;
> > +			return PTRACE_SYSCALL_INFO_ENTRY;
> >  		case PTRACE_EVENTMSG_SYSCALL_EXIT:
> > -			actual_size = ptrace_get_syscall_info_exit(child, regs,
> > -								   &info);
> > -			break;
> > +			return PTRACE_SYSCALL_INFO_EXIT;
> >  		}
> >  		break;
> >  	case SIGTRAP | (PTRACE_EVENT_SECCOMP << 8):
> > -		actual_size = ptrace_get_syscall_info_seccomp(child, regs,
> > -							      &info);
> > +		return PTRACE_SYSCALL_INFO_SECCOMP;
> > +	}
> > +
> > +	return PTRACE_SYSCALL_INFO_NONE;
> 
> Cosmetic, I won't insist, but I'd suggest to do
> 
> 	default:
> 		return PTRACE_SYSCALL_INFO_SECCOMP;
> 	}
> 
> to make it more symmetric.

OK, but I suppose you mean PTRACE_SYSCALL_INFO_NONE here, though.


-- 
ldv


More information about the Strace-devel mailing list