Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35278855rwd; Mon, 10 Jul 2023 05:22:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHeuyXWwdG08EPjHEus0IWIOHn7rR+8nmJKL8oUmdhKpKGk3IZHwcSN/o4KNor4Spi6/cur X-Received: by 2002:a17:906:5354:b0:993:e9b8:90f4 with SMTP id j20-20020a170906535400b00993e9b890f4mr8177364ejo.8.1688991732563; Mon, 10 Jul 2023 05:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688991732; cv=none; d=google.com; s=arc-20160816; b=b0I8hfy5Zv1lZI1MtPbfTxHb2WB1GFEccTuh42l1UMvXUVhgXfzpf51hS+USp1EZ4Z N5+uDji0QrZKrjqpoIEmDA+kRZUvOk5bVwVGQDEId2eV3IQKXl6Cc31GngFPbUOvCKjW rOM8iP/TMPwSX/OS06FTR0DXVqYs4wNKw1BFt3ReBRZAAvSvfLqCsUYcOR1Ap553GQTc 0tZ9dzxb//o72aWQnrR3hBVMXThvx8oedBmcKAlUPl15mhkgzDeMpfBEwFhyqgNDOOO7 aAV/19NTRSNsiGcp7zKVFYCqDXlFU+K8DFwLWLAN7VQ67kbnhGrGC0zyFfkmbg8iH4Pl qKcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:subject:cc:to:from:dkim-signature; bh=FkEO1tqZ+27O7SSIoQS4r6u+s69zGccn3H8AHcTlJjk=; fh=B4q89xUy9DRjDdZZ7pfgA4xc0K5nMMNyHs2WNlwRQlk=; b=SyOBI48beOauEHN4+ijMvTRHU+7IJTYKhQn6voEQuvpTvCCkW1/+jDfw7g8Yw5hpLW kceOsLmQTsta9KOazC+xbQsoUjvtUvyrj9MRFdvVEIOgK3xlBbPDg1Eqva3gbKUp0J9K 6jS/tw2hz4j/QBHK2Xdfk0b+K+gSLbGS2yR678emd7oy9d9iE7tt6tS1RuNXx++7q94u JXUyc9r3URCvqtPZqUbHE1F0XWAkj0LdEyh1raMo/v/hmnent5zv3dICaP4lnlrjBc0J PPXwPHEE8P2AEfx6g7B3AFOWReCM9hwERCg6wSOH/aQNWZWHj3a61lcvVOS1ZPnQOJbh tAoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RPkV13vT; 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 z21-20020a170906715500b0098df1cbe2aesi9223410ejj.1008.2023.07.10.05.21.49; Mon, 10 Jul 2023 05:22:12 -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=RPkV13vT; 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 S230057AbjGJMOW (ORCPT + 99 others); Mon, 10 Jul 2023 08:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230361AbjGJMOV (ORCPT ); Mon, 10 Jul 2023 08:14:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1584DFE; Mon, 10 Jul 2023 05:14:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A466460FD8; Mon, 10 Jul 2023 12:14:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AA4DC433C7; Mon, 10 Jul 2023 12:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688991259; bh=uRmPflcHLfzXe1J+lIanercG5gxP43DJIKpzISbfov4=; h=From:To:Cc:Subject:Date:From; b=RPkV13vTx9RSPN6IsnCOgNJa7lL+jSuOu6XnuBUKqQSnWSJGpEyBGyTDuhwLx4m9f OZVmwKtBKxbAjl7EJ1XUM2V1m0iYpzLJNQtKQvu4L6Srb06PpS4N2INXWISV/XIVwu FJEbqcyyZHk8gWTacR2D+a8gXO3gV1QFG7UYSpBPSuL3panFFzQ3OlC4MXavabVCWI 4VwKcIH5rys1YJVIuEOWVBVoo5IRI2ew8NZf/9klFwZemUOGlUEPB26IyrvgQp7Rr5 10MEXBucYPfTS1HC9GjhDeKzC//b4DzuxKch5VQ2KgXl3R9Phr6wpciY+aaGemJyI1 dZemgE1cwp7yQ== From: "Masami Hiramatsu (Google)" To: Peter Zijlstra Cc: Petr Pavlu , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, samitolvanen@google.com, x86@kernel.org, linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Masami Hiramatsu Subject: [RFC PATCH 0/2] x86: kprobes: Fix CFI_CLANG related issues Date: Mon, 10 Jul 2023 21:14:13 +0900 Message-Id: <168899125356.80889.17967397360941194229.stgit@devnote2> X-Mailer: git-send-email 2.25.1 User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 Hi Peter, Here I tried to fix 2 issues discussed on the previous thread; https://lore.kernel.org/all/20230706113403.GI2833176@hirez.programming.kicks-ass.net/ - Prohibit probing on __cfi_* preamble symbols, which have the typeid. - Prohibit probing on compiler generated movl/addl which is used for detecting typeid on x86. I'm not sure how arm64 implemented, but it seems cfi_handler()@arch/arm64/kernel/traps.c just reads the registers for the typeid instead of decoding the instructions. I just build tested, since I could not boot the kernel with CFI_CLANG=y. Would anyone know something about this error? [ 0.141030] MMIO Stale Data: Unknown: No mitigations [ 0.153511] SMP alternatives: Using kCFI [ 0.164593] Freeing SMP alternatives memory: 36K [ 0.165053] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: start_kernel+0x472/0x48b [ 0.166028] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.2-00002-g12b1b2fca8ef #126 [ 0.166028] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 [ 0.166028] Call Trace: [ 0.166028] [ 0.166028] dump_stack_lvl+0x6e/0xb0 [ 0.166028] panic+0x146/0x2f0 [ 0.166028] ? start_kernel+0x472/0x48b [ 0.166028] __stack_chk_fail+0x14/0x20 [ 0.166028] start_kernel+0x472/0x48b [ 0.166028] x86_64_start_reservations+0x24/0x30 [ 0.166028] x86_64_start_kernel+0xa6/0xbb [ 0.166028] secondary_startup_64_no_verify+0x106/0x11b [ 0.166028] [ 0.166028] ---[ end Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: start_kernel+0x472/0x48b ]--- Thank you, --- Masami Hiramatsu (Google) (2): kprobes: Prohibit probing on CFI preamble symbol x86/kprobes: Prohibit probing on compiler generated CFI checking code arch/x86/kernel/kprobes/core.c | 34 ++++++++++++++++++++++++++++++++++ kernel/kprobes.c | 17 ++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) -- Masami Hiramatsu (Google)