Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612149

Re: syscall_get_error() && TS_ checks

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: syscall_get_error() && TS_ checks
Date 2017-03-29 18:50 +0200
Message-ID <tqoXf-188-15@gated-at.bofh.it> (permalink)
References <tq0UV-12M-15@gated-at.bofh.it> <tqoNA-14j-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/1] get_nr_restart_syscall() should return  __NR_ia32_restart_syscall if __USER32_CS Oleg Nesterov <oleg@redhat.com> - 2017-03-28 17:10 +0200
  syscall_get_error() && TS_ checks Oleg Nesterov <oleg@redhat.com> - 2017-03-29 18:40 +0200
    Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-29 18:50 +0200
      Re: syscall_get_error() && TS_ checks Oleg Nesterov <oleg@redhat.com> - 2017-03-29 19:00 +0200
        Re: syscall_get_error() && TS_ checks Oleg Nesterov <oleg@redhat.com> - 2017-03-29 19:10 +0200
          Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-29 19:20 +0200
            Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-29 21:00 +0200
              Re: syscall_get_error() && TS_ checks Oleg Nesterov <oleg@redhat.com> - 2017-03-30 16:00 +0200
                Re: syscall_get_error() && TS_ checks Oleg Nesterov <oleg@redhat.com> - 2017-03-30 18:00 +0200
                Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 19:50 +0200
                Re: syscall_get_error() && TS_ checks Andy Lutomirski <luto@amacapital.net> - 2017-03-30 20:30 +0200
                Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 20:40 +0200
                Re: syscall_get_error() && TS_ checks Andy Lutomirski <luto@amacapital.net> - 2017-03-30 21:00 +0200
                Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 21:20 +0200
                Re: syscall_get_error() && TS_ checks Andy Lutomirski <luto@amacapital.net> - 2017-03-30 21:30 +0200
                Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-30 21:30 +0200
            Re: syscall_get_error() && TS_ checks Oleg Nesterov <oleg@redhat.com> - 2017-03-29 21:00 +0200
        Re: syscall_get_error() && TS_ checks Linus Torvalds <torvalds@linux-foundation.org> - 2017-03-29 19:10 +0200
      Re: syscall_get_error() && TS_ checks Andy Lutomirski <luto@amacapital.net> - 2017-03-29 19:10 +0200

csiph-web