Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9978488ybi; Wed, 24 Jul 2019 13:25:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbnFrtUIGcUOy051UUFcMvGVSu+MOG4dqFzj1RsLzsh0FOXJ2DQ/GYT2fghkTJmVmOikyF X-Received: by 2002:a17:90a:3344:: with SMTP id m62mr1237964pjb.135.1563999936449; Wed, 24 Jul 2019 13:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563999936; cv=none; d=google.com; s=arc-20160816; b=mcBihDt3n6oKD1ooVXN1fNR8v8FMRXxtlE2ptTBO5HsQmwSgT69vqgQQVr+HGw5Z8u LmNAae1q8T1lOJszPqo/t+hoq+N8Ic2+uK8tQQOXXdPUTgweYgfTmBoAhu6FX86Uswb8 H7OB+0u9s0nbbvLcj4MbSSDtoteLW5+bHCdH++Kfb0tDaWUA3SmQ3Tmq4Cf2M6dfX5g3 AjM7awEwSN4rd97oM4rDkctfNYVyQkXHQmk5nCQSv3Ob2ay+KEl82IBs4QRFtHN9u60H l6U8hLVKU6BZ9zAp9nASRddVtRPlu8dksTVs21LY3tnbT2d5KWKTzGU/F5mvXk/f6+KB 9fjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vSFAk7iGhPR1K+6MqThPCaIsOzQdmmmp90QPqKsbrx8=; b=LfjMYlSEBRjyIXfDpWVPf0WUK9/gni62Jqz6OK95q/7msao8+7rUeWuqnzQ+D1bJ47 vLCOsCGVecAQOjJNuWdPNOJD4kMFIeHD11AFa+ysphFOZmR/3hnB+Ef7I7e1iebVks9m YmG1eh99Wnc590KjNX5mlsgutQyDvehaLMEvWPMNFgsiUBEpddS/MwLML5ZSmZumMVBG nQVbVj1saJtf5Ydm7puWoSt+5qJkJKqY0vG9fFam7QIQGTGTizRm+EWDmF/gX28yrDeK vkJjJLkle+j/LmNu4Jh6CKKGPglK3vc51mPDN/7QDserPW688YgtkBfADNs4GWF3nocu GYrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jnOkvbQa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m128si14566228pfm.97.2019.07.24.13.25.21; Wed, 24 Jul 2019 13:25:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jnOkvbQa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390578AbfGXUW4 (ORCPT + 99 others); Wed, 24 Jul 2019 16:22:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:45286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389917AbfGXTnN (ORCPT ); Wed, 24 Jul 2019 15:43:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A454217D4; Wed, 24 Jul 2019 19:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997392; bh=kEHKA4EUTrNeERxwRQ+APkr3hFEhUC2gW5svMuPHzJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jnOkvbQav2/wUCQBVMX40adWS54pCPbB2dn1wNDLH+QrEiS7rUnmNLtbdw/oNaIox 2ajNOIPpAx5qjnrP6JBGLpQIr6U7lR7TxyRmFTkuvzSYAuXkrJhPXJvMYnmTwBtNBU A3BedW0TnbiTiybhr1k2F7chJNI6JzNyPUGuSKpE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rolf Eike Beer , Helge Deller Subject: [PATCH 5.2 384/413] parisc: Ensure userspace privilege for ptraced processes in regset functions Date: Wed, 24 Jul 2019 21:21:15 +0200 Message-Id: <20190724191802.501947632@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Helge Deller commit 34c32fc603311a72cb558e5e337555434f64c27b upstream. On parisc the privilege level of a process is stored in the lowest two bits of the instruction pointers (IAOQ0 and IAOQ1). On Linux we use privilege level 0 for the kernel and privilege level 3 for user-space. So userspace should not be allowed to modify IAOQ0 or IAOQ1 of a ptraced process to change it's privilege level to e.g. 0 to try to gain kernel privileges. This patch prevents such modifications in the regset support functions by always setting the two lowest bits to one (which relates to privilege level 3 for user-space) if IAOQ0 or IAOQ1 are modified via ptrace regset calls. Link: https://bugs.gentoo.org/481768 Cc: # v4.7+ Tested-by: Rolf Eike Beer Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- arch/parisc/kernel/ptrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c @@ -496,7 +496,8 @@ static void set_reg(struct pt_regs *regs return; case RI(iaoq[0]): case RI(iaoq[1]): - regs->iaoq[num - RI(iaoq[0])] = val; + /* set 2 lowest bits to ensure userspace privilege: */ + regs->iaoq[num - RI(iaoq[0])] = val | 3; return; case RI(sar): regs->sar = val; return;