Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp895541yba; Wed, 3 Apr 2019 23:27:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTGg8Edbjwka7llKHi8o3vf6V09gCHrbAxXChOV40ouGFUIez0F5gx5pU4VmGsSE1Qx7Hf X-Received: by 2002:a62:4610:: with SMTP id t16mr3936750pfa.217.1554359251735; Wed, 03 Apr 2019 23:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554359251; cv=none; d=google.com; s=arc-20160816; b=jrv5uIoV3eU+6/8UPimG3K5lcmKkFZtlRIJzm5YhnvQhrT58pU71Xynwy2KvRAyWuX Wapry2H5I+MglaHuHfhalsGKGRoYRwiRzJ5+3NtZ9ZlUxibERGfwRxTVuqtrUSQD+OH9 c57mIDGprH/1Kx5OZyhU1ZoAgtwQc45RawKElvaq7BxTX9fso6mUf8mZpn3kbmGidFpC 9R6cfkpqklmdjfnX9pr7pg+l2p7ADtkakD5iAGr7ywX/TXr1N761zlxbymY7gf+5RX3e pIqqeybnwL7GVOo6D1fRg+/B6G9zoOm+jWGYjZeiLj9pY+PrG1o/lgb0p86isOfIngxq KZyQ== 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 :message-id:date:subject:to:from; bh=qZdFO5zMlocQL2t/fE+usGlab+1b5Sb6wBASBNrD8yk=; b=bHFpi8KS8UhSqljCcNvuSwksVJ0Bl/YzIQHKMqvCke0rvYhlReETcUpthJiZ/G2nRv HZbFz/fcu95JHPPs/7/eaUooPzG6iJC4XnyxXWuZtPQ+RJ3nfjad0vmYUb8VGHysWzFF Ti1K7HKfCHGV1OG/YiW+OUcsfFYrdYriv3ODHISFMXRhzrqJughBDuOfTiU3zwtFwC6i faW8/THqrukThDICplk5eYPEYAaALFs1x1JdpU4Hg3PTH2tC0c40UczBmeC6zmWdFBIQ B37PzRtsHToLF2cnemPpRWcwoeljdbOuRePBdyDKUkfcl9OWXhB3NQaqNkoPXWWob8WG lZ6g== 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 bj1si7422719plb.214.2019.04.03.23.27.13; Wed, 03 Apr 2019 23:27:31 -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 S1726462AbfDDG0c (ORCPT + 99 others); Thu, 4 Apr 2019 02:26:32 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:36087 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726031AbfDDG0c (ORCPT ); Thu, 4 Apr 2019 02:26:32 -0400 X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 332CF240004; Thu, 4 Apr 2019 06:26:28 +0000 (UTC) From: Alexandre Ghiti To: "James E . J . Bottomley" , Helge Deller , Andrew Morton , Alexandre Ghiti , Kees Cook , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] parisc: Consider stack randomization for mmap base only when necessary Date: Thu, 4 Apr 2019 02:26:22 -0400 Message-Id: <20190404062622.26009-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not offset mmap base address because of stack randomization if current task does not want randomization. Signed-off-by: Alexandre Ghiti --- arch/parisc/kernel/sys_parisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 376ea0d1b275..4407ac4c1d84 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -86,7 +86,8 @@ static unsigned long mmap_upper_limit(struct rlimit *rlim_stack) stack_base = STACK_SIZE_MAX; /* Add space for stack randomization. */ - stack_base += (STACK_RND_MASK << PAGE_SHIFT); + if (current->flags & PF_RANDOMIZE) + stack_base += (STACK_RND_MASK << PAGE_SHIFT); return PAGE_ALIGN(STACK_TOP - stack_base); } -- 2.20.1