Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp683142ybt; Wed, 17 Jun 2020 11:09:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8l6V2WqcSNE6a2tNDBD19v852v9raXp/Tf/8u+yWoz42g1KzmzKrLPAM+wPwNQwqjo2Gb X-Received: by 2002:a17:906:2bd8:: with SMTP id n24mr388522ejg.83.1592417344871; Wed, 17 Jun 2020 11:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592417344; cv=none; d=google.com; s=arc-20160816; b=WkdvF4F3/3BW0FKlEo/m0SnuSGuu+mHpCmKqKIeUQh8XZuG4qzrDaGmQjz8MO1ykm4 69nRxwXdCkDxAicEhUeZYYiVAXwalQi7zAtjXe7xcTrJOF6IQugjcSyKVV8rbDNGGS6Z nj2/ord+e1cPsgFZ9EyrWZ556Vr1/2Lutfaw44nluhYNTA+fI5mLZsR7BmOMh0XXwmmE D8i+dDLn0nOusNEMgtU8SPbxpZRiRl3QphKPq3OCAKcVe/v7+a+hGWrWJBy6YqzkUu2p Ke8GAzKbWEoI6yTvxf4g9GlU7r64r5hbaS/LgvhdunJH+IrzAuw261lwc94KFql033GN Hy/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yum1itbYwGCVmrfngXbrZP6sf+Nn+eNmWkfS6zoUuA0=; b=NF9YUO5q82ML/YC9iaLuE9Mi3E7oS5Ey8tkl6RdrwtWhLl2Bpezq7COMhxC3ORjZEt XPIZwSN01YZ/Ks5upna35YBCiFZ/9K3IERBzlsWLjWgP8j7MK6fWI4swVf3T0wF+4d0c H5iRYIgKbXGZTdZSgSY/vyhCgUe8+Fdbv+cZy1RAnMplUkgqIPrdmRuCjmYU/1sc7DLG DgWDDjz0Es3hTtXoRQv/3BecAsUPBr9Fx93f9aFXn1teVYP/FBmrHbGfiDuPFwlND9Y8 2c7hJIGLjNAJggqWW9mt9xnt9ooDGk6+Ezt2CrqPWrZuM2obBlCsOVdadLf9gX03fgc3 7k2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kNUKj3I5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si405057ejx.88.2020.06.17.11.08.41; Wed, 17 Jun 2020 11:09:04 -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=@google.com header.s=20161025 header.b=kNUKj3I5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727058AbgFQSGb (ORCPT + 99 others); Wed, 17 Jun 2020 14:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgFQSGa (ORCPT ); Wed, 17 Jun 2020 14:06:30 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 493B1C06174E for ; Wed, 17 Jun 2020 11:06:29 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id t194so2997429wmt.4 for ; Wed, 17 Jun 2020 11:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yum1itbYwGCVmrfngXbrZP6sf+Nn+eNmWkfS6zoUuA0=; b=kNUKj3I5DxcPPrd4rg6poK4TXuYGuPA4GWwH7m9/L1+j8/qA8vNttplARLe4t6GEvA hr6XzgtXNWeJboRDI7DdmZVxc/RnuJ+J3ceRfmPyxF2Hx/yIHbSTqacmyESlUQ11bsaz l0HPpQI1VCILiAX72sbGMqh4jL/tR9N4xytd7DzkoKA+jeN9FxeYorJsNMCh1IyYPW5C +1ZRdZK43LZdU23YSkFTHM9mh+n6u77dfh9+XSgJ305z2g5GxKllrPP7hAeT0/EdUzoJ 9HdFp1fWFlO3KnbVS0W580RzlzXSa26kQSL9k+jerVnhgku4kBTqiVrRTJKkKeIDCa1p wpTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yum1itbYwGCVmrfngXbrZP6sf+Nn+eNmWkfS6zoUuA0=; b=Vk1YYbjxijJZo2Z0Fe3lEo/jn4l5lJNRsIdUPSAqR+aMCWH+C23FOxFlqeqnlduKK/ +aa4XL8IaCC0+Lub9TuMRATVD+LrMMZSKe82bnO9O83QVy0/RkS09dEj9klKVNQTa0BB rSkgCJ1yJed2DKs8F8W6YzCGbuF0bw67gBradZ2zUIxpQsyapzPUKo5dqLux8eF/HE3N SOhZ+idrXlbT/dJkyof0Fem+mJ8NJbl9yFKt+AgzHc+S/M6vOFpshdtPUNldmSHO29DX rfxWctWum2jIXzrczvnBf6VJCvLFWKU+ax+IZLyJD8nkbwNMgunSTbL5f70BAXoAZLGD HdUg== X-Gm-Message-State: AOAM530VkCq/xmeLo566JNJmzMiWDZP55uXvIYbIBHt1VBD7lnZWTt1Q oNuIEA+nHEEDdj3GVeF2lJXatw== X-Received: by 2002:a1c:3b8b:: with SMTP id i133mr9658094wma.111.1592417187758; Wed, 17 Jun 2020 11:06:27 -0700 (PDT) Received: from elver.google.com ([100.105.32.75]) by smtp.gmail.com with ESMTPSA id 5sm477701wrr.5.2020.06.17.11.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 11:06:26 -0700 (PDT) Date: Wed, 17 Jun 2020 20:06:21 +0200 From: Marco Elver To: Peter Zijlstra Cc: Dmitry Vyukov , Andrey Konovalov , Mark Rutland , Borislav Petkov , Thomas Gleixner , Ingo Molnar , clang-built-linux , "Paul E. McKenney" , Alexander Potapenko , kasan-dev , LKML , the arch/x86 maintainers , Andrew Morton , Josh Poimboeuf , ndesaulniers@google.com, Andy Lutomirski Subject: Re: [PATCH -tip v3 1/2] kcov: Make runtime functions noinstr-compatible Message-ID: <20200617180621.GD56208@elver.google.com> References: <20200615142949.GT2531@hirez.programming.kicks-ass.net> <20200615145336.GA220132@google.com> <20200615150327.GW2531@hirez.programming.kicks-ass.net> <20200615152056.GF2554@hirez.programming.kicks-ass.net> <20200617143208.GA56208@elver.google.com> <20200617144949.GA576905@hirez.programming.kicks-ass.net> <20200617151959.GB56208@elver.google.com> <20200617155517.GB576905@hirez.programming.kicks-ass.net> <20200617163635.GC576905@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617163635.GC576905@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.13.2 (2019-12-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 17, 2020 at 06:36PM +0200, Peter Zijlstra wrote: > On Wed, Jun 17, 2020 at 05:55:17PM +0200, Peter Zijlstra wrote: > > On Wed, Jun 17, 2020 at 05:19:59PM +0200, Marco Elver wrote: > > > > > > Does GCC (8, as per the new KASAN thing) have that > > > > __builtin_memcpy_inline() ? > > > > > > No, sadly it doesn't. Only Clang 11. :-/ > > > > > > But using a call to __memcpy() somehow breaks with Clang+KCSAN. Yet, > > > it's not the memcpy that BUGs, but once again check_preemption_disabled > > > (which is noinstr!). Just adding calls anywhere here seems to results in > > > unpredictable behaviour. Are we running out of stack space? > > > > Very likely, bad_iret is running on that entry_stack you found, and as > > you found, it is puny. > > > > Andy wanted to make it a full page a while ago, so I suppose the > > question is do we do that now? > > Andy suggested doing the full page; untested patches here: > > git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/entry Yeah, that works, thanks! I think the stack increase alone fixes any kind of crash due to the reproducer. Also, my guess is this is not a hot function, right? One caveat to keep in mind is that because it's not 'memcpy', the compiler will never inline these memcpys (unlike before). Whether or not that actually makes things faster or slower is anyone's guess though. Thanks, -- Marco