Commit Graph

987963 Commits

Author SHA1 Message Date
David Brazdil
e69c61cf4e ANDROID: KVM: arm64: iommu: Create parent/child relation
In preparation for adding new IOMMU devices that act as suppliers to
others, add the notion of a parent IOMMU device. Such device must be
registered after its parent and the driver of the parent device must
validate the addition.

The relation has no generic implications, it is up to drivers to make
use of it.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I4ee3675e5529bb73ad4546fa32380f237f054177
2022-03-29 17:09:26 +01:00
David Brazdil
be84f2c770 ANDROID: KVM: arm64: iommu: Run validate() on struct pkvm_iommu
In preparation for needing to validate more aspects of a device that is
about to be registered, change the callback to accept the to-be-added
'struct pkvm_iommu' rather than individual inputs.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I3fb911e4280c220ddd779cf6a5fc9c302a5617f7
2022-03-29 17:09:26 +01:00
David Brazdil
e6574a68fa ANDROID: KVM: arm64: iommu: Create private mapping last
Private EL2 mappings currently cannot be removed. Move the creation of
IOMMU device mappings at the end of the registration function so that
other errors do not result in unnecessary mappings.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I3139e9af3345f157295eb72441a7cf3cc055116d
2022-03-29 17:09:26 +01:00
David Brazdil
acb9a25416 ANDROID: KVM: arm64: iommu: Free memory on registration error
Memory for IOMMU device entries gets allocated from a pool donated by
the host. It is possible for pkvm_iommu_register() to allocate the
memory and then fail, in which case the memory remains unused but not
freed.

Refactor the code such that the host lock covers the entire section
where the memory is allocated. This way we can return the memory back to
the linear allocator if an error is returned.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I8c1650ba3e545741144d793de506e93c4066896f
2022-03-29 17:09:26 +01:00
David Brazdil
6eaed0b8b7 ANDROID: KVM: arm64: iommu: Harden __pkvm_iommu_pm_notify
Currently __pkvm_iommu_pm_notify always changes the value of
dev->powered following a suspend/resume attempt. This could potentially
be abused to force the hypervisor to stop issuing updates to an S2MPU
and preserving an old/invalid state.

Modify to only update the power state if suspend/resume was successful.

Bug: 190463801
Signed-off-by: David Brazdil <dbrazdil@google.com>
Change-Id: I285fc822e9fc926c49b9b5e69446790e1edccafb
2022-03-29 17:09:26 +01:00
Will Deacon
a75cb9df82 ANDROID: KVM: arm64: Drop FOLL_FORCE when pinning guest memory pages
Passing FOLL_FORCE when pinning guest memory pages was intended to allow
the VMM to map guest memory as PROT_NONE without prohibiting access from
the guest. As it turns out, crosvm doesn't implement this, and since
the host kernel will inject a signal into the VMM on a bad access
irrespective of the stage-1 permissions, we can drop the FOLL_FORCE flag
altogether.

Bug: 226564150
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: If21091b6adf3dbe4155c5c840753c912d283b159
2022-03-29 09:05:07 +01:00
Will Deacon
a246583fcc Revert "ANDROID: BACKPORT: KVM: arm64: Add initial support for KVM_CAP_EXIT_HYPERCALL"
This reverts commit e853c3b172.

This capability is unused, so remove it to avoid UAPI divergence from
upstream.

Bug: 226564150
[willdeacon@: Also removed additional instance in arch/arm64/kvm/arm.c]
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ib3e929a5fc81dc5c9c1ff8512d48f63bdda5c404
2022-03-29 09:05:06 +01:00
Will Deacon
bbe5c85592 Revert "ANDROID: KVM: arm64: Allow userspace to receive SHARE and UNSHARE notifications"
This reverts commit 7f19cf521f.

These notifications are unused by crosvm and are no longer required now
that the host takes care of injecting a SEGV on an illegal memory access
from userspace.

Bug: 226564150
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I22c3e49b4aa5f023961c8849b79e2e0a21ebf0c1
2022-03-29 09:05:06 +01:00
Xie Yongji
588affc843 BACKPORT: virtio-blk: Use blk_validate_block_size() to validate block size
The block layer can't support a block size larger than
page size yet. And a block size that's too small or
not a power of two won't work either. If a misconfigured
device presents an invalid block size in configuration space,
it will result in the kernel crash something like below:

[  506.154324] BUG: kernel NULL pointer dereference, address: 0000000000000008
[  506.160416] RIP: 0010:create_empty_buffers+0x24/0x100
[  506.174302] Call Trace:
[  506.174651]  create_page_buffers+0x4d/0x60
[  506.175207]  block_read_full_page+0x50/0x380
[  506.175798]  ? __mod_lruvec_page_state+0x60/0xa0
[  506.176412]  ? __add_to_page_cache_locked+0x1b2/0x390
[  506.177085]  ? blkdev_direct_IO+0x4a0/0x4a0
[  506.177644]  ? scan_shadow_nodes+0x30/0x30
[  506.178206]  ? lru_cache_add+0x42/0x60
[  506.178716]  do_read_cache_page+0x695/0x740
[  506.179278]  ? read_part_sector+0xe0/0xe0
[  506.179821]  read_part_sector+0x36/0xe0
[  506.180337]  adfspart_check_ICS+0x32/0x320
[  506.180890]  ? snprintf+0x45/0x70
[  506.181350]  ? read_part_sector+0xe0/0xe0
[  506.181906]  bdev_disk_changed+0x229/0x5c0
[  506.182483]  blkdev_get_whole+0x6d/0x90
[  506.183013]  blkdev_get_by_dev+0x122/0x2d0
[  506.183562]  device_add_disk+0x39e/0x3c0
[  506.184472]  virtblk_probe+0x3f8/0x79b [virtio_blk]
[  506.185461]  virtio_dev_probe+0x15e/0x1d0 [virtio]

