From patchwork Tue Jan 15 18:58:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruslan Nikolaev X-Patchwork-Id: 10764999 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 2038514E5 for ; Tue, 15 Jan 2019 19:08:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EFAC2D887 for ; Tue, 15 Jan 2019 19:08:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 035E62C989; Tue, 15 Jan 2019 19:08:44 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 32D172D90A for ; Tue, 15 Jan 2019 19:08:42 +0000 (UTC) Received: (qmail 22289 invoked by uid 550); 15 Jan 2019 19:08:38 -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 11498 invoked from network); 15 Jan 2019 18:58:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1547578722; bh=UDbogFj/B62hIslut8veCoQk9mAPQDSK2geYHdtgfqs=; h=To:Cc:From:Subject:Date:From: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o9ELOhsMUR_eADMCXcf3x99rbbLaus60NTE0O WclD_k4btNaSzPaTd1Jb86x65lUVqrTEGJFsmYCydSBbsXUgHm16eskiDYWbnkD6.iS.DZk6IAAf xU5bFMq1rvIqjqWsfu8wRJYGTBOBSnpwDixnvwuBFvU.RCfnYcZnUykeLr2kGyoGRLlwH4vyevQd lxEsP_0ktKqgxf9t_YfOSGMGjCnCpXg7nwKVhbuYqhlJFI0xNoo9Ta7wq4f6Vf_0y5pyuj9wjQIe Kh8aiBv24XYPe.LvPrH1vVdQqucsYbe4flrHRHkL994NWh_NqO0TqF.wndzBLJ1a.5OqKxwOiPqe 37iR70K..2z3ewbyFUeqg8TSAjyQE84rv.CYTX51tLo_zPKriq_ATfqWCGliMFhqcczd6NwaFejI SBEmy_US4 To: kernel-hardening@lists.openwall.com Cc: thgarnie@google.com, x86@kernel.org, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, keescook@chromium.org From: Ruslan Nikolaev Subject: [PATCH v1 02/06]: Avoid using the same object file in the kernel and modules Message-ID: <3633bff2-d07d-e135-a583-6fada6bf7671@yahoo.com> Date: Tue, 15 Jan 2019 13:58:40 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-US X-Virus-Scanned: ClamAV using ClamSMTP Avoid using the same object file in the kernel and modules The patch is by Hassan Nadeem and Ruslan Nikolaev. This extends the prior PIE kernel patch (by Thomas Garnier) to also support position-independent modules that can be placed anywhere in the 48/64-bit address space (for better KASLR). Signed-off-by: Ruslan Nikolaev --- Makefile | 2 +- entropy_common_dec.c | 2 ++ fse_decompress_dec.c | 2 ++ zstd_common_dec.c | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff -uprN a/lib/zstd/entropy_common_dec.c b/lib/zstd/entropy_common_dec.c --- a/lib/zstd/entropy_common_dec.c 1969-12-31 19:00:00.000000000 -0500 +++ b/lib/zstd/entropy_common_dec.c 2019-01-15 11:22:25.688186400 -0500 @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 +#include "entropy_common.c" diff -uprN a/lib/zstd/fse_decompress_dec.c b/lib/zstd/fse_decompress_dec.c --- a/lib/zstd/fse_decompress_dec.c 1969-12-31 19:00:00.000000000 -0500 +++ b/lib/zstd/fse_decompress_dec.c 2019-01-15 11:22:25.688186400 -0500 @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 +#include "fse_decompress.c" diff -uprN a/lib/zstd/Makefile b/lib/zstd/Makefile --- a/lib/zstd/Makefile 2019-01-15 11:20:44.987165514 -0500 +++ b/lib/zstd/Makefile 2019-01-15 11:22:25.688186400 -0500 @@ -6,4 +6,4 @@ ccflags-y += -O3 zstd_compress-y := fse_compress.o huf_compress.o compress.o \ entropy_common.o fse_decompress.o zstd_common.o zstd_decompress-y := huf_decompress.o decompress.o \ - entropy_common.o fse_decompress.o zstd_common.o + entropy_common_dec.o fse_decompress_dec.o zstd_common_dec.o diff -uprN a/lib/zstd/zstd_common_dec.c b/lib/zstd/zstd_common_dec.c --- a/lib/zstd/zstd_common_dec.c 1969-12-31 19:00:00.000000000 -0500 +++ b/lib/zstd/zstd_common_dec.c 2019-01-15 11:22:25.688186400 -0500 @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 +#include "zstd_common.c"