commit 2c2c7e4a12c7e274adda3b334d912169c515efe7
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Mar 11 10:15:13 2022 +0100

    Linux 4.19.234
    
    Link: https://lore.kernel.org/r/20220309155856.155540075@linuxfoundation.org
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20220310140807.749164737@linuxfoundation.org
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>                              =
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Hulk Robot <hulkrobot@huawei.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c307029d811e03546d18d0e512fe295b3103b8e5
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:43 2022 +0100

    xen/netfront: react properly to failing gnttab_end_foreign_access_ref()
    
    Commit 66e3531b33ee51dad17c463b4d9c9f52e341503d upstream.
    
    When calling gnttab_end_foreign_access_ref() the returned value must
    be tested and the reaction to that value should be appropriate.
    
    In case of failure in xennet_get_responses() the reaction should not be
    to crash the system, but to disable the network device.
    
    The calls in setup_netfront() can be replaced by calls of
    gnttab_end_foreign_access(). While at it avoid double free of ring
    pages and grant references via xennet_disconnect_backend() in this case.
    
    This is CVE-2022-23042 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 92dc0e4a219602242407dedd987dc9c8263c959b
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:43 2022 +0100

    xen/gnttab: fix gnttab_end_foreign_access() without page specified
    
    Commit 42baefac638f06314298087394b982ead9ec444b upstream.
    
    gnttab_end_foreign_access() is used to free a grant reference and
    optionally to free the associated page. In case the grant is still in
    use by the other side processing is being deferred. This leads to a
    problem in case no page to be freed is specified by the caller: the
    caller doesn't know that the page is still mapped by the other side
    and thus should not be used for other purposes.
    
    The correct way to handle this situation is to take an additional
    reference to the granted page in case handling is being deferred and
    to drop that reference when the grant reference could be freed
    finally.
    
    This requires that there are no users of gnttab_end_foreign_access()
    left directly repurposing the granted page after the call, as this
    might result in clobbered data or information leaks via the not yet
    freed grant reference.
    
    This is part of CVE-2022-23041 / XSA-396.
    
    Reported-by: Simon Gaiser <simon@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f85d03f0f482cc28a2ee15a1fed2ae57ae359412
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:43 2022 +0100

    xen/pvcalls: use alloc/free_pages_exact()
    
    Commit b0576cc9c6b843d99c6982888d59a56209341888 upstream.
    
    Instead of __get_free_pages() and free_pages() use alloc_pages_exact()
    and free_pages_exact(). This is in preparation of a change of
    gnttab_end_foreign_access() which will prohibit use of high-order
    pages.
    
    This is part of CVE-2022-23041 / XSA-396.
    
    Reported-by: Simon Gaiser <simon@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2466bed361f3274e3e0ca9d8e539532481c06fea
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:42 2022 +0100

    xen/9p: use alloc/free_pages_exact()
    
    Commit 5cadd4bb1d7fc9ab201ac14620d1a478357e4ebd upstream.
    
    Instead of __get_free_pages() and free_pages() use alloc_pages_exact()
    and free_pages_exact(). This is in preparation of a change of
    gnttab_end_foreign_access() which will prohibit use of high-order
    pages.
    
    By using the local variable "order" instead of ring->intf->ring_order
    in the error path of xen_9pfs_front_alloc_dataring() another bug is
    fixed, as the error path can be entered before ring->intf->ring_order
    is being set.
    
    By using alloc_pages_exact() the size in bytes is specified for the
    allocation, which fixes another bug for the case of
    order < (PAGE_SHIFT - XEN_PAGE_SHIFT).
    
    This is part of CVE-2022-23041 / XSA-396.
    
    Reported-by: Simon Gaiser <simon@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c900f34fc134cc75de431e16546f37bf7804a012
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:42 2022 +0100

    xen: remove gnttab_query_foreign_access()
    
    Commit 1dbd11ca75fe664d3e54607547771d021f531f59 upstream.
    
    Remove gnttab_query_foreign_access(), as it is unused and unsafe to
    use.
    
    All previous use cases assumed a grant would not be in use after
    gnttab_query_foreign_access() returned 0. This information is useless
    in best case, as it only refers to a situation in the past, which could
    have changed already.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fbc57368ea527dcfa909908fc47a851a56e4e5ce
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:42 2022 +0100

    xen/gntalloc: don't use gnttab_query_foreign_access()
    
    Commit d3b6372c5881cb54925212abb62c521df8ba4809 upstream.
    
    Using gnttab_query_foreign_access() is unsafe, as it is racy by design.
    
    The use case in the gntalloc driver is not needed at all. While at it
    replace the call of gnttab_end_foreign_access_ref() with a call of
    gnttab_end_foreign_access(), which is what is really wanted there. In
    case the grant wasn't used due to an allocation failure, just free the
    grant via gnttab_free_grant_reference().
    
    This is CVE-2022-23039 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 62a696c15cfcfd32527f81ca3d94f2bde57475dc
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:42 2022 +0100

    xen/scsifront: don't use gnttab_query_foreign_access() for mapped status
    
    Commit 33172ab50a53578a95691310f49567c9266968b0 upstream.
    
    It isn't enough to check whether a grant is still being in use by
    calling gnttab_query_foreign_access(), as a mapping could be realized
    by the other side just after having called that function.
    
    In case the call was done in preparation of revoking a grant it is
    better to do so via gnttab_try_end_foreign_access() and check the
    success of that operation instead.
    
    This is CVE-2022-23038 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 927e4eb8ddf4968b6a33be992b28063f84552c72
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:41 2022 +0100

    xen/netfront: don't use gnttab_query_foreign_access() for mapped status
    
    Commit 31185df7e2b1d2fa1de4900247a12d7b9c7087eb upstream.
    
    It isn't enough to check whether a grant is still being in use by
    calling gnttab_query_foreign_access(), as a mapping could be realized
    by the other side just after having called that function.
    
    In case the call was done in preparation of revoking a grant it is
    better to do so via gnttab_end_foreign_access_ref() and check the
    success of that operation instead.
    
    This is CVE-2022-23037 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 423a3a50dce9a48d10d2d2a70cd2f78064c13703
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:41 2022 +0100

    xen/blkfront: don't use gnttab_query_foreign_access() for mapped status
    
    Commit abf1fd5919d6238ee3bc5eb4a9b6c3947caa6638 upstream.
    
    It isn't enough to check whether a grant is still being in use by
    calling gnttab_query_foreign_access(), as a mapping could be realized
    by the other side just after having called that function.
    
    In case the call was done in preparation of revoking a grant it is
    better to do so via gnttab_end_foreign_access_ref() and check the
    success of that operation instead.
    
    For the ring allocation use alloc_pages_exact() in order to avoid
    high order pages in case of a multi-page ring.
    
    If a grant wasn't unmapped by the backend without persistent grants
    being used, set the device state to "error".
    
    This is CVE-2022-23036 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 17659846fe336366b1663194f5669d10f5947f53
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:41 2022 +0100

    xen/grant-table: add gnttab_try_end_foreign_access()
    
    Commit 6b1775f26a2da2b05a6dc8ec2b5d14e9a4701a1a upstream.
    
    Add a new grant table function gnttab_try_end_foreign_access(), which
    will remove and free a grant if it is not in use.
    
    Its main use case is to either free a grant if it is no longer in use,
    or to take some other action if it is still in use. This other action
    can be an error exit, or (e.g. in the case of blkfront persistent grant
    feature) some special handling.
    
    This is CVE-2022-23036, CVE-2022-23038 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8d521d960aef22781ff499e16899c30af899de8d
