Re: force_successful_syscall_return() buggy?

Paul Mackerras
2003-06-16T02:19:13Z

Russell King writes:

> #define force_successful_syscall_return() \
> do { \
> ia64_task_regs(current)->r8 = 0; \
> } while (0)
>
> I don't know what happens on these architectures, but I have a suspicion
> that there is a case which the above will fail, maybe with dramatic
> consequences.

On PPC, I am going to use a bit in the thread_info flags field to
indicate that the current syscall should not return an error. The
syscall entry and exit paths already look at the thread_info flags
(testing the syscall trace bit, among others) so it's convenient to
have the "no error" flag there too. The flag bit gets cleared on
syscall entry, set by force_successful_syscall_return() and tested on
syscall exit. The only restriction is that kernel code should not do
a system call between where it calls force_successful_syscall_return
and where it returns from the syscall. But I don't believe we ever do
recursive system calls anyway, so that should be fine.

Regards,
Paul.