Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp388254pxb; Tue, 15 Feb 2022 16:13:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5qDbyJTQrNJx6025myWOTdptRmHHv8RgPG22KCZDAHwzaa38nwUwiAJQr50QARfeDe/i+ X-Received: by 2002:a17:902:ea09:b0:14d:9644:6f03 with SMTP id s9-20020a170902ea0900b0014d96446f03mr349210plg.110.1644970402795; Tue, 15 Feb 2022 16:13:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644970402; cv=none; d=google.com; s=arc-20160816; b=lFzjVpMdFema6LXVacCda3Sujjq5j/Bw8HRAycCGt9JG493VUVP2FEGrQzHOZsGvoy ZMJwTzCgqwlWDDX6neoMZMuWRiGTRIdgRteANhV/wYUZ1HIjqeVUiL9ZjYMaDPWufzFq B3XYSvC/CSKyFEY4t0ctTkYrhGhJPQUQXbu+iiyRQF1kW0yWnKDtYONMOQDokb0v2+i0 BctPIFZpKsztXqnDNjB+U3kl3R7XgG90dUXutiqylaGjw+cRFu2oQihh51jN0afvHWKF ehvXP0FldDZE8Rm0kr7aBnynsMmbWLPM/yxBeBpaCXckWMXllH86NnFivzx+MVtDxHkM c7Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9F1cZHityGGoWBhfQ6coBOoN6sLDbcrG5DsSqFvaDqU=; b=wmFkQLxocLef/9EcCPm1SprJNR6ENpWv4YR0VTeC6DH29y5qVVZLYDWhrJjLnMdjxg Yh7LDVU+kl7lJmw/58b3iBHNsbVT+/Zyx9QDe0M++m99I8NAU3VZsp0tFgJHL7/V1jez Rb/VokaX0MKN0cfV7/YZ+GzSCRzKMcbLJypt1ckVmeOULTvXyrtfMBAoqNpm1G1JLt6B n+VriflPJ19u5zYDujAdxYwVgrXGs3UlTznC9vCkaLn+MoigscDDL5ppTTFFz7gYknte ofYJW3SAUSFfMKRezwGzawpp0gi0FgA96Fn19oTXHSkOQSPztqqb0KDHarOxEv1YQDhI ecuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QerMelEY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q132si4063881pgq.162.2022.02.15.16.13.07; Tue, 15 Feb 2022 16:13:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QerMelEY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239090AbiBOQHs (ORCPT + 99 others); Tue, 15 Feb 2022 11:07:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241306AbiBOQHp (ORCPT ); Tue, 15 Feb 2022 11:07:45 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 481F4DE92 for ; Tue, 15 Feb 2022 08:07:35 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id om7so17741056pjb.5 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=UuHo4huDG/g+8KnzR0JQ20OKXaQtQb9eub3jhPm/cee0IPqdhaj5LRGLpy5AjO6Fi8 pqdrhoxX2j4EbC6YwFYTC7+Kgt5fR57P3Al2oqrpGXBnndEkURJFacS647wAOi8zVpvH +EYMPj9LDwdfTU6KrxUyzMbaHvfsbIdKxKGDULsyyW0G669bpxdOSKck7FRp5UMlovUH YnD5UJXz784kDUKpEhjeTQnxzPuujkV+i4+Lv2VgYDS+er25VABnlrcRfytjmRL+Cop/ 1ldBcJDDbGZrLDhpmLYzyiuVWQnUpXYCc0jvtdHZXUzHNyqCZiHsH0BUtmrJ3uLvv3VW Twqw== X-Gm-Message-State: AOAM531oEDbvTQt60A/SsHJ9SxfOCZKUt2bdLbRqjt3hlwOPoUu9sR3m sxCqKxznku/6JwSKw3hNWiJZaw== 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: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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