From patchwork Mon Nov 14 05:25:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 694377 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tHJxc0Z5Vz9t1H for ; Mon, 14 Nov 2016 16:29:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vO9gC3ap"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tHJxb6PvVzDvj2 for ; Mon, 14 Nov 2016 16:29:55 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vO9gC3ap"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tHJrX4cDXzDvXN for ; Mon, 14 Nov 2016 16:25:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vO9gC3ap"; dkim-atps=neutral Received: by mail-pg0-x243.google.com with SMTP id e9so7663404pgc.1 for ; Sun, 13 Nov 2016 21:25:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=plEZQ3Gh78oarbLhmsF9uEguupMuxbtZy/TRKL/7Ctk=; b=vO9gC3apznskM9qaMQN1rqG7ijz8RozEBr1dGMC5wlYfNgzC6FBpPinMDh9ulT+nXR Gpx6sBWNBQc94Ux9+Ee/X6Rd3azWRJmypasNWOcLgm/xa2V57QSBQCSJPllC7uFLpe+b ZytD7eqpRAv41/J6DcaUKLlNwbxMBwuK/17azgwyzXOx653OerM9C7L2OmiqrcwCFzzQ f34qOE1yhruCykxBkD6QL4n0IH8qdnECrhPa+K/haZ4ksTPezvV4ngSIuXB3tSnvSLRK fWrjh/aMVrjOUa9EdHUfzLN/uMBfSRMqWPPrGZJ2FTATtvL48G7Ofsze5Debm13SpxzR JMHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=plEZQ3Gh78oarbLhmsF9uEguupMuxbtZy/TRKL/7Ctk=; b=Lxa7BGcPZFisWlp7RFaZWu8WqNtHtGMtcKaGTs1/gfyqmjFkU8k3TA8VTKGxbx62kk GVIGQBYFOVQqPbjfrrVbn0xE3kSVu46G5dP6+MKmKXUAJOOROhNWihZOteYeSTLqMp0R yL9ETSfg8lOHnr9UK+QZfJGevC2n+Ycyb+0zhKU1ktFbeDsPXncEoVL/JopUQiL1X0ec kAXTCTWU8Zx41Fk5NCyiGfqrOw3cEnJlB95IkemwPI0f4LtBK1DAOQaZ7eAxW6PPCqd0 VhUzQ63r2uAqpddlydthlNMs3Zg67krs+XBbQ9j7GUT8OjFMjdwWOH5clLjDxb7qz8mA g8qw== X-Gm-Message-State: ABUngvfo+ULryM6Ge4vIqPFgQ/iwIrVQMqdWSR0opybOY5B/Weu51ByTdXkIpXRr0P27Fw== X-Received: by 10.98.37.198 with SMTP id l189mr32221800pfl.39.1479101131058; Sun, 13 Nov 2016 21:25:31 -0800 (PST) Received: from balbir.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id s2sm31646700pfi.10.2016.11.13.21.25.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 21:25:30 -0800 (PST) From: Balbir Singh To: linuxppc-dev@lists.ozlabs.org Subject: [powerpc v4 2/3] Detect instruction fetch denied and report Date: Mon, 14 Nov 2016 16:25:11 +1100 Message-Id: <1479101112-21120-3-git-send-email-bsingharora@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479101112-21120-1-git-send-email-bsingharora@gmail.com> References: <1479101112-21120-1-git-send-email-bsingharora@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" ISA 3 allows for prevention of instruction fetch and execution of user mode pages. If such an error occurs, SRR1 bit 35 reports the error. We catch and report the error in do_page_fault() Signed-off-by: Balbir Singh --- arch/powerpc/mm/fault.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index d0b137d..1e7ff7b 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -404,6 +404,10 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, (cpu_has_feature(CPU_FTR_NOEXECUTE) || !(vma->vm_flags & (VM_READ | VM_WRITE)))) goto bad_area; + + if (regs->msr & SRR1_ISI_N_OR_G) + goto bad_area; + #ifdef CONFIG_PPC_STD_MMU /* * protfault should only happen due to us