The offset would have to be part of the kernel ABI... that is, different versions of the library would still have to use the same offsets if they want to work on the same kernel. It's possible that there was a version change in the kernel that changed the ABI, and if we at some point updated the fake kernel version we report to glibc without updating the offset then that could explain why things are breaking.
Steve On Wed, Jan 30, 2013 at 1:27 PM, Nilay <[email protected]> wrote: > On Wed, January 30, 2013 8:58 am, Michael Levenhagen wrote: > > > > On Jan 29, 2013, at 3:59 PM, Nilay wrote: > > > >> On Tue, January 29, 2013 12:50 pm, Michael Levenhagen wrote: > >>> A test program which calls gettimeofday() incorrectly ends up in the > >>> time > >>> system call. I disassembled the program and looked at the offset used > >>> for > >>> the virtual system call for both time() and gettimeofday(). > >>> > >>> gettimeofday() uses an offset of 0x0 > >>> > >>> 000000000040cf30 <__gettimeofday>: > >>> 40cf30: 48 83 ec 08 sub $0x8,%rsp > >>> 40cf34: 48 c7 c0 00 00 60 ff mov $0xffffffffff600000,%rax > >>> 40cf3b: ff d0 callq *%rax > >>> > >>> time() uses an offset of 0x400 > >>> > >>> 000000000042cd90 <time>: > >>> 42cd90: 48 83 ec 08 sub $0x8,%rsp > >>> 42cd94: 48 c7 c0 00 04 60 ff mov $0xffffffffff600400,%rax > >>> 42cd9b: ff d0 callq *%rax > >>> 42cd9d: 48 83 c4 08 add $0x8,%rsp > >>> > >>> > >>> > >> > >> This seems like a glibc/linux issue. Do you think some document might > >> exist that specifies what the offset should be? > > > > I compile executables to run in SE mode via: > > > > gcc -static hello.c -o hello > > > > How do I compile a binary that has vsyscall offsets that match what's in > > the repository? > > > > I guess I was not lucid enough. It seems to me that the C library in use > would decide what the offset should be. A different library (or just a > version change) may have a different offset. Do you think this offset is > same for everyone using the glibc? Can you provide some documentation or > piece of code from the glibc that talks about what the offset should be? > > -- > Nilay > > _______________________________________________ > gem5-dev mailing list > [email protected] > http://m5sim.org/mailman/listinfo/gem5-dev > _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
