Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5761978imm; Mon, 23 Jul 2018 05:45:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdgDrbMcm7z6P1L1WxCd3rjrzdAb6oON6+VITKTh577dSXMab0vMtQrqma0BWsHKtrYNVQg X-Received: by 2002:a17:902:6b09:: with SMTP id o9-v6mr12669736plk.256.1532349936638; Mon, 23 Jul 2018 05:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532349936; cv=none; d=google.com; s=arc-20160816; b=K1e4yTSeID3fK6drXeT0f9/POjk6WhKh7eXOPFSlvC/NHgEq+sZITM3dv2oSjW4vpj AWB2KYCFWuvHMbc1H43/WZ8zjnH3YF4yRoB1lem3ITnLnbp2gwRB54NwIRWXx2supQjk kGWSd+xFECDBxQOveVpaqNT3J5hmWZMpGDjgmTkQea49A/uSV6QuhRINa6b9FgU+KCEz jcwOzQgKfJvTjs0AJqOkOCGaJMs7ontLAHsxAPPHZTGJoexUm5NxWjzpEipSW1AUmKcK dElpM6aWwb2hN6/T9m4n70wlYt3+17VUIBw5+f4gz7zdIUDDadNuWdD2Poud3TOMuncc 7sYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Rmhv8wH3IaaQAPegfoQnnpnkEuOukz4S7cS2LbUsZ14=; b=xaaDv9EzuLg6NEAsBOqrHbvrvAvfqNqLpYh5+e6v63a+J14HSDvg5PYZfQZsCKadI3 4eiKwuStBuqhGiIOj9Sl+b6s1xNl2G20IDRRhYuzwzLML+otxh6RDhb1w/CbHhdUFZoE LwTO9Zij2GkEdLzSRpVbEzIupXHhaUHSyhzFcdRvG7yIrkOgtDpvlQg7CqU0JR3nBEey AnVJ9XrrexolnqnUVHFW6dQcZPeZjyBpHZ8mMm7kzWiN3PnltjB33M/1tZfPmcSTLUrb h3VOMofuXv2wHkP5V9CM0Iu/folaLseg7zNX3T/jePmpYc9uPY46qykIC1Et2xS9d4t6 UOCw== ARC-Authentication-Results: i=1; mx.google.com; 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 g67-v6si8154154plb.73.2018.07.23.05.45.22; Mon, 23 Jul 2018 05:45: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; 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 S2388939AbeGWNoe (ORCPT + 99 others); Mon, 23 Jul 2018 09:44:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48344 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388443AbeGWNod (ORCPT ); Mon, 23 Jul 2018 09:44:33 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7EC2DC7D; Mon, 23 Jul 2018 12:43:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vineet Gupta Subject: [PATCH 4.4 006/107] ARC: mm: allow mprotect to make stack mappings executable Date: Mon, 23 Jul 2018 14:41:00 +0200 Message-Id: <20180723122413.238814123@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vineet Gupta commit 93312b6da4df31e4102ce5420e6217135a16c7ea upstream. 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 Signed-off-by: Greg Kroah-Hartman --- arch/arc/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arc/include/asm/page.h +++ b/arch/arc/include/asm/page.h @@ -102,7 +102,7 @@ typedef pte_t * pgtable_t; #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) /* 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