Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5649118pxb; Mon, 28 Mar 2022 15:29:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyi8SO864S8ocaSfwkc4QzdoQhNvVNu2uN2vUvC3olE2QhvQ6LvjYgQDktrAAzzJP3FEy3 X-Received: by 2002:a17:903:1210:b0:151:fa59:95ef with SMTP id l16-20020a170903121000b00151fa5995efmr28193665plh.57.1648506583261; Mon, 28 Mar 2022 15:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648506583; cv=none; d=google.com; s=arc-20160816; b=jQ9V/QkT/dehusEVVXdRJ4J+WsyjVbjaF6ckAFnsj+v5FIhKXlbTBbSSHLLk90OVN9 O8cn/6bDRjNzoPeYQkD4Q82BoAgTRigo7lZR6XE7ewj0pPFiKMlF7f8ZTFmwnldT0JRh My5ntC6YGPeZoBeFTEZRERK7kC95cHXwc7oJ1ozZuhaGMXKAY+g/rdlMtjIF5sEsHMXC Xh1PAzN4je+/6oWhIjrPVhLdiG3nzhU3RZOGnXhgusFAFTpgSR5pcu+EsmE0jU0Zb4MW sgjuVATQLXdylV9jf3RX/2L+G+Z98JZNoYGnBYzf5qZgJhqZomNjtJeMrO9Dc0eyoT4r L74Q== 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=d8/rOot+Zn55BsrOys3cwi/OQAonRbrHF4qbQtyFPfU=; b=PiHxHqrhiV25kZ69UeV4Qnsx1jeAk4+lg0sF9t8wT+GYMUbJj5Z4JKzLB4EhwTJVyy ZpAqgr/Ea3ZdcCAokKyhL635NdNQYOZocJraTbHkW34oDobYxG7vtnXXcoe7pTp64pZ2 p7H0o4Du4dZx9MZjIW5ETxXdcvioJcfhxJWdtzvVVmZE27TtdN1r9XwL8jCJJsnyNJK8 t/7If0/k7ZdCWAEg5ynUSLSGzYSfZMKQ3G9h7s7Crsny8dbUw7dDsa7+y1uHi3a6kxif XhQi4C9lUrANQtldnF/qKHRbqdQvpeD+f43oiiuMtuFKWRZvtF2ZZmvD37ZyWi4zx7tF F9HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JRielGlY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b25-20020a631b59000000b0039846ac15b5si6952033pgm.284.2022.03.28.15.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 15:29:43 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JRielGlY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 19F8041329; Mon, 28 Mar 2022 14:42:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239988AbiC1QSh (ORCPT + 99 others); Mon, 28 Mar 2022 12:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235679AbiC1QSf (ORCPT ); Mon, 28 Mar 2022 12:18:35 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB86327B1C; Mon, 28 Mar 2022 09:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=d8/rOot+Zn55BsrOys3cwi/OQAonRbrHF4qbQtyFPfU=; b=JRielGlYIbDlpiEeEs8rRgK6zA +iV4zrteozIT6NLmADRqsFe5zcve5qm4T5rCYDyc6YBiF8OGbBJUiSa2my6KzdC/WFLPuHNXAaT0C aFX6+I361AWOIQCVILyke8MjVC+Js88koDB7pC63zgy3aGNx2tUleY7pMpLVdYRBS7YBQ3rhsFD9X lAZJJLfB3qd3GuFw79iWTLoIbflDYmYYKcMBeBZen1I/RtMrLTkcP0cF+J78efEDfC23R3y6yNq5T ojRfHpR65zd5cEuEM87bOpvoOC4qnhiNX29H4xsVIc2JY/p75TfSAqo+iSwgj8zDbmHvPdgHJ29UX 1KyYwb4A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nYs2p-00H4I6-Ii; Mon, 28 Mar 2022 16:16:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 77C9F30026E; Mon, 28 Mar 2022 18:16:37 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 56EEB209909C8; Mon, 28 Mar 2022 18:16:37 +0200 (CEST) Date: Mon, 28 Mar 2022 18:16:37 +0200 From: Peter Zijlstra To: Segher Boessenkool Cc: Mark Rutland , Nick Desaulniers , Borislav Petkov , Nathan Chancellor , x86-ml , lkml , llvm@lists.linux.dev, Josh Poimboeuf , linux-toolchains@vger.kernel.org Subject: Re: clang memcpy calls Message-ID: References: <20220325151238.GB614@gate.crashing.org> <20220328142220.GI614@gate.crashing.org> <20220328155957.GK614@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220328155957.GK614@gate.crashing.org> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Mar 28, 2022 at 10:59:57AM -0500, Segher Boessenkool wrote: > I do not see how that follows. Maybe that is obvious from how you look > at your use case, but it is not from the viewpoint of people who just > want to do sanitation. It's a substitution issue: either: memcpy() equals: "asan instrumentation" + "memcpy implementation" or: memcpy() equals: "memcpy implementation" It can not be both, since they're not equivalent. So if the compiler does the substitution, it needs some sense of equivalence. All we're asking is that it be consistent (my preference is for the latter). > So what is the goal here? Why do you need to > prevent sanitation on anything called from this function, at all cost? Kernel entry code might not have reached a point where instrumentation assumptions are valid yet. Consider calling into C before the kernel page-tables are swapped in. KASAN instrumentation would insta-explode simply because the environment it expects (the shadow data etc..) isn't there.