[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

FPU avoidance idea



Here's the offending code in glibc:

  sysdeps/unix/sysv/linux/init-first.c

static void
init (int argc, char **argv, char **envp)
{
  extern int __personality (int);
  extern void __getopt_clean_environment (char **);

  /* We must not call `personality' twice.  */
  if (!__libc_multiple_libcs)
    {
      /* The `personality' system call takes one argument that chooses
         the "personality", i.e. the set of system calls and such.  We
         must make this call first thing to disable emulation of some
         other system that might have been enabled by default based on
         the executable format.  */
      __personality (PER_LINUX);

      /* Set the FPU control word to the proper default value.  */
      __setfpucw (__fpu_control);
    }

      ^^^^^^^^^^
     that's what kills us.


How's this for an idea - what if we could cook up a little binary that
will do an LD_PRELOAD of the __setfpucw to something harmless?  It
could then be used to insmod the FP emulator, or call any other
command.  Is that possible?

Of course, this will need to be staticly linked, and not use the same
code itself.

If this worked, then we wouldn't have to hack up glibc, bash, or insmod.

I think I'll repost this idea to the list.

Cheers,

 - Jim


Reply to: