Commit Graph

988420 Commits

Author SHA1 Message Date
Stephan Müller
befd3e393e UPSTREAM: crypto: jitter - add oversampling of noise source
The output n bits can receive more than n bits of min entropy, of course,
but the fixed output of the conditioning function can only asymptotically
approach the output size bits of min entropy, not attain that bound.
Random maps will tend to have output collisions, which reduces the
creditable output entropy (that is what SP 800-90B Section 3.1.5.1.2
attempts to bound).

The value "64" is justified in Appendix A.4 of the current 90C draft,
and aligns with NIST's in "epsilon" definition in this document, which is
that a string can be considered "full entropy" if you can bound the min
entropy in each bit of output to at least 1-epsilon, where epsilon is
required to be <= 2^(-32).

Note, this patch causes the Jitter RNG to cut its performance in half in
FIPS mode because the conditioning function of the LFSR produces 64 bits
of entropy in one block. The oversampling requires that additionally 64
bits of entropy are sampled from the noise source. If the conditioner is
changed, such as using SHA-256, the impact of the oversampling is only
one fourth, because for the 256 bit block of the conditioner, only 64
additional bits from the noise source must be sampled.

This patch is derived from the user space jitterentropy-library.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Reviewed-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: 188620248
(cherry picked from commit 908dffaf88)
Change-Id: I7ae1fe58c1b5ea5f206a8f3675f0c20e255a97ec
Signed-off-by: Eric Biggers <ebiggers@google.com>
2022-10-07 08:41:13 +00:00
Rick Yiu
6ed90e9805 ANDROID: Update the ABI representation
1 function symbol(s) added
  'int __traceiter_android_vh_rebuild_root_domains_bypass(void *, bool, bool *)'

1 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_rebuild_root_domains_bypass'

Bug: 238390134
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ic03880e8ad87d07ce3560a1fd4ba456cdd510ab8
2022-10-06 15:05:37 +00:00
Chao Yu
9a8b45a9e4 FROMGIT: f2fs: support recording stop_checkpoint reason into super_block
This patch supports to record stop_checkpoint error into
f2fs_super_block.s_stop_reason[].

Bug: 247456379
Bug: 246094874
(cherry picked from commit 93523dddd98b9838896277fa9cad238a72214f02
https: //git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: I3e5fb355a7a7413b1e4bb4937791491ca73e6853
2022-10-05 14:04:43 +00:00
Ziyi Cui
800870b6d4 ANDROID: Update the ABI representation
2 function symbol(s) added
  'int __traceiter_android_vh_early_resume_begin(void *, void *)'
  'int __traceiter_android_vh_resume_end(void *, void *)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_early_resume_begin'
  'struct tracepoint __tracepoint_android_vh_resume_end'

Bug: 241946090
Signed-off-by: Ziyi Cui <ziyic@google.com>
Change-Id: Ie131055ec01e31a7b72ccb997215c67f71ce6bdc
2022-10-05 01:28:01 +00:00
Todd Kjos
b6a23be181 ANDROID: Fix for kernelci !CONFIG_SMP break-breaks
ab9c52146f ("ANDROID: cgroup: Add vendor hook for rebuild_root_domains_bypass")
introduced a hook that declared a parameter whose name collided with a
global variable. If !CONFIG_SMP, this global variable is instead a
compile-time constant which causes this error:

include/linux/cpu.h:101:28: error: expected ‘;’, ‘,’ or ‘)’ before numeric constant

Fixes: ab9c52146f ("ANDROID: cgroup: Add vendor hook for rebuild_root_domains_bypass")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I7831c5067be2ee548e8f6885eec99ab9085414fa
2022-10-04 23:33:19 +00:00
Paul Lawrence
9bc66fe57c ANDROID: fuse-bpf: set error_in to ENOENT in negative lookup
Bug: 250617797
Test: fuse-test passes, app installs
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I44544f8989d0ddf00a98eaddce5751df6598130f
2022-10-03 10:09:14 -07:00
Paul Lawrence
92fc848ef5 ANDROID: fuse-bpf: Add ability to run ranges of tests to fuse_test
Test: run various range options
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Bug: 248576331
Change-Id: I75bfa9b499b974250d4d3e375537de1807268c47
2022-10-03 10:08:15 -07:00
Duoming Zhou
cd9914280a BACKPORT: NFC: netlink: fix sleep in atomic bug when firmware download timeout
commit 4071bf121d upstream.

There are sleep in atomic bug that could cause kernel panic during
firmware download process. The root cause is that nlmsg_new with
GFP_KERNEL parameter is called in fw_dnld_timeout which is a timer
handler. The call trace is shown below:

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:265
Call Trace:
kmem_cache_alloc_node
__alloc_skb
nfc_genl_fw_download_done
call_timer_fn
__run_timers.part.0
run_timer_softirq
__do_softirq
...

