1. May 08, 2020
    • Josh Poimboeuf's avatar
      s390: Change s390_kernel_write() return type to match memcpy() · cb2cceae
      Josh Poimboeuf authored
      
      
      s390_kernel_write()'s function type is almost identical to memcpy().
      Change its return type to "void *" so they can be used interchangeably.
      
      Cc: linux-s390@vger.kernel.org
      Cc: heiko.carstens@de.ibm.com
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> # s390
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      cb2cceae
    • Josh Poimboeuf's avatar
      livepatch: Prevent module-specific KLP rela sections from referencing vmlinux symbols · ca376a93
      Josh Poimboeuf authored
      
      
      Prevent module-specific KLP rela sections from referencing vmlinux
      symbols.  This helps prevent ordering issues with module special section
      initializations.  Presumably such symbols are exported and normal relas
      can be used instead.
      
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      ca376a93
    • Peter Zijlstra's avatar
      livepatch: Remove .klp.arch · 1d05334d
      Peter Zijlstra authored
      
      
      After the previous patch, vmlinux-specific KLP relocations are now
      applied early during KLP module load.  This means that .klp.arch
      sections are no longer needed for *vmlinux-specific* KLP relocations.
      
      One might think they're still needed for *module-specific* KLP
      relocations.  If a to-be-patched module is loaded *after* its
      corresponding KLP module is loaded, any corresponding KLP relocations
      will be delayed until the to-be-patched module is loaded.  If any
      special sections (.parainstructions, for example) rely on those
      relocations, their initializations (apply_paravirt) need to be done
      afterwards.  Thus the apparent need for arch_klp_init_object_loaded()
      and its corresponding .klp.arch sections -- it allows some of the
      special section initializations to be done at a later time.
      
      But... if you look closer, that dependency between the special sections
      and the module-specific KLP relocations doesn't actually exist in
      reality.  Looking at the contents of the .altinstructions and
      .parainstructions sections, there's not a realistic scenario in which a
      KLP module's .altinstructions or .parainstructions section needs to
      access a symbol in a to-be-patched module.  It might need to access a
      local symbol or even a vmlinux symbol; but not another module's symbol.
      When a special section needs to reference a local or vmlinux symbol, a
      normal rela can be used instead of a KLP rela.
      
      Since the special section initializations don't actually have any real
      dependency on module-specific KLP relocations, .klp.arch and
      arch_klp_init_object_loaded() no longer have a reason to exist.  So
      remove them.
      
      As Peter said much more succinctly:
      
        So the reason for .klp.arch was that .klp.rela.* stuff would overwrite
        paravirt instructions. If that happens you're doing it wrong. Those
        RELAs are core kernel, not module, and thus should've happened in
        .rela.* sections at patch-module loading time.
      
        Reverting this removes the two apply_{paravirt,alternatives}() calls
        from the late patching path, and means we don't have to worry about
        them when removing module_disable_ro().
      
      [ jpoimboe: Rewrote patch description.  Tweaked klp_init_object_loaded()
      	    error path. ]
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      1d05334d
    • Josh Poimboeuf's avatar
      livepatch: Apply vmlinux-specific KLP relocations early · 7c8e2bdd
      Josh Poimboeuf authored
      
      
      KLP relocations are livepatch-specific relocations which are applied to
      a KLP module's text or data.  They exist for two reasons:
      
        1) Unexported symbols: replacement functions often need to access
           unexported symbols (e.g. static functions), which "normal"
           relocations don't allow.
      
        2) Late module patching: this is the ability for a KLP module to
           bypass normal module dependencies, such that the KLP module can be
           loaded *before* a to-be-patched module.  This means that
           relocations which need to access symbols in the to-be-patched
           module might need to be applied to the KLP module well after it has
           been loaded.
      
      Non-late-patched KLP relocations are applied from the KLP module's init
      function.  That usually works fine, unless the patched code wants to use
      alternatives, paravirt patching, jump tables, or some other special
      section which needs relocations.  Then we run into ordering issues and
      crashes.
      
      In order for those special sections to work properly, the KLP
      relocations should be applied *before* the special section init code
      runs, such as apply_paravirt(), apply_alternatives(), or
      jump_label_apply_nops().
      
      You might think the obvious solution would be to move the KLP relocation
      initialization earlier, but it's not necessarily that simple.  The
      problem is the above-mentioned late module patching, for which KLP
      relocations can get applied well after the KLP module is loaded.
      
      To "fix" this issue in the past, we created .klp.arch sections:
      
        .klp.arch.{module}..altinstructions
        .klp.arch.{module}..parainstructions
      
      Those sections allow KLP late module patching code to call
      apply_paravirt() and apply_alternatives() after the module-specific KLP
      relocations (.klp.rela.{module}.{section}) have been applied.
      
      But that has a lot of drawbacks, including code complexity, the need for
      arch-specific code, and the (per-arch) danger that we missed some
      special section -- for example the __jump_table section which is used
      for jump labels.
      
      It turns out there's a simpler and more functional approach.  There are
      two kinds of KLP relocation sections:
      
        1) vmlinux-specific KLP relocation sections
      
           .klp.rela.vmlinux.{sec}
      
           These are relocations (applied to the KLP module) which reference
           unexported vmlinux symbols.
      
        2) module-specific KLP relocation sections
      
           .klp.rela.{module}.{sec}:
      
           These are relocations (applied to the KLP module) which reference
           unexported or exported module symbols.
      
      Up until now, these have been treated the same.  However, they're
      inherently different.
      
      Because of late module patching, module-specific KLP relocations can be
      applied very late, thus they can create the ordering headaches described
      above.
      
      But vmlinux-specific KLP relocations don't have that problem.  There's
      nothing to prevent them from being applied earlier.  So apply them at
      the same time as normal relocations, when the KLP module is being
      loaded.
      
      This means that for vmlinux-specific KLP relocations, we no longer have
      any ordering issues.  vmlinux-referencing jump labels, alternatives, and
      paravirt patching will work automatically, without the need for the
      .klp.arch hacks.
      
      All that said, for module-specific KLP relocations, the ordering
      problems still exist and we *do* still need .klp.arch.  Or do we?  Stay
      tuned.
      
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: default avatarJessica Yu <jeyu@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      7c8e2bdd
    • Josh Poimboeuf's avatar
      livepatch: Disallow vmlinux.ko · dcf550e5
      Josh Poimboeuf authored
      
      
      This is purely a theoretical issue, but if there were a module named
      vmlinux.ko, the livepatch relocation code wouldn't be able to
      distinguish between vmlinux-specific and vmlinux.o-specific KLP
      relocations.
      
      If CONFIG_LIVEPATCH is enabled, don't allow a module named vmlinux.ko.
      
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      dcf550e5
  2. May 07, 2020
  3. May 06, 2020
  4. May 05, 2020
    • Xiongfeng Wang's avatar
      platform/x86: thinkpad_acpi: Remove always false 'value < 0' statement · f8a31eca
      Xiongfeng Wang authored
      
      
      Since 'value' is declared as unsigned long, the following statement is
      always false.
      	value < 0
      
      So let's remove it.
      
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      f8a31eca
    • Arnd Bergmann's avatar
      platform/x86: intel_pmc_core: avoid unused-function warnings · 01f259f3
      Arnd Bergmann authored
      When both CONFIG_DEBUG_FS and CONFIG_PM_SLEEP are disabled, the
      functions that got moved out of the #ifdef section now cause
      a warning:
      
      drivers/platform/x86/intel_pmc_core.c:654:13: error: 'pmc_core_lpm_display' defined but not used [-Werror=unused-function]
        654 | static void pmc_core_lpm_display(struct pmc_dev *pmcdev, struct device *dev,
            |             ^~~~~~~~~~~~~~~~~~~~
      drivers/platform/x86/intel_pmc_core.c:617:13: error: 'pmc_core_slps0_display' defined but not used [-Werror=unused-function]
        617 | static void pmc_core_slps0_display(struct pmc_dev *pmcdev, struct device *dev,
            |             ^~~~~~~~~~~~~~~~~~~~~~
      
      Rather than add even more #ifdefs here, remove them entirely and
      let the compiler work it out, it can actually get rid of all the
      debugfs calls without problems as long as the struct member is
      there.
      
      The two PM functions just need a __maybe_unused annotations to avoid
      another warning instead of the #ifdef.
      
      Fixes: aae43c2b
      
       ("platform/x86: intel_pmc_core: Relocate pmc_core_*_display() to outside of CONFIG_DEBUG_FS")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      01f259f3
    • Hans de Goede's avatar
      platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA · 3bd12da7
      Hans de Goede authored
      
      
      asus-nb-wmi does not add any extra functionality on these Asus
      Transformer books. They have detachable keyboards, so the hotkeys are
      send through a HID device (and handled by the hid-asus driver) and also
      the rfkill functionality is not used on these devices.
      
      Besides not adding any extra functionality, initializing the WMI interface
      on these devices actually has a negative side-effect. For some reason
      the \_SB.ATKD.INIT() function which asus_wmi_platform_init() calls drives
      GPO2 (INT33FC:02) pin 8, which is connected to the front facing webcam LED,
      high and there is no (WMI or other) interface to drive this low again
      causing the LED to be permanently on, even during suspend.
      
      This commit adds a blacklist of DMI system_ids on which not to load the
      asus-nb-wmi and adds these Transformer books to this list. This fixes
      the webcam LED being permanently on under Linux.
      
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      3bd12da7
    • Archana Patni's avatar
      platform/x86: intel_pmc_core: Change Jasper Lake S0ix debug reg map back to ICL · e87fa339
      Archana Patni authored
      Jasper Lake uses Icelake PCH IPs and the S0ix debug interfaces are same as
      Icelake. It uses SLP_S0_DBG register latch/read interface from Icelake
      generation. It doesn't use Tiger Lake LPM debug registers. Change the
      Jasper Lake S0ix debug interface to use the ICL reg map.
      
      Fixes: 16292bed
      
       ("platform/x86: intel_pmc_core: Add Atom based Jasper Lake (JSL) platform support")
      Signed-off-by: default avatarArchana Patni <archana.patni@intel.com>
      Acked-by: default avatarDavid E. Box <david.e.box@intel.com>
      Tested-by: default avatarDivagar Mohandass <divagar.mohandass@intel.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      e87fa339
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 47cf1b42
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - Wacom driver functional and regression fixes from Jason Gerecke
      
       - race condition fix in usbhid, found by syzbot and fixed by Alan Stern
      
       - a few device-specific quirks and ID additions
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock
        HID: mcp2221: add gpiolib dependency
        HID: i2c-hid: reset Synaptics SYNA2393 on resume
        HID: wacom: Report 2nd-gen Intuos Pro S center button status over BT
        HID: usbhid: Fix race between usbhid_close() and usbhid_stop()
        Revert "HID: wacom: generic: read the number of expected touches on a per collection basis"
        HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead
        HID: alps: Add AUI1657 device ID
        HID: logitech: Add support for Logitech G11 extra keys
        HID: multitouch: add eGalaxTouch P80H84 support
        HID: wacom: Read HID_DG_CONTACTMAX directly for non-generic devices
      47cf1b42