From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29B0AC433EF for ; Tue, 15 Feb 2022 16:07:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 909EE6B007B; Tue, 15 Feb 2022 11:07:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B9DB6B007D; Tue, 15 Feb 2022 11:07:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75AAA6B007E; Tue, 15 Feb 2022 11:07:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 684B96B007B for ; Tue, 15 Feb 2022 11:07:36 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 39F9922D7F for ; Tue, 15 Feb 2022 16:07:36 +0000 (UTC) X-FDA: 79145494512.05.6EB1DFD Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf31.hostedemail.com (Postfix) with ESMTP id C3CE52001B for ; Tue, 15 Feb 2022 16:07:35 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id d9-20020a17090a498900b001b8bb1d00e7so2523115pjh.3 for ; Tue, 15 Feb 2022 08:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9F1cZHityGGoWBhfQ6coBOoN6sLDbcrG5DsSqFvaDqU=; b=QerMelEYY6ZDyyl1cI/YVp6a+3AiRTY9PXCnsmnFgeUeqOfD0RdHc1oShO5TFk3a1e reRp5IdzoSDGiTUW0TUs9obthAaR6Fd7ALoGIVLN+mzEsNiFaBatztWhabOU5Mdkco4q B/zJoBvoW6A94AVKVgT4SIX+4LVEqROqThJII= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9F1cZHityGGoWBhfQ6coBOoN6sLDbcrG5DsSqFvaDqU=; b=g36S/xSLGAa5jmN5lQtQx0+ZzOftyxbpP0eSz/2ll7qT2my92hqh48IFJb9m53WuO0 ZYQLlDrhvMU1JmMFVMu8ypf0HqkPpc/wqrU0Bi3bsA4K5S0McDk/P/4jBaC/nNS57Vsb phQ6uoEiEzMOrVPzrvTY1K3YuHYBDt7avjmNbMty265x9i8eT+nVHDmqDNxSA9xIGpCz fFfR+udEyIhZsg6vxgjMp0YC23+gj5n9aqsKZdGDgEy/8YGNtuxZnW7usNRM0qhxslaL AaeHXTmRRyse9eoE8iUyaDiqRX41c3ZLF2MxKxsvHDSForM6uzNOm2YkCB0IwAvLD3kf 8Xjw== X-Gm-Message-State: AOAM531rh7qXEuWAPF1TvsfmP4XttNoPuJfheGjtv+sjE6tsqaSQn8vk rwmO+1SiQEL97OiWpOpoa/1FMw== X-Google-Smtp-Source: ABdhPJy9XUFQBS9qoJ92jrgPj0aOGN3xbqhE/n4oek8xKKJdVkIpgUPawPDOLHN99L+h2PeDtK1eNw== X-Received: by 2002:a17:902:b413:: with SMTP id x19mr5046708plr.103.1644941254817; Tue, 15 Feb 2022 08:07:34 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n29sm2964422pgc.10.2022.02.15.08.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 08:07:34 -0800 (PST) Date: Tue, 15 Feb 2022 08:07:33 -0800 From: Kees Cook To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Andrew Morton , "James E.J. Bottomley" , Helge Deller , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v4 00/13] Fix LKDTM for PPC64/IA64/PARISC v4 Message-ID: <202202150807.D584917D34@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QerMelEY; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf31.hostedemail.com: domain of keescook@chromium.org designates 209.85.216.53 as permitted sender) smtp.mailfrom=keescook@chromium.org X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C3CE52001B X-Stat-Signature: btwkq45cnq61yrohyyew488koouzptj9 X-HE-Tag: 1644941255-150280 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Feb 15, 2022 at 01:40:55PM +0100, Christophe Leroy wrote: > PPC64/IA64/PARISC have function descriptors. LKDTM doesn't work > on those three architectures because LKDTM messes up function > descriptors with functions. > > This series does some cleanup in the three architectures and > refactors function descriptors so that it can then easily use it > in a generic way in LKDTM. Thanks for doing this! It looks good to me. :) -Kees > > Changes in v4: > - Added patch 1 which Fixes 'sparse' for powerpc64le after wrong report on previous series, refer https://github.com/ruscur/linux-ci/actions/runs/1351427671 > - Exported dereference_function_descriptor() to modules > - Addressed other received comments > - Rebased on latest powerpc/next (5a72345e6a78120368fcc841b570331b6c5a50da) > > Changes in v3: > - Addressed received comments > - Swapped some of the powerpc patches to keep func_descr_t renamed as struct func_desc and remove 'struct ppc64_opd_entry' > - Changed HAVE_FUNCTION_DESCRIPTORS macro to a config item CONFIG_HAVE_FUNCTION_DESCRIPTORS > - Dropped patch 11 ("Fix lkdtm_EXEC_RODATA()") > > Changes in v2: > - Addressed received comments > - Moved dereference_[kernel]_function_descriptor() out of line > - Added patches to remove func_descr_t and func_desc_t in powerpc > - Using func_desc_t instead of funct_descr_t > - Renamed HAVE_DEREFERENCE_FUNCTION_DESCRIPTOR to HAVE_FUNCTION_DESCRIPTORS > - Added a new lkdtm test to check protection of function descriptors > > Christophe Leroy (13): > powerpc: Fix 'sparse' checking on PPC64le > powerpc: Move and rename func_descr_t > powerpc: Use 'struct func_desc' instead of 'struct ppc64_opd_entry' > powerpc: Remove 'struct ppc64_opd_entry' > powerpc: Prepare func_desc_t for refactorisation > ia64: Rename 'ip' to 'addr' in 'struct fdesc' > asm-generic: Define CONFIG_HAVE_FUNCTION_DESCRIPTORS > asm-generic: Define 'func_desc_t' to commonly describe function > descriptors > asm-generic: Refactor dereference_[kernel]_function_descriptor() > lkdtm: Force do_nothing() out of line > lkdtm: Really write into kernel text in WRITE_KERN > lkdtm: Fix execute_[user]_location() > lkdtm: Add a test for function descriptors protection > > arch/Kconfig | 3 + > arch/ia64/Kconfig | 1 + > arch/ia64/include/asm/elf.h | 2 +- > arch/ia64/include/asm/sections.h | 24 +------- > arch/ia64/kernel/module.c | 6 +- > arch/parisc/Kconfig | 1 + > arch/parisc/include/asm/sections.h | 16 ++---- > arch/parisc/kernel/process.c | 21 ------- > arch/powerpc/Kconfig | 1 + > arch/powerpc/Makefile | 2 +- > arch/powerpc/include/asm/code-patching.h | 2 +- > arch/powerpc/include/asm/elf.h | 6 ++ > arch/powerpc/include/asm/sections.h | 29 ++-------- > arch/powerpc/include/asm/types.h | 6 -- > arch/powerpc/include/uapi/asm/elf.h | 8 --- > arch/powerpc/kernel/module_64.c | 42 ++++++-------- > arch/powerpc/kernel/ptrace/ptrace.c | 6 ++ > arch/powerpc/kernel/signal_64.c | 8 +-- > drivers/misc/lkdtm/core.c | 1 + > drivers/misc/lkdtm/lkdtm.h | 1 + > drivers/misc/lkdtm/perms.c | 71 +++++++++++++++++++----- > include/asm-generic/sections.h | 15 ++++- > include/linux/kallsyms.h | 2 +- > kernel/extable.c | 24 +++++++- > tools/testing/selftests/lkdtm/tests.txt | 1 + > 25 files changed, 155 insertions(+), 144 deletions(-) > > -- > 2.34.1 > -- Kees Cook