[CRIU] [PATCH] cr-check: Inspect errno on syscall failures

Filipe Brandenburger filbranden at google.com
Mon Mar 14 10:47:06 PDT 2016


Hi Pavel, Laurent,

On Mon, Mar 14, 2016 at 10:43 AM, Filipe Brandenburger
<filbranden at google.com> wrote:
> After replacing sys_kcmp with syscall() and sys_prctl with prctl(), the
> API is changed to return -1 and set errno on failure (instead of
> returning the negative value of the error code directly on return.)
>
> Commit 8ceab588a5ce91 ("crtools: no more linked with builtin syscall")
> replaced calls to sys_kcmp and sys_prctl, but did not update the checks
> for ret to check for -1 and errno, so update them here.

I hope this patch catches all the problems with ret = -EXXX vs.
setting errno, I looked at commit 8ceab588a5ce91 and also some places
where errno is being set (errno = -ret or errno = -fd) and I think
they're all covered now.

There is still:
- criu/pie/util.c which uses #define __sys(foo) foo but still assumes
a sys_foo interface
- criu/include/lock.h which defines sys_futex to return -EXXX when
errno is set (maybe the opposite approach of leaving errno set would
be better since it works with pr_perror and %m?)

If you can take a look at those and fix them if necessary, that would
be great...

Cheers!
Filipe


More information about the CRIU mailing list