Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp249548rwi; Tue, 18 Oct 2022 17:14:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BUyphY/V3+YbY/nzSbSfJOnmnhmB3Reh+oIEEn48vxU/aH5+C710WLF+owdBWJDJVTAl9 X-Received: by 2002:a17:906:8a61:b0:78d:9d00:c906 with SMTP id hy1-20020a1709068a6100b0078d9d00c906mr4506180ejc.321.1666138484774; Tue, 18 Oct 2022 17:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666138484; cv=none; d=google.com; s=arc-20160816; b=g80oG92Kz9hHEklRwqsE4yr7c0H3yO+iXbyAwpYRYzyWY5OdKviHkCau4dBAtKSDEl KDIQqFDXVDaY5QUeE3SXFCmfbXzgdpFhnsimXhJb4FscQBZTbjPsZJM8rcibw9DT4idD AE3HtE5rMIIB+63eVRZiuYdzTv2nlvm8G67lqitLf9gYjwTetXqm2DvRFO5wbtXtS2WU x5LU6H0d0tad9rPefS5eoexZK28i9ue+XOTSWAf3t2hJiX0KnDuMA5BBXNW8KTcrdMn2 /DK/HVSiJkh1dSTRfL2nOWF8cXI9oBMzp0SV2Yci9kBpDFC3Cq9Z5+s7dYe1jgyW/P2g +BFg== 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=BWfesYHBhFY+Es4d5ktnPUJKX1aCal8LpLvdxDCKubI=; b=mI9HVzYYDxu3JTjIvvNVk3f8cgEeRtzq/9vdnbRNPssmyMUEYUIWjEuMMe9AMZunaE TtD4MwPTDQsXv+7RAoMoVOIShXxqVU0JMO87fTsBV5ZNCeqVWLh9MyQhvnKR34OPE3De NEyZPj9WzdzyEcBEXNak1gNMpYYl+9UqjUwHb1sOI7J7qUuu4srfUipHqUltMroFfg1V UFWadSIEqObop/XRGR91Ol/ti5zxN88rl9CBtqDoIkkjxE6m5qKhYTKOmy+5fvOnc0l8 bmtxM2T4P0FVmgDfrcZ3/BbSgmsrW26xPVOlz3Xp9f1XLmLeBQJ+va8Nt3RL58RyiorB qDgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="X+vz/mWH"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cb17-20020a0564020b7100b00459c448d32csi11269630edb.446.2022.10.18.17.14.18; Tue, 18 Oct 2022 17:14:44 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b="X+vz/mWH"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbiJRXb4 (ORCPT + 99 others); Tue, 18 Oct 2022 19:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiJRXby (ORCPT ); Tue, 18 Oct 2022 19:31:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CEFC9DDBD for ; Tue, 18 Oct 2022 16:31:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E4B1BB82111 for ; Tue, 18 Oct 2022 23:31:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52988C433D7; Tue, 18 Oct 2022 23:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666135910; bh=i7Rf7RuijYT+A1PrKXXj3WcVpmSNBggwpTrcljWZx70=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X+vz/mWHf1dXlJwO2qkfWQCFvUqf3CCY4IM05lcrxhlnQXcbGYha96wnS51nzXDJV mAGjrIZCQGh3Dh5LpLfqI2xwMCe+ORmMac4dlM3MSE+GZPf8Hql9gOsrA4iA4E/fD8 qOM0eFEJiBn+jOT0MBSrnyTzlmm4+dzsJxlgycJp7NqH6lXmHF4etTlTI25IiwlzwS fWyJ+KUdbLyKsOZK7GQ0SDFsNXicQH3CMYWdPoijc5xwf3hV3cJcXO9sjCYakrrfEZ URzBQduygsfm4REFTyx+5CWO5ujnP6YnQBMp8q7gXt+HW30CpvvgcWpEgJe1nGD7xJ 9i4mLpe4Fo3Qg== Date: Tue, 18 Oct 2022 16:31:48 -0700 From: Josh Poimboeuf To: Peter Zijlstra Cc: Kees Cook , x86@kernel.org, Sami Tolvanen , Joao Moreira , linux-kernel@vger.kernel.org, Mark Rutland , Josh Poimboeuf Subject: Re: [PATCH] x86/ibt: Implement FineIBT Message-ID: <20221018233148.lgoiis2tws7caw3l@treble> References: <202210181020.79AF7F7@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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, Oct 18, 2022 at 09:56:36PM +0200, Peter Zijlstra wrote: > On Tue, Oct 18, 2022 at 11:09:13AM -0700, Kees Cook wrote: > > > +config FINEIBT > > > + def_bool y > > > + depends on X86_KERNEL_IBT && CFI_CLANG > > > + select CALL_PADDING > > > > To that end, can we please make this a prompted choice? > > How about something like so instead? > > --- > Subject: x86/cfi: Boot time selection of CFI scheme > From: Peter Zijlstra > Date: Tue Oct 18 21:50:54 CEST 2022 > > Add the "cfi=" boot parameter to allow users to select a scheme at > boot time. > > Signed-off-by: Peter Zijlstra (Intel) > --- > arch/x86/kernel/alternative.c | 103 +++++++++++++++++++++++++++++++++--------- > 1 file changed, 83 insertions(+), 20 deletions(-) > > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -702,6 +702,47 @@ void __init_or_module noinline apply_ibt > #endif /* CONFIG_X86_KERNEL_IBT */ > > #ifdef CONFIG_FINEIBT > + > +enum cfi_mode { > + CFI_DEFAULT, > + CFI_OFF, > + CFI_KCFI, > + CFI_FINEIBT, > +}; Is there a reason not to default to FineIBT if the hardware supports it? If we're going to give the user choices then my previous rant about documentation still applies: https://lkml.kernel.org/lkml/20220503220244.vyz5flk3gg3y6rbw@treble -- Josh