|From:||"Noah yan" <noah.yan@xxxxxxxxx>|
|Date:||Thu, 26 Jul 2007 09:45:36 -0500|
i didnot see anything wrong with the mmap calls, i_womp = mmap(NULL, i_size, PROT_READ, MAP_PRIVATE, ifd, 0);
I attached a binary patch built without -O and with -g. Remeber i have a messed up kernel/modules and the world (typically libc) and the new binaries built before the error behave very wired, e.g. cp arg.c argdfd.c errs out with "file name too long". In my another box that has clean installation and latest sources, things go without any problem.
Noah yan wrote: > mmap failed: Invalid argument > Patching file /usr/src/bin/csh/../../contrib/tcsh/sh.exp.c using Plan B. .. > Segmentation fault (core dumped)
could you debug this core file? Seems that there are two problems:
1. mmap fails. root of the problem. what could be the invalid argument:
[EINVAL] MAP_FIXED was specified and the addr parameter was not page aligned, or part of the desired address space resides out of the valid address space for a user process.
I doubt it is using MAP_FIXED, so no.
[EINVAL] Len was negative.
[EINVAL] MAP_ANON was specified and the fd parameter was not -1.
I think it is mapping the source file, so MAP_ANON is probably not used.
[EINVAL] MAP_ANON has not been specified and fd did not refer- ence a regular or character special file.
[EINVAL] Offset was not page-aligned. (See BUGS below.)
Possible, but why wouldn't it map all the file?
2. Something does not check the return value of mmap or whatever and hence segfaults.
is this reproducable? is the filesystem correct? in which phase does this happen (I guess at the build tools phase)? could you create a patch binary without -O and with debug symbols?
-- Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\ Work - Mac +++ space for low €€€ NOW!1 +++ Campaign \ / Party Enjoy Relax | http://dragonflybsd.org Against HTML \ Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
Description: Binary data