The nlmsg_new with GFP_KERNEL parameter may sleep during memory
allocation process, and the timer handler is run as the result of
a "software interrupt" that should not call any other function
that could sleep.

This patch changes allocation mode of netlink message from GFP_KERNEL
to GFP_ATOMIC in order to prevent sleep in atomic bug. The GFP_ATOMIC
flag makes memory allocation operation could be used in atomic context.

Bug: 245675148
Fixes: 9674da8759 ("NFC: Add firmware upload netlink command")
Fixes: 9ea7187c53 ("NFC: netlink: Rename CMD_FW_UPLOAD to CMD_FW_DOWNLOAD")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220504055847.38026-1-duoming@zju.edu.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I510b617174c0575cc6f438b2edf44f0262f9c09c
2022-10-03 16:53:31 +00:00
Fuad Tabba
e56825d048 ANDROID: KVM: arm64: Initialize ptr auth in protected mode
Ensure that pointer authentication is initialized when the vcpu
is initialized as well, and not only when the vcpu is reset.

Bug: 249192647
Signed-off-by: Fuad Tabba <tabba@google.com>
Change-Id: Ida39a3ee5e6b4b0d3255bfef95601890afd80709
2022-10-03 16:48:20 +00:00
Rick Yiu
ab9c52146f ANDROID: cgroup: Add vendor hook for rebuild_root_domains_bypass
Vendor could decide to bypass this function.

Bug: 238390134
Change-Id: Ia6bc71c7569d21da9ae226e5d8739f97b9ca1a4f
Signed-off-by: Rick Yiu <rickyiu@google.com>
2022-09-30 16:50:45 +00:00
Elliot Berman
8015dd49c0 FROMGIT: KVM: arm64: Ignore kvm-arm.mode if !is_hyp_mode_available()
Ignore kvm-arm.mode if !is_hyp_mode_available(). Specifically, we want
to avoid switching kvm_mode to KVM_MODE_PROTECTED if hypervisor mode is
not available. This prevents "Protected KVM" cpu capability being
reported when Linux is booting in EL1 and would not have KVM enabled.
Reasonably though, we should warn if the command line is requesting a
KVM mode at all if KVM isn't actually available. Allow
"kvm-arm.mode=none" to skip the warning since this would disable KVM
anyway.

Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220920190658.2880184-1-quic_eberman@quicinc.com

Bug: 249052880
(cherry picked from commit b2a4d007c3
 https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git next)
Change-Id: I196649fc00537e563a1fab0a22bf23c5b7abe00d
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2022-09-30 08:05:27 +00:00
Oleg Matcovschi
5495c19c30 ANDROID: Update the ABI symbol list and xml
1 symbol(s) added
  'bool drm_mode_parse_command_line_for_connector(const char *, const struct drm_connector *, struct drm_cmdline_mode *)'

Bug: 197774385
Signed-off-by: Oleg Matcovschi <omatcovschi@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: If1686604cc37be5698b4a80f574ad1c907d80137
2022-09-30 02:52:58 +00:00
Johannes Berg
9c24cb8704 UPSTREAM: wifi: mac80211_hwsim: use 32-bit skb cookie
commit cc5250cdb4 upstream.

We won't really have enough skbs to need a 64-bit cookie,
and on 32-bit platforms storing the 64-bit cookie into the
void *rate_driver_data doesn't work anyway. Switch back to
using just a 32-bit cookie and uintptr_t for the type to
avoid compiler warnings about all this.

Fixes: 4ee186fa7e ("wifi: mac80211_hwsim: fix race condition in pending packet")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Cc: Jeongik Cha <jeongik@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6dece5ad6e)
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Bug: 236994625
Change-Id: I81b075297ec2248f706aebc914cd5e2783665bbc
2022-09-29 21:49:40 +00:00
Johannes Berg
80c59100da UPSTREAM: wifi: mac80211_hwsim: add back erroneously removed cast
commit 58b6259d82 upstream.

The robots report that we're now casting to a differently
sized integer, which is correct, and the previous patch
had erroneously removed it.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 4ee186fa7e ("wifi: mac80211_hwsim: fix race condition in pending packet")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Cc: Jeongik Cha <jeongik@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit d400222f49)
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Bug: 236994625
Change-Id: I4b5cfa77c47d4d03b46600f0b543e27340c228c0
2022-09-29 21:49:40 +00:00
Jeongik Cha
9fafd34f1d UPSTREAM: wifi: mac80211_hwsim: fix race condition in pending packet
commit 4ee186fa7e upstream.

A pending packet uses a cookie as an unique key, but it can be duplicated
because it didn't use atomic operators.

And also, a pending packet can be null in hwsim_tx_info_frame_received_nl
due to race condition with mac80211_hwsim_stop.

For this,
 * Use an atomic type and operator for a cookie
 * Add a lock around the loop for pending packets

