Re: Compat 32-bit syscall entry from 64-bit task!?

From: Oleg Nesterov
Date: Wed Jan 25 2012 - 14:44:46 EST


On 01/18, Linus Torvalds wrote:
>
> Using the high bits of 'eflags' might work.

I thought about changing eflags too, this looks very natural to me.

But I do not understand the result of this discussion, are you going
to apply this change?

If not...

Not sure this is really better, but there is another idea. Currently we
have PTRACE_O_TRACESYSGOOD to avoid the confusion with the real SIGTRAP.
Perhaps we can add PTRACE_O_TRACESYS_VERY_GOOD (or we can look at
PT_SEIZED instead) and report TS_COMPAT via ptrace_report_syscall ?

IOW. Currently ptrace_report_syscall() does

ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));

We can add the new events,

PTRACE_EVENT_SYSCALL_ENTRY
PTRACE_EVENT_SYSCALL_COMPAT_ENTRY
PTRACE_EVENT_SYSCALL_EXIT
PTRACE_EVENT_SYSCALL_COMPAT_EXIT

and change ptrace_report_syscall() to do

if (PT_SEIZED) /* or PT_TRACESYS_VERY_GOOD? */ {
int event = entry ? PTRACE_EVENT_SYSCALL_ENTRY : EXIT;
if (is_compat_task(current))
event++;
ptrace_notify((event << 8) | SIGTRAP);
} else {
ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
}

This also allows to distinguish entry/exit.


However. The change in get_flags() also allows to know the state of
TIF_IA32 bit bit outside of syscall entry/exit reports, perhaps there
is a reason why do we want this?

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/