From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753748AbcGTJyX (ORCPT ); Wed, 20 Jul 2016 05:54:23 -0400 Received: from smtp-out6.electric.net ([192.162.217.188]:53274 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753461AbcGTJyV (ORCPT ); Wed, 20 Jul 2016 05:54:21 -0400 From: David Laight To: "'Kees Cook'" , "linux-kernel@vger.kernel.org" CC: Jan Kara , "kernel-hardening@lists.openwall.com" , Will Deacon , "linux-mm@kvack.org" , "sparclinux@vger.kernel.org" , "linux-ia64@vger.kernel.org" , Christoph Lameter , "Andrea Arcangeli" , "linux-arch@vger.kernel.org" , "x86@kernel.org" , Russell King , "linux-arm-kernel@lists.infradead.org" , Catalin Marinas , PaX Team , Borislav Petkov , Mathias Krause , Fenghua Yu , Rik van Riel , David Rientjes , Tony Luck , Andy Lutomirski , Josh Poimboeuf , Andrew Morton , Dmitry Vyukov , Laura Abbott , Brad Spengler , "Ard Biesheuvel" , Pekka Enberg , Daniel Micay , Casey Schaufler , Joonsoo Kim , "linuxppc-dev@lists.ozlabs.org" , "David S. Miller" Subject: RE: [PATCH v3 00/11] mm: Hardened usercopy Thread-Topic: [PATCH v3 00/11] mm: Hardened usercopy Thread-Index: AQHR3uKNcxOYp60hMUWRwOoJRQE2b6AhFJXQ Date: Wed, 20 Jul 2016 09:52:25 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D5F4FD6A3@AcuExch.aculab.com> References: <1468619065-3222-1-git-send-email-keescook@chromium.org> In-Reply-To: <1468619065-3222-1-git-send-email-keescook@chromium.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u6K9sReD022568 From: Kees Cook > Sent: 15 July 2016 22:44 > This is a start of the mainline port of PAX_USERCOPY[1]. ... > - if address range is in the current process stack, it must be within the > current stack frame (if such checking is possible) or at least entirely > within the current process's stack. ... That description doesn't seem quite right to me. I presume the check is: Within the current process's stack and not crossing the ends of the current stack frame. The 'current' stack frame is likely to be that of copy_to/from_user(). Even if you use the stack of the caller, any problematic buffers are likely to have been passed in from a calling function. So unless you are going to walk the stack (good luck on that) I'm not sure checking the stack frames is worth it. I'd also guess that a lot of copies are from the middle of structures so cannot fail the tests you are adding. David