Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751534AbdGYR6M (ORCPT ); Tue, 25 Jul 2017 13:58:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56562 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbdGYR6K (ORCPT ); Tue, 25 Jul 2017 13:58:10 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 53D60883B9 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jpoimboe@redhat.com Date: Tue, 25 Jul 2017 12:58:07 -0500 From: Josh Poimboeuf To: Ingo Molnar Cc: x86@kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Linus Torvalds , Andy Lutomirski , Jiri Slaby , "H. Peter Anvin" , Peter Zijlstra , Mike Galbraith , Kees Cook Subject: Re: [PATCH v3 00/10] x86: ORC unwinder (previously undwarf) Message-ID: <20170725175807.hflthwlmnecu4mtd@treble> References: <20170712082710.g2syanmhtwqeus4o@gmail.com> <20170712144254.tihj43mvdj2so74d@treble> <20170712192750.p4wwz6ptjrub7bav@gmail.com> <20170714171745.xq257arzxnypq4mt@treble> <20170725090944.enku4cxxnrh5eszi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170725090944.enku4cxxnrh5eszi@gmail.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 25 Jul 2017 17:58:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1335 Lines: 29 [ Adding Kees to CC for the hardened usercopy discussion. ] Kees, FYI: frame pointers may be disabled by default on x86 relatively soon (presumably weeks or months) in favor of the ORC unwinder. So the hardened usercopy stack walk will no longer work as advertised. Using the ORC unwinder for hardened usercopy would probably be pretty bad performance-wise. I'm not sure what else could be done. Ingo did have a few ideas for sanity checks: On Tue, Jul 25, 2017 at 11:09:44AM +0200, Ingo Molnar wrote: > > > > Well, on x86, hardened usercopy relies on frame pointers, but not the > > > > unwinder. It does the frame pointer walk manually to avoid the full > > > > unwinder overhead. See arch_within_stack_frames(). > > BTW., I think this aspect of the hardened user-copy is crazy stuff - there can be > many stack frames, and this adds a serious amount of overhead even with frame > pointers... > > I think the current behavior is fine: if frame pointers are disabled then > arch_within_stack_frames() returns NOT_STACK. Maybe it could do a few sanity > checks: we do know the kernel stack range and we could check alignment as well. I believe it checks the kernel stack range already in check_stack_object() before deciding whether to call arch_within_stack_frames(). It also has an overlapping stack check. -- Josh