Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 12 Jun 2015 13:26:55 +0900
From: Yoshinori Sato <ysato@...rs.sourceforge.jp>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com,
	"D. Jeff Dionne" <Jeff@...inux.org>,
	shumpei.kawasaki@...wc.com
Subject: Re: Moving forward with sh2/nommu

On Fri, 12 Jun 2015 02:22:27 +0900,
Rich Felker wrote:
> 
> On Thu, Jun 11, 2015 at 11:12:52AM -0400, Rich Felker wrote:
> > > >> 3. We need sh/vfork.s since the default vfork.c just uses fork, which
> > > >>    won't work. I have a version locally but it doesn't make sense to
> > > >>    commit without runtime trap number selection.
> > > > 
> > > > Done and updated to use runtime selection in the (ugly) patch.
> > > 
> > > If they ask for vfork() they should get vfork()...?
> > 
> > Yes. The "runtime selection" is about the syscall trap number, not
> > whether or not to use vfork. I committed vfork to upstream musl now,
> > but with a SH3/4 trap number to be consistent with the code that's
> > upstream now. Later I'll either convert them all to trap 31 (0x1f) if
> > that ends up being acceptable, or merge the runtime-selection code,
> > but I think it makes sense to make the change across all files at
> > once, whichever way it's done.
> 
> Ah, maybe I misunderstood. If you were asking abaout the original
> remark that the default vfork.c uses fork, the reason is simply that
> you can't write vfork() in C. The return from vfork() in the child
> will clobber vfork's stack frame, which may contain the return address
> or saved registers, and then when the parent resumes, very bad things
> will happen. vfork() has to be implemented in asm to ensure that any
> state it needs to be able to return in the parent is kept in registers
> rather than memory. Thus, each arch needs an arch-specific version,
> and we just hadn't gotten around to adding the sh version yet.
> 
> Rich

No. vfork kept only last return address.
It isn't necessary to preserve the value of anything but that.
Child process can't return caller routine.

-- 
Yoshinori Sato
<ysato@...rs.sourceforge.jp>

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.