Signed-off-by: Jeongik Cha <jeongik@google.com>
Link: https://lore.kernel.org/r/20220704084354.3556326-1-jeongik@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit eb8fc4277b)
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Bug: 236994625
Change-Id: Ic6613c8869a51b5de303e40406f023af689b9d64
2022-09-29 21:49:40 +00:00
Leo Chen
d91e7b80d8 ANDROID: Update the ABI representation
1 symbol(s) added
  'void drm_atomic_bridge_chain_disable(struct drm_bridge *, struct drm_atomic_state *)'

Bug: 233709537
Signed-off-by: Leo Chen <yinchiuan@google.com>
Change-Id: I1e3e5c41f3c32404dc25c1f69f447efb3cbafb5d
2022-09-29 03:57:37 +00:00
John Stultz
14e1028389 ANDROID: sched: Fix off-by-one with cpupri MAX_RT_PRIO evaluation
This patch addresses an issue seen where SCHED_FIFO prio 99
tasks were being woken up on a cpu where a long-running softirq
was executing, and the RT task was not being migrated, causing
long (10+ms wakeup latencies).

Prior to upstream commit 934fc3314b ("sched/cpupri: Remap
CPUPRI_NORMAL to MAX_RT_PRIO-1") the task->prio -> cpupri
mapping is a little ackward.

For RT tasks, its calculated as:
  cpupri = MAX_RT_PRIO - prio + 1;

See:
https://android.googlesource.com/kernel/common/+/refs/heads/android13-5.10/kernel/sched/cpupri.c#39

This is added ontop of the also ackward detail that the
task->prio is inverted (RT prio99 -> 0), means the cpupri
mapping for RT tasks goes from 2->101. This makes it easy to
evaluate the cpupri incorrectly.

Which it turns out happened In commit 3adfd8e344 ("ANDROID:
sched: avoid placing RT threads on cores handling softirqs"):
  3adfd8e344%5E%21/

With the lines:
  int task_pri = convert_prio(p->prio);
  bool drop_nopreempts = task_pri <= MAX_RT_PRIO;

Where the added logic to decide to migrate a rt task off of a
cpu depended on this drop_nopreempts being true.

This works properly for rt tasks from prio 99 to 1, but for the
case of task->prio == 0 (userland rt prio 99 tasks) it breaks,
as the cpupri will be MAX_RT_PRIO - 0 + 1, which then gets
checked as <= MAX_RT_PRIO.

This prevents the cpu from being dropped from the scheduling
set and prevents the rt user prio 99 task from migrating, which
results in high priority rt tasks being left on cpus where long
running softirqs are executing, causing long latencies.

This patch fixes the off by one by changing the evaulation
to MAX_RT_PRIO + 1, so that user-prio 99 tasks will also be
migrated if appropriate.

Luckilly this odd cpupri mapping has been fixed upstream, making
this patch no longer necessary in 5.15 and newer kernels.

Fixes: 3adfd8e344 ("ANDROID: sched: avoid placing RT threads on cores handling softirqs")
Signed-off-by: John Stultz <jstultz@google.com>
Change-Id: Ia2db7cd461eb4c90f5850b791de1ae95582f7530
2022-09-28 22:14:40 +00:00
Greg Kroah-Hartman
7a6ea55aa0 Revert "ANDROID: workqueue: add vendor hook for wq lockup information"
This reverts commit 34f087452f.

The hook android_vh_wq_lockup_pool is not used by any vendor, so remove
it to help with merge issues with future LTS releases.

If this is needed by any real user, it can easily be reverted to add it
back and then the symbol should be added to the abi list at the same
time to prevent it from being removed again later.

Bug: 203756332
Bug: 169374262
Cc: Sangmoon Kim <sangmoon.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I84eb7e1abc535a4efecd2b6071ef6d25fa2c1e2e
2022-09-27 20:04:43 +00:00
Jianqun Xu
7b19b0064b UPSTREAM: kernel/irq: export irq_gc_set_wake
Module driver may use irq_gc_set_wake.

Bug: 194515348
Change-Id: I52f43e1dff15d987532395e5151e65419b5904b2
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210305080658.2422114-1-jay.xu@rock-chips.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 024c79520f)
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2022-09-27 16:41:34 +08:00
Hsiu-Chang Chen
1856a68952 ANDROID: Update the ABI representation
2 symbol(s) added
  'struct user_namespace init_user_ns'
  'bool ns_capable_noaudit(struct user_namespace *, int)'

Bug: 234311675
Signed-off-by: Hsiu-Chang Chen <hsiuchangchen@google.com>
Change-Id: I78851c0ada381095bbac338a331bcd2cc2cd8cde
2022-09-24 13:37:50 +00:00
Paul Lawrence
1bd5344779 ANDROID: fuse-bpf: Add test for lookup postfilter
Test: fuse_test passes
Bug: 219958836
Signed-off-by: Paul Lawrence <paullawrence@google.com>

Change-Id: I04a68af274ecf823a96e2f0ead49f56d2f1c1452
2022-09-23 12:42:02 +00:00
Paul Lawrence
494e7075c9 ANDROID: fuse-bpf: readddir postfilter fixes
Test: fuse_test passes, with appropriate user code directories can be
hidden
Bug: 219958836
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ia77d4bf9e63d0dd4535e53e9e07c3216fd4b8430
2022-09-23 12:42:02 +00:00
Bowgo Tsai
8483cc3a75 ANDROID: Enable BUILD_GKI_CERTIFICATION_TOOLS for x86_64 GKI
The tools are required to certify a x86_64 GKI boot.img.

Bug: 241497048
Test: BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh
Signed-off-by: Bowgo Tsai <bowgotsai@google.com>
Change-Id: I0a34b9c8376cdfd77fb9b58b1b50ac734696672f
(cherry picked from commit 35b34f2880)
2022-09-23 02:24:52 +00:00
Todd Kjos
f813694424 ANDROID: force struct cgroup_taskset to be defined in KMI
struct cgroup_taskset is defined in kernel/cgroup/cgroup-internal.h,
however libabigail is not finding its definition based on the
instantiation of the hooks, so force it to be defined by defining a
dummy exported symbol. Since cgroup_taskset is defined in a
subsystem-private header, create a new vendor_hooks.c file in
kernel/cgroup to define the dummy symbol.

Update the XML with the new type definitions

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I7a2bf2a722bf5aec0c702f215d572cc8e5336f9a
2022-09-23 01:00:15 +00:00
Todd Kjos
3dc6e416a1 ANDROID: force struct blk_mq_alloc_data to be defined in KMI
There were 3 remaining types directly referenced by vendor
hooks that were not fully-defined in the KMI:

struct blk_mq_alloc_data is defined in block/blk-mq.h, however
libabigail is not finding its definition based on the instantiation
of the hooks, so force it to be defined by defining a dummy exported
symbol. Since blk_mq_alloc_data is defined in a subsystem-private
header, create a new vendor_hooks.c file in block/ to define
the dummy symbol.

Bug: 233047575
Bug: 248263460
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I6419caba1c6a159b7a64b9d28e983d753393af86
2022-09-23 01:00:15 +00:00
Hongyu Jin
af4d4153ca BACKPORT: erofs: fix use-after-free of on-stack io[]
The root cause is the race as follows:
Thread #1                              Thread #2(irq ctx)

z_erofs_runqueue()
  struct z_erofs_decompressqueue io_A[];
  submit bio A
  z_erofs_decompress_kickoff(,,1)
                                       z_erofs_decompressqueue_endio(bio A)
                                       z_erofs_decompress_kickoff(,,-1)
                                       spin_lock_irqsave()
                                       atomic_add_return()
  io_wait_event()	-> pending_bios is already 0
  [end of function]
                                       wake_up_locked(io_A[]) // crash

Referenced backtrace in kernel 5.4:

[   10.129422] Unable to handle kernel paging request at virtual address eb0454a4
[   10.364157] CPU: 0 PID: 709 Comm: getprop Tainted: G        WC O      5.4.147-ab09225 #1
[   11.556325] [<c01b33b8>] (__wake_up_common) from [<c01b3300>] (__wake_up_locked+0x40/0x48)
[   11.565487] [<c01b3300>] (__wake_up_locked) from [<c044c8d0>] (z_erofs_vle_unzip_kickoff+0x6c/0xc0)
[   11.575438] [<c044c8d0>] (z_erofs_vle_unzip_kickoff) from [<c044c854>] (z_erofs_vle_read_endio+0x16c/0x17c)
[   11.586082] [<c044c854>] (z_erofs_vle_read_endio) from [<c06a80e8>] (clone_endio+0xb4/0x1d0)
[   11.595428] [<c06a80e8>] (clone_endio) from [<c04a1280>] (blk_update_request+0x150/0x4dc)
[   11.604516] [<c04a1280>] (blk_update_request) from [<c06dea28>] (mmc_blk_cqe_complete_rq+0x144/0x15c)
[   11.614640] [<c06dea28>] (mmc_blk_cqe_complete_rq) from [<c04a5d90>] (blk_done_softirq+0xb0/0xcc)
[   11.624419] [<c04a5d90>] (blk_done_softirq) from [<c010242c>] (__do_softirq+0x184/0x56c)
[   11.633419] [<c010242c>] (__do_softirq) from [<c01051e8>] (irq_exit+0xd4/0x138)
[   11.641640] [<c01051e8>] (irq_exit) from [<c010c314>] (__handle_domain_irq+0x94/0xd0)
[   11.650381] [<c010c314>] (__handle_domain_irq) from [<c04fde70>] (gic_handle_irq+0x50/0xd4)
[   11.659641] [<c04fde70>] (gic_handle_irq) from [<c0101b70>] (__irq_svc+0x70/0xb0)

Bug: 246657836
Change-Id: Ieebf1c5abb48723538d05a5e65b5179a382dab3f
(cherry picked from commit 60b3005011)
[Hongyu: Resolved minor conflict in fs/erofs/zdata.c ]
Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20220401115527.4935-1-hongyu.jin.cn@gmail.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2022-09-22 19:09:34 +00:00
Amit Pundir
aec8f79a0f ANDROID: GKI: db845c: Update symbols list and ABI
android13-5.10 is broken on Dragonboard 845c because of
recently added snd_pcm_* symbols.

So updated the symbols list by running:
  "BUILD_CONFIG=common/build.config.db845c \
    KMI_SYMBOL_LIST_ADD_ONLY=1 build/build_abi.sh -s"

And the abi_gki_aarch64 ABI by running:
  "BUILD_CONFIG=common/build.config.gki.aarch64 \
    ABI_DEFINITION=abi_gki_aarch64.xml KMI_SYMBOL_LIST_ADD_ONLY=1 \
     build/build_abi.sh --update --print-report"

========================================================
ABI DIFFERENCES HAVE BEEN DETECTED!

3 symbol(s) added
  'int snd_pcm_create_iec958_consumer_default(u8 *, size_t)'
  'int snd_pcm_fill_iec958_consumer(struct snd_pcm_runtime *, u8 *, size_t)'
  'int snd_pcm_fill_iec958_consumer_hw_params(struct snd_pcm_hw_params *, u8 *, size_t)'
========================================================

Bug: 146449535
Fixes: 8de9ae8605 ("UPSTREAM: ALSA: iec958: Split status creation and fill")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I0ae0be501faea03f67feb9358b8e44f70571f2df
2022-09-21 21:11:42 +05:30
Yifan Hong
7b87b9ddb4 ANDROID: kleaf: Explicit list of ABI files.
In BUILD.bazel, explicitly list abi_definition,
kmi_symbol_list, and additional_kmi_symbol_lists.
This avoids using the glob expression which may
accidentally match editor backup files.

Bug: 246344503
Test: TH
Change-Id: I3cd494dee47b68a0fe7c3c80dd379b5af6b060fe
Signed-off-by: Yifan Hong <elsk@google.com>
2022-09-20 19:19:36 +00:00
Weichao Guo
d25aa0dbae FROMLIST: f2fs: let FI_OPU_WRITE override FADVISE_COLD_BIT
Cold files may be fragmented due to SSR, defragment is needed as
sequential reads are dominant scenarios of these files. FI_OPU_WRITE
should override FADVISE_COLD_BIT to avoid defragment fails.

Bug: 246903585

Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Weichao Guo <guoweichao@oppo.corp-partner.google.com>
Link: https://lore.kernel.org/all/YxlTQ3H+PPKcvpyc@google.com/T/
Change-Id: I52ab86a15ec275772c5356bfc985803bbdde4408
2022-09-20 18:22:45 +00:00
Tadeusz Struk
5625e355a9 ANDROID: incfs: Add check for ATTR_KILL_SUID and ATTR_MODE in incfs_setattr
Add an explicite check for ATTR_KILL_SUID and ATTR_MODE in incfs_setattr.
Both of these attributes can not be set at the same time, otherwise
notify_change() function will check it and invoke BUG(), crashing
the system.

Bug: 243394930

Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I91080d68efbd62f1441e20a5c02feef3d1b06e4e
2022-09-20 18:12:59 +00:00
Bart Van Assche
0cf7d9ce9f Revert "UPSTREAM: scsi: ufs: core: Reduce the power mode change timeout"
This reverts commit 3d35c6b91d.

Patch "scsi: ufs: core: Reduce the power mode change timeout" caused a
spike in the number of UFS suspend timeouts. Hence revert that change
and also later UFS driver changes.

Bug: b/246990788
Change-Id: I5aae929f0598020dc5e7c440946eb0d2101b07cc
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-09-19 15:20:50 -07:00
Bart Van Assche
1d61c5b5a0 Revert "FROMLIST: scsi: ufs: Fix deadlocks between power management and error handler"
This reverts commit f68d040c31.

Patch "scsi: ufs: core: Reduce the power mode change timeout" caused a
spike in the number of UFS suspend timeouts. Hence revert that change
and also later UFS driver changes.

Bug: b/246990788
Change-Id: Ic20594727d47dc6d9af9a320d64bd7011112e789
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-09-19 15:20:43 -07:00
Masahiro Yamada
dd18c291f9 BACKPORT: UPSTREAM: kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}
GZIP-compressed files end with 4 byte data that represents the size
of the original input. The decompressors (the self-extracting kernel)
exploit it to know the vmlinux size beforehand. To mimic the GZIP's
trailer, Kbuild provides cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}.
Unfortunately these macros are used everywhere despite the appended
size data is only useful for the decompressors.

