On 2 November 2011 19:23, Alexander Graf <ag...@suse.de> wrote: > There are a number of files in /proc that expose host information > to the guest program. This patch adds infrastructure to override > the open() syscall for guest programs to enable us to on the fly > generate guest sensible files. > > Signed-off-by: Alexander Graf <ag...@suse.de> > --- > linux-user/syscall.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++-- > 1 files changed, 49 insertions(+), 3 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 9f5da36..38953ba 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -4600,6 +4600,52 @@ int get_osversion(void) > return osversion; > } > > +static int do_open(void *cpu_env, const char *pathname, int flags, mode_t > mode)
Once you open the pandoras-box that is emulating /proc, I think you'll probably need to hook it in more places and be more general; although you may well get away with it for this particular case. Isn't it better to put the filename interception code somewhere more general so that it can also be misused by other calls - e.g. stat(). I guess you're also going to need to be able to do /proc/pid/* instead of /proc/self; something is bound to use that. Dave