Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp600345lqs; Tue, 5 Mar 2024 10:35:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWmN0Yi9mtSD3iWEDA+O4zMGl6qyqLmO5sa90Ov2KiP19k9IwYBy9xDtp8v0e3tKhUPJSAqBKy46J/PYva84/Jjqv92758pojUvzjTvgQ== X-Google-Smtp-Source: AGHT+IHySHfRMr7wEMqUU90yGktmj1rO+5bt9jd6kRWNDA0fDX9Q53BWhwWjg3oITEQFHDhr3zyA X-Received: by 2002:a05:6a20:9592:b0:1a1:e70:3195 with SMTP id iu18-20020a056a20959200b001a10e703195mr2591933pzb.8.1709663730016; Tue, 05 Mar 2024 10:35:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709663730; cv=pass; d=google.com; s=arc-20160816; b=aPiSpnaHCUiLnd2KwHg/o5z0GDgWnAfoC9H0MZK7jNnFOomPfoPqcg9kC01bkBMxC2 ZO+h0aRoLBbN8DhRgRZo5PiytT8ZBayx1gtY/TBozaY6AKUgbF3/ZVPtK10A8JUi3NdI SlUlMP+Zwld1TqZsjhssHACLCwiNumD7YihbA+0l++ayBke2fTShObFjapSSYIfqCsGo 04SS7XbANGZ4ot1sqit14w3gUMuUhwk7cNCUQhdgCSd2fQsHrB1QXzuCmwJm9M7CqdWu DOp0Vhv2PmmikUigmJmo9yvOQp+O9fl8aVK8bPefzeg2uyi/nMmODjkEs7u9EnVPT+1V 5tog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=D5YQCxQHduP3JvbhcqBfSHr7Q7jty3FaHYmIqmS0PXg=; fh=LwBfjAjFRWZF2QR0DpUUg66NJkycWnFjclOHzAUIuzE=; b=W2RTq1hJ91w/MXoIeeOmLqNDfgU/VH1rcRhsMJzT3tMnBKSWqfBQSyZYVorOQVpNpQ 0ZqYBlHyTHhcmJqJVKqZblWXKagC9rQymNT97qnC1Bt0iJRE3Md+onYbJYPKuYMam0ne QkuqJuEH1KfBSAWoHHkrLcqmelAQdnr981LULVvuTdcMx0DbWipB0Kagg4fDbBpUqFqm 3hH+LP8ObwzzsWhPhhSj2eLoGedJYBJVS5rhXfqLTwsd8oy/dioIIL5AaEJgUKRkl88o Hsq0tUmas4/ja1e6Nomohnx1MTm0xyla1wVm5PUVO8byYmHsxAK9VEoVyMO7FL+PvYJn TO7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NG2exrpP; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-92798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92798-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o75-20020a62cd4e000000b006e58d592579si10230950pfg.290.2024.03.05.10.35.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 10:35:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NG2exrpP; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-92798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92798-linux.lists.archive=gmail.com@vger.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1D485B2A964 for ; Tue, 5 Mar 2024 17:58:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B1BB17BC9; Tue, 5 Mar 2024 17:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="NG2exrpP" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0609B179AE for ; Tue, 5 Mar 2024 17:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709661500; cv=none; b=VDWGsO9ChPTpjqYd7ySU6+7B1ZSgCT1kyD5LpiQPt1oJiDjJr1S9m10/udjamHETekfDVszdofK+JDuX6rNZu9NQu5k3PJatePScAqU6BSYE2bznhRv/LJTxey3X06SewRZeDfhMD8IX8AKpXe/dus6EZZXA5u89HUxPfYElh8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709661500; c=relaxed/simple; bh=vgsmr9tJ4N+iUmYsDzkiKcPorKbBR/Nr+bKBtk/siOw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=QA8cilgZTC6SOl9F7IBcu7E2ASzhlzLeYc8ldgeJadirmSXYjRjLl4AJbwbFOnmao829RA2M/aEJb1mbifmPfJRdoyZ0lvCZ4/2mhPOtPMjX449QQo1vYML0XC2Ogz/QiK3OPtoTv28ZpPgvAQpzf9vcXqJpZDhvTpsnw7lVRJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=NG2exrpP; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5131316693cso7829272e87.0 for ; Tue, 05 Mar 2024 09:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1709661496; x=1710266296; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=D5YQCxQHduP3JvbhcqBfSHr7Q7jty3FaHYmIqmS0PXg=; b=NG2exrpPwVpkVgmIyWL/WlNXQ5Rt+Zkx3fjqEl2xGwEDuBYJnyTYrLdMzYetxqN9XZ VwshTKgZDZyIx1/4QHZflR44u9lc2DwGHxt+6Yy47NyQ0KyIo7KBUAUxskuen7BTiH/g z3dipIosQd13c+AqCuuAywzLvyqiQ8E5X+v8k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709661496; x=1710266296; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D5YQCxQHduP3JvbhcqBfSHr7Q7jty3FaHYmIqmS0PXg=; b=DJQDTbhys5wT+DBHEj7Ihwn/n9ST0q+cZDQiftub8Mtycwk9oerdlpkb+nEqu3G3de v954Tx6M8Cu5wnr18xQvqBGwvu37N8Op6wphXZtHUYci11k7bh02rtAyMd5EQvQcRU+W eXBg696Nx0UcUvejDRGj/3WD5dXGf3wk5SP6eeLXdPEyvEXX4+fYbueEZvCEeVBOnWp/ nPxnG7c+FhscQ8uaGwlFHIB5pDNtOa0c2m7K9nqgt+iiw0MTjtgIlNcZ3xAvpaICsYTQ BrR1BiubldSh+RaBMhwTZJe+low9XagZeACa247hyTFTJ52VpjCGEe5A2e7VUm3ag+dz JDJw== X-Gm-Message-State: AOJu0YxTSxlBWgEDNKV3iDOO+x19tQX9ZRQB690WOpYvACuWxQ8i+D+F A1BshWRrMdCZDQjFBiWaJHHywx3ue0gjGkKCqis6IZbOdO/WbRYPsx8hebcFvmasfTiZ4dB5eIY 83ob0mw== X-Received: by 2002:ac2:4c8e:0:b0:513:2b10:cc28 with SMTP id d14-20020ac24c8e000000b005132b10cc28mr1765096lfl.9.1709661495669; Tue, 05 Mar 2024 09:58:15 -0800 (PST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id f12-20020a05651201cc00b00513360ebd22sm1677868lfp.118.2024.03.05.09.58.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Mar 2024 09:58:14 -0800 (PST) Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-513181719easo4166700e87.3 for ; Tue, 05 Mar 2024 09:58:14 -0800 (PST) X-Received: by 2002:a19:5509:0:b0:513:33ac:fe61 with SMTP id n9-20020a195509000000b0051333acfe61mr1884324lfe.60.1709661494071; Tue, 05 Mar 2024 09:58:14 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <3b7dbd88-0861-4638-b2d2-911c97a4cadf@I-love.SAKURA.ne.jp> <06c11112-db64-40ed-bb96-fa02b590a432@I-love.SAKURA.ne.jp> In-Reply-To: <06c11112-db64-40ed-bb96-fa02b590a432@I-love.SAKURA.ne.jp> From: Linus Torvalds Date: Tue, 5 Mar 2024 09:57:57 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] x86: disable non-instrumented version of copy_mc when KMSAN is enabled To: Tetsuo Handa , Alexander Potapenko , Marco Elver , Dmitry Vyukov Cc: LKML , "the arch/x86 maintainers" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" [ For the KMSAN people I brought in: this is the patch I'm NAK'ing: https://lore.kernel.org/all/3b7dbd88-0861-4638-b2d2-911c97a4cadf@I-love.SAKURA.ne.jp/ and it looks like you were already cc'd on earlier versions (which were even more broken) ] On Tue, 5 Mar 2024 at 03:31, Tetsuo Handa wrote: > > Ping? Please don't add new people and 'ping' without context. Very annoying. That said, after having to search for it that whole patch is disgusting. Why make duplicated complex conditionals when you could have just had the tests inside one #ifndef. Also, that patch means that a KMSAN kernel potentially simply no longer works on admittedly crappy hardware that almost doesn't exist. So now a debug feature changes actual semantics in a big way. Not ok. So I think this patch is ugly but also doubly incorrect. I think the KMSAN people need to tell us how to tell kmsan that it's a memcpy (and about the "I'm going to touch this part of memory", needed for the "copy_mv_to_user" side). So somebody needs to abstract out that depot_stack_handle_t origin; if (!kmsan_enabled || kmsan_in_runtime()) return; kmsan_enter_runtime(); /* Using memmove instead of memcpy doesn't affect correctness. */ kmsan_internal_memmove_metadata(dst, (void *)src, n); kmsan_leave_runtime(); set_retval_metadata(shadow, origin); kind of thing, and expose it as a helper function for "I did something that looks like a memory copy", the same way that we currently have kmsan_copy_page_meta() Because NO, IT IS NEVER CORRECT TO USE __msan_memcpy FOR THE MC COPIES. So no. NAK on that patch. It's completely and utterly wrong. The onus is firmly on the KMSAN people to give kernel people a way to tell KMSAN to shut the f&%^ up about that. End result: don't bother the x86 people until KMSAN has the required support. Linus