There is no guarantee that such hand-crafted trailers are safely ignored.
In fact, the kernel refuses compressed initramdfs with the garbage data.
That is why usr/Makefile overrides size_append to make it no-op.

To limit the use of such broken compressed files, this commit renames
the existing macros as follows:

  cmd_bzip2   --> cmd_bzip2_with_size
  cmd_lzma    --> cmd_lzma_with_size
  cmd_lzo     --> cmd_lzo_with_size
  cmd_lz4     --> cmd_lz4_with_size
  cmd_xzkern  --> cmd_xzkern_with_size
  cmd_zstd22  --> cmd_zstd22_with_size

To keep the decompressors working, I updated the following Makefiles
accordingly:

  arch/arm/boot/compressed/Makefile
  arch/h8300/boot/compressed/Makefile
  arch/mips/boot/compressed/Makefile
  arch/parisc/boot/compressed/Makefile
  arch/s390/boot/compressed/Makefile
  arch/sh/boot/compressed/Makefile
  arch/x86/boot/compressed/Makefile

I reused the current macro names for the normal usecases; they produce
the compressed data in the proper format.

I did not touch the following:

  arch/arc/boot/Makefile
  arch/arm64/boot/Makefile
  arch/csky/boot/Makefile
  arch/mips/boot/Makefile
  arch/riscv/boot/Makefile
  arch/sh/boot/Makefile
  kernel/Makefile

