From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7407 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] replace 'hlt' by 'ud2' in i386/x32/x86_64 a_crash implementations Date: Fri, 17 Apr 2015 21:48:38 +0300 (MSK) Message-ID: References: <1429207139-10359-1-git-send-email-amonakov@ispras.ru> <20150417055500.GW6817@brightrain.aerifal.cx> <20150417164401.GY6817@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: ger.gmane.org 1429296538 18899 80.91.229.3 (17 Apr 2015 18:48:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Apr 2015 18:48:58 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7420-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 17 20:48:58 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YjBJr-0003o4-W0 for gllmg-musl@m.gmane.org; Fri, 17 Apr 2015 20:48:52 +0200 Original-Received: (qmail 5299 invoked by uid 550); 17 Apr 2015 18:48:50 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5279 invoked from network); 17 Apr 2015 18:48:50 -0000 In-Reply-To: <20150417164401.GY6817@brightrain.aerifal.cx> User-Agent: Alpine 2.11 (LNX 23 2013-08-11) Xref: news.gmane.org gmane.linux.lib.musl.general:7407 Archived-At: > > An argument in favor of plain hlt/ud2 is that registers and memory are > > preserved, in case someone will be analyzing the coredump. > > That's a good point. The above could be fixed to preserve registers > with some minor added push/pop (simple pusha/popa on 32-bit) > before/after the syscall, but then it gets bigger. Hm, no, I wouldn't like to see that. By the time a_crash executes, "the impossible happened", so stack pointer might be pointing somewhere you wouldn't want modified. A good reason for compilers to generate ud2 is that it also works for kernel code, unlike hlt -- but then OSv carries a copy of musl to run it in the context of, as I understand, virtualized kernel -- what happens when they execute a_crash? Alexander.