So let's use a block layer helper to validate the block size.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20211026144015.188-5-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 57a13a5b81)
[keirf@: Implement missing error path]
Bug: 226679849
Signed-off-by: Keir Fraser <keirf@google.com>
Change-Id: I78cde1101baf8da2f68d0b9f942a0f1ec89fb30e
2022-03-29 07:01:22 +00:00
Rick Yiu
fe0484006f ANDROID: Update the ABI representation
Leaf changes summary: 13 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 7 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 6 Added variables

7 Added functions:

  [A] 'function void ___update_load_avg(sched_avg*, unsigned long int)'
  [A] 'function int ___update_load_sum(u64, sched_avg*, unsigned long int, unsigned long int, int)'
  [A] 'function int __traceiter_android_rvh_attach_entity_load_avg(void*, cfs_rq*, sched_entity*)'
  [A] 'function int __traceiter_android_rvh_detach_entity_load_avg(void*, cfs_rq*, sched_entity*)'
  [A] 'function int __traceiter_android_rvh_remove_entity_load_avg(void*, cfs_rq*, sched_entity*)'
  [A] 'function int __traceiter_android_rvh_update_blocked_fair(void*, rq*)'
  [A] 'function int __traceiter_android_rvh_update_load_avg(void*, u64, cfs_rq*, sched_entity*)'

6 Added variables:

  [A] 'tracepoint __tracepoint_android_rvh_attach_entity_load_avg'
  [A] 'tracepoint __tracepoint_android_rvh_detach_entity_load_avg'
  [A] 'tracepoint __tracepoint_android_rvh_remove_entity_load_avg'
  [A] 'tracepoint __tracepoint_android_rvh_update_blocked_fair'
  [A] 'tracepoint __tracepoint_android_rvh_update_load_avg'
  [A] 'int pelt_load_avg_max'

Bug: 201260585
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ie75a373840f3cb531648d760eaba846065328d1a
2022-03-29 03:03:54 +00:00
Rick Yiu
e3356ca0a6 ANDROID: sched: Add vendor hook for util-update related functions
Vendor may have the need to implement their own util tracking.

Bug: 201260585
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I973902e6ff82a85ecd029ac5a78692d629df1ebe
2022-03-29 01:08:35 +00:00
Ray Chi
ec7c9ea9d4 ANDROID: Update the ABI representation
Leaf changes summary: 19 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 19 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

19 Added functions:

  [A] 'function void gether_cleanup(eth_dev*)'
  [A] 'function net_device* gether_connect(gether*)'
  [A] 'function void gether_disconnect(gether*)'
  [A] 'function int gether_get_dev_addr(net_device*, char*, int)'
  [A] 'function int gether_get_host_addr(net_device*, char*, int)'
  [A] 'function void gether_get_host_addr_u8(net_device*, u8*)'
  [A] 'function int gether_get_ifname(net_device*, char*, int)'
  [A] 'function unsigned int gether_get_qmult(net_device*)'
  [A] 'function int gether_register_netdev(net_device*)'
  [A] 'function int gether_set_dev_addr(net_device*, const char*)'
  [A] 'function void gether_set_gadget(net_device*, usb_gadget*)'
  [A] 'function int gether_set_host_addr(net_device*, const char*)'
  [A] 'function int gether_set_ifname(net_device*, const char*, int)'
  [A] 'function void gether_set_qmult(net_device*, unsigned int)'
  [A] 'function net_device* gether_setup_name_default(const char*)'
  [A] 'function int usb_assign_descriptors(usb_function*, usb_descriptor_header**, usb_descriptor_header**, usb_descriptor_header**, usb_descriptor_header**)'
  [A] 'function void usb_free_all_descriptors(usb_function*)'
  [A] 'function usb_string* usb_gstrings_attach(usb_composite_dev*, usb_gadget_strings**, unsigned int)'
  [A] 'function config_group* usb_os_desc_prepare_interf_dir(config_group*, int, usb_os_desc**, char**, module*)'

Bug: 226074645
Change-Id: Iddfd251ee91514fac4153e14737825f40d855634
Signed-off-by: Ray Chi <raychi@google.com>
2022-03-28 15:58:20 +00:00
Quentin Perret
982febefcd ANDROID: KVM: arm64: pkvm: Inject SIGSEGV on illegal accesses
The pKVM hypervisor will currently panic if the host tries to access
memory that it doesn't own (e.g. protected guest memory). Sadly, as
guest memory can still be mapped into the VMM's address space, userspace
can trivially crash the kernel/hypervisor by poking into guest memory.

To prevent this, inject the abort back in the host with S1PTW set in the
ESR, hence allowing the host to differentiate this abort from normal
userspace faults and inject a SIGSEGV cleanly.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 215520143
Change-Id: I9636e71e2fe3eb49d2d7cddaab7774cd672cfcae
2022-03-28 10:53:17 +00:00
Quentin Perret
e7b80adac2 ANDROID: KVM: arm64: Refactor enter_exception64()
In order to simplify the injection of exceptions in the host in pkvm
context, let's factor out of enter_exception64() the code calculating
the exception offset from VBAR_EL1 and the cpsr.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 215520143
Change-Id: I97b2431a79fdec87c95c2d1f691bd3a11635c29b
2022-03-28 10:53:11 +00:00
Quentin Perret
91c32ff1fe ANDROID: KVM: arm64: Add is_pkvm_initialized() helper
Add a helper allowing to check when the pkvm static key is enabled to
ease the introduction of pkvm hooks in other parts of the code.

