Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1041498lqt; Tue, 19 Mar 2024 10:58:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXFCT6ZpAw7jydcIo0JF2ELJ0zCtoqwebxWGF0Wv4MPd3RkQz5v7v9ZwoBGlg1TKmPhEuIEw0PEF6hyyf7pk3HB+MwPWStv5uiiVB3K2w== X-Google-Smtp-Source: AGHT+IGL4jA6lP7KqWY0ukV7EHrGVKsivbgOzjIyBPcotb+SByxG+WjR+ZQjT22xJ5oCmhFH5vKh X-Received: by 2002:a05:6358:3a14:b0:17e:6924:e4ef with SMTP id g20-20020a0563583a1400b0017e6924e4efmr20994425rwe.24.1710871111042; Tue, 19 Mar 2024 10:58:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710871111; cv=pass; d=google.com; s=arc-20160816; b=ZDF/UVf8r+EFDPK2b4Xmj9s5Ck9jIsS5xaDj7Bnr7uod04N4bDISAHooGVekp+KgL+ Bha90bDPAtIcadf1alAYrhJon2vNysNouOTV1mUZEg2OBxQ47ykLsOjPSIHFGqpcXX+x o35TPq5tYpCGjcAHt8S86M/ooItoBFBYhDnRRwpKsDjOCk8PeGeQh80wblRHx55Cu9AK 6Bhy2w4gaHKuZSf8ff9BIYoXCy7p7/xYyyWat1ww1FtCTZLMGj2e2cEvbN5mpmsbUNAZ d1tjeFWOYRL2EkHXu/ehh54LVrM44LtCWwTbJH+u+yakIg967I+ijt6EDJ4vUoAyQPws sUHQ== 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=twG2O+T6o6F/FN8MJ3T2+Oi98EiyVLX3AwSybqhHmqM=; fh=TzGYVVCXMINeUXucVsjt/V/6CEQ3roLVlemcn6rl718=; b=j/k5fkCwGyk3kXx9AgiOFJNxD+C8qZ2krAYwG6j2UP50wCTYlricjGENk5ivQJS8vt SN4E9cPodhw7I6XojptO4hcfkEvlvOBflZSx0LrV72LUI2+80Wl0+ouCM0aUlqUSm5rk 7mTraZU12LBwtF7RJ5Ua2zl+NSvQB//UU8K8KXP+oK1AYZFm1tK4seQyng+vF4Jq/Ajk Hzuinp8QP90/orGUS/A0smF7ahgNEaxY6kD8UhFXtYfcbKQ7iJt/NcnUGB+0nwSN8ilX qlbxyE24ILWiNvdjs8HMIitZcJOnUJpQiTekQFtN/HmKVDPNDZmxWMO3CM/glwbM4La0 /UYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Rd69+Yoc; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-107957-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107957-linux.lists.archive=gmail.com@vger.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 d21-20020a631d55000000b005dc425a94d9si10795576pgm.369.2024.03.19.10.58.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 10:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107957-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=@linux-foundation.org header.s=google header.b=Rd69+Yoc; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-107957-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107957-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B3137283A01 for ; Tue, 19 Mar 2024 17:58:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0120D2746D; Tue, 19 Mar 2024 17:58:25 +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="Rd69+Yoc" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 3B43D23772 for ; Tue, 19 Mar 2024 17:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710871104; cv=none; b=RYv7eTWkUbk7W9BoE9jboSSEs8OiE8RlpsyVJ4HXgWfgNZuUJamtEWV+sbPa4DwJVfqbrKFsdN6EY/fAfCtoitMqsXHDpr2NwtSBWJFlJI9Xj5tww1JlndkXpw0uZ/nKXQngc0rHhLE4jr8KcIIo0i+8hSrDPKLuv/g8pbr2G1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710871104; c=relaxed/simple; bh=8sTskcdOtVLcUoJrJXgCugdbs+vDeaj4D36P9Iiu1jg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Os1vyijWMa2v2vLHcKFRSwczWFsuWbIvuU3SlEy/p9QEa+BOOvoZ5aEHcVFtwY3w2/e0mzND5vDXNugsYFev235CbG+6+c26BRo9/Kf3YltrLIg4zUwx6HtQYqcupa1kkbwKZ1LQVO/gbmmXMaSJRpkWtXw3Ph6sfYv+t1hw+kg= 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=Rd69+Yoc; arc=none smtp.client-ip=209.85.218.44 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-ej1-f44.google.com with SMTP id a640c23a62f3a-a44ad785a44so702688566b.3 for ; Tue, 19 Mar 2024 10:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1710871100; x=1711475900; 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=twG2O+T6o6F/FN8MJ3T2+Oi98EiyVLX3AwSybqhHmqM=; b=Rd69+Yoch/DnuyBkvNiH3z52iBa/7EuZ4vQZZy4tbjaRJp3qefUf/7zWyHpuKcoFWW vP3lye6/9yMFwy4nnC8724UQFWu5u/OkbIf3xA4oxRpaRTrisdQaB7aFZVfK+OJjfl0Y fjW6wqsiCeALX8KTA1NbU3k3nxTthbT2+rmCQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710871100; x=1711475900; 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=twG2O+T6o6F/FN8MJ3T2+Oi98EiyVLX3AwSybqhHmqM=; b=IRJxnod/dpj5PUlNkmLLz/Zn6jwDoBF1Qw/mg34uOhvhMUDiH6AjcDuUGpUWnFAGZA TuLsg7y8EJvGOLtAUaSYXELRpsLZVtYCN3PWQZo4n6GFE+ZteAEjqzfNf3nehcfcvBrv zwSPtwuH2zHq+SGEzC0uaOvqSkb8xpZZyVPnhLbVmEqwIKaGUZr8y928CuAiVv1fJlHm rbpwCmewuASjnvtqIz2KF+6VaE3QDRVlTR4ua+qkfeYPQcxaRaSJVIwYhsFcw6k/4S/D kZCvwA9nDmPmhy8O/LadPGOMgCDjxRodmebx3EA2oBEF5jYggGNzWENvkaxHYuMv6S+1 1urA== X-Forwarded-Encrypted: i=1; AJvYcCXUHL2KOXnnyRarkLAWxUDW9tOoxNy4ULJNl99HirSR9FKzyS+Kg0lp37RaJpY16ne4iOJy7t3hNwsdTgCJcLTkh9lo0owqXXfvtK9r X-Gm-Message-State: AOJu0YwciiiHyAhM0GOIc1gGEwPtECg965qRTPkWovUFGEJkH2rlX56i DWE04UzM5ogs6GpVfgmG50s6RuqfhvyzrI1hRvDKRJffmk1udY5hIT7fjUOweU9liDb/WZtMbCp C61zVhQ== X-Received: by 2002:a17:907:b9ce:b0:a46:be28:bb8d with SMTP id xa14-20020a170907b9ce00b00a46be28bb8dmr4834118ejc.64.1710871100319; Tue, 19 Mar 2024 10:58:20 -0700 (PDT) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com. [209.85.218.46]) by smtp.gmail.com with ESMTPSA id e9-20020a170906c00900b00a46ce8f5e11sm1880177ejz.152.2024.03.19.10.58.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Mar 2024 10:58:19 -0700 (PDT) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a44ad785a44so702684166b.3 for ; Tue, 19 Mar 2024 10:58:19 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUDpU5+4w3lv97cdPUPYI9ngUHPtGb63VqEViDHfkyqPWhXUyyQbagW8SOte8/I1cxititrUieDfwouThxiX6pa3yM2xzS7QvbzQkCZ X-Received: by 2002:a17:907:7e9f:b0:a45:ad00:eade with SMTP id qb31-20020a1709077e9f00b00a45ad00eademr12086295ejc.57.1710871099106; Tue, 19 Mar 2024 10:58:19 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240319163656.2100766-1-glider@google.com> <20240319163656.2100766-3-glider@google.com> In-Reply-To: <20240319163656.2100766-3-glider@google.com> From: Linus Torvalds Date: Tue, 19 Mar 2024 10:58:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 3/3] x86: call instrumentation hooks from copy_mc.c To: Alexander Potapenko Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, tglx@linutronix.de, x86@kernel.org, Dmitry Vyukov , Marco Elver , Tetsuo Handa Content-Type: text/plain; charset="UTF-8" On Tue, 19 Mar 2024 at 09:37, Alexander Potapenko wrote: > > if (copy_mc_fragile_enabled) { > __uaccess_begin(); > + instrument_copy_to_user(dst, src, len); > ret = copy_mc_fragile((__force void *)dst, src, len); > __uaccess_end(); I'd actually prefer that instrument_copy_to_user() to be *outside* the __uaccess_begin. In fact, I'm a bit surprised that objtool didn't complain about it in that form. __uaccess_begin() causes the CPU to accept kernel accesses to user mode, and I don't think instrument_copy_to_user() has any business actually touching user mode memory. In fact it might be better to rename the function and change the prototype to instrument_src(src, len); because you really can't sanely instrument the destination of a user copy, but "instrument_src()" might be useful in other situations than just user copies. Hmm? Linus