mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: alexander.antonov@linux.intel.com, peterz@infradead.org,
	linux-kernel@vger.kernel.org
Cc: kyle.meyer@hpe.com, alexey.v.bayduraev@linux.intel.com
Subject: Re: [PATCH v2 0/2] Fix NULL pointer dereference issue during discovering UPI topology
Date: Mon, 27 Nov 2023 16:09:40 -0500	[thread overview]
Message-ID: <04967d96-cc03-4751-91f2-9f1ff80c6860@linux.intel.com> (raw)
In-Reply-To: <20231127185246.2371939-1-alexander.antonov@linux.intel.com>



On 2023-11-27 1:52 p.m., alexander.antonov@linux.intel.com wrote:
> From: Alexander Antonov <alexander.antonov@linux.intel.com>
> 
> The NULL dereference happens inside upi_fill_topology() procedure in
> case of disabling one of the sockets on the system.
> 
> For example, if you disable the 2nd socket on a 4-socket system then
> uncore_max_dies() returns 3 and inside pmu_alloc_topology() memory will
> be allocated only for 3 sockets and stored in type->topology.
> In discover_upi_topology() memory is accessed by socket id from CPUNODEID
> registers which contain physical ids (from 0 to 3) and on the line:
> 
>     upi = &type->topology[nid][idx];
> 
> out-of-bound access will happen and the 'upi' pointer will be passed to
> upi_fill_topology() where it will be dereferenced.
> 
> To avoid this issue update the code to convert physical socket id to
> logical socket id in discover_upi_topology() before accessing memory.
> 
> Changed in v2:
>  1. Factor out topology_gidnid_map() with common code for GIDNIDMAP procedure
> 
> Alexander Antonov (2):
>   perf/x86/intel/uncore: Fix NULL pointer dereference issue in
>     upi_fill_topology()
>   perf/x86/intel/uncore: Factor out topology_gidnid_map()

Reviewed-by: Kan Liang <kan.liang@linux.intel.com>

Thanks,
Kan

> 
>  arch/x86/events/intel/uncore_snbep.c | 71 ++++++++++++++++------------
>  1 file changed, 40 insertions(+), 31 deletions(-)
> 

      parent reply	other threads:[~2023-11-27 21:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 18:52 alexander.antonov
2023-11-27 18:52 ` [PATCH v2 1/2] perf/x86/intel/uncore: Fix NULL pointer dereference issue in upi_fill_topology() alexander.antonov
2023-11-30 13:36   ` [tip: perf/core] " tip-bot2 for Alexander Antonov
2023-11-27 18:52 ` [PATCH v2 2/2] perf/x86/intel/uncore: Factor out topology_gidnid_map() alexander.antonov
2023-11-30 13:36   ` [tip: perf/core] " tip-bot2 for Alexander Antonov
2023-11-27 21:09 ` Liang, Kan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04967d96-cc03-4751-91f2-9f1ff80c6860@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=alexander.antonov@linux.intel.com \
    --cc=alexey.v.bayduraev@linux.intel.com \
    --cc=kyle.meyer@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®