Signed-off-by: Quentin Perret <qperret@google.com>
Bug: 215520143
Change-Id: Iae065b09bb33d42d73a408365c803727269d0de0
2022-03-28 10:53:05 +00:00
Will Deacon
ba73e0b827 ANDROID: KVM: arm64: Use PSCI MEM_PROTECT to zap guest pages on reset
If a malicious/compromised host issues a PSCI SYSTEM_RESET call in the
presence of guest-owned pages then the contents of those pages may be
susceptible to cold-reboot attacks.

Use the PSCI MEM_PROTECT call to ensure that volatile memory is wiped by
the firmware if a SYSTEM_RESET occurs while unpoisoned guest pages exist
in the system. Since this call does not offer protection for a "warm"
reset initiated by SYSTEM_RESET2, detect this case in the PSCI relay and
repaint the call to a standard SYSTEM_RESET instead.

Bug: 196204410
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5c3dd93bc83ebcd0b6cea2ec734f6e3a77f0064e
2022-03-28 10:50:25 +00:00
Quentin Perret
40493bc91e ANDROID: KVM: arm64: Check pin_user_pages() return value
Let's check the return value of pin_user_pages() before blindly
dereferencing the struct page pointer as it may very well be NULL.

Bug: 223678931
Reported-by: Keir Fraser <keirf@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I49eb0eb14b88429cfeed3e7cc8a2a72404cfea97
2022-03-28 08:19:58 +00:00
Marc Zyngier
dbba49b6cb ANDROID: KVM: arm64: Handle all ID registers trapped for a protected VM
A protected VM accessing ID_AA64ISAR2_EL1 gets punished with an UNDEF,
while it really should only get a zero back if the register is not
handled by the hypervisor emulation (as mandated by the architecture).

Introduce all the missing ID registers (including the unallocated ones),
and have them to return 0.

Bug: 226913064
Reported-by: Will Deacon <willdeacon@google.com>
Signed-off-by: Marc Zyngier <mzyngier@google.com>
Change-Id: I1f8de324af8a47974e6ab6b0bf68c8e1b01c4baf
2022-03-27 11:47:42 +00:00
Siddharth Kapoor
5c6f14f146 ANDROID: Update the ABI symbol list
Leaf changes summary: 0 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 1 Added function symbol not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info

1 Added function symbol not referenced by debug info:

  [A] memchr

Bug: 220942030
Signed-off-by: Siddharth Kapoor <ksiddharth@google.com>
Change-Id: If972ccefd136c76871fece6be793db36e76e42e0
2022-03-26 06:33:50 +00:00
Bowgo Tsai
373e5bd7d4 ANDROID: GKI: Enable BUILD_GKI_CERTIFICATION_TOOLS
Bug: 222082632
Test: TH
Signed-off-by: Bowgo Tsai <bowgotsai@google.com>
Change-Id: I29aa163a8de8d60c103aad642f306ad5d4b92d40
2022-03-26 03:21:01 +00:00
Aran Dalton
83631772f3 ANDROID: usb: gadget: f_accessory: add compat_ioctl support
On Android 32-bit system, the following Cts Verifier testcase failed:

manualTests#com.android.cts.verifier.usb.accessory.UsbAccessoryTestActivity

The reason is that compat_ioctl() needs to be called.
So let's add compat_ioctl() for 32-bit applications to solve this issue.

Bug: 223101878
Change-Id: I6e1f797d919494d293184411041955c33ad08aef
Signed-off-by: Aran Dalton <arda@allwinnertech.com>
(cherry picked from commit 77bf53b486)
2022-03-25 19:55:01 +00:00
Suren Baghdasaryan
4443600ce1 UPSTREAM: mm: fix use-after-free when anon vma name is used after vma is freed
When adjacent vmas are being merged it can result in the vma that was
originally passed to madvise_update_vma being destroyed.  In the current
implementation, the name parameter passed to madvise_update_vma points
directly to vma->anon_name and it is used after the call to vma_merge.
In the cases when vma_merge merges the original vma and destroys it,
this might result in UAF.  For that the original vma would have to hold
the anon_vma_name with the last reference.  The following vma would need
to contain a different anon_vma_name object with the same string.  Such
scenario is shown below:

madvise_vma_behavior(vma)
  madvise_update_vma(vma, ..., anon_name == vma->anon_name)
    vma_merge(vma)
      __vma_adjust(vma) <-- merges vma with adjacent one
        vm_area_free(vma) <-- frees the original vma
    replace_vma_anon_name(anon_name) <-- UAF of vma->anon_name

Fix this by raising the name refcount and stabilizing it.

Link: https://lkml.kernel.org/r/20220224231834.1481408-3-surenb@google.com
Link: https://lkml.kernel.org/r/20220223153613.835563-3-surenb@google.com
Fixes: 9a10064f56 ("mm: add a field to store names for private anonymous memory")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reported-by: syzbot+aa7b3d4b35f9dc46a366@syzkaller.appspotmail.com
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Alexey Gladkov <legion@kernel.org>
Cc: Chris Hyser <chris.hyser@oracle.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Colin Cross <ccross@google.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xiaofeng Cao <caoxiaofeng@yulong.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit 942341dcc5)

Bug: 218352794
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I07e3cbff2eaa69a0d56281537510f7a42feaaf09
2022-03-25 16:28:52 +00:00
Suren Baghdasaryan
6962eb33d8 UPSTREAM: mm: prevent vm_area_struct::anon_name refcount saturation
A deep process chain with many vmas could grow really high.  With
default sysctl_max_map_count (64k) and default pid_max (32k) the max
number of vmas in the system is 2147450880 and the refcounter has
headroom of 1073774592 before it reaches REFCOUNT_SATURATED
(3221225472).

