Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754106AbdHIRH6 (ORCPT ); Wed, 9 Aug 2017 13:07:58 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:35553 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752934AbdHIRH4 (ORCPT ); Wed, 9 Aug 2017 13:07:56 -0400 MIME-Version: 1.0 From: Kees Cook Date: Wed, 9 Aug 2017 10:07:54 -0700 Message-ID: Subject: new ELF marking To: LKML , binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 896 Lines: 30 Hi, I'd like to be able to mark an ELF binary in such a way that Linux's binfmt_elf.c will collapse a PIE text area into the mmap region (currently they are separately randomized in memory). This is desired by AddressSanitizer to avoid having an ASan-built binary have its text area moving into an unexpected location[1] (ASLR is still desired, but doesn't need to have a PIE/mmap split). I see a few ways: - Add parsing for NOTE program headers and add a new NOTE type (NT_GNU_EXEC_FLAGS), though notes tend to be strings... - Add a new Program Header (GNU_EXEC_FLAGS), which is similar to how GNU_STACK and GNU_RELRO were handled. This could sort of be like NOTE except just lots of bit flags. - Use a filesystem xattr. This is fragile, in the case of copying binaries between systems or filesystems. Thoughts? -Kees [1] https://lkml.org/lkml/2017/8/7/770 -- Kees Cook Pixel Security