Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3085130iob; Mon, 16 May 2022 12:44:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/a7lO0V47af8Z6Hq1Y44H+CwLmxl/Ih++cr3+gaEHJC+xraNIslEeuCE69ysZusUzbAvT X-Received: by 2002:a17:907:6e28:b0:6f4:6428:6ee8 with SMTP id sd40-20020a1709076e2800b006f464286ee8mr15833732ejc.608.1652730275229; Mon, 16 May 2022 12:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652730275; cv=none; d=google.com; s=arc-20160816; b=xauoGalldsSW74GQCWSFs4B67lUMS8yLulc6Bh8KZhvfjhOM9yo+FYyclCZG39SjRR tL0fnGXv/NvT7X6UXf4u6ilaHhgqOLmAhHrzh/wC+nvm3mA0r3Y8oC+inl147CiZ7PrK b5Y8JGAQrVTCgTEreenURY9Ply779U6Ky0dLWXxf1/dPqsWQsctMvEJJ3+ai/AfKS+eY xrYGhYIrdLFolFzhFaqU/RoAqmo6jd0WUn1VOVjIQvCx4zT2Tt4WNWAm8YnjC28RWbe0 77PpEUhkCCHFEJ2nMV1gRTZToXlpH7WTUYTW2FKDnqG2Nw72izOn99ENnaKW5hTrhiXY B7Fw== 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=yTJ/JqBThBUULFI/eq0KMUagYlEy+U8Gm8DCXUOLqI4=; b=gIPoR+Z2ZFdA5k7VE1ISdTmbsXsPGeM38cAjwxPOJ3xKOWYxqfHpAORXpi06JXwhpl 16Ks27gvlvxNaY446DXXz2qpqOhDI8jK4xMYA9OQdr9SDvW6uEIPst7A8CT60rM5HaIb C2R8NM7m26IIrWoxD8z8xcMcb7Hdx5VX26Gsol1EJsIVkLgYpBhJ8usIdeWhVgQ1edEg bNPJe9F4R1Nt8Sar00TzfqFb7EhPv3JAXbmaoycYvVVYfKcousCgzRw0jw1x5AL1czlL 2Br7/acbN5VdJCjwb/iWtEraMXcUy3XVa83fDO0lIA3dh503oW5m2KQ1NlI2bmiajY6o 1NYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Nj4rFH2i; 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 hp6-20020a1709073e0600b006f3af36fea2si286201ejc.362.2022.05.16.12.44.09; Mon, 16 May 2022 12:44:35 -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=@chromium.org header.s=google header.b=Nj4rFH2i; 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 S234005AbiEODlv (ORCPT + 99 others); Sat, 14 May 2022 23:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235650AbiEODll (ORCPT ); Sat, 14 May 2022 23:41:41 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 399CD65CA for ; Sat, 14 May 2022 20:41:40 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so11258816pjq.2 for ; Sat, 14 May 2022 20:41:40 -0700 (PDT) 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=yTJ/JqBThBUULFI/eq0KMUagYlEy+U8Gm8DCXUOLqI4=; b=Nj4rFH2iGcDCRWm7En8MMB9PlgCsyGVxQAPs7BMHVclQ27z31PBw6Dxdm3IvfWzPAV L7mSdonC/7b1wN1otPDwe1wD51BlBkiLnb6TRuJ8hkgKwbPpocmSPsCRB/70parsHMgc 4ME6hu5g6TfCBsYNyr2rW8AOj4lsDpFe7p17c= 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=yTJ/JqBThBUULFI/eq0KMUagYlEy+U8Gm8DCXUOLqI4=; b=wB8TmYOoKZrHkHoXSBnlzOmoe3gzcWubr+a4c3dOoLgKN6k34mbKhqciFjkD56RN8o ZVFa7eC5oVjxaGCHfwq+KR8YwV0yU8T6CfQDjgy+KOwWlVgCWAPoGd18VT5qvvEh5sGH 8+bPQ6i+fMtNT8MpvkXS8PIiZWkIAWnZsnyAszbBPpTZM+bDYl7Ly26feltegXPcYJ8j KY+gkKGjK4RIZV1mPW1JLXgF6BnfxJqWjtavNGEyr04JPBLPlzDFgdsobT6Zn6ICbJ1H 7r4rgfVInuwY7aQrR9py9wt3dKPrw5eXw5PTkq6CROGXmuFnON+GLJxX2ED2u+dQoIBE nNcg== X-Gm-Message-State: AOAM531f0wDDi4PfzvwZ50i8WQ0qKyDPl95IgW5hhh/lUuDT+sg8oqCW EABBjVdeAdDXBGZxsuDWAGin5g== X-Received: by 2002:a17:90b:1251:b0:1d7:f7ae:9f1 with SMTP id gx17-20020a17090b125100b001d7f7ae09f1mr24122359pjb.65.1652586099705; Sat, 14 May 2022 20:41:39 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id cu8-20020a056a00448800b0050dc76281b3sm4375942pfb.141.2022.05.14.20.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 20:41:39 -0700 (PDT) Date: Sat, 14 May 2022 20:41:35 -0700 From: Kees Cook To: Sami Tolvanen Cc: linux-kernel@vger.kernel.org, Josh Poimboeuf , Peter Zijlstra , x86@kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Joao Moreira , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev Subject: Re: [RFC PATCH v2 06/21] cfi: Switch to -fsanitize=kcfi Message-ID: <202205142031.A3322C75@keescook> References: <20220513202159.1550547-1-samitolvanen@google.com> <20220513202159.1550547-7-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220513202159.1550547-7-samitolvanen@google.com> X-Spam-Status: No, score=-2.7 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=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 Fri, May 13, 2022 at 01:21:44PM -0700, Sami Tolvanen wrote: > Switch from Clang's original forward-edge control-flow integrity > implementation to -fsanitize=kcfi, which is better suited for the > kernel, as it doesn't require LTO, doesn't use a jump table that > requires altering function references, and won't break cross-module > function address equality. > > Signed-off-by: Sami Tolvanen Looks good on arm64 with LKDTM, too: [ 96.904483] lkdtm: Performing direct entry CFI_FORWARD_PROTO [ 96.904718] lkdtm: Calling matched prototype ... [ 96.904829] lkdtm: Calling mismatched prototype ... [ 96.905250] CFI failure at lkdtm_CFI_FORWARD_PROTO+0x54/0x94 [lkdtm] (target: lkdtm_increment_int+0x0/0x20 [lkdtm]; expected type: 0x7e0c52a5) Tested-by: Kees Cook -Kees -- Kees Cook