NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/52303: linux emulation: linux-brk-syscall return value is page-rounded up (?), on native linux the syscall returns the requested value



>Number:         52303
>Category:       kern
>Synopsis:       linux emulation: linux-brk-syscall return value is page-rounded up (?), on native linux the syscall returns the requested value
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 16 18:30:00 +0000 2017
>Originator:     u-bc8k
>Release:        7.1
>Organization:
Aetey
>Environment:
NetBSD XXXX 7.1 NetBSD 7.1 (GENERIC.201703111743Z) amd64
>Description:
Some Linux-specific code assumes the documented behaviour of the linux-brk-syscall: the return value to be the requested address on success, otherwise the possibly previously set current value on failure, without any page size rounding.

This works both under Linux and under the Linux ABI on FreeBSD but breaks under the Linux ABI on NetBSD.

The latter seems to round up the return value to the nearest page, which is not expected.
>How-To-Repeat:
The following brk() implementation for ia32 works under Linux and under the Linux ABI on FreeBSD but breaks under the Linux ABI on NetBSD:

int brk(char *addr) {
  int res;
  res = _syscall1(__NR_brk, (int)addr);
  if (res == (int)addr) return 0;
  errno = ENOMEM;
  return -1;
}

>Fix:



Home | Main Index | Thread Index | Old Index