Therefore it's unlikely that an anonymous name refcounter will overflow
with these defaults.  Currently the max for pid_max is PID_MAX_LIMIT
(4194304) and for sysctl_max_map_count it's INT_MAX (2147483647).  In
this configuration anon_vma_name refcount overflow becomes theoretically
possible (that still require heavy sharing of that anon_vma_name between
processes).

kref refcounting interface used in anon_vma_name structure will detect a
counter overflow when it reaches REFCOUNT_SATURATED value but will only
generate a warning and freeze the ref counter.  This would lead to the
refcounted object never being freed.  A determined attacker could leak
memory like that but it would be rather expensive and inefficient way to
do so.

To ensure anon_vma_name refcount does not overflow, stop anon_vma_name
sharing when the refcount reaches REFCOUNT_MAX (2147483647), which still
leaves INT_MAX/2 (1073741823) values before the counter reaches
REFCOUNT_SATURATED.  This should provide enough headroom for raising the
refcounts temporarily.

Link: https://lkml.kernel.org/r/20220223153613.835563-2-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Michal Hocko <mhocko@suse.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Alexey Gladkov <legion@kernel.org>
Cc: Chris Hyser <chris.hyser@oracle.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Colin Cross <ccross@google.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xiaofeng Cao <caoxiaofeng@yulong.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit 96403e1128)

Bug: 218352794
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ieaab58f6300d9aff3139eed1c1d3417237d81955
2022-03-25 16:28:46 +00:00
Suren Baghdasaryan
9fbdc4b53f UPSTREAM: mm: refactor vm_area_struct::anon_vma_name usage code
Avoid mixing strings and their anon_vma_name referenced pointers by
using struct anon_vma_name whenever possible.  This simplifies the code
and allows easier sharing of anon_vma_name structures when they
represent the same name.

[surenb@google.com: fix comment]

Link: https://lkml.kernel.org/r/20220223153613.835563-1-surenb@google.com
Link: https://lkml.kernel.org/r/20220224231834.1481408-1-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Matthew Wilcox <willy@infradead.org>
Suggested-by: Michal Hocko <mhocko@suse.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Colin Cross <ccross@google.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Alexey Gladkov <legion@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Chris Hyser <chris.hyser@oracle.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Xiaofeng Cao <caoxiaofeng@yulong.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit 5c26f6ac94)

Bug: 218352794
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I4a6b5602ce7151d1a4b88fac489f86d68089bd4d
2022-03-25 16:28:27 +00:00
Will Deacon
6b94b8c3b7 ANDROID: KVM: arm64: Only map swap-backed pages into the guest
Alistair reports an ext4 splat when running a non-protected guest under
pKVM using Cuttlefish on a rockpi board:

 | WARNING: CPU: 4 PID: 3125 at fs/ext4/inode.c:3592 ext4_set_page_dirty+0x6c/0x90
 |  sp : ffffffc00e1a39b0
 |  x29: ffffffc00e1a39b0 x28: ffffffc009ac3c18 x27: ffffffc009a80968
 |  x26: ffffff80c2753a00 x25: 0000000200000000 x24: ffffffc00a6dc000
 |  x23: 0000000000000000 x22: 0000000000000001 x21: fffffffe0314f640
 |  x20: ffffff8063a99890 x19: fffffffe0314f640 x18: ffffffc00dbf5090
 |  x17: 0000000000000020 x16: ffffffc00ab73080 x15: 0000000000000040
 |  x14: 0000000000000040 x13: 0000000000000040 x12: 0000000080200000
 |  x11: 0000000000000000 x10: fffffffe0314f640 x9 : 0000000000000016
 |  x8 : 0000000000000015 x7 : 0000000000000062 x6 : 0000000000000068
 |  x5 : 0000000080200015 x4 : ffffff80067c7500 x3 : 0000000080200016
 |  x2 : 0000000000000001 x1 : 0000000000000001 x0 : fffffffe0314f640
 |  Call trace:
 |   ext4_set_page_dirty+0x6c/0x90
 |   set_page_dirty+0xf0/0x264
 |   set_page_dirty_lock+0x94/0x164
 |   unpin_user_pages_dirty_lock+0xa0/0x15c
 |   kvm_shadow_destroy+0xd4/0x150
 |   kvm_arch_destroy_vm+0xa0/0xa4
 |   kvm_destroy_vm+0x634/0xa0c
 |   kvm_vcpu_release+0x44/0xc0
 |   __fput+0xf8/0x43c
 |   ____fput+0x14/0x24
 |   task_work_run+0x140/0x204
 |   do_exit+0x450/0x12b0
 |   do_group_exit+0xc8/0x17c
 |   get_signal+0x85c/0xa10
 |   do_signal+0x9c/0x268
 |   do_notify_resume+0x98/0x220
 |   el0_svc+0x5c/0x84
 |   el0t_64_sync_handler+0x88/0xec
 |   el0t_64_sync+0x1b4/0x1b8

This appears to be due to virtio-pmem mapping a host page-cache page
directly into the guest and pinning it with GUP. A later attempt to
wrprotect the page using page_mkclean() on the writeback path will not
find the guest mapping and consequently the filesystem becomes confused
when we later dirty the page without any page buffers having been
allocated.

Since the host cannot generally access the memory of protected VMs,
restrict ourselves to swap-backed pages for now and avoid attempting
writeback altogether, with the GUP pin preventing swapout.