Author: Juergen Gross <jgross@suse.com>
Date:   Fri Feb 25 16:05:40 2022 +0100

    xen/xenbus: don't let xenbus_grant_ring() remove grants in error case
    
    Commit 3777ea7bac3113005b7180e6b9dadf16d19a5827 upstream.
    
    Letting xenbus_grant_ring() tear down grants in the error case is
    problematic, as the other side could already have used these grants.
    Calling gnttab_end_foreign_access_ref() without checking success is
    resulting in an unclear situation for any caller of xenbus_grant_ring()
    as in the error case the memory pages of the ring page might be
    partially mapped. Freeing them would risk unwanted foreign access to
    them, while not freeing them would leak memory.
    
    In order to remove the need to undo any gnttab_grant_foreign_access()
    calls, use gnttab_alloc_grant_references() to make sure no further
    error can occur in the loop granting access to the ring pages.
    
    It should be noted that this way of handling removes leaking of
    grant entries in the error case, too.
    
    This is CVE-2022-23040 / part of XSA-396.
    
    Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 623ca876d4a91665b7d948e399f5776c713722ea
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Thu Mar 10 10:22:14 2022 +0000

    ARM: fix build warning in proc-v7-bugs.c
    
    commit b1a384d2cbccb1eb3f84765020d25e2c1929706e upstream.
    
    The kernel test robot discovered that building without
    HARDEN_BRANCH_PREDICTOR issues a warning due to a missing
    argument to pr_info().
    
    Add the missing argument.
    
    Reported-by: kernel test robot <lkp@intel.com>
    Fixes: 9dd78194a372 ("ARM: report Spectre v2 status through sysfs")
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 868d5f8a428f41da7f493a6744913b55c5c97ee2
Author: Nathan Chancellor <nathan@kernel.org>
Date:   Wed Mar 9 15:07:27 2022 -0700

    ARM: Do not use NOCROSSREFS directive with ld.lld
    
    commit 36168e387fa7d0f1fe0cd5cf76c8cea7aee714fa upstream.
    
    ld.lld does not support the NOCROSSREFS directive at the moment, which
    breaks the build after commit b9baf5c8c5c3 ("ARM: Spectre-BHB
    workaround"):
    
      ld.lld: error: ./arch/arm/kernel/vmlinux.lds:34: AT expected, but got NOCROSSREFS
    
    Support for this directive will eventually be implemented, at which
    point a version check can be added. To avoid breaking the build in the
    meantime, just define NOCROSSREFS to nothing when using ld.lld, with a
    link to the issue for tracking.
    
    Cc: stable@vger.kernel.org
    Fixes: b9baf5c8c5c3 ("ARM: Spectre-BHB workaround")
    Link: https://github.com/ClangBuiltLinux/linux/issues/1609
    Signed-off-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8dd98efe9e3f20927a2970bed5974ca8c3646c92
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Wed Mar 9 19:08:42 2022 +0000

    ARM: fix co-processor register typo
    
    commit 33970b031dc4653cc9dc80f2886976706c4c8ef1 upstream.
    
    In the recent Spectre BHB patches, there was a typo that is only
    exposed in certain configurations: mcr p15,0,XX,c7,r5,4 should have
    been mcr p15,0,XX,c7,c5,4
    
    Reported-by: kernel test robot <lkp@intel.com>
    Fixes: b9baf5c8c5c3 ("ARM: Spectre-BHB workaround")
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 594de64394b45200cefe25aeab3ad0ac88c451a4
Author: Sami Tolvanen <samitolvanen@google.com>
Date:   Tue Apr 28 15:14:15 2020 -0700

    kbuild: add CONFIG_LD_IS_LLD
    
    commit b744b43f79cc758127042e71f9ad7b1afda30f84 upstream.
    
    Similarly to the CC_IS_CLANG config, add LD_IS_LLD to avoid GNU ld
    specific logic such as ld-version or ld-ifversion and gain the
    ability to select potential features that depend on the linker at
    configuration time such as LTO.
    
    Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
    Acked-by: Masahiro Yamada <masahiroy@kernel.org>
    [nc: Reword commit message]
    Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
    Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
    Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
    Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit fffcf80d055c4f619ae9cd8bf3a8b67319317100
Author: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Date:   Tue Mar 8 20:18:20 2022 +0100

    ARM: fix build error when BPF_SYSCALL is disabled
    
    commit 330f4c53d3c2d8b11d86ec03a964b86dc81452f5 upstream.
    
    It was missing a semicolon.
    
    Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Fixes: 25875aa71dfe ("ARM: include unprivileged BPF status in Spectre V2 reporting").
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 29db7e4b67fccf5e1fe28ec89f2add90ce74d77b
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Mon Mar 7 19:28:32 2022 +0000

    ARM: include unprivileged BPF status in Spectre V2 reporting
    
    commit 25875aa71dfefd1959f07e626c4d285b88b27ac2 upstream.
    
    The mitigations for Spectre-BHB are only applied when an exception
    is taken, but when unprivileged BPF is enabled, userspace can
    load BPF programs that can be used to exploit the problem.
    
    When unprivileged BPF is enabled, report the vulnerable status via
    the spectre_v2 sysfs file.
    
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 99e14db3b711c27f93079ba9d7f2fff169916d5f
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Thu Feb 10 16:05:45 2022 +0000

    ARM: Spectre-BHB workaround
    
    commit b9baf5c8c5c356757f4f9d8180b5e9d234065bc3 upstream.
    
    Workaround the Spectre BHB issues for Cortex-A15, Cortex-A57,
    Cortex-A72, Cortex-A73 and Cortex-A75. We also include Brahma B15 as
    well to be safe, which is affected by Spectre V2 in the same ways as
    Cortex-A15.
    
    Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    [changes due to lack of SYSTEM_FREEING_INITMEM - gregkh]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 67e1f18a972be16363c6e88d7b29cde880774164
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Feb 11 19:49:50 2022 +0000

    ARM: use LOADADDR() to get load address of sections
    
    commit 8d9d651ff2270a632e9dc497b142db31e8911315 upstream.
    
    Use the linker's LOADADDR() macro to get the load address of the
    sections, and provide a macro to set the start and end symbols.
    
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 45c25917ceb7a5377883ef4c3a675276fba8a268
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Feb 11 19:46:15 2022 +0000

    ARM: early traps initialisation
    
    commit 04e91b7324760a377a725e218b5ee783826d30f5 upstream.
    
    Provide a couple of helpers to copy the vectors and stubs, and also
    to flush the copied vectors and stubs.
    
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dc64af755099d1e51fd64e99fe3a59b75595814a
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Feb 11 16:45:54 2022 +0000

    ARM: report Spectre v2 status through sysfs
    
    commit 9dd78194a3722fa6712192cdd4f7032d45112a9a upstream.
    
    As per other architectures, add support for reporting the Spectre
    vulnerability status via sysfs CPU.
    
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
    [ preserve res variable and add SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED - gregkh ]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bbb66a2464a6a4a9e1998ac7e1e5c58ccc2152eb
Author: Mark Rutland <mark.rutland@arm.com>
Date:   Fri Aug 9 14:22:40 2019 +0100

    arm/arm64: smccc/psci: add arm_smccc_1_1_get_conduit()
    
    commit 6b7fe77c334ae59fed9500140e08f4f896b36871 upstream.
    
    SMCCC callers are currently amassing a collection of enums for the SMCCC
    conduit, and are having to dig into the PSCI driver's internals in order
    to figure out what to do.
    
    Let's clean this up, with common SMCCC_CONDUIT_* definitions, and an
    arm_smccc_1_1_get_conduit() helper that abstracts the PSCI driver's
    internal state.
    
    We can kill off the PSCI_CONDUIT_* definitions once we've migrated users
    over to the new interface.
    
    Signed-off-by: Mark Rutland <mark.rutland@arm.com>
    Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Acked-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d5c149cfc797d5832452f9f5ecb3641f6a0c989f
Author: Steven Price <steven.price@arm.com>
Date:   Mon Oct 21 16:28:21 2019 +0100

    arm/arm64: Provide a wrapper for SMCCC 1.1 calls
    
    commit 541625ac47ce9d0835efaee0fcbaa251b0000a37 upstream.
    
    SMCCC 1.1 calls may use either HVC or SMC depending on the PSCI
    conduit. Rather than coding this in every call site, provide a macro
    which uses the correct instruction. The macro also handles the case
    where no conduit is configured/available returning a not supported error
    in res, along with returning the conduit used for the call.
    
    This allow us to remove some duplicated code and will be useful later
    when adding paravirtualized time hypervisor calls.
    
    Signed-off-by: Steven Price <steven.price@arm.com>
    Acked-by: Will Deacon <will@kernel.org>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9711b12a3f4c0fc73dd257c1e467e6e42155a5f1
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Fri Feb 25 14:32:28 2022 -0800

    x86/speculation: Warn about eIBRS + LFENCE + Unprivileged eBPF + SMT
    
    commit 0de05d056afdb00eca8c7bbb0c79a3438daf700c upstream.
    
    The commit
    
       44a3918c8245 ("x86/speculation: Include unprivileged eBPF status in Spectre v2 mitigation reporting")
    
    added a warning for the "eIBRS + unprivileged eBPF" combination, which
    has been shown to be vulnerable against Spectre v2 BHB-based attacks.
    
    However, there's no warning about the "eIBRS + LFENCE retpoline +
    unprivileged eBPF" combo. The LFENCE adds more protection by shortening
    the speculation window after a mispredicted branch. That makes an attack
    significantly more difficult, even with unprivileged eBPF. So at least
    for now the logic doesn't warn about that combination.
    
    But if you then add SMT into the mix, the SMT attack angle weakens the
    effectiveness of the LFENCE considerably.
    
    So extend the "eIBRS + unprivileged eBPF" warning to also include the
    "eIBRS + LFENCE + unprivileged eBPF + SMT" case.
    
      [ bp: Massage commit message. ]
    
    Suggested-by: Alyssa Milburn <alyssa.milburn@linux.intel.com>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8bfdba77595aee5c3e83ed1c9994c35d6d409605
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Fri Feb 25 14:31:49 2022 -0800

    x86/speculation: Warn about Spectre v2 LFENCE mitigation
    
    commit eafd987d4a82c7bb5aa12f0e3b4f8f3dea93e678 upstream.
    
    With:
    
      f8a66d608a3e ("x86,bugs: Unconditionally allow spectre_v2=retpoline,amd")
    
    it became possible to enable the LFENCE "retpoline" on Intel. However,
    Intel doesn't recommend it, as it has some weaknesses compared to
    retpoline.
    
    Now AMD doesn't recommend it either.
    
    It can still be left available as a cmdline option. It's faster than
    retpoline but is weaker in certain scenarios -- particularly SMT, but
    even non-SMT may be vulnerable in some cases.
    
    So just unconditionally warn if the user requests it on the cmdline.
    
      [ bp: Massage commit message. ]
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c034d344e733a3ac574dd09e39e911a50025c607
Author: Kim Phillips <kim.phillips@amd.com>
Date:   Mon Feb 28 11:23:16 2022 -0600

    x86/speculation: Update link to AMD speculation whitepaper
    
    commit e9b6013a7ce31535b04b02ba99babefe8a8599fa upstream.
    
    Update the link to the "Software Techniques for Managing Speculation
    on AMD Processors" whitepaper.
    
    Signed-off-by: Kim Phillips <kim.phillips@amd.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3cb3a6927222268a10b2f12dfb8c9444f7cc39e
Author: Kim Phillips <kim.phillips@amd.com>
Date:   Mon Feb 28 11:23:15 2022 -0600

    x86/speculation: Use generic retpoline by default on AMD
    
    commit 244d00b5dd4755f8df892c86cab35fb2cfd4f14b upstream.
    
    AMD retpoline may be susceptible to speculation. The speculation
    execution window for an incorrect indirect branch prediction using
    LFENCE/JMP sequence may potentially be large enough to allow
    exploitation using Spectre V2.
    
    By default, don't use retpoline,lfence on AMD.  Instead, use the
    generic retpoline.
    
    Signed-off-by: Kim Phillips <kim.phillips@amd.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 995629e1d8e6751936c6e2b738f70b392b0461de
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Fri Feb 18 11:49:08 2022 -0800

    x86/speculation: Include unprivileged eBPF status in Spectre v2 mitigation reporting
    
    commit 44a3918c8245ab10c6c9719dd12e7a8d291980d8 upstream.
    
    With unprivileged eBPF enabled, eIBRS (without retpoline) is vulnerable
    to Spectre v2 BHB-based attacks.
    
    When both are enabled, print a warning message and report it in the
    'spectre_v2' sysfs vulnerabilities file.
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    [fllinden@amazon.com: backported to 4.19]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7af95ef3ec6248696300fce5c68f6c8c4f50e4a4
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Feb 16 20:57:02 2022 +0100

    Documentation/hw-vuln: Update spectre doc
    
    commit 5ad3eb1132453b9795ce5fd4572b1c18b292cca9 upstream.
    
    Update the doc with the new fun.
    
      [ bp: Massage commit message. ]
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    [fllinden@amazon.com: backported to 4.19]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f66bedb96ff4c064a819e68499f79b38297ba26
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Feb 16 20:57:01 2022 +0100

    x86/speculation: Add eIBRS + Retpoline options
    
    commit 1e19da8522c81bf46b335f84137165741e0d82b7 upstream.
    
    Thanks to the chaps at VUsec it is now clear that eIBRS is not
    sufficient, therefore allow enabling of retpolines along with eIBRS.
    
    Add spectre_v2=eibrs, spectre_v2=eibrs,lfence and
    spectre_v2=eibrs,retpoline options to explicitly pick your preferred
    means of mitigation.
    
    Since there's new mitigations there's also user visible changes in
    /sys/devices/system/cpu/vulnerabilities/spectre_v2 to reflect these
    new mitigations.
    
      [ bp: Massage commit message, trim error messages,
        do more precise eIBRS mode checking. ]
    
    Co-developed-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Patrick Colp <patrick.colp@oracle.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    [fllinden@amazon.com: backported to 4.19 (no Hygon)]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 25440a8c77dd2fde6a8e9cfc0c616916febf408e
Author: Peter Zijlstra (Intel) <peterz@infradead.org>
Date:   Wed Feb 16 20:57:00 2022 +0100

    x86/speculation: Rename RETPOLINE_AMD to RETPOLINE_LFENCE
    
    commit d45476d9832409371537013ebdd8dc1a7781f97a upstream.
    
    The RETPOLINE_AMD name is unfortunate since it isn't necessarily
    AMD only, in fact Hygon also uses it. Furthermore it will likely be
    sufficient for some Intel processors. Therefore rename the thing to
    RETPOLINE_LFENCE to better describe what it is.
    
    Add the spectre_v2=retpoline,lfence option as an alias to
    spectre_v2=retpoline,amd to preserve existing setups. However, the output
    of /sys/devices/system/cpu/vulnerabilities/spectre_v2 will be changed.
    
      [ bp: Fix typos, massage. ]
    
    Co-developed-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    [fllinden@amazon.com: backported to 4.19]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1dd7efcfcccee59c974f56848739d4f5a5a570c7
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Oct 26 14:01:46 2021 +0200

    x86,bugs: Unconditionally allow spectre_v2=retpoline,amd
    
    commit f8a66d608a3e471e1202778c2a36cbdc96bae73b upstream.
    
    Currently Linux prevents usage of retpoline,amd on !AMD hardware, this
    is unfriendly and gets in the way of testing. Remove this restriction.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Borislav Petkov <bp@suse.de>
    Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Tested-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/r/20211026120310.487348118@infradead.org
    [fllinden@amazon.com: backported to 4.19 (no Hygon in 4.19)]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d86fc674172edc0794f84198405f59f00b71512a
Author: Borislav Petkov <bp@suse.de>
Date:   Mon Jun 15 08:51:25 2020 +0200

    x86/speculation: Merge one test in spectre_v2_user_select_mitigation()
    
    commit a5ce9f2bb665d1d2b31f139a02dbaa2dfbb62fa6 upstream.
    
    Merge the test whether the CPU supports STIBP into the test which
    determines whether STIBP is required. Thus try to simplify what is
    already an insane logic.
    
    Remove a superfluous newline in a comment, while at it.
    
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: Anthony Steinhauser <asteinhauser@google.com>
    Link: https://lkml.kernel.org/r/20200615065806.GB14668@zn.tnic
    [fllinden@amazon.com: fixed contextual conflict (comment) for 4.19]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>