Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp2099224rdb; Sun, 21 Jan 2024 07:23:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsPhm5uwzC2fpb6MxXNhO/l4qw3b6eApCgAnTsfdObANyHvWlSeF2lYZyBnuDOvGnZvArW X-Received: by 2002:a62:6504:0:b0:6db:da3f:9e00 with SMTP id z4-20020a626504000000b006dbda3f9e00mr220653pfb.50.1705850630155; Sun, 21 Jan 2024 07:23:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705850630; cv=pass; d=google.com; s=arc-20160816; b=JSk9oQ8SW1jxjaoSAKmwvELDdymF/KgeNGAHF/b3WPdHHwb/TWaOYmYa05msG+uTDK brs81WMaAwN6GEkfxG7LEnvYjFpEa9kg36WTkm/djuh83jiFT6w6t2eqtGH/3wpjKJqr SfOdWxd8qou5Wpn7HXW6RcLD4v3hwtlVoNmMacZhaUQCptJFU6IUudruCXWBacBCn8xB 76rnUFX0Vm7k8BEKVc6GUfhbmqUB8g6IFiscUOcFSUXzk10HxExu3G5iREg/7UxV2X9T tTbcdyQdUIJNNZnXaT2OrNmA9NhvnzRvOUm0OprTbJYIgab0issnRAladC/tcLk2czBi 3yyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=TfpPJ+cfp09qff8AJoxqyqerqhtNA4QExDPHxkFl/V0=; fh=Ppw9ONTWZQxgN/oiAi2i88pY0+LSdALTUO1C9IKGe8w=; b=y7KP3HPQsliufE7MpkAxxP00CXmSebl/VMyJwXf93UNnyaozAhUG/ROQ/XPhjqVu4f bDbVuMp3KIY4AECknKISFEM+WK8yzWJiYENEPHHmkV8ttGlrdOUdtzAVvdTM5hfbvPIo fTpT1QsQpOXyriKIswFYs8VygEish55T8CNq+PGLfEz75As+beYhE9RyBpvFhsHcepe3 o6XNO2wqYcBnvqPR+o7POj+iSre5beAFT9xt5mRsdfJPpnjOiSLJnpbl52Bmfay7c8yy V0rpyVN7UjBtGL3lPZ/amGdo63+qAb3QZBPK29fJ41RZvuVn5Z3bdr/t1pAL0oyA/bek xaQA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e26Lo+Cx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32081-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q14-20020a056a00088e00b006d9ab7034cfsi9286920pfj.131.2024.01.21.07.23.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 07:23:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32081-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e26Lo+Cx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32081-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BAF69281C8B for ; Sun, 21 Jan 2024 15:23:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16960376E3; Sun, 21 Jan 2024 15:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e26Lo+Cx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F00682EB19 for ; Sun, 21 Jan 2024 15:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705850621; cv=none; b=I1zmfnJR4PbOFOhv1eEutUfdY0YN3w9TteCexlP3sHXoojorDy/+eQ/aU2I2hoPfRgcHxpSubYyihQ7b1pLp0XJoetNWXnsRRb7QpKNzJ7HFY6E40sq7tyH0BoBK8CQBPd4CmQu653q4YqlgHAkuW5ZDV3osJm220eO1Gg/YVE8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705850621; c=relaxed/simple; bh=ZwcDC2Zn8owVk+p5ZZRsu7MNXT2ErpX+qzUlu6bk/vQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=H7djTgNIvLaw41aDMZlvGvbFdABkMlnqp3nSakNgMZ16m0ynRBfUk618ODzSTn+lH+cA4N0Ze921n06Kwv9ALqsBwMhhA/r9+H+iHoobUtt60EGO5AA+AgAM13CYE+/OC7NbKUuyKqb9p1CnFaoK/AMXJd4BBkjOQg1/slPHy0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e26Lo+Cx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13794C433C7; Sun, 21 Jan 2024 15:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705850620; bh=ZwcDC2Zn8owVk+p5ZZRsu7MNXT2ErpX+qzUlu6bk/vQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=e26Lo+CxZF3GUS4gF0wtqguwOrTOz5xSZBMwHtXyMAExyVjyQW6yPYJoNCK5vn7ik RB4ceRLq2hvcWKV6bFAHolQpbzW69o6B7gbmIHONXMZ2FL9TTtOUY3qeGSqImh7CsC 1Z/ES6IcZFGPuSBH49DKcWJBDPOXm03cb8EKQmIlVmjgOfWv25T4DwL+3QVWj2o5uR xk7mUqW4x8KGRkSODbIbCn/J04Pv8oCALfnhwPuucsi3YB5v74p0LgAq2L6xDi59Ae rSlozA+bQ0KyqeFDleNPxTL7Po3Q4OzouqeQj3+Rkx97KV478IoY+/0d6rqVsytDz0 XabeXBHemOyQA== Message-ID: Date: Sun, 21 Jan 2024 16:23:35 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -tip v2] x86/kprobes: Drop removed INT3 handling code Content-Language: en-GB, fr-BE To: "Masami Hiramatsu (Google)" Cc: Steven Rostedt , x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , linux-kernel@vger.kernel.org, Huacai Chen , Jinyang He , Tiezhu Yang , "Naveen N . Rao" References: <166981518895.1131462.4693062055762912734.stgit@devnote3> <06cb540e-34ff-4dcd-b936-19d4d14378c9@kernel.org> <20240120170517.5cadbc20@rorschach.local.home> <20240121112852.381ebd7bf37ea6d2236db9f2@kernel.org> <20240121180544.8c663977651d2a18291318d5@kernel.org> From: Matth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81R1L1q3swaEuh95vWj6iskxeNWSTyFAVKYYVskG V+OTtB71P1XCnb6AJCW9cKpC25+zxQqD2Zy0dK3u2RuKErajKBa/YWzuSaKAOkneFxG3LJIv Hl7iqPF+JDCjB5sAEQEAAcLBXwQYAQIACQUCVeP56QIbDAAKCRD2t4JPQmmgc5VnD/9YgbCr HR1FbMbm7td54UrYvZV/i7m3dIQNXK2e+Cbv5PXf19ce3XluaE+wA8D+vnIW5mbAAiojt3Mb 6p0WJS3QzbObzHNgAp3zy/L4lXwc6WW5vnpWAzqXFHP8D9PTpqvBALbXqL06smP47JqbyQxj Xf7D2rrPeIqbYmVY9da1KzMOVf3gReazYa89zZSdVkMojfWsbq05zwYU+SCWS3NiyF6QghbW voxbFwX1i/0xRwJiX9NNbRj1huVKQuS4W7rbWA87TrVQPXUAdkyd7FRYICNW+0gddysIwPoa KrLfx3Ba6Rpx0JznbrVOtXlihjl4KV8mtOPjYDY9u+8x412xXnlGl6AC4HLu2F3ECkamY4G6 UxejX+E6vW6Xe4n7H+rEX5UFgPRdYkS1TA/X3nMen9bouxNsvIJv7C6adZmMHqu/2azX7S7I vrxxySzOw9GxjoVTuzWMKWpDGP8n71IFeOot8JuPZtJ8omz+DZel+WCNZMVdVNLPOd5frqOv mpz0VhFAlNTjU1Vy0CnuxX3AM51J8dpdNyG0S8rADh6C8AKCDOfUstpq28/6oTaQv7QZdge0 JY6dglzGKnCi/zsmp2+1w559frz4+IC7j/igvJGX4KDDKUs0mlld8J2u2sBXv7CGxdzQoHaz lzVbFe7fduHbABmYz9cefQpO7wDE/Q== Organization: NGI0 Core In-Reply-To: <20240121180544.8c663977651d2a18291318d5@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Masami, Steven, On 21/01/2024 10:05, Masami Hiramatsu (Google) wrote: > On Sun, 21 Jan 2024 11:28:52 +0900 > Masami Hiramatsu (Google) wrote: > >> On Sat, 20 Jan 2024 17:05:17 -0500 >> Steven Rostedt wrote: >> >>> On Sat, 20 Jan 2024 18:44:38 +0100 >>> Matthieu Baerts wrote: >>> >>>> >>>> I'm sorry to reply on a patch that is more than one year old, but in >>> >>> No problem, I've done the same. >> >> Yeah, thanks for reporting! I realized the problem. Thank you both for your quick reply, very useful explanations, analysis and patch! (...) > So this another solution is already done. I think we need to add the > ghost INT3 check in the exc_int3() as follows; > > Thank you, > > From add8cf7da99cdb096a0d6765b3dc5de9a3ea3019 Mon Sep 17 00:00:00 2001 > From: "Masami Hiramatsu (Google)" > Date: Sun, 21 Jan 2024 17:16:50 +0900 > Subject: [PATCH] x86: Fixup from the removed INT3 if it is unhandled > > INT3 is used not only for software breakpoint, but also self modifying > code on x86 in the kernel. For example, jump_label, function tracer etc. > Those may not handle INT3 after removing it but not waiting for > synchronizing CPUs enough. Since such 'ghost' INT3 is not handled by > anyone because they think it has been removed already. > Recheck there is INT3 on the exception address and if not, ignore it. > > Note that previously kprobes does the same thing by itself, but that is > not a good location to do that because INT3 is commonly used. Do it at > the common place so that it can handle all 'ghost' INT3. I just tested it, and I was able to run pings for 3h without any issues! While at it, and just to be on the safe side, I also re-run the tests after having added a "pr_warn()" -- I know, using printk(), especially when talking to you... but I was not sure what was safe to use at this place in the code :) -- before returning "true" in the new function you added, and we can see that the crash is avoided thanks to the new code: [ 27.422518] traps: crash avoided, addr=18446744071882050317 [ 27.426182] traps: crash avoided, addr=18446744071882050317 [ 370.483208] traps: crash avoided, addr=18446744071882075656 [ 370.485066] traps: crash avoided, addr=18446744071882075656 [ 370.485084] traps: crash avoided, addr=18446744071882075656 [ 592.866416] traps: crash avoided, addr=18446744071882075656 [ 592.867937] traps: crash avoided, addr=18446744071882075656 [ 980.988342] traps: crash avoided, addr=18446744071882050317 [ 980.989866] traps: crash avoided, addr=18446744071882050317 (from my VM running with 2 CPU cores) Again, thank you for the fix! (Just in case you need it:) Tested-by: Matthieu Baerts Cheers, Matt -- Sponsored by the NGI0 Core fund.