This means those Makefiles will stop appending the size data.

I dropped the 'override size_append' hack from usr/Makefile.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>

Bug: 135791357
(cherry picked from commit 7ce7e984ab
 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master)
Change-Id: I3524909ef3daab85f7d22afdebc2e5bbfd5e5cf3
[szuweilin: Resolved the conflict about non-existing zstd22 in arch/s390/boot/compressed/Makefile]
Signed-off-by: SzuWei Lin <szuweilin@google.com>
2022-09-17 11:53:58 +00:00
Bart Van Assche
f68d040c31 FROMLIST: scsi: ufs: Fix deadlocks between power management and error handler
The following deadlocks have been observed on multiple test setups:

* ufshcd_wl_suspend() is waiting for blk_execute_rq() to complete while it
  holds host_sem.
* ufshcd_eh_host_reset_handler() invokes ufshcd_err_handler() and the
  latter function tries to obtain host_sem.
This is a deadlock because blk_execute_rq() can't execute SCSI commands
while the host is in the SHOST_RECOVERY state and because the error
handler cannot make progress either.

* ufshcd_wl_runtime_resume() is waiting for blk_execute_rq() to finish
  while it holds host_sem.
* ufshcd_eh_host_reset_handler() invokes ufshcd_err_handler() and the
  latter function calls pm_runtime_resume().
