Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp198771lqb; Thu, 14 Mar 2024 08:55:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlzRno0+eL2RykO3kIDnJNbuXZYXnroB1BpKJeJ/kiNJCOz7UPMHoQyXfcqE1BtHYtLtW0qoVTWyby6KhJbyVFG+rGBVFts9E2088S8g== X-Google-Smtp-Source: AGHT+IGGO2biUshaOIS9Rdvu+1HoCquq7mqEfCCl3S1Y4KtUsDr/Q4SbcAvsicOIfhh+HHF81RA5 X-Received: by 2002:a05:622a:4e0c:b0:42e:b9c9:e119 with SMTP id dh12-20020a05622a4e0c00b0042eb9c9e119mr2497777qtb.43.1710431757891; Thu, 14 Mar 2024 08:55:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710431757; cv=pass; d=google.com; s=arc-20160816; b=SyCGj8DHmqHEAmxn/qrB0y6Dn0I7Ha+YvQVb5bIN3EXX7WWvX2dyQh0sOC1kZ9TrSu PTk0zaYLQpWHj+ANo5GXQGKVd8orjKLBcwAZSc8XxZWUDVzectch/aVuXmPVMLW0yfT0 IC7WEZ/uRoInNTv39GIGToNsdr0yHQ9FSEGatnsqqHshioBIJBP+fGWqb+Lm5ROXa1YL 4O8/VMxjH9shRr2o4iguXWSlTC8Ug1Gj0aiOG93kvKlR/Vo9hM5dFabD3pMnSbPcFtwI LP4wRpDBfxmqvs6+Xq8ygixUYcBrpPnaokSSlQ7zFKrbgd1pkOkX6zl3cxDRhNAc1qfd LaCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=q8pCavAfgm3Ta3aBIUaxKjw7Rla9cIYxV3vEhFuCFfM=; fh=ofUNb14VKffTVI8N1DaAfrWZYBRrTWkAiyhwJs2lC24=; b=ndxaSHKDH+euzCWBFKa1uWggMi/Q7Zzm5RqzO2VbEOKEUgnl4c7IfHiLOd1R2cavU8 e/xzGFAroPsH83opLRNa+YjdSdKjcIZdaxz4nHDVOPPRyZ9ETBnqGF7kXeDVckv6s+6/ tXd7G9tGN2ZM2KmuDzeB3YRoVyHKhEHr+0rxGxLRMeDnYVx3kfIc+jVP7EMI21MNHbCH LCjtXal2OESVgbi2eysU6ErQh8H2phaOUlzgpR0fIZqkO46gyZySvHlXuE08C4ofHih8 ImkE/7crftSHAWqUJI7XVovghaVVl69O1U79n0O1DzYggy+S5CRR2fkorWOJv6oDF0BM OniQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-103533-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103533-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g18-20020ac87d12000000b0042e5f6a661dsi1739516qtb.45.2024.03.14.08.55.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 08:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103533-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-103533-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103533-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 917C21C20F2D for ; Thu, 14 Mar 2024 15:55:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85A3673196; Thu, 14 Mar 2024 15:55:45 +0000 (UTC) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.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 9B11E73165; Thu, 14 Mar 2024 15:55:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710431745; cv=none; b=Oiy78MdewDpsosvcpeBL1R1LvLTT5YqemT3OS5qPeuvHEhHCBH940TqiEwZR/5OSitYELi3pElSXmv/NmTbILpcjmprdYzDIj2ACnQCQ6liJrE+BxASyUWhvpAF7YQtD/cgfiTu2NnnThhwYKkXOFSI5uqhYxVqING+YoFo4qWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710431745; c=relaxed/simple; bh=yfhwJl3cDefDSYW2nZ14IXtUIYws5SiAxYO+fsXpqG4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XhKIZVX2b4CMfjAQ4JRmkyzQkkqiD8iMJBjUoGKBmJrEhccqDByx7pt0Ds6zX15M3JJik+RCs4WEWl9bY3ktT8bMNMsXP35rumS87myuhJ/CTyaVS/VqCHCIwAwYPqhD2vhMaWNp/3HdUCa/CUM43EZjeNeMIdt5m/n7BsN1ug8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6e4de525a42so78735a34.1; Thu, 14 Mar 2024 08:55:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710431742; x=1711036542; h=content-transfer-encoding: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=q8pCavAfgm3Ta3aBIUaxKjw7Rla9cIYxV3vEhFuCFfM=; b=ebhSnndnXhgWZg4VnVe19ecUOIsUjKPGs5MlAUJpC+/PW0k42qc5tAs9p8Jpwi+v/H cS+YCJlQo3oDC2a9PJ3zYL1FJMwmXcFcHS2XAGZ4AyuiexW5OeoXb5gsg61b+7zFemw1 RT5yacLZXJo4mIzrXNWXN5l2bwCynn4JQMJyC7mxAr8ghknnLXf6PTAyhA200w+o2Ui2 awpMflbY4Pmoq87+Cx0tgKlohN74N8YdV6Fv7LBkOgGagmy/LAXfRrui88si914ORZvy UwP8jPNeBo7JxP7Oej3I75EwGIDXU+ODtLku6BUm5OhT04TV9nZz/f5COiqKIezLFInI WIdQ== X-Forwarded-Encrypted: i=1; AJvYcCU2SNyNpQVcQJfU0MzOcwCttjblVJaUr5jGcTytE6qAWD1QmCyZi9lnGk7f3/4BvF+y/UYKF9mrtqMkWk7REVqdUYenD7kW+pkn5YMSgW31EZ9aKNKsYCDLWqCmnJ88IdEzQkQhqC+He9y3JMlzv9eglajPnr+hyruIYJ2cQOQ= X-Gm-Message-State: AOJu0YzwT14H92Ej/1s7PiRLCiUccarhuWbJiBCggcgxVUxOWV5C+Jfr lZqM6fhWawtpoC4lgXbqDGra3+2qpZKhTvet2uaO21VK7CNZCgV6tenb/jKiyM7sxqeuw7+YMe3 apYGYFvfVJIjQe68tKJ6tkLcgGlA= X-Received: by 2002:a05:6870:82a4:b0:222:239e:bd04 with SMTP id q36-20020a05687082a400b00222239ebd04mr2205348oae.1.1710431742538; Thu, 14 Mar 2024 08:55:42 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240314142656.17699-1-anton@tuxera.com> <70261e2a-b87e-462e-964e-95a51ecde978@intel.com> In-Reply-To: <70261e2a-b87e-462e-964e-95a51ecde978@intel.com> From: "Rafael J. Wysocki" Date: Thu, 14 Mar 2024 16:55:31 +0100 Message-ID: Subject: Re: [PATCH] x86/pm: Fix false positive kmemleak report in msr_build_context(). To: Dave Hansen Cc: Anton Altaparmakov , "Rafael J . Wysocki" , Pavel Machek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Chen Yu , Pawan Gupta , Catalin Marinas , linux-mm@kvack.org, Matthieu Baerts , Mat Martineau , "Rafael J . Wysocki" , Ingo Molnar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 14, 2024 at 4:05=E2=80=AFPM Dave Hansen = wrote: > > On 3/14/24 07:26, Anton Altaparmakov wrote: > > /* image of the saved processor state */ > > struct saved_context { > > - /* > > - * On x86_32, all segment registers except gs are saved at kernel > > - * entry in pt_regs. > > - */ > > - u16 gs; > > unsigned long cr0, cr2, cr3, cr4; > > u64 misc_enable; > > struct saved_msrs saved_msrs; > > @@ -27,6 +22,11 @@ struct saved_context { > > unsigned long tr; > > unsigned long safety; > > unsigned long return_address; > > + /* > > + * On x86_32, all segment registers except gs are saved at kernel > > + * entry in pt_regs. > > + */ > > + u16 gs; > > bool misc_enable_saved; > > } __attribute__((packed)); > > Isn't this just kinda poking at the symptoms? This seems to be > basically the exact same bug as b0b592cf08, just with a different source > of unaligned structure members. > > There's nothing to keep folks from reintroducing these kinds of issues > and evidently no way to detect when they happen without lengthy reproduce= rs. This change is fine with me FWIW, but I agree that making it for kmemleak reasons feels kind of misguided.