Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 826067

Summary: Use-after-free on CPU hotplug
Product: Red Hat Enterprise Linux 6 Reporter: Roman Kagan <rvkagan>
Component: kernelAssignee: Igor Mammedov <imammedo>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: areis, juzhang, michen, shuang, shu, tburke, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-2.6.32-306.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 06:15:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 833569    
Attachments:
Description Flags
[RHEL 6.4 PATCH] ACPI: Fix use-after-free in acpi_map_lsapic none

Description Roman Kagan 2012-05-29 14:02:30 UTC
Description of problem:

Occasionally the hotplugged CPU isn't enabled because of a use-after-free in acpi_map_lsapic().

The mainstream commit ac909ec308ce8d5177963c780564824d12bc3fa2 (after v3.3) fixes the issue and contains all the details.

It applies cleanly to RHEL kernel.

Version-Release number of selected component (if applicable):
2.6.32-220+

How reproducible:
seldom (under 3%)

Steps to Reproduce:
1. run RHEL6 in a virtual machine (Parallels Server Bare Metal was used as a virtualization platform)
2. hot-add CPU(s) to the VM
  
Actual results:
1. the number of CPUs in the guest is less than expected
2. kernel log contains "Unable to map lapic to logical cpu number"


Expected results:
All virtual CPUs are available in the guest.

Additional info:

Comment 3 Karen Noel 2012-06-08 22:59:25 UTC
commit ac909ec308ce8d5177963c780564824d12bc3fa2
Author: Petr Vandrovec <petr>
Date:   Thu Mar 8 13:33:24 2012 -0800

    ACPI: Fix use-after-free in acpi_map_lsapic
    
    When processor is being hot-added to the system, acpi_map_lsapic invokes
    ACPI _MAT method to find APIC ID and flags, verifies that returned structure
    is indeed ACPI's local APIC structure, and that flags contain MADT_ENABLED
    bit.  Then saves APIC ID, frees structure - and accesses structure when
    computing arguments for acpi_register_lapic call.  Which sometime leads
    to acpi_register_lapic call being made with second argument zero, failing
    to bring processor online with error 'Unable to map lapic to logical cpu
    number'.
    
    As lapic->lapic_flags & ACPI_MADT_ENABLED was already confirmed to be non-zero
    few lines above, we can just pass unconditional ACPI_MADT_ENABLED to the
    acpi_register_lapic.
    
    Signed-off-by: Petr Vandrovec <petr>
    Signed-off-by: Alok N Kataria <akataria>
    Reviewed-by: Toshi Kani <toshi.kani>
    Signed-off-by: Len Brown <len.brown>

Comment 4 RHEL Program Management 2012-07-10 08:36:14 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 5 RHEL Program Management 2012-07-10 23:50:00 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 6 RHEL Program Management 2012-07-31 08:11:31 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 7 juzhang 2012-08-10 09:03:50 UTC
Can reproduce with qemu-kvm-302&2.6.32-294.el6

boot guest 
#/usr/libexec/qemu-kvm -cpu 1,maxcpus=160
#hot add vcpu repeatly.

Comment 8 Igor Mammedov 2012-09-03 21:11:39 UTC
Created attachment 609475 [details]
[RHEL 6.4 PATCH] ACPI: Fix use-after-free in acpi_map_lsapic

Comment 9 Jarod Wilson 2012-09-08 03:04:25 UTC
Patch(es) available on kernel-2.6.32-306.el6

Comment 12 Shaolong Hu 2013-01-17 03:10:57 UTC
Verified on 2.6.32-351.el6.x86_64:

1. boot guest with -smp 2,maxcpus=4
2. in guest, following cmd failed
   taskset 0x00000004 echo 123
3. in qemu monitor
(qemu) info cpus
* CPU #0: pc=0xffffffff8103b90b (halted) thread_id=2346 
  CPU #1: pc=0xffffffff8103b90b (halted) thread_id=2347 
(qemu) cpu_set 2 online
4. in guest, cat /proc/cpuinfo shows 3 cpu, no kernel log contains "Unable to map lapic to logical cpu number"
5. in guest, following cmd succeed.
   taskset 0x00000004 echo 123

Comment 14 errata-xmlrpc 2013-02-21 06:15:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0496.html