This is a deadlock because of the same reason as the previous scenario.

Fix both deadlocks by not obtaining host_sem from the power management
code paths. Removing the host_sem locking from the power management code
is safe because the ufshcd_err_handler() is already serialized against
SCSI command execution.

Cc: dh0421.hwang@samsung.com
Cc: Asutosh Das <asutoshd@codeaurora.org>
Fixes: b294ff3e34 ("scsi: ufs: core: Enable power management for wlun")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bug: 240498410
Bug: 246990788
Bug: 247073231
Bug: 247081382
Bug: 247082093
Link: https://lore.kernel.org/linux-scsi/
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Change-Id: Ifb9b429ba89ff6d8a133d96a172eaefc09d85955
2022-09-16 07:01:24 -07:00
Jiapeng Chong
32934b542c UPSTREAM: ASoC: hdmi-codec: make hdmi_codec_controls static
This symbol is not used outside of hdmi-codec.c, so marks it static.

Fix the following sparse warning:

sound/soc/codecs/hdmi-codec.c:750:25: warning: symbol
'hdmi_codec_controls' was not declared. Should it be static?

Bug: 239396464
Change-Id: I6569284ef557fee683afb9031e5cc1b5684a1c30
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/1623822941-3077-1-git-send-email-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit e99d7c69fd)
2022-09-15 20:16:04 +00:00
Maxime Ripard
46a21348d6 UPSTREAM: ASoC: hdmi-codec: Add a prepare hook
The IEC958 status bit is usually set by the userspace after hw_params
has been called, so in order to use whatever is set by the userspace, we
need to implement the prepare hook. Let's add it to the hdmi_codec_ops,
and mandate that either prepare or hw_params is implemented.

Bug: 239396464
Change-Id: I06ccde5d8185955bb60783b597f0205811460968
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-6-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 2fef64eec2)
2022-09-15 20:16:04 +00:00
Maxime Ripard
21e97dfa19 UPSTREAM: ASoC: hdmi-codec: Add iec958 controls
The IEC958 status bits can be exposed and modified by the userspace
through dedicated ALSA controls.

This patch implements those controls for the hdmi-codec driver. It
relies on a default value being setup at probe time that can later be
overridden by the control put.

The hw_params callback is then called with a buffer filled with the
proper bits for the current parameters being passed on so the underlying
driver can just reuse those bits as is.

