Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1404218ybk; Thu, 14 May 2020 08:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwcDRcInQEK30o5qoSW2IgE43GzQ3/CXecAZfuuQfqL1AdttLOL+Qrtwz0+S8JmC0nHNiM X-Received: by 2002:a50:9e2a:: with SMTP id z39mr4518927ede.371.1589469060468; Thu, 14 May 2020 08:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589469060; cv=none; d=google.com; s=arc-20160816; b=EusHkKWzVTzXJ4NTAiDdCNxu6zjqegye06HplcPSUYza7PU8AWGsrsE87Ah4xppUX1 RUggQLFrAGkf7DnHshQWOXany74oDo/aX+CX9oE2/TSNx2ry7UNg8Cj20vKYKOfEMrFQ 85SW8mD3TOgJnLgK5L3a5DC7wjhzD7qjtALGJz66N22e22f7w5Ba4gTSPJwjp4pvcgO3 hEI/8QGROgpNCQvFTyIuG5MApUm3OTpyWR3Zna+DXe3ig7w0FKI1vBc2CYrWIZKqhoR2 Q5u1dlAfE0G1mFsw8vDJ6DAIq+lqdeatzSroVufG4XUmoU1E1xZZ091jlnNxhDuyfHZd q9wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=4GWceYLJdSvfpD/nEJEfI5ey8cVcCIdOsUccPiJ0f+g=; b=iWJ8/3iACc8TR9IZFKpRKVS6lSfHbs3guYcSeRuQ/6DCiugJdZo7BVWu3rkdmXX+V1 Nm81CNbmzWESKj8/ziLxjprN57CTEVMxL7AclR6G2yzRJKDvO1jg4stvAEEMk1kA4Fgj BMDleHZtx1nVJAdfq4fdzwf7FLPAyD5y15SviLcJobW6o0f2AzJd1ypqu3sCsbBNZgc2 zbLXihGx/RfBVDPW+fVHAkJIrrpmfQNJxrt0QVYfMN+t/OrOixISZUzmgj3jE/0J2+6Q AYSsjPjUR9DM226Wi1iLbHirQ61vKcCBvzQgXBO7Fp9nRpJ8JYLStjHJfxtuPGubANuC T+yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ZHpBqhG0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce21si1810985edb.297.2020.05.14.08.10.36; Thu, 14 May 2020 08:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ZHpBqhG0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgENPIv (ORCPT + 99 others); Thu, 14 May 2020 11:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbgENPIv (ORCPT ); Thu, 14 May 2020 11:08:51 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445C7C061A0C for ; Thu, 14 May 2020 08:08:50 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id q9so894062pjm.2 for ; Thu, 14 May 2020 08:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=4GWceYLJdSvfpD/nEJEfI5ey8cVcCIdOsUccPiJ0f+g=; b=ZHpBqhG0m51QPbBQAghcB7ijlWVcZJPoBgxlLqjhXfvHNcyjjE0ZeLxjz2LpkZaPSI wfl0maSFHqiH67JXXhCnUZ3tjLB4NubdlCMlUenRyVKFgeRck/51yRG2tu36+oxfV7nZ 6vQ5koZy5BvJmCIkqeuI9PJ79ql2l83G9qOpwERUi8j/QTscWO6vRPsfQ6AfVP5LSEGW 7lY/WVEBS7PNWMvC/HlBG0Pfzr7P6fH73Niyg3qT2NMaiJ1Z9JHiq2QPJrBSuiDO82jE 88DIjStmeJnA9xXJC8lNUf7s0doE706rROSri9ZaB9hKL2Rf4PrNL++m1IANj0RrOHAm TLHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=4GWceYLJdSvfpD/nEJEfI5ey8cVcCIdOsUccPiJ0f+g=; b=IDjRGIRP7bQppRwPblc+pbKRgIxpjf4kxWXcfKM6HGx+Ts5lA+BnTZ4dqkxNlQoCAG NuC659Nyl6PpOmarSuJLZ5OCfYt8VBddJF50QAeVFOF3pIZqLh3Mna7OhKzndInkKgIU /J6UYvTf0AMdKrdMcesy3y4pccnxghF+M6AbD5Gl5DIizwtyEatfUF+kb67WdTmL87s0 DS9F0cWzPKXT8zSqB8vkTHtH4SRpgOPyWNGWHa9Rs8YKjqFjTYhkMOMd6QjtBnYa1a+n VJwtgcjBB/7zweRRRDkxyTGM+rNNozVZ8Cv+qe4T9pY32Jnyx7hMd0gazbTQVuyK7L1l tUoA== X-Gm-Message-State: AOAM533xM1xCVTFRc8SoJK90LyytFyQTPQ9T8GU44awWd6QDZQTaqgFo N8GB20GLLHLs41ocXue8TS7R8A== X-Received: by 2002:a17:90a:f994:: with SMTP id cq20mr4309344pjb.52.1589468929278; Thu, 14 May 2020 08:08:49 -0700 (PDT) Received: from ?IPv6:2600:1010:b044:c0a6:fc3e:abd:d4e0:e1e4? ([2600:1010:b044:c0a6:fc3e:abd:d4e0:e1e4]) by smtp.gmail.com with ESMTPSA id p66sm2495160pfb.65.2020.05.14.08.08.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2020 08:08:48 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [patch V4 part 4 02/24] x86/int3: Avoid atomic instrumentation Date: Thu, 14 May 2020 08:08:46 -0700 Message-Id: References: <878shuzhcx.fsf@nanos.tec.linutronix.de> Cc: Peter Zijlstra , Andy Lutomirski , LKML , X86 ML , "Paul E. McKenney" , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon In-Reply-To: <878shuzhcx.fsf@nanos.tec.linutronix.de> To: Thomas Gleixner X-Mailer: iPhone Mail (17E262) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 14, 2020, at 8:06 AM, Thomas Gleixner wrote: >=20 > =EF=BB=BFPeter Zijlstra writes: >>> On Thu, May 14, 2020 at 02:51:32PM +0200, Thomas Gleixner wrote: >>> Peter Zijlstra writes: >>>> On Wed, May 13, 2020 at 09:57:52PM -0700, Andy Lutomirski wrote: >>>>> On Tue, May 5, 2020 at 7:15 AM Thomas Gleixner wr= ote: >>>>>>=20 >>>>>> From: Peter Zijlstra >>>>>>=20 >>>>>> Use arch_atomic_*() and READ_ONCE_NOCHECK() to ensure nothing untowar= d >>>>>> creeps in and ruins things. >>>>>>=20 >>>>>> That is; this is the INT3 text poke handler, strictly limit the code >>>>>> that runs in it, lest it inadvertenly hits yet another INT3. >>>>>=20 >>>>>=20 >>>>> Acked-by: Andy Lutomirski >>>>>=20 >>>>> Does objtool catch this error? >>>>=20 >>>> It does not. I'll put it on the (endless) todo list.. >>>=20 >>> Well, at least it detects when that code calls out into something which >>> is not in the non-instrumentable section. >>=20 >> True, but the more specific problem is that noinstr code can use >> jump_label/static_call just fine. >>=20 >> So a more specific test is validating none of that happens in the INT3 >> handler before poke_int3_handler(). Which is what I think Andy was >> after. >=20 > Indeed. Forgot about that one. >=20 > Hmm, alternatives and jumplabel patch locations in entry.text and > noinstr.text can be valid at least during early boot where we know that > we don't run those code pathes... Alternatives should be valid regardless. Isn=E2=80=99t the world essentially= stopped while we apply them? >=20 > Thanks, >=20 > tglx