Bug: 223678931
Reported-by: Alistair Delva <adelva@google.com>
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Id8da126aac220df6eff44177a911dc4627e68c02
2022-03-25 10:07:45 +00:00
Will McVicker
c8b5505153 ANDROID: Update the ABI representation
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added variable:

  [A] 'reboot_mode reboot_mode'

Bug: 226526792
Change-Id: Ic51d233429f0325c33111bc36a65b78fc4288fa6
Signed-off-by: Will McVicker <willmcvicker@google.com>
2022-03-24 22:37:14 +00:00
Nick Desaulniers
3101b49e5b ANDROID: clang: update to 14.0.3
Bug: 225394140
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: Id092562afb73b51883feafbd8ae49736a570af09
2022-03-24 19:46:10 +00:00
Will Deacon
93846ccca1 ANDROID: KVM: arm64: Invalidate TLB by VMID when tearing down the shadow VM
When a shadow VM is torn down, its VMID can be reallocated as soon as
the shadow table entry is cleared to NULL. Since tearing down the
stage-2 page-table does not imply TLB invalidation, the TLB could still
contain stale entries from the old VM and the new user of the VMID could
end up seeing erroneous translations.

Invalidate the TLB for the VMID of the VM being torn down prior to
clearing its entry in the shadow table.

Bug: 226312378
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ice44d030bf01a1b7612413ee32440f3f38cb3e4e
2022-03-24 09:02:48 +00:00
Jaegeuk Kim
ed0dec098e ANDROID: gki_config: enable F2FS_UNFAIR_RWSEM
Let's try this to avoid lock contention, until we find a better solution.

Bug: 216636351
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ib7ae218cb4a2531fdb85679b8530e4eba755e06a
2022-03-24 00:52:18 +00:00
Jaegeuk Kim
f8c415b6c2 Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.10.y' into android13-5.10
* aosp/upstream-f2fs-stable-linux-5.10.y:
  fscrypt: update documentation for direct I/O support
  f2fs: support direct I/O with fscrypt using blk-crypto
  ext4: support direct I/O with fscrypt using blk-crypto
  iomap: support direct I/O with fscrypt using blk-crypto
  fscrypt: add functions for direct I/O support
  f2fs: fix to do sanity check on .cp_pack_total_block_count
  f2fs: make gc_urgent and gc_segment_mode sysfs node readable
  f2fs: use aggressive GC policy during f2fs_disable_checkpoint()
  f2fs: fix compressed file start atomic write may cause data corruption
  f2fs: initialize sbi->gc_mode explicitly
  f2fs: introduce gc_urgent_mid mode
  f2fs: compress: fix to print raw data size in error path of lz4 decompression
  f2fs: remove redundant parameter judgment
  f2fs: use spin_lock to avoid hang
  f2fs: don't get FREEZE lock in f2fs_evict_inode in frozen fs
  f2fs: remove unnecessary read for F2FS_FITS_IN_INODE
  f2fs: introduce F2FS_UNFAIR_RWSEM to support unfair rwsem
  f2fs: avoid an infinite loop in f2fs_sync_dirty_inodes
  f2fs: fix to do sanity check on curseg->alloc_type
  f2fs: fix to avoid potential deadlock
  f2fs: quota: fix loop condition at f2fs_quota_sync()
  f2fs: Restore rwsem lockdep support
  f2fs: fix missing free nid in f2fs_handle_failed_inode
  f2fs: add a way to limit roll forward recovery time
  f2fs: introduce F2FS_IPU_HONOR_OPU_WRITE ipu policy
  f2fs: adjust readahead block number during recovery
  f2fs: fix to unlock page correctly in error path of is_alive()
  f2fs: expose discard related parameters in sysfs
  f2fs: move discard parameters into discard_cmd_control
  f2fs: fix to enable ATGC correctly via gc_idle sysfs interface
  f2fs: move f2fs to use reader-unfair rwsems

Bug: 216636351
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I53cc37765ba69df2a9b7b9c070e4938822354f05
2022-03-24 00:51:47 +00:00
Todd Kjos
cf9be86ac4 ANDROID: GKI: 3/23/2022 KMI update
Set KMI_GENERATION=2 for 3/23 KMI update

Leaf changes summary: 505 artifacts changed
Changed leaf types summary: 2 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 489 Changed, 6 Added functions
Removed/Changed/Added variables summary: 0 Removed, 3 Changed, 5 Added variables

6 Added functions:

  [A] 'function int __traceiter_android_vh___get_user_pages_remote(void*, int*, unsigned int*)'
  [A] 'function int __traceiter_android_vh_get_user_pages(void*, unsigned int*)'
  [A] 'function int __traceiter_android_vh_internal_get_user_pages_fast(void*, unsigned int*)'
  [A] 'function int __traceiter_android_vh_pin_user_pages(void*, unsigned int*)'
  [A] 'function int __traceiter_android_vh_try_grab_compound_head(void*, page*, int, unsigned int, bool*)'
  [A] 'function unsigned long int get_pfnblock_flags_mask(page*, unsigned long int, unsigned long int)'

489 functions with some sub-type change:

  [C] 'function sk_buff* __alloc_skb(unsigned int, gfp_t, int, int)' at skbuff.c:183:1 has some sub-type changes:
    CRC (modversions) changed from 0x42ee9964 to 0x7c77e5af

  [C] 'function sk_buff* __cfg80211_alloc_event_skb(wiphy*, wireless_dev*, nl80211_commands, nl80211_attrs, unsigned int, int, int, gfp_t)' at nl80211.c:10277:1 has some sub-type changes:
    CRC (modversions) changed from 0x55bb655c to 0x5f07fe5f

  [C] 'function sk_buff* __cfg80211_alloc_reply_skb(wiphy*, nl80211_commands, nl80211_attrs, int)' at nl80211.c:13811:1 has some sub-type changes:
    CRC (modversions) changed from 0x8854dc9d to 0x4d096973

  ... 486 omitted; 489 symbols have only CRC changes

