1. 27 Dec, 2021 10 commits
    • Sudeep Holla's avatar
      ACPICA: Fix wrong interpretation of PCC address · 9a3b8655
      Sudeep Holla authored
      ACPICA commit 41be6afacfdaec2dba3a5ed368736babc2a7aa5c
      
      With the PCC Opregion in the firmware and we are hitting below kernel crash:
      
      -->8
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
       Workqueue: pm pm_runtime_work
       pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
       pc : __memcpy+0x54/0x260
       lr : acpi_ex_write_data_to_field+0xb8/0x194
       Call trace:
        __memcpy+0x54/0x260
        acpi_ex_store_object_to_node+0xa4/0x1d4
        acpi_ex_store+0x44/0x164
        acpi_ex_opcode_1A_1T_1R+0x25c/0x508
        acpi_ds_exec_end_op+0x1b4/0x44c
        acpi_ps_parse_loop+0x3a8/0x614
        acpi_ps_parse_aml+0x90/0x2f4
        acpi_ps_execute_method+0x11c/0x19c
        acpi_ns_evaluate+0x1ec/0x2b0
        acpi_evaluate_object+0x170/0x2b0
        acpi_device_set_power+0x118/0x310
        acpi_dev_suspend+0xd4/0x180
        acpi_subsys_runtime_suspend+0x28/0x38
        __rpm_callback+0x74/0x328
        rpm_suspend+0x2d8/0x624
        pm_runtime_work+0xa4/0xb8
        process_one_work+0x194/0x25c
        worker_thread+0x260/0x49c
        kthread+0x14c/0x30c
        ret_from_fork+0x10/0x20
       Code: f9000006 f81f80a7 d65f03c0 361000c2 (b9400026)
       ---[ end trace 24d8a032fa77b68a ]---
      
      The reason for the crash is that the PCC channel index passed via region.address
      in acpi_ex_store_object_to_node is interpreted as the channel subtype
      incorrectly.
      
      Assuming the PCC op_region support is not used by any other type, let us
      remove the subtype check as the AML has no access to the subtype information.
      Once we remove it, the kernel crash disappears and correctly complains about
      missing PCC Opregion handler.
      
      ACPI Error: No handler for Region [PFRM] ((____ptrval____)) [PCC] (20210730/evregion-130)
      ACPI Error: Region PCC (ID=10) has no handler (20210730/exfldio-261)
      ACPI Error: Aborting method \_SB.ETH0._PS3 due to previous error (AE_NOT_EXIST) (20210730/psparse-531)
      
      Link: https://github.com/acpica/acpica/commit/41be6afaSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9a3b8655
    • Rafael J. Wysocki's avatar
      ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() · 24ea5f90
      Rafael J. Wysocki authored
      ACPICA commit d984f12041392fa4156b52e2f7e5c5e7bc38ad9e
      
      If Operand[0] is a reference of the ACPI_REFCLASS_REFOF class,
      acpi_ex_opcode_1A_0T_1R () calls acpi_ns_get_attached_object () to
      obtain return_desc which may require additional resolution with
      the help of acpi_ex_read_data_from_field (). If the latter fails,
      the reference counter of the original return_desc is decremented
      which is incorrect, because acpi_ns_get_attached_object () does not
      increment the reference counter of the object returned by it.
      
      This issue may lead to premature deletion of the attached object
      while it is still attached and a use-after-free and crash in the
      host OS.  For example, this may happen when on evaluation of ref_of()
      a local region field where there is no registered handler for the
      given Operation Region.
      
      Fix it by making acpi_ex_opcode_1A_0T_1R () return Status right away
      after a acpi_ex_read_data_from_field () failure.
      
      Link: https://github.com/acpica/acpica/commit/d984f120
      Link: https://github.com/acpica/acpica/pull/685Reported-by: default avatarLenny Szubowicz <lszubowi@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      24ea5f90
    • Rafael J. Wysocki's avatar
      ACPICA: Utilities: Avoid deleting the same object twice in a row · 1cdfe9e3
      Rafael J. Wysocki authored
      ACPICA commit c11af67d8f7e3d381068ce7771322f2b5324d687
      
      If original_count is 0 in acpi_ut_update_ref_count (),
      acpi_ut_delete_internal_obj () is invoked for the target object, which is
      incorrect, because that object has been deleted once already and the
      memory allocated to store it may have been reclaimed and allocated
      for a different purpose by the host OS.  Moreover, a confusing debug
      message following the "Reference Count is already zero, cannot
      decrement" warning is printed in that case.
      
      To fix this issue, make acpi_ut_update_ref_count () return after finding
      that original_count is 0 and printing the above warning.
      
      Link: https://github.com/acpica/acpica/commit/c11af67d
      Link: https://github.com/acpica/acpica/pull/652Reported-by: default avatarMark Asselstine <mark.asselstine@windriver.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1cdfe9e3
    • Shuuichirou Ishii's avatar
      ACPICA: Fix AEST Processor generic resource substructure data field byte length · 00395b74
      Shuuichirou Ishii authored
      ACPICA commit 13b9327761955f6e1e5dbf748b3112940c0dc539
      
      The byte length of the Data field in the AEST Processor generic resource
      substructure defined in ACPI for the Armv8 RAS Extensions 1.1 is 4Byte.
      However, it is defined as a pointer type, and on a 64-bit machine,
      it is interpreted as 8 bytes. Therefore, it is changed from a pointer
      type unsigned integer 1 byte to an unsigned integer 4 bytes.
      
      Link: https://github.com/acpica/acpica/commit/13b93277Signed-off-by: default avatarShuuichirou Ishii <ishii.shuuichir@fujitsu.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      00395b74
    • Bob Moore's avatar
      ACPICA: iASL/Disassembler: Additional support for NHLT table · e4a07f5a
      Bob Moore authored
      ACPICA commit 0420852ffc520b81960e877852703b739c16025c
      
      Added support for Vendor-defined microphone arrays and SNR
      (signal-to-noise) extension.
      
      Link: https://github.com/acpica/acpica/commit/0420852fSigned-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e4a07f5a
    • Jessica Clarke's avatar
      ACPICA: Avoid subobject buffer overflow when validating RSDP signature · a3e525fe
      Jessica Clarke authored
      ACPICA commit 6bb72909c1e3d415aee214104a01bc9834b2d4ce
      
      Since the Signature member is accessed through an struct acpi_table_header, the
      pointer to it is only to a 4-char array, and so trying to read past the
      4th character, as will be done when it is an RSDP, reads beyond the
      bounds of the accessed member. On CHERI, and thus Arm's experimental
      Morello prototype architecture, pointers are represented as
      capabilities, which are unforgeable bounded pointers, providing
      always-on fine-grained spatial memory safety. By default, subobject
      bounds enforcement is not enabled, only bounds on allocations, but it is
      enabled in the cheri_BSD (a port of free_BSD) kernel as intra-object
      overflow attacks are common on operating system kernels, and so this
      overflow is detected there and traps.
      
      Link: https://github.com/acpica/acpica/commit/6bb72909Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a3e525fe
    • Jessica Clarke's avatar
      ACPICA: Macros: Remove ACPI_PHYSADDR_TO_PTR · 339651be
      Jessica Clarke authored
      ACPICA commit 52abebd410945ec55afb4dd8b7150e8a39b5c960
      
      This macro was only ever used when stuffing pointers into physical
      addresses and trying to later reconstruct the pointer, which is
      implementation-defined as to whether that can be done. Now that all such
      operations are gone, the macro is unused, and should be removed to avoid
      such practices being reintroduced.
      
      Link: https://github.com/acpica/acpica/commit/52abebd4Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      339651be
    • Jessica Clarke's avatar
      ACPICA: Use original pointer for virtual origin tables · 5d6e5966
      Jessica Clarke authored
      ACPICA commit dfa3feffa8f760b686207d09dc880cd2f26c72af
      
      Currently the pointer to the table is cast to acpi_physical_address and
      later cast back to a pointer to be dereferenced. Whether or not this is
      supported is implementation-defined.
      
      On CHERI, and thus Arm's experimental Morello prototype architecture,
      pointers are represented as capabilities, which are unforgeable bounded
      pointers, providing always-on fine-grained spatial memory safety. This
      means that any pointer cast to a plain integer will lose all its
      associated metadata, and when cast back to a pointer it will give a
      null-derived pointer (one that has the same metadata as null but an
      address equal to the integer) that will trap on any dereference. As a
      result, this is an implementation where acpi_physical_address cannot be
      used as a hack to store real pointers.
      
      Thus, alter the lifecycle of table descriptors. Internal physical tables
      keep the current behaviour where only the address is set on install, and
      the pointer is set on acquire. Virtual tables (internal and external)
      now store the pointer on initialisation and use that on acquire (which
      will redundantly set *table_ptr to itself, but changing that is both
      unnecessary and overly complicated as acpi_tb_acquire_table is called with
      both a pointer to a variable and a pointer to Table->Pointer itself).
      
      This requires propagating the (possible) table pointer everywhere in
      order to make sure pointers make it through to acpi_tb_acquire_temp_table,
      which requires a change to the acpi_install_table interface. Instead of
      taking an ACPI_PHYSADDR_TYPE and a boolean indicating whether it's
      physical or virtual, it is now split into acpi_install_table (that takes
      an external virtual table pointer) and acpi_install_physical_table (that
      takes an ACPI_PHYSADDR_TYPE for an internal physical table address).
      This also has the benefit of providing a cleaner API.
      
      Link: https://github.com/acpica/acpica/commit/dfa3feffSigned-off-by: default avatarBob Moore <robert.moore@intel.com>
      [ rjw: Adjust the code in tables.c to match interface changes ]
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5d6e5966
    • Jessica Clarke's avatar
      ACPICA: Use original data_table_region pointer for accesses · ca25f92b
      Jessica Clarke authored
      ACPICA commit d9eb82bd7515989f0b29d79deeeb758db4d6529c
      
      Currently the pointer to the table is cast to acpi_physical_address and
      later cast back to a pointer to be dereferenced. Whether or not this is
      supported is implementation-defined.
      
      On CHERI, and thus Arm's experimental Morello prototype architecture,
      pointers are represented as capabilities, which are unforgeable bounded
      pointers, providing always-on fine-grained spatial memory safety. This
      means that any pointer cast to a plain integer will lose all its
      associated metadata, and when cast back to a pointer it will give a
      null-derived pointer (one that has the same metadata as null but an
      address equal to the integer) that will trap on any dereference. As a
      result, this is an implementation where acpi_physical_address cannot be
      used as a hack to store real pointers.
      
      Thus, add a new field to struct acpi_object_region to store the pointer for
      table regions, and propagate it to acpi_ex_data_table_space_handler via the
      region context, to use a more portable implementation that supports
      CHERI.
      
      Link: https://github.com/acpica/acpica/commit/d9eb82bdSigned-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ca25f92b
    • Mark Langsdorf's avatar
      ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions · f81bdeaf
      Mark Langsdorf authored
      ACPICA commit bc02c76d518135531483dfc276ed28b7ee632ce1
      
      The current ACPI_ACCESS_*_WIDTH defines do not provide a way to
      test that size is small enough to not cause an overflow when
      applied to a 32-bit integer.
      
      Rather than adding more magic numbers, add ACPI_ACCESS_*_SHIFT,
      ACPI_ACCESS_*_MAX, and ACPI_ACCESS_*_DEFAULT #defines and
      redefine ACPI_ACCESS_*_WIDTH in terms of the new #defines.
      
      This was inititally reported on Linux where a size of 102 in
      ACPI_ACCESS_BIT_WIDTH caused an overflow error in the SPCR
      initialization code.
      
      Link: https://github.com/acpica/acpica/commit/bc02c76dSigned-off-by: default avatarMark Langsdorf <mlangsdo@redhat.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f81bdeaf
  2. 26 Dec, 2021 4 commits
  3. 25 Dec, 2021 12 commits
  4. 24 Dec, 2021 3 commits
  5. 23 Dec, 2021 11 commits