2003-01-21 06:20:53

by Dave Airlie

[permalink] [raw]
Subject: elf loader and differing inode mappings..


Hi,
first off I'm running a stock 2.4.19 and have the RH8.0 glibc and
linker and toolchain..

I have modified my kernel to do some CRC'ing of text segments and it seems
to be working fine.. except when I load a program which hasn't been
stripped and I can't understand this..

I've locked all pages in memory by setting def_flags to VM_LOCKED in
fork.c, and I'm using the inode of the file (gotten from do_mmap_pgoff) to
give me the physical pages of where the file is actually mapped,
(i_mapping->clean_pages), and CRCing the pages mapped with
PROT_READ|PROT_EXEC. This was fine until I realised kernel loaded objects
(executable, dynamic linker) don't work quite so well with this due to
relocations and things.. so I then put some hooks in to load_elf_binary
and load_elf_interpreter along with some ELF header reading code to store
the start and end of the text segment within the inode,

This works for all cases except where the executable has not been
stripped, for some reason the clean_pages list changes between the kernel
loading the binary and my CRC thread coming along later and checking it ..
but *only* for unstripped binaries.. which as far as I can see should make
no difference whatsoever...

Any ideas?
Dave.

--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / [email protected]
pam_smb / Linux DecStation / Linux VAX / ILUG person