Bug: 239396464
Change-Id: I99f37b7e74655687e73a75ba19fd2de8041f8646
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-5-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 7a8e1d4421)
2022-09-15 20:16:04 +00:00
Maxime Ripard
9e9d26699d UPSTREAM: ASoC: hdmi-codec: Rework to support more controls
We're going to add more controls to support the IEC958 output, so let's
rework the control registration a bit to support more of them.

Bug: 239396464
Change-Id: Ia8c0bf8c997638b5a121ae7356fa1eb27746036f
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-4-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 366b45b974)
2022-09-15 20:16:04 +00:00
Maxime Ripard
8de9ae8605 UPSTREAM: ALSA: iec958: Split status creation and fill
In some situations, like a codec probe, we need to provide an IEC status
default but don't have access to the sampling rate and width yet since
no stream has been configured yet.

Each and every driver has its own default, whereas the core iec958 code
also has some buried in the snd_pcm_create_iec958_consumer functions.

Let's split these functions in two to provide a default that doesn't
rely on the sampling rate and width, and another function to fill them
when available.

Bug: 239396464
Change-Id: I277899145367b219b337bc796f2faee8c4917082
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210525132354.297468-3-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 9eafc11f92)
2022-09-15 20:16:04 +00:00
Maxime Ripard
92c209708a UPSTREAM: ALSA: doc: Clarify IEC958 controls iface
The doc currently mentions that the IEC958 Playback Default should be
exposed on the PCM iface, and the Playback Mask on the mixer iface.

It's a bit confusing to advise to have two related controls on two
separate ifaces, and it looks like the drivers that currently expose
those controls use any combination of the mixer and PCM ifaces.

Let's try to clarify the situation a bit, and encourage to at least have
the controls on the same iface.

Bug: 239396464
Change-Id: Ie0fb033564972f74154c378c644c581dc4d06dfa
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20210525132354.297468-2-maxime@cerno.tech
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit aa7899537a)
2022-09-15 20:16:04 +00:00
Pierre-Louis Bossart
6cc06d03bf UPSTREAM: ASoC: hdmi-codec: remove unused spk_mask member
fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:25:16: style: struct member
'hdmi_codec_channel_map_table::spk_mask' is never
used. [unusedStructMember]
 unsigned long spk_mask;  /* speaker position bit mask */
               ^

Bug: 239396464
Change-Id: I235b7757db88bfbd059ad0f9795908fbfbb1cfdb
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 9ad869fee5)
2022-09-15 20:16:04 +00:00
Pierre-Louis Bossart
004a44b913 UPSTREAM: ASoC: hdmi-codec: remove useless initialization
Fix cppcheck warning:

sound/soc/codecs/hdmi-codec.c:745:5: style: Redundant initialization
for 'cf'. The initialized value is overwritten before it is
read. [redundantInitialization]
 cf = dai->playback_dma_data;
    ^
sound/soc/codecs/hdmi-codec.c:738:31: note: cf is initialized
 struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
                              ^
sound/soc/codecs/hdmi-codec.c:745:5: note: cf is overwritten
 cf = dai->playback_dma_data;
    ^

Bug: 239396464
Change-Id: Ia903635862e043207929827afcaeb531e6344283
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210312182246.5153-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 3c011ef344)
2022-09-15 20:16:04 +00:00
Sia Jee Heng
a7633aa2d9 UPSTREAM: ASoC: codec: hdmi-codec: Support IEC958 encoded PCM format
Existing hdmi-codec driver only support standard pcm format.
Support of IEC958 encoded format pass from ALSA IEC958 plugin is needed
so that the IEC958 encoded data can be streamed to the HDMI chip.

Bug: 239396464
Change-Id: I01516e34605e380995b5312273035a0d000d36f1
Signed-off-by: Sia Jee Heng <jee.heng.sia@intel.com>
Link: https://lore.kernel.org/r/20210204014258.10197-2-jee.heng.sia@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 28785f548d)
2022-09-15 20:16:04 +00:00
Stephan Gerhold
c584eb99bb UPSTREAM: ASoC: hdmi-codec: Fix return value in hdmi_codec_set_jack()
Sound is broken on the DragonBoard 410c (apq8016_sbc) since 5.10:

  hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: error at snd_soc_component_set_jack on hdmi-audio-codec.1.auto: -95
  qcom-apq8016-sbc 7702000.sound: Failed to set jack: -95
  ADV7533: ASoC: error at snd_soc_link_init on ADV7533: -95
  hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: error at snd_soc_component_set_jack on hdmi-audio-codec.1.auto: -95
  qcom-apq8016-sbc: probe of 7702000.sound failed with error -95

This happens because apq8016_sbc calls snd_soc_component_set_jack() on
all codec DAIs and attempts to ignore failures with return code -ENOTSUPP.
-ENOTSUPP is also excluded from error logging in soc_component_ret().

