Skip to content
  1. Mar 13, 2024
  2. Dec 15, 2023
    • Thomas Gleixner's avatar
      x86/alternatives: Disable interrupts and sync when optimizing NOPs in place · e53dc751
      Thomas Gleixner authored
      apply_alternatives() treats alternatives with the ALT_FLAG_NOT flag set
      special as it optimizes the existing NOPs in place.
      
      Unfortunately this happens with interrupts enabled and does not provide any
      form of core synchronization.
      
      So an interrupt hitting in the middle of the update and using the affected
      code path will observe a half updated NOP and crash and burn. The following
      3 NOP sequence was observed to expose this crash halfways reliably under
      QEMU 32bit:
      
         0x90 0x90 0x90
      
      which is replaced by the optimized 3 byte NOP:
      
         0x8d 0x76 0x00
      
      So an interrupt can observe:
      
         1) 0x90 0x90 0x90		nop nop nop
         2) 0x8d 0x90 0x90		undefined
         3) 0x8d 0x76 0x90		lea    -0x70(%esi),%esi
         4) 0x8d 0x76 0x00		lea     0x0(%esi),%esi
      
      Where only #1 and #4 are true NOPs. The same problem exists for 64bit obviously.
      
      Disable interrupts around this NOP optimization and invoke sync_core()
      before reenabling them.
      
      Fixes: 270a69c4
      
       ("x86/alternative: Support relocations in alternatives")
      Reported-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
      e53dc751
    • Thomas Gleixner's avatar
      x86/alternatives: Sync core before enabling interrupts · 68ce7bd5
      Thomas Gleixner authored
      
      
      text_poke_early() does:
      
         local_irq_save(flags);
         memcpy(addr, opcode, len);
         local_irq_restore(flags);
         sync_core();
      
      That's not really correct because the synchronization should happen before
      interrupts are reenabled to ensure that a pending interrupt observes the
      complete update of the opcodes.
      
      It's not entirely clear whether the interrupt entry provides enough
      serialization already, but moving the sync_core() invocation into interrupt
      disabled region does no harm and is obviously correct.
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
      68ce7bd5
  3. Dec 04, 2023
    • Bruce Ashfield's avatar
      Merge tag 'v6.5.13' into v6.5/standard/base · 7fe59b2e
      Bruce Ashfield authored
      This is the 6.5.13 stable release
      
      # -----BEGIN PGP SIGNATURE-----
      #
      # iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmVmIDMACgkQONu9yGCS
      # aT4ZGg/+LzxwEv+fFy2Tkab5v6i1Dy4ziCel9wT1kKjx0Zo6LluZT9o8RSKElxiK
      # t1GzCNPRh1CPReDQkt+NIVeMUevQwi5HPB3nDDjaGOmVjzceJaFChVxb9UvbSy2H
      # 7wPIk7fduAwuchEfv12G/fkQ6HcNPjsSA+aa3oPusuFWh5xThRdnXiytLgMNNMsI
      # gE0VFJgM2Ijf+wxyqNo1U5ccWrQnlmHAF3lEiZXHCpQaxKtufH2sEOV5mF2ptr4H
      # jHI7vXf60YELbxGRMznxmyb5R51DEYfyTU5Dwm0WwJ8QIx2cmpiHifaDATkPUcWF
      # m9mirxdsCrSs2KqDjY1e8kJLQjePSMLratk1yoqBczrGyVHf8qJPPiL7pJJnrWA+
      # KX03Pa1/6oUcsbWkOXZrHW9cFMhQuyxzfhgnZFpKgfRwNxVZVXwqoUIppmNyUaYE
      # 7lDf+fimDAdVlmUoAvkt5Rj5kK9LFh67yI0EmmhqSgyMfoMOgViaqGzbgjixMNO7
      # khw0BT3MwuZF7ZhvIxjEezm6WCnd4XaFZ2dbRU9bgCRtrbHmMvHGCQueYaUaLDwc
      # jeONVtxCZ27aMFA0sLHio22lQNrAWk+XVILHCZIjFisx+h5HIFVMQRMIKULJoxlW
      # fVPt90TP077Y4rR5b/C+vQ2hJD6kV+iZlC/4Ca6t4PSVfisdB/Q=
      # =SG0Z
      # -----END PGP SIGNATURE-----
      # gpg: keybox '/home/bruce/.gnupg/pubring.kbx' created
      # gpg: Signature made Tue 28 Nov 2023 12:15:31 PM EST
      # gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
      # gpg: Can't check signature: No public key
      7fe59b2e
  4. Nov 29, 2023