lkml.org 
[lkml]   [2017]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: syscall_get_error() && TS_ checks
On Wed, Mar 29, 2017 at 9:33 AM, Oleg Nesterov <oleg@redhat.com> wrote:
>
> Firstly, why do we need the IS_ERR_VALUE() check? This is only used by
> do_signal/handle_signal, we do not care if it returns non-zero as long
> as the value can't be confused with -ERESTART.* codes.

There are system calls that can return "negative" values that aren't errors.

Notably mmap() can return a valid pointer with the high bit set.

So syscall_get_error() should return 0 for not just positive return
values, but for those kinds of negative non-error values.

> And why do we need the TS_ checks?

Those may be bogus.

> So why we can't simply change putreg32() to always sign-extend regs->ax
> regs->orig_ax and just do
>
> static inline long syscall_get_error(struct task_struct *task,
> struct pt_regs *regs)
> {
> return regs-ax;
> }

That would be *complete* garbage. Lots of system calls return positive
values that sure as hell aren't errors.

Linus

\
 
 \ /
  Last update: 2017-03-29 18:45    [W:2.007 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site