5 Added variables:

  [A] 'tracepoint __tracepoint_android_vh___get_user_pages_remote'
  [A] 'tracepoint __tracepoint_android_vh_get_user_pages'
  [A] 'tracepoint __tracepoint_android_vh_internal_get_user_pages_fast'
  [A] 'tracepoint __tracepoint_android_vh_pin_user_pages'
  [A] 'tracepoint __tracepoint_android_vh_try_grab_compound_head'

3 Changed variables:

  [C] 'net init_net' was changed at net_namespace.c:47:1:
    CRC (modversions) changed from 0xaff22d13 to 0x59ca894

  [C] 'pid_namespace init_pid_ns' was changed at pid.c:75:1:
    CRC (modversions) changed from 0x31a2d4d4 to 0x1ee0d04c

  [C] 'softnet_data softnet_data' was changed at dev.c:403:1:
    CRC (modversions) changed from 0x3f45ee4 to 0xad33d222

'struct net_device at netdevice.h:1898:1' changed:
  type size hasn't changed
  1 data member insertion:
    'const macsec_ops* macsec_ops', at offset 19328 (in bits) at netdevice.h:2202:1
  there are data member changes:
    11 ('const udp_tunnel_nic_info* udp_tunnel_nic_info' .. 'u64 android_kabi_reserved8') offsets changed (by +64 bits)
  2953 impacted interfaces

'struct phy_device at phy.h:541:1' changed:
  type size changed from 12736 to 12800 (in bits)
  1 data member insertion:
    'const macsec_ops* macsec_ops', at offset 12480 (in bits) at phy.h:647:1
  there are data member changes:
    4 ('u64 android_kabi_reserved1' .. 'u64 android_kabi_reserved4') offsets changed (by +64 bits)
  2953 impacted interfaces

Bug: 226384098
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I128f3003dff88cee9e0dd4041e2f2cc467dac1ee
2022-03-23 19:49:30 +00:00
Victor Shutemov
e5315a20b2 ANDROID: GKI: enable macsec
This is needed for Volvo Cars

Bug: 224999021

Signed-off-by: Victor Shutemov <victor@haleytek.com>
Change-Id: I61fb2388524ba9efa6cd34873d91dd7cc9fe246e
2022-03-23 19:49:23 +00:00
Minchan Kim
7531264e68 ANDROID: Update the ABI symbol list
Update the generic symbol list.

Bug: 218731671
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I8c48b029a1a1c7da39e3611446616815630173ab
2022-03-23 19:49:15 +00:00
Minchan Kim
aea946bdf0 ANDROID: mm: gup: vendor hook in GUP friends
The page pinning causes CMA allocation long latency until the process
held the refcont is scheduled in and then released the refcount, which
introduces CMA allocaiton failure.

To overcome the issue, add vendor hooks to migrate the target page of
GUP out of CMA area.

Bug: 218731671
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I5ebf491531d0bfee96ebee83919f22e34ee1d41b
2022-03-23 19:49:08 +00:00
Tadeusz Struk
0375b0d297 ANDROID: selftests: incfs: Add umount helper function
Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I3c8eebbce3079292fc85dad8984efe6382f22cac
2022-03-23 08:39:53 -07:00
Tadeusz Struk
5fdeabb1a2 ANDROID: selftests: incfs: skip large_file_test test is not enough free space
Make the large_file_test check if there is at least 3GB of free disk
space and skip the test if there is not. This is to make the tests pass
on a VM with limited disk size, now all functional tests are passing.

TAP version 13
1..26
ok 1 basic_file_ops_test
ok 2 cant_touch_index_test
ok 3 dynamic_files_and_data_test
ok 4 concurrent_reads_and_writes_test
ok 5 attribute_test
ok 6 work_after_remount_test
ok 7 child_procs_waiting_for_data_test
ok 8 multiple_providers_test
ok 9 hash_tree_test
ok 10 read_log_test
ok 11 get_blocks_test
ok 12 get_hash_blocks_test
ok 13 large_file_test
ok 14 mapped_file_test
ok 15 compatibility_test
ok 16 data_block_count_test
ok 17 hash_block_count_test
ok 18 per_uid_read_timeouts_test
ok 19 inotify_test
ok 20 verity_test
ok 21 enable_verity_test
ok 22 mmap_test
ok 23 truncate_test
ok 24 stat_test
ok 25 sysfs_test
Error mounting fs.: File exists
Error mounting fs.: File exists
ok 26 sysfs_rename_test

Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I2260e2b314429251070d0163c70173f237f86476
2022-03-23 08:39:22 -07:00
Woody Lin
9a7faf669a ANDROID: Update the ABI symbol list
Leaf changes summary: 3 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

2 Added functions:

  [A] 'function int __traceiter_android_vh_scheduler_tick(void*, rq*)'
  [A] 'function pid* find_pid_ns(int, pid_namespace*)'

1 Added variable:

  [A] 'tracepoint __tracepoint_android_vh_scheduler_tick'

