Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755977AbYBEIPY (ORCPT ); Tue, 5 Feb 2008 03:15:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755292AbYBEIPM (ORCPT ); Tue, 5 Feb 2008 03:15:12 -0500 Received: from mx1.redhat.com ([66.187.233.31]:37071 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754873AbYBEIPK (ORCPT ); Tue, 5 Feb 2008 03:15:10 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Ingo Molnar X-Fcc: ~/Mail/linus Cc: Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86_64: make traps on 'iret' be debuggable in user space In-Reply-To: Ingo Molnar's message of Tuesday, 5 February 2008 09:01:49 +0100 <20080205080149.GA16929@elte.hu> References: <20080205075137.617012701A8@magilla.localdomain> <20080205080149.GA16929@elte.hu> Emacs: a compelling argument for pencil and paper. Message-Id: <20080205081506.655CB2701A8@magilla.localdomain> Date: Tue, 5 Feb 2008 00:15:06 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2208 Lines: 103 > thanks, applied. I suppose you have a testcase for this that we could try? This should exit 0 and show "wait status 0xb7f", and does on i386. On 2.6.24 it exits 1 and shows "wait status 0xb". Note, on the current tree before [PATCH] x86_64: fix iret exception recovery that I also posted today, this will instead produce pathological weirdness probably with a quick crash or silent reboot, from running with the wrong GS. Thanks, Roland --- #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include static pid_t child; static void cleanup (void) { if (child != 0) kill (child, SIGKILL); } static void handler_fail (int signo) { cleanup (); signal (SIGABRT, SIG_DFL); abort (); } int main (void) { long l; int status, i; pid_t pid; long cs; setbuf (stdout, NULL); atexit (cleanup); signal (SIGABRT, handler_fail); signal (SIGINT, handler_fail); signal (SIGALRM, handler_fail); alarm (10); signal (SIGUSR1, SIG_IGN); signal (SIGUSR2, SIG_IGN); child = fork (); switch (child) { case -1: assert_perror (errno); assert (0); case 0: l = ptrace (PTRACE_TRACEME, 0, NULL, NULL); assert (l == 0); i = raise (SIGUSR1); assert (i == 0); assert (0); default: break; } pid = waitpid (child, &status, 0); assert (pid == child); assert (WIFSTOPPED (status)); assert (WSTOPSIG (status) == SIGUSR1); cs = 0xFFFF; l = ptrace (PTRACE_POKEUSER, child, (void *) offsetof (struct user_regs_struct, cs), (void *) cs); assert (l == 0); l = ptrace (PTRACE_CONT, child, NULL, NULL); assert (l == 0); pid = waitpid (child, &status, 0); assert (pid == child); printf ("wait status %#x\n", status); return WIFSTOPPED (status) ? 0 : 1; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/