linux-mips
[Top] [All Lists]

Re: User applications

To: Carsten Langgaard <carstenl@mips.com>
Subject: Re: User applications
From: Ralf Baechle <ralf@oss.sgi.com>
Date: Mon, 8 Jan 2001 14:25:13 -0200
Cc: linux-mips@oss.sgi.com
In-reply-to: <3A598AFC.83204F56@mips.com>; from carstenl@mips.com on Mon, Jan 08, 2001 at 10:40:12AM +0100
References: <3A598AFC.83204F56@mips.com>
Sender: owner-linux-mips@oss.sgi.com
User-agent: Mutt/1.2.5i
On Mon, Jan 08, 2001 at 10:40:12AM +0100, Carsten Langgaard wrote:

> When a new user process is started will its user space be cleared by the
> kernel or is there a potential leak from an older user process ?

A new process is started by the clone(2) or fork(2) syscalls.  Module the
options that can be passed to clone(2) the two only create an identical copy
of the invoking process, so they're designed to leak information by design ;-)

execve(2) replaces the existing mappings with a new process image loaded
from files plus a newly created stack area.  No old mappings survive, so
there in memory there is no information leak.

> What about the registers values, are they cleared for each new user
> application or will it simply contain the current value it got when the
> user application is started ?

We make no attempt at the integer registers for a new process, so some
information might be leaked in registers.  All the callee saved registers
will be passed unchanged to the child process; the caller saved registers
except those that are used as syscall return values will return random
garbage.  Floating point registers will be cleared with SNANs as soon
as the process is attempting to use a FPU for the first time, that is
we won't leak information via fpu registers.

(Ooops, we're not Orange Book B1 compliant, how sad ;-)

> How can you flush the data and instruction cashes from a user application ?

cacheflush(2).  See man page.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>