Skip to contentSkip to conversation

emulate_load_store_insn

DISCUSSION Carsten Langgaard 2 participants 2 messages Jun 9, 2001 MIPS

lore
Share & tools
lore
#0 lore raw

Can anyone please explain the whole deal with the emulate_load_store_insn function in arch/mips/kernel/unaligned.c.
Isn't there a potential hole there, where a user application makes an illegal memory access to an unaligned address and then the kernel tries to emulate that and crashes.
It also look like the MF_FIXADE flag is set by default, why is that ? Shouldn't one suppose to make a syscall setting this MF_FIXADE flag ?

/Carsten

#1 lore raw
Quoted 2 lines · Carsten Langgaard

Can anyone please explain the whole deal with the emulate_load_store_insn function in arch/mips/kernel/unaligned.c.

Some software does of unaligned accesses. Typical userspace example is fdisk and the network stack which generally tries hard to avoid unaligned loads and stores may make unaligned stores at times though.

Quoted 3 lines

Isn't there a potential hole there, where a user application makes an illegal memory access to an unaligned address and then the kernel tries to emulate that and crashes.

The addresses are verified the same way as any other userspace address passed to the kernel.

Quoted 1 line

It also look like the MF_FIXADE flag is set by default, why is that ?

Two reasons 1) other MIPS OSes such as Risc/OS and IRIX also do it 2) crappy software doesn't know how to enable this feature ...

Quoted 1 line

Shouldn't one suppose to make a syscall setting this MF_FIXADE flag ?

Sysmips(2) allows to toggle this flag.

Ralf