From patchwork Thu Jun 9 03:02:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9166151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FFBA60467 for ; Thu, 9 Jun 2016 03:02:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46AEA26E1A for ; Thu, 9 Jun 2016 03:02:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B4E02824F; Thu, 9 Jun 2016 03:02:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 9908D26E1A for ; Thu, 9 Jun 2016 03:02:46 +0000 (UTC) Received: (qmail 9693 invoked by uid 550); 9 Jun 2016 03:02:44 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9675 invoked from network); 9 Jun 2016 03:02:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :in-reply-to; bh=Yegg01KxYxToI3Cw8Uz24Dz47GTeNgCj9iMUa1fBFFc=; b=nR2+yu282kXo3cG4/b/BO4iL/skgVdaOc4yhlkVK4GGmgRmDjGGCzpDKRCslMsE1vU 2AVmZ3u+bzBDOhESzDz3V5q59pmPzxnWCVmOilTkp0QBzqzAyN2nkxr2z1yEw9JR2iAb SDdglM4SO4Mv27J+Z9i9+2ovQV9HLYyRYnoxQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:in-reply-to; bh=Yegg01KxYxToI3Cw8Uz24Dz47GTeNgCj9iMUa1fBFFc=; b=irqj46m4nqro0lwOrY+ytKVTNl3G6NLStipcHw/C9b1hjjOMTiqHPFytQ0/Qudy+h1 DCpH7ewWdOCXQEC2Jqo6i0AtdYU7a935IEIWuSt2tlu+h5bWa7i3/CyCWMCOBNKgz4IJ uC8cxIVXxbqOUqRKFa9JFpY2wKdZwRRdrMsTdtYAZIQQe0SHQ9GWCbWNBddWhG4zWs2M rxAqNcTJ5o8tUF8JCqp6B4fgYSH4qjw4yRcAANnSy0JdrEtP94jrhQbhPHCp/J6CY0RU +zTPhZJFbZCbt/u3iRwfvqv0y1BKZdNkLglsPgyi+oex1y23nMFqXs/Wp6hyjl6JjFRG rRbg== X-Gm-Message-State: ALyK8tJORZUOA20DBVH4tvc4vDQdeyGgvXxJ420H5wasY8lDKqXxPO1fupBaglhglmOyZk1e X-Received: by 10.66.251.2 with SMTP id zg2mr9497100pac.32.1465441352011; Wed, 08 Jun 2016 20:02:32 -0700 (PDT) Date: Wed, 8 Jun 2016 20:02:30 -0700 From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Brad Spengler , PaX Team , Casey Schaufler , Rik van Riel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Message-ID: <20160609030230.GA23922@www.outflux.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1465420302-23754-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [RFC][PATCH v2 5/4] arm: fixes for usercopy X-Virus-Scanned: ClamAV using ClamSMTP These will be in the next version; they are the fixes I needed to boot my ARM VM. Signed-off-by: Kees Cook diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 7bcdb56ce6fb..c4887b272527 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -515,12 +515,12 @@ __copy_to_user(void __user *to, const void *from, unsigned long n) #ifndef CONFIG_UACCESS_WITH_MEMCPY unsigned int __ua_flags = uaccess_save_and_enable(); - check_object_size(to, n, false); + check_object_size(from, n, true); n = arm_copy_to_user(to, from, n); uaccess_restore(__ua_flags); return n; #else - check_object_size(to, n, false); + check_object_size(from, n, true); return arm_copy_to_user(to, from, n); #endif } diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 7b8f2141427b..98b497c83aef 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -252,6 +252,7 @@ badframe: static int setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) { + sigset_t setcopy = *set; struct aux_sigframe __user *aux; int err = 0; @@ -278,7 +279,7 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) __put_user_error(current->thread.address, &sf->uc.uc_mcontext.fault_address, err); __put_user_error(set->sig[0], &sf->uc.uc_mcontext.oldmask, err); - err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); + err |= __copy_to_user(&sf->uc.uc_sigmask, &setcopy, sizeof(*set)); aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; #ifdef CONFIG_CRUNCH diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index e2c6da096cef..99420fc1f066 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -125,6 +125,8 @@ SECTIONS #ifdef CONFIG_DEBUG_ALIGN_RODATA . = ALIGN(1<