This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [resend] Re: handling overflow in sbrk.

On Thu, May 29, 2008 at 1:47 PM, Chris Demetriou <> wrote:
> IMO yes, the kernel _should_ return an error on bad sys_brk, but given
> that it does not (maybe never has) and AFAICT the interface to sys_brk
> is different than brk and is not actually firmly documented... I'm a
> bit concerned about trying to make that change.

This is the real bug.

> re: slow path: well, you're just about to do a syscall which changes
> your page tables... *and* it's a correctness issue.  Yes probably
> better to be handled in the kernel with a normal error return ... but
> it's not.

Think about a kernel fix:
1. No added instructions in the userspace fast path.
2. Possibly fixes other C libraries (uclibc?)
3. Overflow check exists in one location handled properly for S_G_U
and S_G_D cases.

In the end I think we need to fix the kernel instead of glibc.

I see that LTP has an sbrk test, but I don't know if it's any good.
You may wish to contribute your testcase to LTP or to the Open POSIX
test suite.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]