From patchwork Thu Jun 13 11:26:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Droneaud X-Patchwork-Id: 10991597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38E9F924 for ; Thu, 13 Jun 2019 11:32:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 253B828B79 for ; Thu, 13 Jun 2019 11:32:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1856628B7F; Thu, 13 Jun 2019 11:32:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 0C82728B79 for ; Thu, 13 Jun 2019 11:32:07 +0000 (UTC) Received: (qmail 18119 invoked by uid 550); 13 Jun 2019 11:32:06 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 9271 invoked from network); 13 Jun 2019 11:26:21 -0000 From: Yann Droneaud To: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Cc: Andrew Morton , Kees Cook , Alexey Dobriyan , Yann Droneaud Date: Thu, 13 Jun 2019 13:26:03 +0200 Message-Id: X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a01:e35:39f2:1220:9dd7:c176:119b:4c9d X-SA-Exim-Mail-From: ydroneaud@opteya.com Subject: [PATCH 0/3] ELF interpretor info: align and add random padding X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ou.quest-ce.net) X-Virus-Scanned: ClamAV using ClamSMTP Hi, The following patches are mostly focused on ensuring AT_RANDOM array is aligned on 16bytes boundary, and while being located at a pseudo-random offset on stack (at most 256 bytes). This patchset also insert a random sized (at most 15 bytes) padding between AT_RANDOM and AT_PLATFORM and/or AT_BASE_PLATFORM. It also insert a random sized padding (at most 256 bytes) between those data and the arrays passed to userspace (argv[] + environ[] + auxv[]) as defined by ABI. Adding random padding around AT_RANDOM, AT_PLATFORM, AT_BASE_PLATEFORM should be viewed as an exercise of cargo-cult security as I'm not aware of any attack that can be prevented with this mechanism in place. Regards. Yann Droneaud (3): binfmt/elf: use functions for stack manipulation binfmt/elf: align AT_RANDOM array binfmt/elf: randomize padding between ELF interp info fs/binfmt_elf.c | 110 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 24 deletions(-)