Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934204AbdGTHMW (ORCPT ); Thu, 20 Jul 2017 03:12:22 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36452 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933089AbdGTHMT (ORCPT ); Thu, 20 Jul 2017 03:12:19 -0400 Subject: Re: [PATCH v3.1 09/10] x86/unwind: add ORC unwinder To: Josh Poimboeuf , x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Linus Torvalds , Andy Lutomirski , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Mike Galbraith References: <55eba34724a72b4b03d1e787ef17397931af68fe.1499786555.git.jpoimboe@redhat.com> <20170714172214.pnol6ve45qpa33si@treble> From: Jiri Slaby Message-ID: Date: Thu, 20 Jul 2017 09:12:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170714172214.pnol6ve45qpa33si@treble> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1487 Lines: 54 On 07/14/2017, 07:22 PM, Josh Poimboeuf wrote: > +void __unwind_start(struct unwind_state *state, struct task_struct *task, > + struct pt_regs *regs, unsigned long *first_frame) > +{ > + memset(state, 0, sizeof(*state)); > + state->task = task; > + > + /* > + * Refuse to unwind the stack of a task while it's executing on another > + * CPU. This check is racy, but that's ok: the unwinder has other > + * checks to prevent it from going off the rails. > + */ > + if (task_on_another_cpu(task)) > + goto done; > + > + if (regs) { > + if (user_mode(regs)) > + goto done; > + > + state->ip = regs->ip; > + state->sp = kernel_stack_pointer(regs); > + state->bp = regs->bp; > + state->regs = regs; > + state->full_regs = true; > + state->signal = true; > + > + } else if (task == current) { > + asm volatile("lea (%%rip), %0\n\t" > + "mov %%rsp, %1\n\t" > + "mov %%rbp, %2\n\t" > + : "=r" (state->ip), "=r" (state->sp), > + "=r" (state->bp)); > + > + } else { > + struct inactive_task_frame *frame = (void *)task->thread.sp; > + > + state->ip = frame->ret_addr; > + state->sp = task->thread.sp; > + state->bp = frame->bp; I wonder, if the reads from 'frame' should have READ_ONCE_NOCHECK for the same reason as in: commit 84936118bdf37bda513d4a361c38181a216427e0 Author: Josh Poimboeuf Date: Mon Jan 9 12:00:23 2017 -0600 x86/unwind: Disable KASAN checks for non-current tasks ? thanks, -- js suse labs