Commit Graph

1049179 Commits

Author SHA1 Message Date
Alistair Delva
3dfbbce217 Revert "FROMLIST: configfs: make directories inherit uid/gid from creator"
This reverts commit 311e1c831c.

Reason for revert: uapi impacting changes can't be FROMLIST

Change-Id: I1d793178ab9a529f1be15a14c7e268e3e3953263
2021-11-06 17:04:49 +00:00
Greg Kroah-Hartman
cd4bd5eb3f Merge f594e28d80 ("Merge tag 'hardening-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iadcebc8a55910660316a5aa1e6f3cbd48fa9d9cc
2021-11-06 15:07:11 +01:00
Greg Kroah-Hartman
9909e8a73a Merge 01463374c5 ("Merge tag 'cpu-to-thread_info-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7a23735f3cc2e1c012849106b42a4d1e37df0e4b
2021-11-06 15:05:15 +01:00
Greg Kroah-Hartman
422ae5fb27 Merge 46f8763228 ("Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0dd24800b6f26902f2dbe39b6025fb52d1f36f90
2021-11-06 14:36:54 +01:00
Greg Kroah-Hartman
b0d00c9d42 Merge 879dbe9ffe ("Merge tag 'x86_sgx_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I63ddf31b07712d3821a808d8c8f047bf3e3bf57a
2021-11-06 13:16:38 +01:00
Greg Kroah-Hartman
3d1f7b2753 ANDROID: GKI: update Kconfig options for CONFIG_PREEMPT
Commit c597bfddc9 ("sched: Provide Kconfig support for default dynamic
preempt mode") changed the dependancies for CONFIG_PREEMPT, now
CONFIG_PREEMPT_BEHAVIOR needs to be set, so fix up the GKI config files
to properly do this.

Fixes: c597bfddc9 ("sched: Provide Kconfig support for default dynamic preempt mode")
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9b2e80b93985159a1925af3af8c221b556577f3d
2021-11-05 16:08:55 +00:00
Greg Kroah-Hartman
732e4b98eb Merge 9a7e0a90a4 ("Merge tag 'sched-core-2021-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1.

Resolves merge conflicts in:
	kernel/irq_work.c
	kernel/sched/core.c
	kernel/sched/fair.c

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4b144ffba858a38a417e9d71d76c23d015b7aa9b
2021-11-05 17:07:26 +01:00
Greg Kroah-Hartman
24430bad49 ANDROID: fix build error in arch/arm64/include/asm/arch_timer.h
clang is throwing up when it hits the BUILD_BUG_ON() macro at the
moment, so remove it from arch_time.h for arm64 to fix the build at this
point in time.

Fixes: a1cb80290f ("Merge 57a315cd71 ("Merge tag 'timers-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline")
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Marc Zyngier <mzyngier@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0ccd2fa80b3f9fea92464ba40cd3ca6ad013a5d1
2021-11-05 14:21:46 +01:00
Miguel Ojeda
fe8a1544ad FROMLIST: compiler_types: mark __compiletime_assert failure as __noreturn
`__compiletime_assert` declares a fake `extern` function
which appears (to the compiler) to be called when the test fails.

Therefore, compilers may emit possibly-uninitialized warnings
in some cases, even if it will be an error anyway (for compilers
supporting the `error` attribute, e.g. GCC and Clang >= 14)
or a link failure (for those that do not, e.g. Clang < 14).

Annotating the fake function as `__noreturn` gives them
the information they need to avoid the warning,
e.g. see https://godbolt.org/z/x1v69jjYY.

Link: https://lore.kernel.org/llvm/202110100514.3h9CI4s0-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Change-Id: I6aaf5325bc7821cafda8fea501e8e304750ad84a
Fixes: a1cb80290f ("Merge 57a315cd71 ("Merge tag 'timers-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline")
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2021-11-05 09:23:50 +01:00
Greg Kroah-Hartman
a1cb80290f Merge 57a315cd71 ("Merge tag 'timers-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If9127c0b9dacb55728ab43aa8e6f768d9c2368c1
2021-11-05 08:18:22 +01:00
Eric Biggers
2fd53f8098 ANDROID: fscrypt: add support for hardware-wrapped keys
Add support for hardware-wrapped keys to fscrypt.  Hardware-wrapped keys
are inline encryption keys which are only present in kernel memory in
ephemerally-wrapped form, and which can only be unwrapped by dedicated
hardware.  Such keys are protected from certain attacks, such as cold
boot attacks.  For more information, see the "Hardware-wrapped keys"
section of Documentation/block/inline-encryption.rst.

To support hardware-wrapped keys in fscrypt, we allow the fscrypt master
keys to be hardware-wrapped, and we allow encryption policies to be
flagged as needing a hardware-wrapped key.  File contents encryption is
done by passing the wrapped key to the inline encryption hardware via
blk-crypto.  Other fscrypt operations such as filenames encryption
continue to be done by the kernel, using the "software secret" which the
hardware derives.

Note that this feature doesn't require any filesystem-specific changes.
However it does depend on inline encryption support, and thus currently
it is only applicable to ext4 and f2fs, not to ubifs or CephFS.

This is a reworked version of a patch which was temporily reverted by
https://android-review.googlesource.com/c/kernel/common/+/1867364, and
which originated from
https://android-review.googlesource.com/c/kernel/common/+/1200864.
This is based on a version of this patch that I've proposed upstream
(https://lore.kernel.org/r/20211021181608.54127-4-ebiggers@kernel.org),
but by necessity it preserves the existing UAPI and on-disk format which
Android expects.  I also dropped the changes to the documentation file.

Bug: 160883801
Change-Id: If4bb83f1188a5863184717c04cb8a064dc4ea168
Signed-off-by: Eric Biggers <ebiggers@google.com>
2021-11-04 12:27:15 -07:00
Barani Muthukumaran
fd35c92fc4 ANDROID: dm: add support for passing through derive_sw_secret
Update the device-mapper core to support exposing the inline crypto
support of wrapped keys through the device-mapper device.

derive_sw_secret in keyslot manager is used to derive the software
secret from the given wrapped keyblob using the underlying blk device.
Given that the sw_secret is the same for a given wrapped keyblob the
call exits when the first underlying blk-device suceeds.

This is a reworked version of a patch which was temporily reverted by
https://android-review.googlesource.com/c/kernel/common/+/1867366, and
which originated from
https://android-review.googlesource.com/c/kernel/common/+/1229460.

Bug: 147209885
Bug: 160883266
Bug: 160883801

Test: Validated FBE with wrappedkey_v0 when /data is mounted on a
      dm device.

Change-Id: Id30d00afdbd3114e089887db1493ffd41e833e21
Signed-off-by: Barani Muthukumaran <bmuthuku@codeaurora.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
2021-11-04 12:24:19 -07:00
Barani Muthukumaran
56e1e0a69a ANDROID: dm: Add wrapped key support in dm-default-key
To prevent keys from being compromised if an attacker acquires read
access to kernel memory, some inline encryption hardware supports
protecting the keys in hardware without software having access to or the
ability to set the plaintext keys.  Instead, software only sees "wrapped
keys", which may differ on every boot.  The keys can be initially
generated either by software (in which case they need to be imported to
hardware to be wrapped), or directly by the hardware.

Add support for this type of hardware by allowing keys to be flagged as
hardware-wrapped. When used, dm-default-key will pass the wrapped key
to the inline encryption hardware to encryption metadata. The hardware
will internally unwrap the key and derive the metadata encryption key.

This is a reworked version of a patch which was temporily reverted by
https://android-review.googlesource.com/c/kernel/common/+/1867365, and
which originated from
https://android-review.googlesource.com/c/kernel/common/+/1224286.

Bug: 147209885
Bug: 160883801
Bug: 160883266
Bug: 160885805

Test: Validate metadata encryption & FBE with wrapped keys.

Change-Id: I38393727bf71e5d20b3c3ac9d2af62a1864a0a82
Signed-off-by: Barani Muthukumaran <bmuthuku@codeaurora.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
2021-11-04 12:24:19 -07:00
Eric Biggers
c26f08d1d4 ANDROID: block: add basic hardware-wrapped key support
To prevent keys from being compromised if an attacker acquires read
access to kernel memory, some inline encryption hardware can accept keys
which are wrapped by a per-boot hardware-internal key.  This avoids
needing to keep the plaintext keys in kernel memory, without restricting
the number of keys that can be used.  Such keys can be initially
generated either by software (in which case they must be imported to
hardware to be wrapped) or directly by the hardware.  There is also a
mechanism to derive a "software secret" for cryptographic tasks that
can't be handled by inline encryption.

To support this hardware, allow struct blk_crypto_key to represent a
hardware-wrapped key as an alternative to a standard key, and make
drivers set flags in struct blk_crypto_profile to indicate which types
of keys they support.  Also add the derive_sw_secret() low-level
operation, which drivers supporting wrapped keys must implement.

For more information, see the detailed documentation which this patch
adds to Documentation/block/inline-encryption.rst.

This is a reworked version of a patch which was temporily reverted by
https://android-review.googlesource.com/c/kernel/common/+/1867367, and
which originated from several ANDROID patches that were consolidated by
https://android-review.googlesource.com/c/kernel/common-patches/+/1350782.
This version of the patch matches the patch in the below "Link:" tag
that was sent upstream as an RFC.  However, due to its history as
ANDROID, it remains tagged as ANDROID rather than FROMLIST.

Bug: 160883801
Link: https://lore.kernel.org/r/20211021181608.54127-2-ebiggers@kernel.org
Change-Id: I4d18c261c279d606457b33374234c0a037e1d45a
Signed-off-by: Eric Biggers <ebiggers@google.com>
2021-11-04 12:24:11 -07:00
Eric Biggers
f9e85d3a7a ANDROID: scsi: ufs: allow overriding the blk_crypto_profile
Add UFSHCD_QUIRK_CUSTOM_CRYPTO_PROFILE which tells ufshcd-core that the
host controller supports inline encryption, but it needs to initialize
the crypto capabilities in a nonstandard way and/or it needs to override
blk_crypto_ll_ops.  If enabled, the standard code won't initialize the
blk_crypto_profile; ufs_hba_variant_ops::init() must do it instead.

Note that it is permitted that the blk_crypto_profile has no keyslots.

This is needed for FMP support, as well as for wrapped key support.

This is a reworked version of a patch which was temporarily reverted by
https://android-review.googlesource.com/c/kernel/common/+/1867368, and
which originated from several ANDROID patches that were consolidated by
https://android-review.googlesource.com/c/kernel/common-patches/+/1508579.

Bug: 162257402
Bug: 160883801
Change-Id: I556a68cd2d11bd5a7353fefdc31920475a5e7425
Signed-off-by: Eric Biggers <ebiggers@google.com>
2021-11-04 12:23:01 -07:00
rogercl.yang
c5027eb926 ANDROID: cpuidle: enable TEO and MENU governors in gki_defconfig
TEO governor was implemented in android12-5.10, however CONFIG_CPU_IDLE_GOV_TEO
was not enabled in gki_defconfig and vendor can not select TEO governor.
This commit enable TEO and MENU governors in gki_defconfig, and vendors can
select the governor they wanted, e.g. in rc file:
write /sys/devices/system/cpu/cpuidle/current_governor "teo"

Besides, MENU governor's rating is 20, and higher than TEO governor,
so MENU governor is still the default governor if vendors not select the governor manually.

Bug: 185762657

Change-Id: I87be7c4d119f17901b921f22dd7df8b61ac539af
Signed-off-by: rogercl.yang <rogercl.yang@mediatek.com>
(cherry picked from commit ea527a52d1)
2021-11-04 18:46:10 +00:00
Kalesh Singh
8448f85943 ANDROID: GKI: Enable HIST_TRIGGERS (x86)
Histogram triggers (already enabled for arm64) will be used
to throttle frequent trace events on Android.

Bug: 146055070
Bug: 145972256
Change-Id: Ia186a79867866e5b4ed37f2cc14be194505f3fba
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2021-11-04 18:14:59 +00:00
Greg Kroah-Hartman
80ab4454de Merge 43aa0a195f ("Merge tag 'objtool-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I58e2090225633e9752c15423d8e1e91b83eeeb7b
2021-11-04 17:28:14 +01:00
Guangming Cao
384f465298 ANDROID: GKI: Enable CONFIG_IOMMU_IO_PGTABLE_ARMV7S
To enable IOMMU driver, we need to enable CONFIG_IOMMU_IO_PGTABLE_ARMV7S
as build-in by default value in gki_defconfig.

Bug: 189076024

Change-Id: Ia9a87682c2c56338f57703a4bc01793fbe1a3496
Signed-off-by: Guangming Cao <Guangming.Cao@mediatek.com>
(cherry picked from commit b6cab5d17d)
2021-11-04 11:34:39 +00:00
Greg Kroah-Hartman
367ad51923 Merge 595b28fb0c ("Merge tag 'locking-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1

Resolves conflicts with:
	kernel/sched/core.c

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id00b97b9373792e736005a410e35aa6a2828cba1
2021-11-04 08:28:52 +01:00
Yifan Hong
6b7933539f ANDROID: Kbuild: Support KBUILD_MIXED_TREE in Makefile.modfinal
When KBUILD_MIXED_TREE points to the output folder of another kernel's
build output, Kbuild can compile a complete kernel tree's modules
against that other kernel tree's vmlinux. This is useful when two
kernel trees exist: a "Generic Kernel Image" tree and a "device kernel"
tree.  Both trees are complete kernel source trees, and the "Generic
Kernel Image" should provide the kernel Image and device kernel tree
provides device driver modules.

To accomplish this, references to vmlinux in the device kernel
should point to the generic kernel's vmlinux and the device
kernel should skip compilation of built-in files.

Change ee1b16e80d
adds support for KBUILD_MIXED_TREE
in Makefile and Makefile.modpost. This change adds support for
KBUILD_MIXED_TREE in Makefile.modfinal, where vmlinux is referenced.

Bug: 202075496

Change-Id: I9bb3ff34fd6b5f0510b87648b9942af25c903de0
Signed-off-by: Yifan Hong <elsk@google.com>
2021-11-03 18:54:06 +00:00
Yifan Hong
2eefbec0f3 ANDROID: Kleaf: common kernel public
.... so it can be referenced in mixed builds.

Test: build cuttlefish
Bug: 202075496
Change-Id: I8d79847c54c639fa619edf3280c021f02ba76645
Signed-off-by: Yifan Hong <elsk@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
2021-11-03 18:52:00 +00:00
Greg Kroah-Hartman
2c2b3a46d5 Revert "ANDROID: futex: Add vendor hook for wait queue"
This reverts commit 3ba4b6d6a3.

The futex code is changed in large ways in 5.16-rc1, so the hook here is
no longer relevant and causes merge conflicts.  It will have to be
re-added if it is still needed in the future.

Bug: 163431711
Cc: JianMin Liu <jian-min.liu@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I318ed87ac80ef7d4fb55240d55f74efb291b7907
2021-11-03 14:11:33 +01:00
Greg Kroah-Hartman
d9bdbf0207 Merge 91e1c99e17 ("Merge tag 'perf-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I70143990f75875c8a058f5ec254f22c72bd637fb
2021-11-03 14:07:12 +01:00
Greg Kroah-Hartman
dcc475d86c Merge 5a47ebe98e ("Merge tag 'irq-core-2021-10-31' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6dce820280dce0b02c2f946a048b3c93c2a75a0d
2021-11-03 13:27:52 +01:00
Greg Kroah-Hartman
d1a7e1ba6c Revert "FROMLIST: irqchip: irq-meson-gpio: make it possible to build as a module"
This reverts commit 95d5435480.

It is already included in 5.16-rc1 in a different form, so revert it
here to prevent merge issues from showing up later on, and to make it
obvious that we are taking the upstream version, not the different
version that was in the android-mainline tree.

Bug: 179406580
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I44f1ec90c26f28d8e921749fab2afbfecead6898
2021-11-03 13:27:19 +01:00
Greg Kroah-Hartman
ebabcb70ed Merge 037c50bfbe ("Merge tag 'for-5.16-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ide84fd0886d433adb3c6d279c1ddaf4816055a3c
2021-11-03 13:26:57 +01:00
Greg Kroah-Hartman
517fa78020 Merge 9c6e8d52a7 ("Merge tag 'exfat-for-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If6e437c7ff6f875e86f773dd760bb5b257b8f270
2021-11-03 12:39:10 +01:00
Greg Kroah-Hartman
180ba6be9f Merge 67a135b80e ("Merge tag 'erofs-for-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I14d87cf9e07ed91c8cafe9230a7d156d9263de09
2021-11-03 12:38:19 +01:00
Greg Kroah-Hartman
599f82ec1e Merge cd3e8ea847 ("Merge tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I89988c6f4281e552da6edec11f37ab4c0bf71aa0
2021-11-03 12:37:18 +01:00
Greg Kroah-Hartman
8c07eec25d ANDROID: fuse: passthrough: fix up build error in ki_complete
Commit 6b19b766e8 ("fs: get rid of the res2 iocb->ki_complete
argument") dropped the res2 argument in ki_complete, which broke the
build in the fuse passthrough code.

Fix this up by dropping the argument here as well.

Bug: 168023149
Cc: Alessio Balsini <balsini@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id4c8d7bd34bda4cdfc6467446cbed9ad267ede03
2021-11-03 12:22:21 +01:00
Greg Kroah-Hartman
625ef9a5f2 Merge 19901165d9 ("Merge tag 'for-5.16/inode-sync-2021-10-29' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie95f85e5a3b9d22f1b3473f2771f6e050a75f84a
2021-11-03 12:20:43 +01:00
Greg Kroah-Hartman
61be9be439 Merge 737f1cd8a8 ("Merge tag 'for-5.16/cdrom-2021-10-29' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I569473fb9e4ab69e09a7c4388abd4e0c866a7b3b
2021-11-03 11:40:25 +01:00
Greg Kroah-Hartman
d103e6b963 Merge 33c8846c81 ("Merge tag 'for-5.16/block-2021-10-29' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.16-rc1

Fixes up merge issues with:
	drivers/scsi/ufs/ufshcd-crypto.c

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibb8331eb6115ef0e16f94fc326070b91de6798e4
2021-11-03 11:38:24 +01:00
Greg Kroah-Hartman
ae2e828732 Merge 9ac211426f ("Merge tag 'locks-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6a2cb9538a2eff757c21390e487f5ed0b8405041
2021-11-03 11:24:12 +01:00
Greg Kroah-Hartman
0f8c04a4ed Merge ad98a92466 ("Merge tag 'tpmdd-next-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9dbb5d2a00dc868862c7f4963e9ac902c745e4f8
2021-11-03 11:23:32 +01:00
Linus Torvalds
dc7512451c UPSTREAM: mm: fix mismerge of folio page flag manipulators
I had missed a semantic conflict between commit d389a4a811 ("mm: Add
folio flag manipulation functions") from the folio tree, and commit
eac96c3efd ("mm: filemap: check if THP has hwpoisoned subpage for PMD
page fault") that added a new set of page flags.

My build tests had too many options enabled, which hid this issue.  But
if you didn't have MEMORY_FAILURE or TRANSPARENT_HUGEPAGE enabled, you'd
end up with build errors like this:

  include/linux/page-flags.h:806:29: error: macro "PAGEFLAG_FALSE" requires 2 arguments, but only 1 given
    806 | PAGEFLAG_FALSE(HasHWPoisoned)
        |                             ^

due to the missing lowercase name used for folio function naming.

Fixes: 49f8275c7d ("Merge tag 'folio-5.16' of git://git.infradead.org/users/willy/pagecache")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Reported-by: Yang Shi <shy828301@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit e664359367)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iaab7a897e0a62d3ca8a1647a202ac9feb3baa9ce
2021-11-02 16:44:37 +01:00
Greg Kroah-Hartman
0542092546 Merge 49f8275c7d ("Merge tag 'folio-5.16' of git://git.infradead.org/users/willy/pagecache") into android-mainline
Steps on the way to 5.16-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I48a092badc5f5841f2e2bac0eeb43874e3559b9e
2021-11-02 16:14:34 +01:00
Greg Kroah-Hartman
8c3fc59e08 Revert "ANDROID: attribute page lock and waitqueue functions as sched"
This reverts commit dec0fd4a03.

It causes too many merge issues with upstream commits, and due to the
age, really should have been sent upstream.  Revert it and if it really
is needed, the developers can add it back when needed.

Bug: 144961676
Bug: 144713689
Bug: 172212772
Cc: Minchan Kim <minchan@google.com>
Cc: Jimmy Shiu <jimmyshiu@google.com>
Cc: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I667d51c9d53a701f273c64bf7aa337848b458c1c
2021-11-02 16:13:33 +01:00
Linus Torvalds
f594e28d80 Merge tag 'hardening-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull compiler hardening updates from Kees Cook:
 "These are various compiler-related hardening feature updates. Notable
  is the addition of an explicit limited rationale for, and deprecation
  schedule of, gcc-plugins.

  gcc-plugins:
   - remove support for GCC 4.9 and older (Ard Biesheuvel)
   - remove duplicate include in gcc-common.h (Ye Guojin)
   - Explicitly document purpose and deprecation schedule (Kees Cook)
   - Remove cyc_complexity (Kees Cook)

  instrumentation:
   - Avoid harmless Clang option under CONFIG_INIT_STACK_ALL_ZERO (Kees Cook)

  Clang LTO:
   - kallsyms: strip LTO suffixes from static functions (Nick Desaulniers)"

* tag 'hardening-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  gcc-plugins: remove duplicate include in gcc-common.h
  gcc-plugins: Remove cyc_complexity
  gcc-plugins: Explicitly document purpose and deprecation schedule
  kallsyms: strip LTO suffixes from static functions
  gcc-plugins: remove support for GCC 4.9 and older
  hardening: Avoid harmless Clang option under CONFIG_INIT_STACK_ALL_ZERO
2021-11-01 17:09:03 -07:00
Linus Torvalds
01463374c5 Merge tag 'cpu-to-thread_info-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull thread_info update to move 'cpu' back from task_struct from Kees Cook:
 "Cross-architecture update to move task_struct::cpu back into
  thread_info on arm64, x86, s390, powerpc, and riscv. All Acked by arch
  maintainers.

  Quoting Ard Biesheuvel:

     'Move task_struct::cpu back into thread_info

      Keeping CPU in task_struct is problematic for architectures that
      define raw_smp_processor_id() in terms of this field, as it
      requires linux/sched.h to be included, which causes a lot of pain
      in terms of circular dependencies (aka 'header soup')

      This series moves it back into thread_info (where it came from)
      for all architectures that enable THREAD_INFO_IN_TASK, addressing
      the header soup issue as well as some pointless differences in the
      implementations of task_cpu() and set_task_cpu()'"

* tag 'cpu-to-thread_info-v5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  riscv: rely on core code to keep thread_info::cpu updated
  powerpc: smp: remove hack to obtain offset of task_struct::cpu
  sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y
  powerpc: add CPU field to struct thread_info
  s390: add CPU field to struct thread_info
  x86: add CPU field to struct thread_info
  arm64: add CPU field to struct thread_info
2021-11-01 17:00:05 -07:00
Linus Torvalds
03feb7c55c Merge tag 'm68k-for-v5.16-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k updates from Geert Uytterhoeven:

 - A small comma vs semicolon cleanup

 - defconfig updates

* tag 'm68k-for-v5.16-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
  m68k: defconfig: Update defconfigs for v5.15-rc1
  m68k: muldi3: Use semicolon instead of comma
2021-11-01 16:57:36 -07:00
Linus Torvalds
552ebfe022 Merge tag 'for-5.16/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller:
 "Lots of new features and fixes:

   - Added TOC (table of content) support, which is a debugging feature
     which is either initiated by pressing the TOC button or via command
     in the BMC. If pressed the Linux built-in KDB/KGDB will be called
     (Sven Schnelle)

   - Fix CONFIG_PREEMPT (Sven)

   - Fix unwinder on 64-bit kernels (Sven)

   - Various kgdb fixes (Sven)

   - Added KFENCE support (me)

   - Switch to ARCH_STACKWALK implementation (me)

   - Fix ptrace check on syscall return (me)

   - Fix kernel crash with fixmaps on PA1.x machines (me)

   - Move thread_info into task struct, aka CONFIG_THREAD_INFO_IN_TASK
     (me)

   - Updated defconfigs

   - Smaller cleanups, including Makefile cleanups (Masahiro Yamada),
     use kthread_run() macro (Cai Huoqing), use swap() macro (Yihao
     Han)"

* tag 'for-5.16/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: (36 commits)
  parisc: Fix set_fixmap() on PA1.x CPUs
  parisc: Use swap() to swap values in setup_bootmem()
  parisc: Update defconfigs
  parisc: decompressor: clean up Makefile
  parisc: decompressor: remove repeated depenency of misc.o
  parisc: Remove unused constants from asm-offsets.c
  parisc/ftrace: use static key to enable/disable function graph tracer
  parisc/ftrace: set function trace function
  parisc: Make use of the helper macro kthread_run()
  parisc: mark xchg functions notrace
  parisc: enhance warning regarding usage of O_NONBLOCK
  parisc: Drop ifdef __KERNEL__ from non-uapi kernel headers
  parisc: Use PRIV_USER and PRIV_KERNEL in ptrace.h
  parisc: Use PRIV_USER in syscall.S
  parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling
  parisc: Move thread_info into task struct
  parisc: add support for TOC (transfer of control)
  parisc/firmware: add functions to retrieve TOC data
  parisc: add PIM TOC data structures
  parisc: move virt_map macro to assembly.h
  ...
2021-11-01 16:51:13 -07:00
Linus Torvalds
46f8763228 Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 updates from Will Deacon:
 "There's the usual summary below, but the highlights are support for
  the Armv8.6 timer extensions, KASAN support for asymmetric MTE, the
  ability to kexec() with the MMU enabled and a second attempt at
  switching to the generic pfn_valid() implementation.

  Summary:

   - Support for the Arm8.6 timer extensions, including a
     self-synchronising view of the system registers to elide some
     expensive ISB instructions.

   - Exception table cleanup and rework so that the fixup handlers
     appear correctly in backtraces.

   - A handful of miscellaneous changes, the main one being selection of
     CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK.

   - More mm and pgtable cleanups.

   - KASAN support for "asymmetric" MTE, where tag faults are reported
     synchronously for loads (via an exception) and asynchronously for
     stores (via a register).

   - Support for leaving the MMU enabled during kexec relocation, which
     significantly speeds up the operation.

   - Minor improvements to our perf PMU drivers.

   - Improvements to the compat vDSO build system, particularly when
     building with LLVM=1.

   - Preparatory work for handling some Coresight TRBE tracing errata.

   - Cleanup and refactoring of the SVE code to pave the way for SME
     support in future.

   - Ensure SCS pages are unpoisoned immediately prior to freeing them
     when KASAN is enabled for the vmalloc area.

   - Try moving to the generic pfn_valid() implementation again now that
     the DMA mapping issue from last time has been resolved.

   - Numerous improvements and additions to our FPSIMD and SVE
     selftests"

[ armv8.6 timer updates were in a shared branch and already came in
  through -tip in the timer pull  - Linus ]

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (85 commits)
  arm64: Select POSIX_CPU_TIMERS_TASK_WORK
  arm64: Document boot requirements for FEAT_SME_FA64
  arm64/sve: Fix warnings when SVE is disabled
  arm64/sve: Add stub for sve_max_virtualisable_vl()
  arm64: errata: Add detection for TRBE write to out-of-range
  arm64: errata: Add workaround for TSB flush failures
  arm64: errata: Add detection for TRBE overwrite in FILL mode
  arm64: Add Neoverse-N2, Cortex-A710 CPU part definition
  selftests: arm64: Factor out utility functions for assembly FP tests
  arm64: vmlinux.lds.S: remove `.fixup` section
  arm64: extable: add load_unaligned_zeropad() handler
  arm64: extable: add a dedicated uaccess handler
  arm64: extable: add `type` and `data` fields
  arm64: extable: use `ex` for `exception_table_entry`
  arm64: extable: make fixup_exception() return bool
  arm64: extable: consolidate definitions
  arm64: gpr-num: support W registers
  arm64: factor out GPR numbering helpers
  arm64: kvm: use kvm_exception_table_entry
  arm64: lib: __arch_copy_to_user(): fold fixups into body
  ...
2021-11-01 16:33:53 -07:00
Linus Torvalds
879dbe9ffe Merge tag 'x86_sgx_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 SGX updates from Borislav Petkov:
 "Add a SGX_IOC_VEPC_REMOVE ioctl to the /dev/sgx_vepc virt interface
  with which EPC pages can be put back into their uninitialized state
  without having to reopen /dev/sgx_vepc, which could not be possible
  anymore after startup due to security policies"

* tag 'x86_sgx_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/sgx/virt: implement SGX_IOC_VEPC_REMOVE ioctl
  x86/sgx/virt: extract sgx_vepc_remove_page
2021-11-01 15:54:07 -07:00
Linus Torvalds
20273d2588 Merge tag 'x86_sev_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 SEV updates from Borislav Petkov:

 - Export sev_es_ghcb_hv_call() so that HyperV Isolation VMs can use it
   too

 - Non-urgent fixes and cleanups

* tag 'x86_sev_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/sev: Expose sev_es_ghcb_hv_call() for use by HyperV
  x86/sev: Allow #VC exceptions on the VC2 stack
  x86/sev: Fix stack type check in vc_switch_off_ist()
  x86/sme: Use #define USE_EARLY_PGTABLE_L5 in mem_encrypt_identity.c
  x86/sev: Carve out HV call's return value verification
2021-11-01 15:52:26 -07:00
Linus Torvalds
160729afc8 Merge tag 'x86_misc_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull misc x86 changes from Borislav Petkov:

 - Use the proper interface for the job: get_unaligned() instead of
   memcpy() in the insn decoder

 - A randconfig build fix

* tag 'x86_misc_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/insn: Use get_unaligned() instead of memcpy()
  x86/Kconfig: Fix an unused variable error in dell-smm-hwmon
2021-11-01 15:45:14 -07:00
Linus Torvalds
e0f4c59dc4 Merge tag 'x86_cpu_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu updates from Borislav Petkov:

 - Start checking a CPUID bit on AMD Zen3 which states that the CPU
   clears the segment base when a null selector is written. Do the
   explicit detection on older CPUs, zen2 and hygon specifically, which
   have the functionality but do not advertize the CPUID bit. Factor in
   the presence of a hypervisor underneath the kernel and avoid doing
   the explicit check there which the HV might've decided to not
   advertize for migration safety reasons, or similar.

 - Add support for a new X86 CPU vendor: VORTEX. Needed for whitelisting
   those CPUs in the hardware vulnerabilities detection

 - Force the compiler to use rIP-relative addressing in the fallback
   path of static_cpu_has(), in order to avoid unnecessary register
   pressure

* tag 'x86_cpu_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/cpu: Fix migration safety with X86_BUG_NULL_SEL
  x86/CPU: Add support for Vortex CPUs
  x86/umip: Downgrade warning messages to debug loglevel
  x86/asm: Avoid adding register pressure for the init case in static_cpu_has()
  x86/asm: Add _ASM_RIP() macro for x86-64 (%rip) suffix
2021-11-01 15:33:54 -07:00
Linus Torvalds
18398bb825 Merge tag 'x86_cleanups_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cleanups from Borislav Petkov:
 "The usual round of random minor fixes and cleanups all over the place"

* tag 'x86_cleanups_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/Makefile: Remove unneeded whitespaces before tabs
  x86/of: Kill unused early_init_dt_scan_chosen_arch()
  x86: Fix misspelled Kconfig symbols
  x86/Kconfig: Remove references to obsolete Kconfig symbols
  x86/smp: Remove unnecessary assignment to local var freq_scale
2021-11-01 15:25:08 -07:00
Linus Torvalds
6e5772c8d9 Merge tag 'x86_cc_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull generic confidential computing updates from Borislav Petkov:
 "Add an interface called cc_platform_has() which is supposed to be used
  by confidential computing solutions to query different aspects of the
  system.

  The intent behind it is to unify testing of such aspects instead of
  having each confidential computing solution add its own set of tests
  to code paths in the kernel, leading to an unwieldy mess"

* tag 'x86_cc_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  treewide: Replace the use of mem_encrypt_active() with cc_platform_has()
  x86/sev: Replace occurrences of sev_es_active() with cc_platform_has()
  x86/sev: Replace occurrences of sev_active() with cc_platform_has()
  x86/sme: Replace occurrences of sme_active() with cc_platform_has()
  powerpc/pseries/svm: Add a powerpc version of cc_platform_has()
  x86/sev: Add an x86 version of cc_platform_has()
  arch/cc: Introduce a function to check for confidential computing features
  x86/ioremap: Selectively build arch override encryption functions
2021-11-01 15:16:52 -07:00