From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abZep-0002We-B1 for qemu-devel@nongnu.org; Thu, 03 Mar 2016 15:15:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1abZeo-0008Lx-4R for qemu-devel@nongnu.org; Thu, 03 Mar 2016 15:15:35 -0500 Received: from mail-vk0-x236.google.com ([2607:f8b0:400c:c05::236]:36080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1abZen-0008Ls-Pt for qemu-devel@nongnu.org; Thu, 03 Mar 2016 15:15:33 -0500 Received: by mail-vk0-x236.google.com with SMTP id c3so33407904vkb.3 for ; Thu, 03 Mar 2016 12:15:33 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1441497448-32489-1-git-send-email-T.E.Baldwin99@members.leeds.ac.uk> <1441497448-32489-11-git-send-email-T.E.Baldwin99@members.leeds.ac.uk> From: Peter Maydell Date: Thu, 3 Mar 2016 20:15:13 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: Riku Voipio , QEMU Developers , Timothy E Baldwin Hi Edgar -- I'm just looking back at these signal handling race condition fix patches, and with this one I have a confusion about the Microblaze Linux syscall code that I hope you can clear up for me. Looking at the kernel entry.S code it looks to me like the way syscalls work on microblaze is: * syscall insn is brki r14 * the insn itself saves the PC of the brki into r14 * on entry the kernel advances r14 by 4 to skip the brki * then SAVE_REGS saves r14 into the 'PC' slot in the pt_regs struct * for syscall restart handle_restart() may wind the PC value in the pt_regs back by 4 * in any case, on syscall exit we pull the PC value out of pt_regs into r14, and do a return with rtbd r14, 0 I think what this implies is that: * r14 is a "used by the kernel, may be corrupted at any time, not to be touched by userspace" register * on exit from a syscall PC and r14 are always the same * this includes do_sigreturn, ie "taking a signal" is one of the things that can corrupt r14 Is that right? (For context, the original patch is this one: http://patchwork.ozlabs.org/patch/514879/ and I now suspect my review comments at the time to be wrong.) thanks -- PMM