From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12167 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Wasm support patch 2 (static syscalls) Date: Tue, 28 Nov 2017 10:50:14 -0500 Message-ID: <20171128155014.GA1627@brightrain.aerifal.cx> References: <20171128125948.GK15263@port70.net> <20171128140531.GM15263@port70.net> <20171128143549.GN15263@port70.net> <20171128150806.GO15263@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1511884233 7295 195.159.176.226 (28 Nov 2017 15:50:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Nov 2017 15:50:33 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12183-gllmg-musl=m.gmane.org@lists.openwall.com Tue Nov 28 16:50:30 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eJi9P-0001DC-EU for gllmg-musl@m.gmane.org; Tue, 28 Nov 2017 16:50:23 +0100 Original-Received: (qmail 17482 invoked by uid 550); 28 Nov 2017 15:50:27 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 17462 invoked from network); 28 Nov 2017 15:50:27 -0000 Content-Disposition: inline In-Reply-To: <20171128150806.GO15263@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12167 Archived-At: On Tue, Nov 28, 2017 at 04:08:06PM +0100, Szabolcs Nagy wrote: > * Nicholas Wilson [2017-11-28 14:53:58 +0000]: > > I think LTO would be required - but I might be missing something > > in your scheme? I'm considering the cases like __setxid and > > pthread_cancel, where the compiler can't work out which syscall > > numbers are possible (because the numbers come from another > > translation unit). In these cases, there's no way to eliminate any > > of the branches in your switch statement. > > > > In particular, getuid() is such a common library call that I think > > we do want to be able to support it on Wasm, without having Musl > > link in everything. I mean, it's not an obscure piece of > > functionality, so it's worth a small refactor to make it usable > > with Wasm. > > getuid is not affected, only __setxid and cancellable syscalls are. > > __setxid is not that important and can be worked around in generic code, > but i don't see an easy solution for syscall_cp except that wasm > probably don't need cancellation at all so it can be just defined > to syscall. I don't think calling __setxid even makes sense in wasm code. Do you actually have a multiuser model with a privileged user who can change uid to other users? Cancellation is actually hard to do via an approach like this, since you need some mechanism for determining the point at which the syscall has atomically succeeded versus being blocked with no side effects yet. Implementing it would probably require doing something similar to what midipix does, but for now it can probably just be omitted. Rich