Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp112715imm; Thu, 12 Jul 2018 15:17:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd7JlxIbBPlK9PUGHYpuwCUz4jH6UFNy9H/v9U1Nq4bqIUJqMptHIcOXDzhiwwGCFSiOpn8 X-Received: by 2002:a65:428b:: with SMTP id j11-v6mr3612259pgp.200.1531433863112; Thu, 12 Jul 2018 15:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531433863; cv=none; d=google.com; s=arc-20160816; b=E7kKG3axiQKbINEezC+0TGEQN2dn2lXSBsrmIXDJo5+3CpRmqXATqnJMXf0+aKfYx2 f0D/0UwT+o7cdaeOqThKvP0QCY3m6K8cR2sW2KEPGBB1gJEea9bQWdzT+mXnrpDsqhC4 MwQi3B85btRtd/VE6fjncfVtXUMHcuuhOjUsjuSeA0/saZFiqt1CFc+SWx9fLBqn8Azq LF5F/dSnc7x6cenRbhjnFAL9EhOgie7X9nMB0vh61gUtJFxTT2sBJuobN7JccW7CjgN0 dsYHBejvbEM9Ht9IerWKOPFvct+seoL8uWu7lRrUfosfx7XWTE110NIq7IPvViBBCWbC 5T2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=miR3sUY52YJegSUphK9Dd1nllr22YsNP91Ma12Fk3dA=; b=OiyYe+r92fI/0tmAwuHU/q/CntHTyTYVs8csHMc6CmwqJhZu/oIVCzCil54uOwLPhA kf93EyaE+48PR5QJS/HQUsUNL/EvwhXpPAUn2GGcpxE1u4xCVHjKsdN3Mq2DFBImllBL qAFgBIX94CpX4nx+QNo8lWnnnu3SDcPC8nj+i8EXVGt3g4LoPgWbLMNUDOlM+vTaTLfa S14DlVsDp7UTHzizWXoRWAM+QlBzztv4ObZLfO3tRshKE9CuxpMel+AiWh6DXQ8/Gv1M rp2Wfw0WP2jiXvnFV1fykxo1NMbYXN/Oz/Tcx24zDn7ufZrzQeMb8yeSuGMY1ttJQUdw tVaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=GPkdZki3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11-v6si13396482pgf.558.2018.07.12.15.17.27; Thu, 12 Jul 2018 15:17:43 -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=@synopsys.com header.s=mail header.b=GPkdZki3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732647AbeGLW21 (ORCPT + 99 others); Thu, 12 Jul 2018 18:28:27 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:47210 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732298AbeGLW20 (ORCPT ); Thu, 12 Jul 2018 18:28:26 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 593B510C0ED7; Thu, 12 Jul 2018 15:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1531433812; bh=Yca7s6kD60X289PP1e7w0j3AFetzIOVmOpQwIZStfjc=; h=From:To:CC:Subject:Date:From; b=GPkdZki3HmVWGuySb2wdl/QNuceX0Rj4eIIF4xK8wP+YuBhiLULG2RgphO3yuhJRP BW9xBGyrw+tWkwRAkoO+qVWdjd7S9sMLP2cUi/HUn7LhGMrUG4p70jciA0dhP8pm9e VOSdi3c0Rsv8VxP7QEzJ9mLTebj5AiZRnYzp0zPYwrHlW1TRad5ueeZkD2sf1ddYVd WNKwBrJaZMdBxxMJIZZEoKzSuEV8yz6pVF52y3O1KiwWZ00RuyaiLV4gO1siYCuFQl S/K3ctXJzDtQbcCLIZggB0tyg+01nVTR8HLwIoec+Iy/j5ApDGGpUsWfL9EOtKlnAl k5xpivJgf71pQ== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 45E5934AF; Thu, 12 Jul 2018 15:16:52 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 12 Jul 2018 15:16:52 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 13 Jul 2018 03:46:49 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.98) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 13 Jul 2018 03:46:48 +0530 From: Vineet Gupta To: CC: , Vineet Gupta , Subject: [PATCH] ARC: mm: allow mprotect to make stack mappings executable Date: Thu, 12 Jul 2018 15:16:34 -0700 Message-ID: <1531433794-7518-1-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.10.161.98] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mprotect(EXEC) was failing for stack mappings as default vm flags was missing MAYEXEC. This was triggered by glibc test suite nptl/tst-execstack testcase What is surprising is that despite running LTP for years on, we didn't catch this issue as it lacks a directed test case. gcc dejagnu tests with nested functions also requiring exec stack work fine though because they rely on the GNU_STACK segment spit out by compiler and handled in kernel elf loader. This glibc case is different as the stack is non exec to begin with and a dlopen of shared lib with GNU_STACK segment triggers the exec stack proceedings using a mprotect(PROT_EXEC) which was broken. CC: stable@vger.kernel.org Signed-off-by: Vineet Gupta --- arch/arc/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h index 109baa06831c..09ddddf71cc5 100644 --- a/arch/arc/include/asm/page.h +++ b/arch/arc/include/asm/page.h @@ -105,7 +105,7 @@ typedef pte_t * pgtable_t; #define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) /* Default Permissions for stack/heaps pages (Non Executable) */ -#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE) +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) #define WANT_PAGE_VIRTUAL 1 -- 2.7.4