Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2990287yba; Mon, 22 Apr 2019 17:18:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVXaKnc4zex8OpnUv1qyXnf09tWptLynCpkqiilGjkWzQKgZxQRRnJyIf5rcB6ewlznblJ X-Received: by 2002:a62:3583:: with SMTP id c125mr1206780pfa.169.1555978712606; Mon, 22 Apr 2019 17:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555978712; cv=none; d=google.com; s=arc-20160816; b=csywrJp/qads3PyGHjXTDpFHs21HRqCOfyD7rAQjazHmYcCqdlp3ulvsPOa01Flx0Y xBkYzfuP5lZje3GR8n5Bd2w2+nNru59glDeGU1T3kL0uLI9lZ84YcjlYMrNTq1umHpv7 RVhIDjH6UiQRmFtzVG5ggjoS7xHjd2qYgm6E8erH1eJUlJkwxWnLtc1z3t/qI4j5hAmU Jz0r8aDcYfvxHO4YjKEiZ/zXBs3cSxk6wePd6Q6cwDX/uM35bgYe/P+eM1Otiv74DAyE rKoDBDDAmFGuLF48O9qtv088Ie3QDZj4BIAVohRMiFSXMRXVDXJuoQij1711C3Tjg1Lq GFGQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=orw34zPyNXRIw7DJAJIDqRyqwKpC/kPfVVGgZ6VeKPY=; b=QP8rnYqgt1ADe4z4KTfY6GC4y9okLiE8Y/+LLNqU5CesQx1ho7ALyRRBCXUMggJOAJ v8Gz6gSPwPpxX48fwsJ3P1RQg6fq17uf5hFWD9Wnfhd6DuyJGT57pVFGOBLSXj/S1vEN o70mOZ0HyP8hnRPczT0csaGVJ1EqqZMX2NgRgxGAspHUu/lGeFcMy8bpuuj4puYw1lAN QB0vdYJV9J43g3ov5aEmZnEm/hDosIitM4dwRPiX5JmKvw+Y+n2IESU/hqOBc8GyjFdC +vUyx9Y7+E3YUoZisebQublSU42CZMG+u4956+WdDvim/dPVQwpgemUMDAUJQx1Mf2Vk b5vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vUarLLJw; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20si13110669pgw.465.2019.04.22.17.18.16; Mon, 22 Apr 2019 17:18:32 -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=vUarLLJw; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732227AbfDVUE4 (ORCPT + 99 others); Mon, 22 Apr 2019 16:04:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:47084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729719AbfDVTpX (ORCPT ); Mon, 22 Apr 2019 15:45:23 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B459E21901; Mon, 22 Apr 2019 19:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962322; bh=0NHLvwfoKQMlaQaxzUsbEC/SYdZ/fTDhC2rT8mW3vRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vUarLLJw8gmFXjQ0ukmIsR9vcv5R+wcpZ5pXk6RmOabN/FFt8fN7zG9ooH7/9NdRC Xzyzguyes5vUNE3HWOlIC4Amyyu+2183V9q91xcgZeA4Zqeydq/+eDJY0R5I75KfxJ E3HGnqktuez+DsGOidDxH8jcV1B3B7gx3v4ftVCI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Martin Schwidefsky , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 02/68] s390: limit brk randomization to 32MB Date: Mon, 22 Apr 2019 15:44:10 -0400 Message-Id: <20190422194516.11634-2-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Schwidefsky [ 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 7d22a474a040..f74639a05f0f 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h @@ -252,11 +252,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