From: "Moger, Babu" <babu.moger@amd.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
fenghua.yu@intel.com, bp@alien8.de, james.morse@arm.com,
tony.luck@intel.com, peternewman@google.com, tglx@linutronix.de,
mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org
Cc: hpa@zytor.com, james.greenhalgh@arm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] x86/resctrl: Fix uninitialized memory read when last CPU of domain goes offline
Date: Mon, 1 Apr 2024 14:18:25 -0500 [thread overview]
Message-ID: <574d000e-318f-4d3c-81b7-63bb656ac462@amd.com> (raw)
In-Reply-To: <ff8dfc8d3dcb04b236d523d1e0de13d2ef585223.1711993956.git.reinette.chatre@intel.com>
On 4/1/24 13:16, Reinette Chatre wrote:
> Tony encountered the OOPS below when the last CPU of a domain goes
> offline while running a kernel built with CONFIG_NO_HZ_FULL:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> #PF: supervisor read access in kernel mode
> #PF: error_code(0x0000) - not-present page
> PGD 0
> Oops: 0000 [#1] PREEMPT SMP NOPTI
> ...
> RIP: 0010:__find_nth_andnot_bit+0x66/0x110
> ...
> Call Trace:
> <TASK>
> ? __die+0x1f/0x60
> ? page_fault_oops+0x176/0x5a0
> ? exc_page_fault+0x7f/0x260
> ? asm_exc_page_fault+0x22/0x30
> ? __pfx_resctrl_arch_offline_cpu+0x10/0x10
> ? __find_nth_andnot_bit+0x66/0x110
> ? __cancel_work+0x7d/0xc0
> cpumask_any_housekeeping+0x55/0x110
> mbm_setup_overflow_handler+0x40/0x70
> resctrl_offline_cpu+0x101/0x110
> resctrl_arch_offline_cpu+0x19/0x260
> cpuhp_invoke_callback+0x156/0x6b0
> ? cpuhp_thread_fun+0x5f/0x250
> cpuhp_thread_fun+0x1ca/0x250
> ? __pfx_smpboot_thread_fn+0x10/0x10
> smpboot_thread_fn+0x184/0x220
> kthread+0xe0/0x110
> ? __pfx_kthread+0x10/0x10
> ret_from_fork+0x2d/0x50
> ? __pfx_kthread+0x10/0x10
> ret_from_fork_asm+0x1a/0x30
> </TASK>
>
> The NULL pointer dereference is encountered while searching for another
> online CPU in the domain (of which there are none) that can be used to
> run the MBM overflow handler.
>
> Because the kernel is configured with CONFIG_NO_HZ_FULL the search for
> another CPU (in its effort to prefer those CPUs that aren't marked
> nohz_full) consults the mask representing the nohz_full CPUs,
> tick_nohz_full_mask. On a kernel with CONFIG_CPUMASK_OFFSTACK=y
> tick_nohz_full_mask is not allocated unless the kernel is booted with
> the "nohz_full=" parameter and because of that any access to
> tick_nohz_full_mask needs to be guarded with tick_nohz_full_enabled().
>
> Replace the IS_ENABLED(CONFIG_NO_HZ_FULL) with tick_nohz_full_enabled().
> The latter ensures tick_nohz_full_mask can be accessed safely and can be
> used whether kernel is built with CONFIG_NO_HZ_FULL enabled or not.
>
> Fixes: a4846aaf3945 ("x86/resctrl: Add cpumask_any_housekeeping() for limbo/overflow")
> Reported-by: Tony Luck <tony.luck@intel.com>
> Closes: https://lore.kernel.org/lkml/ZgIFT5gZgIQ9A9G7@agluck-desk3/
> Suggested-by: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
--
Thanks
Babu Moger
prev parent reply other threads:[~2024-04-01 19:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 18:16 Reinette Chatre
2024-04-01 19:18 ` Moger, Babu [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=574d000e-318f-4d3c-81b7-63bb656ac462@amd.com \
--to=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.greenhalgh@arm.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.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®