Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4829742iob; Mon, 9 May 2022 02:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSzYgoHy/FLIwqrcedDAj04gaSbXgZ24juLlFr3+5I+XOVERrjYeR2G0PnMRgtNy7Vx1Zz X-Received: by 2002:a05:6a00:9a2:b0:505:974f:9fd6 with SMTP id u34-20020a056a0009a200b00505974f9fd6mr15152341pfg.12.1652089029360; Mon, 09 May 2022 02:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652089029; cv=none; d=google.com; s=arc-20160816; b=FF/lVVllJKXjDEQd9ddDJi3dlH58dQtPJJ8fMSoiz3uhWHi4KD02K/YCnt9+2dIn/f u2MYtH3sx6BR103B/G5XHPr7QzaduK8UiKx4Nn6ia7LBnGFwW7NejXq/vo95dk1jVNsC 8qaI0CosD/blOCDNzyitAV75yOu4uril7Byy4fxPx9bao3qy81h3vS+/UsQgTWV2UBG5 X/pk+W8m5rP1fwzXkMDt3tnuuhRzkdGrsuIzub8lbbswPZZB4/eMOJWWp6eKpSBICBXv mc0NIF+tLp7DzUFX5ddhEtnTiDkWxOb5o8fkelSQmkALhhZ8svgROyN5yXw6k0fmYJOU eOmw== 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; bh=jCMryL4m9TtInHhfVICHS2tOhQeIqpek6EbDYStsjVk=; b=Ni80C9OC//Qn1TFbFA9jG4zc/vY+FYugz4JPEeidlZQT5luL0hHyCx95hlCg6PtmSX +m9ufX9WXKlht4um8rH9Xk4oXYvAd65995MCMp+5jlPFxm8ZnafsW3AuBSfMEIU9VyBX KAmY8BNnOsGssbLi7PLG2g7Z8WQVZ4OGzjCpGLvHVI6xlwBxBN7wO2+DKDXwOPXIm0IU +us/FKMnuGkK+4edq31OIMf1pRY8TcUMdMgR01VDSfNl0JmGB/I7zMKRt5DObqVS6s2L BRrnKGID5LV1lnv3QjQ0wNulVVaaM5hZ8ta/QBEIUdSEaFCh8mMfB0VfgdyuUyPKspjK +U3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i185-20020a6387c2000000b003c6a5d55413si5490626pge.114.2022.05.09.02.37.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:37:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4B9821ED281; Mon, 9 May 2022 02:23:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382962AbiEESG4 (ORCPT + 99 others); Thu, 5 May 2022 14:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382959AbiEESGz (ORCPT ); Thu, 5 May 2022 14:06:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 04B0D53E32; Thu, 5 May 2022 11:03:15 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BDD20106F; Thu, 5 May 2022 11:03:14 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.38.147]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A0C0E3FA31; Thu, 5 May 2022 11:03:12 -0700 (PDT) Date: Thu, 5 May 2022 19:03:08 +0100 From: Mark Rutland To: Sami Tolvanen Cc: LKML , Kees Cook , Josh Poimboeuf , Peter Zijlstra , X86 ML , Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers , Joao Moreira , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-arm-kernel , llvm@lists.linux.dev Subject: Re: [RFC PATCH 10/21] treewide: Drop function_nocfi Message-ID: References: <20220429203644.2868448-1-samitolvanen@google.com> <20220429203644.2868448-11-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, May 05, 2022 at 09:51:39AM -0700, Sami Tolvanen wrote: > On Thu, May 5, 2022 at 9:30 AM Mark Rutland wrote: > > I also believe that in most cases we can drop the __nocfi annotation on callers > > now that we can mark the called assembly function with SYM_TYPED_FUNC_START(). > > Good point, thanks for pointing that out. I'll add these to the next > version of the series. Also, I *think* we can drop __nocfi from __init, and always check calls to functions in .init.text. IIUC we made those __nocfi because it leads to section mismatches, and dangling entries in the jump tables after we discarded the init text, neither of which should be a problem with kCFI. Unfortuantely, that appears to be masking some existing type mismatches; e.g. psci_dt_init() blows up because it uses the wrong type for its callees (a mismatched `const`). With that fixed up, arm64 boots fine. > > There' a latent bug here with the existing CFI scheme, since > > `kpti_install_ng_mappings` isn't marked with __nocfi, and should explode when > > calling `idmap_kpti_install_ng_mappings` via the idmap. > > The CONFIG_UNMAP_KERNEL_AT_EL0 version of kpti_install_ng_mappings is > marked __nocfi Ah, so it is. Sorry for the noise! > > There' a latent bug here with the existing CFI scheme, since > > `machine_kexec` isn't marked with __nocfi, and should explode when calling > > `cpu_soft_restart` via the idmap. > > But it's indeed missing from this one. Cool; I'll prep a patch that fixes just this, then. Thanks, Mark.