Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp839741lqb; Fri, 24 May 2024 15:36:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSNMdu/NfQKhyk3j7RljjaGaG3RBVlVkPNz/GrUACCmQuqOyhnkLm0EGYN6sK0tT/iNlWwARdmDTLvvO/TCy/NlZYU/UlRyUZFv0EXdA== X-Google-Smtp-Source: AGHT+IGOkBO6/EJTGLwh4KeOK8qJF830ppQY5NP9ODJyO/y8ZX59oItgguvK7x1MZ5cvlFNAquzO X-Received: by 2002:a17:903:41cd:b0:1f3:dd7:ad42 with SMTP id d9443c01a7336-1f4484013ecmr45361105ad.0.1716590162906; Fri, 24 May 2024 15:36:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716590162; cv=pass; d=google.com; s=arc-20160816; b=He2+c2OoQgqhA5wryqYnoBgpEQn2JodkwG4TwlDGRg0Mjhl34Yinj4frH1RnFn3yi0 BjJqRtg+G0Qqf+vA7iaqw0GP7UKhcGSdhSh0TAT6OUca2yKxKDVYsJyp23RjQLEmh2mO EpatYNoTkKMnum3bkJmHNUsxYf5glATVIDGeWcas27vlulwYyaevP7MYwdqtxF5FCdBu 6JXScGR+fqOtVgkgZICjSx6dzk9KM7IEPXU95MpAONQTolYsfpeIXujDtocq7CHK07aN dAFJeeTXhH2zGrUBrCEwXz5K1tPIPvQ4i4s3VomMxpX5c4PBKOvis1q9xo9NopIMoPJO z/Ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=M4VCk5Dt2iAzT91u/gVxNNQBx4fXfDo05VmnDW4PrRs=; fh=wg9aBKooXZ2zg/IZeSahDnhWabuhulogUaLTVc2d0mA=; b=GcGAi2VYrv1e6elopBsLSizspkLXQFRQ+71FJgpR9Zke4tfNyubs4dVkTZmQ92GUe+ Mp5w5Sw9D0XKBCy4u93v2ZSNK8MvYL+6UVzRZMSxAEthiBkxjBZGqjZeJGDw708dLjwp EkIldOdy4x9HbQMMHv7DusQ/39PrrJtnBiTlmW3yByTt3ybKkD/udVC6BONFgq0w4M2u pUjuYzwU4dLN1GhLQJWnpO7JH4CP+lU5bK/UcsuT1V1X+biqS2vZLV7IqZ2G4KrCNc5V Fr+A5oHqnmeiCjmUn4u3iQ7wuuqqQD+kQBNxfKF3r9pHEawCEVwI/qM9v/e0bB8kZiFZ 6hng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hsgKbfBp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-189172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f44ca030f2si20213565ad.599.2024.05.24.15.36.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 15:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189172-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=@gmail.com header.s=20230601 header.b=hsgKbfBp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-189172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 E8641281758 for ; Fri, 24 May 2024 22:36:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC467126F32; Fri, 24 May 2024 22:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hsgKbfBp" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 879EB3D3B8 for ; Fri, 24 May 2024 22:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716590158; cv=none; b=B/nagVeBfxjnCmFGZbhvHWVqicWPrIYqE0lNMqECvFueyy8guvbmwRndAkMvyQ7MfKqEebBYaXVQWgc6L23KewG0DTbSRNMbBr4wBElcUcaGAnGsuSALwHBCsZzMgydz6WBkj1hJIKFS/XS2Qhfx01gLM2A6ClwZXhkVl1dQxDE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716590158; c=relaxed/simple; bh=M4VCk5Dt2iAzT91u/gVxNNQBx4fXfDo05VmnDW4PrRs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QqJ+9iQl6WNZzzxylpSBEwUlfra9sXXM7+UOqPIlWVjaAxT1oxqNTx3sCdSFooMsMvorWCI0zwjGRSLYi3Pq37aZzjr4cODxYNFLtwE3iIxOChOA97ZPlOjnGNV4/e52YVLKV6LM8eu4ZdllJLyb1AxjgnWZbqqoh4QBkhDlEu4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hsgKbfBp; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5751bcb3139so10944095a12.1 for ; Fri, 24 May 2024 15:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716590155; x=1717194955; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=M4VCk5Dt2iAzT91u/gVxNNQBx4fXfDo05VmnDW4PrRs=; b=hsgKbfBpBqlkg//YouyxPSeFqOrOzjruprQy72rsJSWsIY2a3M1XDrgEBtWTMpsIwV CINY5EJh3JTDA1h8XgYVoVktDK3qoZCiIsrTPg82aiW3988GejA+hzs+re+JTwXezv/N Og52YFlxonbfJHQLdVEMQudHdlL826iJAIEjhMqigkRrJIW/sQN/cvz3k7I6o0tZr8zM CzbEFI/5Tr3M6ClWKA4oFkvS/kcmi1VIXi1B8QP0/ebrPgxBId2daJdxR1to1/FmrtP3 vXrZ84eRqoTuWUrdqejhy+zPPcEjfG5V6vsqiezajnwkyAqBTx83gSljIBfm2r9OkJz9 7swA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716590155; x=1717194955; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=M4VCk5Dt2iAzT91u/gVxNNQBx4fXfDo05VmnDW4PrRs=; b=vwfk1QwpFRh9NP5rrwfGb/nFM+roK/L+69sempdQSVfn8VMR/eXHiFIQt3riNrSUp+ SSbMTqAoBRgw5eZbrHTm9v+m92M6H7fhXRft2LfohifDuPkjdVbLcYaFOt5fg5vi8iMJ nt6bNmyNlhKr8Ky19kf0nKyClf+bm28dOvnjAs4hdnWigcm8q3r+q8rbpt8pbrInNt7q W3dEQIHdYtbRnM17GyA1iR9Ofgv07FQZIWx+AxIsQfvIX0aN+u0IvsaFVdtkH7xFbfN4 1YpA516S9pObVpXg3pXUXLWVPjJHQrqgRg3pDCeqsZqaTiucD6nPQNLVIYwFScBidGXd jUMw== X-Forwarded-Encrypted: i=1; AJvYcCVZ9M9zwPbHv6jcBPXVkrds7Lmxacitp8Z8SVzySyfcSkeDgcGggpCuy1dzZJdRpDev/zh/OG3MeEJJ0Igxx12VmYhhrZPwZgqHa6Vb X-Gm-Message-State: AOJu0YzbzHoQblS1zfKC9J5rei1cmAJ38dn5ak6KXkktg9S3gRNmIZ/f lLMDNWCWA4G79kmgT6lxHLaHcX4ssYOnStOQd7iI9MLhKpIddSXD9Qcz9felKQs= X-Received: by 2002:a50:ab13:0:b0:578:5d83:bae2 with SMTP id 4fb4d7f45d1cf-5785d83bf4dmr1949090a12.15.1716590154619; Fri, 24 May 2024 15:35:54 -0700 (PDT) Received: from rex (lab-4.lab.cs.vu.nl. [192.33.36.4]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57872da9dfbsm23821a12.2.2024.05.24.15.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 15:35:54 -0700 (PDT) Date: Sat, 25 May 2024 00:35:52 +0200 From: Brian Johannesmeyer To: Alexander Potapenko Cc: Marco Elver , Dmitry Vyukov , Andrew Morton , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" Subject: Re: [PATCH] x86: kmsan: Fix hook for unaligned accesses Message-ID: References: <20240523215029.4160518-1-bjohannesmeyer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, May 24, 2024 at 10:28:05AM +0200, Alexander Potapenko wrote: > Nice catch! Does it fix any known bugs? Not that I know of. Based on my cursory testing, it seems that string_memcpy_fromio() is rarely called with an unaligned `from`, so this is a bit of an edge case. On that note: I tried creating a unit test for this, to verify that an unaligned memcpy_fromio() would yield uninitialized data without the patch, and would yield initialized data with the patch. However, what I found is that kmsan_unpoison_memory() seems to always unpoison an entire 4-byte word, even if called with a `size` of less than 4. However, this issue is somewhat unrelated to the patch at hand, so I'll create a separate patch to demonstrate what I mean. Thanks, Brian