Bug: 223481647
Signed-off-by: Woody Lin <woodylin@google.com>
Change-Id: I456c97aeebbc0ae70dd66a2d63b2aba13b1d4116
2022-03-23 11:39:21 +08:00
Tadeusz Struk
b6079b142e ANDROID: incremental-fs: limit mount stack depth
Syzbot recently found a number of issues related to incremental-fs
(see bug numbers below). All have to do with the fact that incr-fs
allows mounts of the same source and target multiple times.
This is a design decision and the user space component "Data Loader"
expects this to work for app re-install use case.
The mounting depth needs to be controlled, however, and only allowed
to be two levels deep. In case of more than two mount attempts the
driver needs to return an error.
In case of the issues listed below the common pattern is that the
reproducer calls:

mount("./file0", "./file0", "incremental-fs", 0, NULL)

many times and then invokes a file operation like chmod, setxattr,
or open on the ./file0. This causes a recursive call for all the
mounted instances, which eventually causes a stack overflow and
a kernel crash:

BUG: stack guard page was hit at ffffc90000c0fff8
kernel stack overflow (double-fault): 0000 [#1] PREEMPT SMP KASAN

This change also cleans up the mount error path to properly clean
allocated resources and call deactivate_locked_super(), which
causes the incfs_kill_sb() to be called, where the sb is freed.

Bug: 211066171
Bug: 213140206
Bug: 213215835
Bug: 211914587
Bug: 211213635
Bug: 213137376
Bug: 211161296

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I08d9b545a2715423296bf4beb67bdbbed78d1be1
2022-03-22 14:50:48 +00:00
Eric Biggers
68980ff96c fscrypt: update documentation for direct I/O support
Now that direct I/O is supported on encrypted files in some cases,
document what these cases are.

Link: https://lore.kernel.org/r/20220128233940.79464-6-ebiggers@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-21 13:56:28 -07:00
Eric Biggers
1654219723 f2fs: support direct I/O with fscrypt using blk-crypto
Encrypted files traditionally haven't supported DIO, due to the need to
encrypt/decrypt the data.  However, when the encryption is implemented
using inline encryption (blk-crypto) instead of the traditional
filesystem-layer encryption, it is straightforward to support DIO.

Therefore, make f2fs support DIO on files that are using inline
encryption.  Since f2fs uses iomap for DIO, and fscrypt support was
already added to iomap DIO, this just requires two small changes:

- Let DIO proceed when supported, by checking fscrypt_dio_supported()
  instead of assuming that encrypted files never support DIO.

- In f2fs_iomap_begin(), use fscrypt_limit_io_blocks() to limit the
  length of the mapping in the rare case where a DUN discontiguity
  occurs in the middle of an extent.  The iomap DIO implementation
  requires this, since it assumes that it can submit a bio covering (up
  to) the whole mapping, without checking fscrypt constraints itself.

Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Acked-by: Jaegeuk Kim <jaegeuk@kernel.org>
Link: https://lore.kernel.org/r/20220128233940.79464-5-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-21 13:56:24 -07:00
Eric Biggers
9f7cc5fda4 ext4: support direct I/O with fscrypt using blk-crypto
Encrypted files traditionally haven't supported DIO, due to the need to
encrypt/decrypt the data.  However, when the encryption is implemented
using inline encryption (blk-crypto) instead of the traditional
filesystem-layer encryption, it is straightforward to support DIO.

Therefore, make ext4 support DIO on files that are using inline
encryption.  Since ext4 uses iomap for DIO, and fscrypt support was
already added to iomap DIO, this just requires two small changes:

- Let DIO proceed when supported, by checking fscrypt_dio_supported()
  instead of assuming that encrypted files never support DIO.

- In ext4_iomap_begin(), use fscrypt_limit_io_blocks() to limit the
  length of the mapping in the rare case where a DUN discontiguity
  occurs in the middle of an extent.  The iomap DIO implementation
  requires this, since it assumes that it can submit a bio covering (up
  to) the whole mapping, without checking fscrypt constraints itself.

Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jaegeuk Kim <jaegeuk@kernel.org>
Link: https://lore.kernel.org/r/20220128233940.79464-4-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-21 13:56:20 -07:00
Eric Biggers
4b613cb0c4 iomap: support direct I/O with fscrypt using blk-crypto
Encrypted files traditionally haven't supported DIO, due to the need to
encrypt/decrypt the data.  However, when the encryption is implemented
using inline encryption (blk-crypto) instead of the traditional
filesystem-layer encryption, it is straightforward to support DIO.

Add support for this to the iomap DIO implementation by calling
fscrypt_set_bio_crypt_ctx() to set encryption contexts on the bios.

Don't check for the rare case where a DUN (crypto data unit number)
discontiguity creates a boundary that bios must not cross.  Instead,
filesystems are expected to handle this in ->iomap_begin() by limiting
the length of the mapping so that iomap doesn't have to worry about it.

Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220128233940.79464-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-21 13:56:10 -07:00
Eric Biggers
b6da748bab fscrypt: add functions for direct I/O support
Encrypted files traditionally haven't supported DIO, due to the need to
encrypt/decrypt the data.  However, when the encryption is implemented
using inline encryption (blk-crypto) instead of the traditional
filesystem-layer encryption, it is straightforward to support DIO.

In preparation for supporting this, add the following functions:

- fscrypt_dio_supported() checks whether a DIO request is supported as
  far as encryption is concerned.  Encrypted files will only support DIO
  when inline encryption is used and the I/O request is properly
  aligned; this function checks these preconditions.

- fscrypt_limit_io_blocks() limits the length of a bio to avoid crossing
  a place in the file that a bio with an encryption context cannot
  cross due to a DUN discontiguity.  This function is needed by
  filesystems that use the iomap DIO implementation (which operates
  directly on logical ranges, so it won't use fscrypt_mergeable_bio())
  and that support FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32.

Co-developed-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220128233940.79464-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-03-21 13:55:25 -07:00
Tadeusz Struk
21557656af ANDROID: selftests: incfs: Add -fno-omit-frame-pointer
Without it incfs/incfs_perf runtime fails in format_signature:

malloc(): invalid size (unsorted)
Aborted

When compiled with gcc version 11.2.0.

Also add check for NULL after the malloc, and remove unneeded
space for uint32_t in signing_section.

Bug: 211066171

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I62b775140e4b89f75335cbd65665cf6a3e0fe964
2022-03-21 20:23:21 +00:00
Chao Yu
59e664cd0e f2fs: fix to do sanity check on .cp_pack_total_block_count
As bughunter reported in bugzilla:

https://bugzilla.kernel.org/show_bug.cgi?id=215709

f2fs may hang when mounting a fuzzed image, the dmesg shows as below:

__filemap_get_folio+0x3a9/0x590
pagecache_get_page+0x18/0x60
__get_meta_page+0x95/0x460 [f2fs]
get_checkpoint_version+0x2a/0x1e0 [f2fs]
validate_checkpoint+0x8e/0x2a0 [f2fs]
f2fs_get_valid_checkpoint+0xd0/0x620 [f2fs]
f2fs_fill_super+0xc01/0x1d40 [f2fs]
mount_bdev+0x18a/0x1c0
f2fs_mount+0x15/0x20 [f2fs]
legacy_get_tree+0x28/0x50
vfs_get_tree+0x27/0xc0
path_mount+0x480/0xaa0
do_mount+0x7c/0xa0
__x64_sys_mount+0x8b/0xe0
do_syscall_64+0x38/0xc0
entry_SYSCALL_64_after_hwframe+0x44/0xae

The root cause is cp_pack_total_block_count field in checkpoint was fuzzed
to one, as calcuated, two cp pack block locates in the same block address,
so then read latter cp pack block, it will block on the page lock due to
the lock has already held when reading previous cp pack block, fix it by
adding sanity check for cp_pack_total_block_count.

Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-03-21 09:19:46 -07:00
Daeho Jeong
40185ceea1 f2fs: make gc_urgent and gc_segment_mode sysfs node readable
Changed a way of showing values of them to use strings.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-03-21 09:18:22 -07:00
Andrey Konovalov
f1e8564c55 FROMLIST: kasan, scs: support tagged vmalloc mappings
Fix up the custom KASAN instrumentation for Shadow Call Stack to support
vmalloc() mappings and pointers being tagged.

- Use the tagged pointer returned by kasan_unpoison_vmalloc() in
  __scs_alloc() when calling memset() to avoid false-positives.

- Do not return a tagged Shadow Call Stack pointer from __scs_alloc(),
  as this might lead to conflicts with the instrumentation.

Link: https://lkml.kernel.org/r/2f6605e3a358cf64d73a05710cb3da356886ad29.1646233925.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
(cherry picked from commit bd2c296805cff9572080bf56807c16d1dd382260
 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm)
Link: https://lore.kernel.org/all/2f6605e3a358cf64d73a05710cb3da356886ad29.1646233925.git.andreyknvl@google.com/
Bug: 217222520
Bug: 222221793
Change-Id: I9e6e4cd303e0815a5b092ba6ec28638bd1f7bc2c
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
2022-03-21 15:30:13 +00:00
Andrey Konovalov
c05355c5f8 ANDROID: kasan: sync vmalloc support with linux-next/akpm
The FROMLIST patches merged in aosp/1974918 that add vmalloc support to
KASAN now have a few fixes staged in linux-next/akpm. Sync the changes.

Bug: 217222520
Bug: 222221793
Change-Id: I33dd30e3834a4d1bb8eac611b350004afdb08a74
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
2022-03-21 15:30:03 +00:00
Greg Kroah-Hartman
12781cdcae Merge 5.10.107 into android13-5.10
Changes in 5.10.107
	Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0"
	sctp: fix the processing for INIT chunk
	xfrm: Check if_id in xfrm_migrate
	xfrm: Fix xfrm migrate issues when address family changes
	arm64: dts: rockchip: fix rk3399-puma eMMC HS400 signal integrity
	arm64: dts: rockchip: reorder rk3399 hdmi clocks
	arm64: dts: agilex: use the compatible "intel,socfpga-agilex-hsotg"
	ARM: dts: rockchip: reorder rk322x hmdi clocks
	ARM: dts: rockchip: fix a typo on rk3288 crypto-controller
	mac80211: refuse aggregations sessions before authorized
	MIPS: smp: fill in sibling and core maps earlier
	ARM: 9178/1: fix unmet dependency on BITREVERSE for HAVE_ARCH_BITREVERSE
	can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready
	atm: firestream: check the return value of ioremap() in fs_init()
	iwlwifi: don't advertise TWT support
	drm/vrr: Set VRR capable prop only if it is attached to connector
	nl80211: Update bss channel on channel switch for P2P_CLIENT
	tcp: make tcp_read_sock() more robust
	sfc: extend the locking on mcdi->seqno
	kselftest/vm: fix tests build with old libc
	io_uring: return back safer resurrect
	arm64: kvm: Fix copy-and-paste error in bhb templates for v5.10 stable
	Linux 5.10.107

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib5977657dd66c90a01694f04ee85d72c3a22bebb
2022-03-19 14:13:08 +01:00
Greg Kroah-Hartman
4c8814277b Linux 5.10.107
Link: https://lore.kernel.org/r/20220317124525.955110315@linuxfoundation.org
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Tested-by: Fox Chen <foxhlchen@gmail.com>
Tested-by: Pavel Machek (CIP) <pavel@denx.de>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-19 13:44:47 +01:00