Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7378496yba; Thu, 2 May 2019 08:52:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmDpfbfwtCWfhlX7SwgBN9UTDcBqADiMP8QP5t/0kFzEk+GijbQGEVkZVU+E/5twsK1sTo X-Received: by 2002:a65:60c7:: with SMTP id r7mr4683646pgv.191.1556812358651; Thu, 02 May 2019 08:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556812358; cv=none; d=google.com; s=arc-20160816; b=jDeikBHDIbxTkaFAfh+Bw1xL4qpqsRvUUpwMZKp41cF6FAdZDb8dRhTMQJhHKgoRzl r0u3jgSynntWixo9hP84+FzPbDRTFgJOCUC9oS7I5pn6r4T6n56pyQZy8dR8luh5ACDI 64EyjmczxZlwD/Oopz4OBtR06MyT3gProhLLPpGJelVh79mmx7CQXYaa4F5f5657MWqb 5UZ+gbXGr0IOWzMaJj4k2t1iysFtxB2GpqOF8NOQWCOgs5YbTkFaL7U+sN8X5BC0liD9 sogEUZBDsXFatOkvfe673TKjAd80/4mCBlxIhFXPB0Y68dGdu+LU4gkLKt8F7aNSAu/d pk0Q== 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=B6CdOHBc8redWZlfbyxemHzngZhh6nkhrs7/w4OjsBA=; b=rWKNi4EOXK1uNmneOsE3P+8kxkUECOPOFJ/kzOEyrpgatIucetsXdem9MFI6ngxIcz hUkHgzlpIrau/sjiBo+6YEvCp1dXHLkSFnQ8XfTLI8iDxVr4HBqILyMnUzr1uxkQ3DVY JyuXyDL0+mIxquEu3B5YxSxg639CQ8veqFuPA82akI7beQQzW/+KEFpUAQFv8H09FWms yhujRmG7knEKmPbw82es0AtONq1Dsecl/QtAjbZceb76THjl2sOTL0Pgtxg0wsyC/ggG Xr2nH6UMu2CgJUNHkYDk+3+yjhjxE2DWJsfaHYYnQCCNQZG6ZMsaEBJAnf9+Ti+/Pd6v apbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eLwZmErP; 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 d129si22864732pfd.267.2019.05.02.08.52.23; Thu, 02 May 2019 08:52:38 -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=eLwZmErP; 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 S1726488AbfEBPWI (ORCPT + 99 others); Thu, 2 May 2019 11:22:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:37284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbfEBPWF (ORCPT ); Thu, 2 May 2019 11:22:05 -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 862152081C; Thu, 2 May 2019 15:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556810525; bh=mCAzXQYMfAxlLqu0U3V4Avl84lWfKttGlE1GuRFcAKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLwZmErPi8pgqFlo1nlPNeRnAvugtnfBJdVdpywvJssDufV8+ognZbzx2aRxVtqp8 lKBNrrb22jduZ6jN7YJdhXU6yNipgJaJ6AIqK+sz/Jdpj9ehShOm2VnF27JTgAHbJs pNFqdjW9iCBV5edgUsC3EOpyYEmRC8G+U8sGjGyw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Liebler , Martin Schwidefsky , "Sasha Levin (Microsoft)" Subject: [PATCH 4.9 05/32] s390: limit brk randomization to 32MB Date: Thu, 2 May 2019 17:20:51 +0200 Message-Id: <20190502143317.201689230@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190502143314.649935114@linuxfoundation.org> References: <20190502143314.649935114@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 [ Upstream commit cd479eccd2e057116d504852814402a1e68ead80 ] For a 64-bit process the randomization of the program break is quite large with 1GB. That is as big as the randomization of the anonymous mapping base, for a test case started with '/lib/ld64.so.1 ' it can happen that the heap is placed after the stack. To avoid this limit the program break randomization to 32MB for 64-bit and keep 8MB for 31-bit. Reported-by: Stefan Liebler Signed-off-by: Martin Schwidefsky Signed-off-by: Sasha Levin (Microsoft) --- arch/s390/include/asm/elf.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 8d665f1b29f8..f0fe566a9910 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h @@ -215,11 +215,14 @@ do { \ /* * Cache aliasing on the latest machines calls for a mapping granularity - * of 512KB. For 64-bit processes use a 512KB alignment and a randomization - * of up to 1GB. For 31-bit processes the virtual address space is limited, - * use no alignment and limit the randomization to 8MB. + * of 512KB for the anonymous mapping base. For 64-bit processes use a + * 512KB alignment and a randomization of up to 1GB. For 31-bit processes + * the virtual address space is limited, use no alignment and limit the + * randomization to 8MB. + * For the additional randomization of the program break use 32MB for + * 64-bit and 8MB for 31-bit. */ -#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ffffUL) +#define BRK_RND_MASK (is_compat_task() ? 0x7ffUL : 0x1fffUL) #define MMAP_RND_MASK (is_compat_task() ? 0x7ffUL : 0x3ff80UL) #define MMAP_ALIGN_MASK (is_compat_task() ? 0 : 0x7fUL) #define STACK_RND_MASK MMAP_RND_MASK -- 2.19.1