However, hdmi_codec_set_jack() returns -E*OP*NOTSUPP if jack detection
is not supported, which is not handled in apq8016_sbc and soc_component_ret().
Make it return -ENOTSUPP instead to fix sound and silence the errors.

Bug: 239396464
Change-Id: Id38ce1cdfc80daaac7d77212cecd29dd6fa4e877
Cc: Cheng-Yi Chiang <cychiang@chromium.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fixes: 55c5cc63ab ("ASoC: hdmi-codec: Use set_jack ops to set jack")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20210107165131.2535-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 2a0435df96)
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2022-09-15 20:16:04 +00:00
Shengjiu Wang
f5a1cb7fd6 UPSTREAM: ASoC: hdmi-codec: Add RX support
HDMI interface can also be used as receiver, this patch is to
add such support. The most difference compare with TX is that RX
don't need to get edid information.

Bug: 239396464
Change-Id: Ib5f9f347cd50abe95fa9c8a4856bd1a91117ca67
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1606372608-2329-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 144f836646)
2022-09-15 20:16:04 +00:00
Cheng-Yi Chiang
6140082c11 UPSTREAM: ASoC: hdmi-codec: Get ELD in before reporting plugged event
In plugged callback, ELD should be updated from display driver so that
user space can query information from ELD immediately after receiving jack
plugged event.

When jack is unplugged, clear ELD buffer so that user space does not get
obsolete information of unplugged HDMI.

Bug: 239396464
Change-Id: I2245de6e6f7dbc64863267db864dafdd3af95747
Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20201118043852.1338877-1-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 25ce4f2b35)
2022-09-15 20:16:04 +00:00
Robin Peng
185f60f2bb ANDROID: add forward declaration vm_unmapped_area_info
aosp/2215503 remove inclusions from hook definition headers
and build breakage detected on pixel device.

include/trace/hooks/mm.h:80:40: error: declaration of 'struct vm_unmapped_area_info' will not be visible outside of this function

Fix this by adding struct vm_unmapped_area_info forward declaration.

Fixes: 7108d9d0e5 ("ANDROID: remove inclusions from hook definition headers")
Bug: 233047575
Signed-off-by: Robin Peng <robinpeng@google.com>
Change-Id: I8989ba78977a26e13c79f9efb156bf8317c1010e
2022-09-15 01:24:29 +00:00
Soukjin Bae
d1b29856ca ANDROID: net: export symbol for tracepoint_consume_skb
Need to use the tracepoint_consume_skb symbol at module driver

Bug: 244504166
Link: https://lore.kernel.org/lkml/20220617200021.02ad8ffc@kernel.org/T

Signed-off-by: Soukjin Bae <soukjin.bae@samsung.com>
Change-Id: Icffa3e7d2045156691a7711c5f19b309f8356261
2022-09-13 19:34:26 +00:00
Sarthak Kukreti
952141fb92 BACKPORT: dm verity: set DM_TARGET_IMMUTABLE feature flag
commit 4caae58406 upstream.

The device-mapper framework provides a mechanism to mark targets as
immutable (and hence fail table reloads that try to change the target
type). Add the DM_TARGET_IMMUTABLE flag to the dm-verity target's
feature flags to prevent switching the verity target with a different
target type.

Bug: 234475629
Fixes: a4ffc15219 ("dm: add verity target")
Cc: stable@vger.kernel.org
Signed-off-by: Sarthak Kukreti <sarthakkukreti@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Iaeec7fa3be98a646062439e4551f84242dacfb45
2022-09-12 22:53:31 +00:00
David Howells
b5fe8c470e BACKPORT: pipe: Fix missing lock in pipe_resize_ring()
commit 189b0ddc24 upstream.

pipe_resize_ring() needs to take the pipe->rd_wait.lock spinlock to
prevent post_one_notification() from trying to insert into the ring
whilst the ring is being replaced.

The occupancy check must be done after the lock is taken, and the lock
must be taken after the new ring is allocated.

The bug can lead to an oops looking something like:

 BUG: KASAN: use-after-free in post_one_notification.isra.0+0x62e/0x840
 Read of size 4 at addr ffff88801cc72a70 by task poc/27196
 ...
 Call Trace:
  post_one_notification.isra.0+0x62e/0x840
  __post_watch_notification+0x3b7/0x650
  key_create_or_update+0xb8b/0xd20
  __do_sys_add_key+0x175/0x340
  __x64_sys_add_key+0xbe/0x140
  do_syscall_64+0x5c/0xc0
  entry_SYSCALL_64_after_hwframe+0x44/0xae

Reported by Selim Enes Karaduman @Enesdex working with Trend Micro Zero
Day Initiative.

Bug: 244395411
Fixes: c73be61ced ("pipe: Add general notification queue support")
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17291
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I129164eb9dba557d5a4370f4eca124b9916774a6
2022-09-12 22:53:02 +00:00