Commit Graph

1150181 Commits

Author SHA1 Message Date
Robin Hsu
e3e2ece8a0 ANDROID: mm: vh for compaction begin/end
Add vendor hook for compaction begin/end.  The first use would be
to measure compaction durations.

Bug: 229927848
Test: echo 1 > /proc/sys/vm/compact_memory and observe output change in
/sys/kernel/pixel_stat/mm/compaction/mm_compaction_duration
Signed-off-by: Robin Hsu <robinhsu@google.com>
Change-Id: I3d95434bf49b37199056dc9ddfc36a59a7de17b7
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 13b6bd38bb)
Signed-off-by: liangjlee <liangjlee@google.com>
2023-10-17 18:15:01 +00:00
Wander Lairson Costa
2176509c4d UPSTREAM: netfilter: xt_u32: validate user space input
commit 69c5d284f6 upstream.

The xt_u32 module doesn't validate the fields in the xt_u32 structure.
An attacker may take advantage of this to trigger an OOB read by setting
the size fields with a value beyond the arrays boundaries.

Add a checkentry function to validate the structure.

This was originally reported by the ZDI project (ZDI-CAN-18408).

Bug: 304913716
Fixes: 1b50b8a371 ("[NETFILTER]: Add u32 match")
Cc: stable@vger.kernel.org
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1c164c1e9e)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ic2ff70b303f55f9c3c5db24295bcb223ed7175a7
2023-10-17 17:35:17 +00:00
Wander Lairson Costa
132b47119e UPSTREAM: netfilter: nfnetlink_osf: avoid OOB read
[ Upstream commit f4f8a78031 ]

The opt_num field is controlled by user mode and is not currently
validated inside the kernel. An attacker can take advantage of this to
trigger an OOB read and potentially leak information.

BUG: KASAN: slab-out-of-bounds in nf_osf_match_one+0xbed/0xd10 net/netfilter/nfnetlink_osf.c:88
Read of size 2 at addr ffff88804bc64272 by task poc/6431

CPU: 1 PID: 6431 Comm: poc Not tainted 6.0.0-rc4 #1
Call Trace:
 nf_osf_match_one+0xbed/0xd10 net/netfilter/nfnetlink_osf.c:88
 nf_osf_find+0x186/0x2f0 net/netfilter/nfnetlink_osf.c:281
 nft_osf_eval+0x37f/0x590 net/netfilter/nft_osf.c:47
 expr_call_ops_eval net/netfilter/nf_tables_core.c:214
 nft_do_chain+0x2b0/0x1490 net/netfilter/nf_tables_core.c:264
 nft_do_chain_ipv4+0x17c/0x1f0 net/netfilter/nft_chain_filter.c:23
 [..]

Also add validation to genre, subtype and version fields.

Bug: 304913642
Fixes: 11eeef41d5 ("netfilter: passive OS fingerprint xtables match")
Reported-by: Lucas Leong <wmliang@infosec.exchange>
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7bb8d52b42)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: If79c79e3f55de8c81b70c19661cb0084b02c3da2
2023-10-17 13:46:39 +01:00
Kyle Zeng
8c3b0a3493 UPSTREAM: ipv4: fix null-deref in ipv4_link_failure
[ Upstream commit 0113d9c9d1 ]

Currently, we assume the skb is associated with a device before calling
__ip_options_compile, which is not always the case if it is re-routed by
ipvs.
When skb->dev is NULL, dev_net(skb->dev) will become null-dereference.
This patch adds a check for the edge case and switch to use the net_device
from the rtable when skb->dev is NULL.

Bug: 304913674
Fixes: ed0de45a10 ("ipv4: recompile ip options in ipv4_link_failure")
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Kyle Zeng <zengyhkyle@gmail.com>
Cc: Stephen Suryaputra <ssuryaextr@gmail.com>
Cc: Vadim Fedorenko <vfedorenko@novek.ru>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2712545e53)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ie840ff3351e487f7095c49fac4fdd1e81021a982
2023-10-17 12:10:12 +00:00
Jamal Hadi Salim
4181951d21 UPSTREAM: net/sched: Retire rsvp classifier
commit 265b4da82d upstream.

The rsvp classifier has served us well for about a quarter of a century but has
has not been getting much maintenance attention due to lack of known users.

Bug: 304913975
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Kyle Zeng <zengyhkyle@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 08569c92f7)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I4716954c5e8d5414a580eb34c699908028aa754b
2023-10-17 11:00:36 +01:00
Ray Chi
acb0728638 UPSTREAM: usb: core: stop USB enumeration if too many retries
When a broken USB accessory connects to a USB host, usbcore might
keep doing enumeration retries. If the host has a watchdog mechanism,
the kernel panic will happen on the host.

This patch provides an attribute early_stop to limit the numbers of retries
for each port of a hub. If a port was marked with early_stop attribute,
unsuccessful connection attempts will fail quickly. In addition, if an
early_stop port has failed to initialize, it will ignore all future
connection events until early_stop attribute is clear.

Signed-off-by: Ray Chi <raychi@google.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20221107072754.3336357-1-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 282876796
Change-Id: I48eff1dbbc341ef893c8abc20953b7e9a62244da
(cherry picked from commit 430d57f53e)
Signed-off-by: Ray Chi <raychi@google.com>
(cherry picked from commit 278999b347)
2023-10-12 17:39:01 +00:00
Mostafa Saleh
8b1bd87917 ANDROID: KVM: arm64: Add missing hyp events for forwarded SMCs
__kvm_hyp_host_forward_smc() forwards SMCs to EL3, which means we
exit and enter the hypervisor without tracing those.
Add missing hyp events.

Bug: 304445720
Change-Id: I0b66c37f1521702764b12c038324c3fec3e499a6
Signed-off-by: Mostafa Saleh <smostafa@google.com>
2023-10-12 10:15:29 +00:00
Fuad Tabba
f4812c6864 ANDROID: KVM: arm64: Store hyp address in the host fp state array
Store the hyp address in kvm_arm_hyp_host_fp_state[], to avoid having to
calculate it with kern_hyp_va() on every access.

Bug: 303684934
Signed-off-by: Fuad Tabba <tabba@google.com>
Change-Id: I52902c297f9b957a8d035be942e3cbeb32fed0a2
2023-10-11 16:41:44 +01:00
Fuad Tabba
6334225e9b ANDROID: KVM: arm64: Allocate host fp/simd state later in initialization
Allocate and map hyp memory to maintain the host's fp/simd state,
which is also used for SVE and SME, later in the initialization
process. The amount of memory needed to track the host's state
varies depending on the number of cpus in the system, whether
there's SVE support, as well as the SVE vector size. Much of the
state needed to extract this information isn't initialized yet at
kvm_hyp_reserve().

Fixes: 6dc9af85f7 ("ANDROID: KVM: arm64: Allocate host fp state at pkvm init rather than per cpu")
Bug: 303684934
Signed-off-by: Fuad Tabba <tabba@google.com>
Change-Id: I744be685a107ddd92c6975bafb0149aebad7bb55
2023-10-11 16:41:44 +01:00
Pablo Neira Ayuso
83ebd50235 UPSTREAM: netfilter: nf_tables: disallow rule removal from chain binding
[ Upstream commit f15f29fd47 ]

Chain binding only requires the rule addition/insertion command within
the same transaction. Removal of rules from chain bindings within the
same transaction makes no sense, userspace does not utilize this
feature. Replace nft_chain_is_bound() check to nft_chain_binding() in
rule deletion commands. Replace command implies a rule deletion, reject
this command too.

Rule flush command can also safely rely on this nft_chain_binding()
check because unbound chains are not allowed since 62e1e94b24
("netfilter: nf_tables: reject unbound chain set before commit phase").

Bug: 302085977
Fixes: d0e2c7de92 ("netfilter: nf_tables: add NFT_CHAIN_BINDING")
Reported-by: Kevin Rich <kevinrich1337@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9af8bb2afe)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I8b05dc37062824db4c2901000fdf701b38605d32
2023-10-11 10:35:58 +00:00
Quang Le
7d088a3e4f UPSTREAM: fs/smb/client: Reset password pointer to NULL
commit e6e43b8aa7 upstream.

Forget to reset ctx->password to NULL will lead to bug like double free

Bug: 303146572
Cc: stable@vger.kernel.org
Cc: Willy Tarreau <w@1wt.eu>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Quang Le <quanglex97@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f555a50808)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Iec1eb857124e3b6ffa6dbbeb5f796087a6194057
2023-10-11 10:03:48 +00:00
David Chiang
2807a43b69 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - kmemdup_nul

Bug: 304675894
Change-Id: Ib6ab20a2c034d3e8dc9aff7384876d10468cd15b
Signed-off-by: David Chiang <davidchiang@google.com>
2023-10-11 05:49:41 +00:00
Prashanth K
368b752997 FROMGIT: usb: typec: ucsi: Clear EVENT_PENDING bit if ucsi_send_command fails
Currently if ucsi_send_command() fails, then we bail out without
clearing EVENT_PENDING flag. So when the next connector change
event comes, ucsi_connector_change() won't queue the con->work,
because of which none of the new events will be processed.

Fix this by clearing EVENT_PENDING flag if ucsi_send_command()
fails.

Cc: stable@vger.kernel.org # 5.16
Fixes: 512df95b94 ("usb: typec: ucsi: Better fix for missing unplug events issue")
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/1694423055-8440-1-git-send-email-quic_prashk@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 304466904
(cherry picked from commit a00e197dae
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-linus)

Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Change-Id: I4d3eef684a04e73b060cf242c5943c4ac7e05b2e
2023-10-10 12:48:49 +00:00
Suren Baghdasaryan
4fcc13c1ff ANDROID: mm: add missing check in the backport for handling faults under VMA lock
While backporting, a check for vma locking inside do_wp_page() was
missed. Add it.

Fixes: 3ebafb7b46 ("BACKPORT: FROMGIT: mm: handle faults that merely update the accessed bit under the VMA lock")
Bug: 293665307
Change-Id: Ibd7f21ae8fec7b8edc6e3d88954714b5fad41516
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-10-09 17:14:06 +00:00
Richard Chang
1fe248991f ANDROID: Update the ABI symbol list
Adding the following symbols:
  - bio_add_page
  - bio_alloc_bioset
  - bio_chain
  - bio_init
  - bio_put
  - blk_check_plugged
  - blkdev_get_by_dev
  - blkdev_put
  - file_path
  - filp_close
  - filp_open_block
  - fs_bio_set
  - submit_bio
  - submit_bio_wait
  - zs_compact
  - zs_create_pool
  - zs_destroy_pool
  - zs_free
  - zs_get_total_pages
  - zs_huge_class_size
  - zs_malloc
  - zs_map_object
  - zs_pool_stats
  - zs_unmap_object

Bug: 303159648
Change-Id: I948e48ccddbc3190ddf136a5c80874a0bb34e636
Signed-off-by: Richard Chang <richardycc@google.com>
2023-10-06 22:25:26 +00:00
Elliot Berman
4301901382 ANDROID: Update STG for ANDROID_KABI_USE(1, unsigned int saved_state)
Update STG for commit f5c2fe80d11f ("BACKPORT: FROMGIT: sched/core:
Remove ifdeffery for saved_state").

type 'struct task_struct' changed
  member 'union { unsigned int saved_state; struct { u64 android_kabi_reserved1; }; union { }; }' was added
  member 'u64 android_kabi_reserved1' was removed

Bug: 292064955
Change-Id: If3796ed8a5f7fb2be569c15b4f7c054ee786bc18
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-10-06 22:04:11 +00:00
Elliot Berman
22cd8e0def FROMGIT: freezer,sched: Use saved_state to reduce some spurious wakeups
After commit f5d39b0208 ("freezer,sched: Rewrite core freezer logic"),
tasks that transition directly from TASK_FREEZABLE to TASK_FROZEN  are
always woken up on the thaw path. Prior to that commit, tasks could ask
freezer to consider them "frozen enough" via freezer_do_not_count(). The
commit replaced freezer_do_not_count() with a TASK_FREEZABLE state which
allows freezer to immediately mark the task as TASK_FROZEN without
waking up the task.  This is efficient for the suspend path, but on the
thaw path, the task is always woken up even if the task didn't need to
wake up and goes back to its TASK_(UN)INTERRUPTIBLE state. Although
these tasks are capable of handling of the wakeup, we can observe a
power/perf impact from the extra wakeup.

We observed on Android many tasks wait in the TASK_FREEZABLE state
(particularly due to many of them being binder clients). We observed
nearly 4x the number of tasks and a corresponding linear increase in
latency and power consumption when thawing the system. The latency
increased from ~15ms to ~50ms.

Avoid the spurious wakeups by saving the state of TASK_FREEZABLE tasks.
If the task was running before entering TASK_FROZEN state
(__refrigerator()) or if the task received a wake up for the saved
state, then the task is woken on thaw. saved_state from PREEMPT_RT locks
can be re-used because freezer would not stomp on the rtlock wait flow:
TASK_RTLOCK_WAIT isn't considered freezable.

Reported-by: Prakash Viswalingam <quic_prakashv@quicinc.com>
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 8f0eed4a78a81668bc78923ea09f51a7a663c2b0)

(cherry picked from commit e4d93065a5085dbb862aa4bd06fb3e51b02e8857
 https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core)
Bug: 292064955
Change-Id: I121cfff46536a13e59b5eb60842984aed0d73faa
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-10-06 22:04:11 +00:00
Elliot Berman
457e65696a BACKPORT: FROMGIT: sched/core: Remove ifdeffery for saved_state
In preparation for freezer to also use saved_state, remove the
CONFIG_PREEMPT_RT compilation guard around saved_state.

On the arm64 platform I tested which did not have CONFIG_PREEMPT_RT,
there was no statistically significant deviation by applying this patch.

Test methodology:

perf bench sched message -g 40 -l 40

Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

(cherry picked from commit fa14aa2c23d31eb39bc615feb920f28d32d2a87e
 https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core)
Bug: 292064955
Change-Id: I9c11ab7ce31ba3b48b304229898d4c7c18a6cb2c
[eberman: Use KABI reservation to preserve CRC/ABI of struct task_struct and
 preserved raw_spin_(un)lock instead of new guard(...) syntax in task_state_match]
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2023-10-06 22:04:11 +00:00
Jingbo Xu
3437652fa2 BACKPORT: erofs: set block size to the on-disk block size
Set the block size to that specified in on-disk superblock.

Also remove the hard constraint of PAGE_SIZE block size for the
uncompressed device backend.  This constraint is temporarily remained
for compressed device and fscache backend, as there is more work needed
to handle the condition where the block size is not equal to PAGE_SIZE.

It is worth noting that the on-disk block size is read prior to
erofs_superblock_csum_verify(), as the read block size is needed in the
latter.

Besides, later we are going to make erofs refer to tar data blobs (which
is 512-byte aligned) for OCI containers, where the block size is 512
bytes.  In this case, the 512-byte block size may not be adequate for a
directory to contain enough dirents.  To fix this, we are also going to
introduce directory block size independent on the block size.

Due to we have already supported block size smaller than PAGE_SIZE now,
disable all these images with such separated directory block size until
we supported this feature later.

Bug: 303691233
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20230313135309.75269-3-jefflexu@linux.alibaba.com
[ Gao Xiang: update documentation. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit d3c4bdcc75)
[dhavale: resolved minor conflict in Documentation/filesystems/erofs.rst]
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Change-Id: I9a46bfb7ec9f79751e0df8f9d6369192dc861736
2023-10-06 21:48:22 +00:00
Jingbo Xu
e84c93fd42 BACKPORT: erofs: avoid hardcoded blocksize for subpage block support
As the first step of converting hardcoded blocksize to that specified in
on-disk superblock, convert all call sites of hardcoded blocksize to
sb->s_blocksize except for:

1) use sbi->blkszbits instead of sb->s_blocksize in
erofs_superblock_csum_verify() since sb->s_blocksize has not been
updated with the on-disk blocksize yet when the function is called.

2) use inode->i_blkbits instead of sb->s_blocksize in erofs_bread(),
since the inode operated on may be an anonymous inode in fscache mode.
Currently the anonymous inode is allocated from an anonymous mount
maintained in erofs, while in the near future we may allocate anonymous
inodes from a generic API directly and thus have no access to the
anonymous inode's i_sb.  Thus we keep the block size in i_blkbits for
anonymous inodes in fscache mode.

Be noted that this patch only gets rid of the hardcoded blocksize, in
preparation for actually setting the on-disk block size in the following
patch.  The hard limit of constraining the block size to PAGE_SIZE still
exists until the next patch.

Bug: 303691233
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20230313135309.75269-2-jefflexu@linux.alibaba.com
[ Gao Xiang: fold a patch to fix incorrect truncated offsets. ]
Link: https://lore.kernel.org/r/20230413035734.15457-1-zhujia.zj@bytedance.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit 3acea5fc33)
[dhavale: resolved few conflicts due to missing other features]
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Change-Id: I4751529e42e4a646b1a2dda75981cdc41b39b6d4
2023-10-06 21:48:22 +00:00
Gao Xiang
36496d09e8 BACKPORT: erofs: get rid of z_erofs_do_map_blocks() forward declaration
The code can be neater without forward declarations.  Let's
get rid of z_erofs_do_map_blocks() forward declaration.

Bug: 303691233
Change-Id: I689c2d2db5ab6b352821298ee480934df3002874

Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Change-Id: If6a6cde8179bef6e8aebcb27d4c956e7495724ad
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230204093040.97967-5-hsiangkao@linux.alibaba.com
(cherry picked from commit 999f2f9a63)
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2023-10-06 21:48:22 +00:00
Gao Xiang
cee0694362 BACKPORT: erofs: get rid of erofs_inode_datablocks()
erofs_inode_datablocks() has the only one caller, let's just get
rid of it entirely.  No logic changes.

Bug: 303691233
Change-Id: I15f4e5df8ddd53c570408cc80b255b6934c06fdb

Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Change-Id: I96195a960204c313649c510766e6a54d49a01784
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230204093040.97967-1-hsiangkao@linux.alibaba.com
(cherry picked from commit 4efdec36dc)
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2023-10-06 21:48:22 +00:00
Gao Xiang
f7d9c7d0b4 BACKPORT: erofs: simplify iloc()
Actually we could pass in inodes directly to clean up all callers.
Also rename iloc() as erofs_iloc().

Bug: 303691233

Link: https://lore.kernel.org/r/20230114150823.432069-1-xiang@kernel.org
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit b780d3fc61)
[dhavale: resolved minor conflict in fs/erofs/zmap.c]
Signed-off-by: Sandeep Dhavale <dhavale@google.com>

Change-Id: Iea7a97040cebdc984e2956d421755230263c97ae
2023-10-06 21:48:22 +00:00
Junghoon Jang
7d42260e5c ANDROID: Update the ABI symbol list
Adding the following symbols:
  - reserve_iova

Bug: 303000855
Change-Id: I84b0eeb179b4194d0d8294b789f2cecc388f0963
Signed-off-by: Junghoon Jang <junghoonjang@google.com>
2023-10-06 17:58:24 +00:00
JohnHsu
324c8522f9 ANDROID: Update symbol list for mtk
6 function symbol(s) added
  'int __traceiter_android_vh_compaction_exit(void*, int, int, int)'
  'int __traceiter_android_vh_compaction_try_to_compact_pages_exit(void*, enum compact_result*)'
  'int __traceiter_android_vh_mm_alloc_pages_direct_reclaim_enter(void*, unsigned int)'
  'int __traceiter_android_vh_mm_alloc_pages_direct_reclaim_exit(void*, unsigned long, int)'
  'int __traceiter_android_vh_mm_alloc_pages_may_oom_exit(void*, struct oom_control*, unsigned long)'
  'int __traceiter_android_vh_vmscan_kswapd_done(void*, int, unsigned int, unsigned int, unsigned int)'

6 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_compaction_exit'
  'struct tracepoint __tracepoint_android_vh_compaction_try_to_compact_pages_exit'
  'struct tracepoint __tracepoint_android_vh_mm_alloc_pages_direct_reclaim_enter'
  'struct tracepoint __tracepoint_android_vh_mm_alloc_pages_direct_reclaim_exit'
  'struct tracepoint __tracepoint_android_vh_mm_alloc_pages_may_oom_exit'
  'struct tracepoint __tracepoint_android_vh_vmscan_kswapd_done'

Bug: 301044280

Change-Id: Ie084b70571900e2e63e6f9d0b1aec4f630d9e6d2
Signed-off-by: john.hsu <john.hsu@mediatek.com>
2023-10-05 16:33:46 +08:00
JohnHsu
30d86f760c ANDROID: mm: Add vendor hooks for recording when kswapd finishing the reclaim job
To monitor the reclaiming ability of kswapd, add vendor hook recording when the kswapd finish the reclaiming job and the reclaim progress.

android_vh_vmscan_kswpad_done(int, unsigned int, unsigned int, unsigned int)

Bug: 301044280

Change-Id: Id6e0a97003f0a156cff4d0996bc38bcd89b1dc69
Signed-off-by: John Hsu <john.hsu@mediatek.com>
2023-10-05 10:48:42 +08:00
JohnHsu
0deb7bb73e ANDROID: mm: Add vendor hooks for __alloc_pages_slowpath
To monitor the efficiency of memory relciaming in __alloc_pages_slowpath, add vendor hooks in each stages of __alloc_pages_slowpath including __alloc_pages_may_oom and __alloc_pages_direct_reclaim.

android_vh_mm_alloc_pages_direct_reclaim_enter()
android_vh_mm_alloc_pages_direct_reclaim_exit(unsigned long, int)
android_vh_mm_alloc_pages_may_oom_exit(struct oom_control *, unsigned long)

Bug: 301044280

Change-Id: Ic5b5f1c2ad31b16e7339f539fcf54659e9acaba7
Signed-off-by: John Hsu <john.hsu@mediatek.com>
2023-10-05 10:46:38 +08:00
JohnHsu
5c2855fbce ANDROID: mm: Add vendor hook for compact pages work.
To monitor the efficiency of each action about compaction.
Add the vendor_hook function and call it in kcompactd_do_work() and
try_to_compact_pages()

ANDROID vendor hook
android_vh_compaction_exit(int, int, const int)
android_vh_compaction_try_to_compact_pages_exit(enum *compact result)

Bug: 301044280

Change-Id: I4c3f94e77eb2b16ba154ba88a9f75095536de916
Signed-off-by: John Hsu <john.hsu@mediatek.com>
2023-10-05 10:46:03 +08:00
Rick Yiu
4e10001b7c ANDROID: Update the ABI symbol list
Adding the following symbols:
  - activate_task
  - arch_freq_scale
  - available_idle_cpu
  - balance_push_callback
  - bpf_trace_run12
  - check_preempt_curr
  - __cpu_active_mask
  - cpufreq_add_update_util_hook
  - cpufreq_disable_fast_switch
  - cpufreq_driver_fast_switch
  - cpufreq_driver_resolve_freq
  - __cpufreq_driver_target
  - cpufreq_enable_fast_switch
  - cpufreq_policy_transition_delay_us
  - cpufreq_register_governor
  - cpufreq_remove_update_util_hook
  - cpufreq_this_cpu_can_update
  - cpufreq_update_util_data
  - cpupri_find_fitness
  - deactivate_task
  - find_task_by_vpid
  - get_governor_parent_kobj
  - get_task_cred
  - gov_attr_set_get
  - gov_attr_set_init
  - gov_attr_set_put
  - governor_sysfs_ops
  - have_governor_per_policy
  - irq_work_queue
  - irq_work_sync
  - kernfs_path_from_node
  - ns_capable
  - _printk_deferred
  - proc_douintvec_minmax
  - proc_set_size
  - push_cpu_stop
  - __put_cred
  - raw_spin_rq_lock_nested
  - raw_spin_rq_unlock
  - resched_curr
  - reweight_task
  - root_task_group
  - runqueues
  - sched_feat_keys
  - sched_uclamp_used
  - set_task_cpu
  - static_key_enable
  - stop_one_cpu_nowait
  - sysctl_sched_features
  - sysctl_sched_latency
  - task_rq_lock
  - teo_cpu_get_util_threshold
  - teo_cpu_set_util_threshold
  - thermal_pressure
  - __traceiter_android_rvh_attach_entity_load_avg
  - __traceiter_android_rvh_can_migrate_task
  - __traceiter_android_rvh_check_preempt_wakeup
  - __traceiter_android_rvh_cpu_overutilized
  - __traceiter_android_rvh_dequeue_task
  - __traceiter_android_rvh_dequeue_task_fair
  - __traceiter_android_rvh_detach_entity_load_avg
  - __traceiter_android_rvh_enqueue_task
  - __traceiter_android_rvh_enqueue_task_fair
  - __traceiter_android_rvh_find_lowest_rq
  - __traceiter_android_rvh_irqs_disable
  - __traceiter_android_rvh_irqs_enable
  - __traceiter_android_rvh_post_init_entity_util_avg
  - __traceiter_android_rvh_preempt_disable
  - __traceiter_android_rvh_preempt_enable
  - __traceiter_android_rvh_prepare_prio_fork
  - __traceiter_android_rvh_remove_entity_load_avg
  - __traceiter_android_rvh_rtmutex_prepare_setprio
  - __traceiter_android_rvh_sched_newidle_balance
  - __traceiter_android_rvh_select_task_rq_fair
  - __traceiter_android_rvh_select_task_rq_rt
  - __traceiter_android_rvh_set_cpus_allowed_by_task
  - __traceiter_android_rvh_set_iowait
  - __traceiter_android_rvh_setscheduler
  - __traceiter_android_rvh_set_task_cpu
  - __traceiter_android_rvh_set_user_nice
  - __traceiter_android_rvh_uclamp_eff_get
  - __traceiter_android_rvh_update_blocked_fair
  - __traceiter_android_rvh_update_load_avg
  - __traceiter_android_rvh_update_rt_rq_load_avg
  - __traceiter_android_vh_arch_set_freq_scale
  - __traceiter_android_vh_binder_restore_priority
  - __traceiter_android_vh_binder_set_priority
  - __traceiter_android_vh_dump_throttled_rt_tasks
  - __traceiter_android_vh_dup_task_struct
  - __traceiter_android_vh_setscheduler_uclamp
  - __traceiter_android_vh_uclamp_validate
  - __traceiter_android_vh_use_amu_fie
  - __traceiter_cpu_frequency
  - __traceiter_pelt_cfs_tp
  - __traceiter_pelt_dl_tp
  - __traceiter_pelt_irq_tp
  - __traceiter_pelt_rt_tp
  - __traceiter_pelt_se_tp
  - __traceiter_sched_cpu_capacity_tp
  - __traceiter_sched_overutilized_tp
  - __traceiter_sched_util_est_cfs_tp
  - __traceiter_sched_util_est_se_tp
  - __tracepoint_android_rvh_attach_entity_load_avg
  - __tracepoint_android_rvh_can_migrate_task
  - __tracepoint_android_rvh_check_preempt_wakeup
  - __tracepoint_android_rvh_cpu_overutilized
  - __tracepoint_android_rvh_dequeue_task
  - __tracepoint_android_rvh_dequeue_task_fair
  - __tracepoint_android_rvh_detach_entity_load_avg
  - __tracepoint_android_rvh_enqueue_task
  - __tracepoint_android_rvh_enqueue_task_fair
  - __tracepoint_android_rvh_find_lowest_rq
  - __tracepoint_android_rvh_irqs_disable
  - __tracepoint_android_rvh_irqs_enable
  - __tracepoint_android_rvh_post_init_entity_util_avg
  - __tracepoint_android_rvh_preempt_disable
  - __tracepoint_android_rvh_preempt_enable
  - __tracepoint_android_rvh_prepare_prio_fork
  - __tracepoint_android_rvh_remove_entity_load_avg
  - __tracepoint_android_rvh_rtmutex_prepare_setprio
  - __tracepoint_android_rvh_sched_newidle_balance
  - __tracepoint_android_rvh_select_task_rq_fair
  - __tracepoint_android_rvh_select_task_rq_rt
  - __tracepoint_android_rvh_set_cpus_allowed_by_task
  - __tracepoint_android_rvh_set_iowait
  - __tracepoint_android_rvh_setscheduler
  - __tracepoint_android_rvh_set_task_cpu
  - __tracepoint_android_rvh_set_user_nice
  - __tracepoint_android_rvh_uclamp_eff_get
  - __tracepoint_android_rvh_update_blocked_fair
  - __tracepoint_android_rvh_update_load_avg
  - __tracepoint_android_rvh_update_rt_rq_load_avg
  - __tracepoint_android_vh_arch_set_freq_scale
  - __tracepoint_android_vh_binder_restore_priority
  - __tracepoint_android_vh_binder_set_priority
  - __tracepoint_android_vh_dump_throttled_rt_tasks
  - __tracepoint_android_vh_dup_task_struct
  - __tracepoint_android_vh_setscheduler_uclamp
  - __tracepoint_android_vh_uclamp_validate
  - __tracepoint_android_vh_use_amu_fie
  - __tracepoint_cpu_frequency
  - __tracepoint_pelt_cfs_tp
  - __tracepoint_pelt_dl_tp
  - __tracepoint_pelt_irq_tp
  - __tracepoint_pelt_rt_tp
  - __tracepoint_pelt_se_tp
  - __tracepoint_sched_cpu_capacity_tp
  - __tracepoint_sched_overutilized_tp
  - __tracepoint_sched_util_est_cfs_tp
  - __tracepoint_sched_util_est_se_tp
  - uclamp_eff_value
  - ___update_load_avg
  - ___update_load_sum
  - update_rq_clock

Bug: 299851672
Change-Id: I5460a1d6622df1ac74cce3a8f9faffcc0e275003
Signed-off-by: Rick Yiu <rickyiu@google.com>
2023-10-04 15:45:08 +00:00
Prashanth K
2434dece1f FROMGIT: usb: gadget: u_serial: Add null pointer check in gserial_suspend
Consider a case where gserial_disconnect has already cleared
gser->ioport. And if gserial_suspend gets called afterwards,
it will lead to accessing of gser->ioport and thus causing
null pointer dereference.

Avoid this by adding a null pointer check. Added a static
spinlock to prevent gser->ioport from becoming null after
the newly added null pointer check.

Fixes: aba3a8d01d ("usb: gadget: u_serial: add suspend resume callbacks")
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Link: https://lore.kernel.org/r/1683278317-11774-1-git-send-email-quic_prashk@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 285495243
(cherry picked from commit 2f6ecb89fe
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ usb-next)

Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Change-Id: I2c5b58eaaa1e3428952ffdbf7f1a39cad519cc5a
(cherry picked from commit f51f079fe30f53aca027aca2c7a517e79c45b67f)
2023-10-04 03:15:46 +00:00
Amit Sunil Dhamne
5f8aa27248 ANDROID: Update the ABI symbol list
Adding the following symbols:
  - device_get_named_child_node
  - tcpm_register_port
  - tcpm_tcpc_reset
  - tcpm_unregister_port

Bug: 302578746
Change-Id: I1af3377667dc4cadacd20977298a9fe99628b5c0
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
2023-10-04 01:40:19 +00:00
RD Babiera
f7e7874d9b BACKPORT: usb: typec: bus: verify partner exists in typec_altmode_attention
Some usb hubs will negotiate DisplayPort Alt mode with the device
but will then negotiate a data role swap after entering the alt
mode. The data role swap causes the device to unregister all alt
modes, however the usb hub will still send Attention messages
even after failing to reregister the Alt Mode. type_altmode_attention
currently does not verify whether or not a device's altmode partner
exists, which results in a NULL pointer error when dereferencing
the typec_altmode and typec_altmode_ops belonging to the altmode
partner.

Verify the presence of a device's altmode partner before sending
the Attention message to the Alt Mode driver.

Fixes: 8a37d87d72 ("usb: typec: Bus type for alternate modes")
Cc: stable@vger.kernel.org
Signed-off-by: RD Babiera <rdbabiera@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230814180559.923475-1-rdbabiera@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 288952921
(cherry picked from commit f236433064)
[rd: changed return type of typec_altmode_attention to void to not break
 kmi, moved tcpm_log from error return to typec_altmode_attention as
 dev_warn]
Signed-off-by: RD Babiera <rdbabiera@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:e23c89c0b76305f9f264ba113d647710b956a540)
Merged-In: I054a6ef56b9b2d7c4e8167e8630a8c277910da88
Change-Id: I054a6ef56b9b2d7c4e8167e8630a8c277910da88
2023-10-02 22:51:53 +00:00
Will McVicker
5cb3b26d79 ANDROID: ABI: Update the pixel symbol list and stg
23 function symbol(s) added
  'int __traceiter_android_vh_typec_tcpm_modify_src_caps(void*, unsigned int*, u32(*)[0], bool*)'
  'void* __xa_erase(struct xarray*, unsigned long)'
  'void* __xa_store(struct xarray*, unsigned long, void*, gfp_t)'
  'unsigned int cpumask_local_spread(unsigned int, int)'
  'void devm_memunmap(struct device*, void*)'
  'long dma_buf_set_name(struct dma_buf*, const char*)'
  'void gether_cleanup(struct eth_dev*)'
  'struct net_device* gether_connect(struct gether*)'
  'void gether_disconnect(struct gether*)'
  'int gether_get_dev_addr(struct net_device*, char*, int)'
  'int gether_get_host_addr(struct net_device*, char*, int)'
  'void gether_get_host_addr_u8(struct net_device*, u8*)'
  'int gether_get_ifname(struct net_device*, char*, int)'
  'unsigned int gether_get_qmult(struct net_device*)'
  'int gether_register_netdev(struct net_device*)'
  'int gether_set_dev_addr(struct net_device*, const char*)'
  'void gether_set_gadget(struct net_device*, struct usb_gadget*)'
  'int gether_set_host_addr(struct net_device*, const char*)'
  'int gether_set_ifname(struct net_device*, const char*, int)'
  'void gether_set_qmult(struct net_device*, unsigned int)'
  'struct net_device* gether_setup_name_default(const char*)'
  'void* xas_find(struct xa_state*, unsigned long)'
  'void xas_pause(struct xa_state*)'

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

Adding the following symbols to the pixel symbol list:
  bpf_trace_run11
  cleancache_register_ops
  cpu_hotplug_disable
  cpu_hotplug_enable
  cpuidle_driver_state_disabled
  cpuidle_get_driver
  cpumask_local_spread
  debugfs_create_file_unsafe
  dev_get_stats
  __devm_irq_alloc_descs
  devm_krealloc
  devm_memremap
  devm_memunmap
  __devm_regmap_init_spmi_ext
  devm_request_any_context_irq
  devm_thermal_of_zone_unregister
  dev_vprintk_emit
  dma_buf_set_name
  drm_add_edid_modes
  drm_atomic_bridge_chain_disable
  drm_atomic_bridge_chain_post_disable
  drm_atomic_get_new_private_obj_state
  drm_atomic_get_old_private_obj_state
  drm_atomic_helper_calc_timestamping_constants
  drm_atomic_helper_connector_destroy_state
  drm_atomic_helper_connector_duplicate_state
  drm_atomic_helper_connector_reset
  drm_atomic_helper_update_legacy_modeset_state
  drm_connector_update_edid_property
  drm_crtc_add_crc_entry
  __drm_crtc_commit_free
  drm_crtc_commit_wait
  drm_crtc_vblank_count
  __drm_debug
  drm_detect_monitor_audio
  __drm_dev_dbg
  drm_dev_printk
  drm_display_mode_from_cea_vic
  drm_do_get_edid
  drm_edid_duplicate
  drm_edid_get_monitor_name
  drm_edid_is_valid
  drm_edid_to_sad
  drm_get_edid
  drm_match_cea_mode
  drm_mode_copy
  drm_mode_destroy
  drm_modeset_lock_single_interruptible
  drm_object_property_set_value
  dw_pcie_find_capability
  dw_pcie_read_dbi
  dw_pcie_write_dbi
  __folio_lock
  fsnotify
  __fsnotify_parent
  gether_cleanup
  gether_connect
  gether_disconnect
  gether_get_dev_addr
  gether_get_host_addr
  gether_get_host_addr_u8
  gether_get_ifname
  gether_get_qmult
  gether_register_netdev
  gether_set_dev_addr
  gether_set_gadget
  gether_set_host_addr
  gether_set_ifname
  gether_set_qmult
  gether_setup_name_default
  __get_task_comm
  i2c_add_adapter
  int_pow
  irq_domain_simple_ops
  irq_force_affinity
  memchr_inv
  mtree_load
  nf_register_net_hooks
  nf_unregister_net_hooks
  of_find_node_with_property
  proc_symlink
  rtnl_trylock
  sched_set_fifo
  sched_set_normal
  snd_pcm_hw_constraint_integer
  snd_soc_set_runtime_hwparams
  spmi_controller_add
  spmi_controller_alloc
  spmi_controller_remove
  __spmi_driver_register
  strnchr
  __tasklet_hi_schedule
  thermal_zone_get_temp
  thermal_zone_get_zone_by_name
  __traceiter_android_rvh_audio_usb_offload_disconnect
  __traceiter_android_rvh_cgroup_force_kthread_migration
  __traceiter_android_vh_audio_usb_offload_connect
  __traceiter_android_vh_typec_tcpm_modify_src_caps
  __tracepoint_android_rvh_audio_usb_offload_disconnect
  __tracepoint_android_rvh_cgroup_force_kthread_migration
  __tracepoint_android_vh_audio_usb_offload_connect
  __tracepoint_android_vh_typec_tcpm_modify_src_caps
  ufshcd_auto_hibern8_update
  usb_assign_descriptors
  usb_ep_alloc_request
  usb_ep_disable
  usb_ep_enable
  usb_ep_free_request
  usb_ep_queue
  usb_free_all_descriptors
  usb_gstrings_attach
  usb_os_desc_prepare_interf_dir
  usb_role_string
  vm_iomap_memory
  __xa_erase
  xas_find
  xas_pause
  __xa_store
  xhci_get_endpoint_index

Bug: 269652215
Change-Id: I608904647b4983ab235522ebcebc40dd4c025d77
Signed-off-by: Will McVicker <willmcvicker@google.com>
2023-10-02 22:32:07 +00:00
Hugh Dickins
cf1ba6a102 UPSTREAM: shmem: fix smaps BUG sleeping while atomic
smaps_pte_hole_lookup() is calling shmem_partial_swap_usage() with page
table lock held: but shmem_partial_swap_usage() does cond_resched_rcu() if
need_resched(): "BUG: sleeping function called from invalid context".

Since shmem_partial_swap_usage() is designed to count across a range, but
smaps_pte_hole_lookup() only calls it for a single page slot, just break
out of the loop on the last or only page, before checking need_resched().

Bug: 302977171

Link: https://lkml.kernel.org/r/6fe3b3ec-abdf-332f-5c23-6a3b3a3b11a9@google.com
(cherry picked from commit e5548f85b4)
Fixes: 2301003215 ("mm/smaps: simplify shmem handling of pte holes")
Change-Id: I1b59341c954cb7eb31709ba0dcc65ec6e67c58c6
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Peter Xu <peterx@redhat.com>
Cc: <stable@vger.kernel.org>	[5.16+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-10-02 11:24:29 +00:00
Hou Tao
52824b718c UPSTREAM: blk-ioprio: Introduce promote-to-rt policy
Since commit a78418e6a0 ("block: Always initialize bio IO priority on
submit"), bio->bi_ioprio will never be IOPRIO_CLASS_NONE when calling
blkcg_set_ioprio(), so there will be no way to promote the io-priority
of one cgroup to IOPRIO_CLASS_RT, because bi_ioprio will always be
greater than or equals to IOPRIO_CLASS_RT.

It seems possible to call blkcg_set_ioprio() first then try to
initialize bi_ioprio later in bio_set_ioprio(), but this doesn't work
for bio in which bi_ioprio is already initialized (e.g., direct-io), so
introduce a new promote-to-rt policy to promote the iopriority of bio to
IOPRIO_CLASS_RT if the ioprio is not already RT.

For none-to-rt policy, although it doesn't work now, but considering
that its purpose was also to override the io-priority to RT and allowing
for a smoother transition, just keep it and treat it as an alias of
the promote-to-rt policy.

Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Change-Id: I1f511e8dca604fdb3249562ea73adb69b93a8aec
Signed-off-by: Hou Tao <houtao1@huawei.com>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Link: https://lore.kernel.org/r/20230428074404.280532-1-houtao@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit ddf63516d8)
Bug: 186902601
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-09-29 09:18:05 +00:00
Zichun Zheng
dce1834895 ANDROID: ABI: Update oplus symbol list
7 function symbol(s) added
  'void __mod_lruvec_state(struct lruvec*, enum node_stat_item, int)'
  'void __mod_zone_page_state(struct zone*, enum zone_stat_item, long)'
  'void folio_add_lru(struct folio*)'
  'struct address_space* folio_mapping(struct folio*)'
  'int folio_referenced(struct folio*, int, struct mem_cgroup*, unsigned long*)'
  'void mem_cgroup_update_lru_size(struct lruvec*, enum lru_list, int, int)'
  'void put_pages_list(struct list_head*)'

1 variable symbol(s) added
  'struct mem_cgroup* root_mem_cgroup'

Bug: 302230539
Change-Id: I34bf400a9f09aa593ccba4dad8a94e87c9b32468
Signed-off-by: Zichun Zheng <zhengzichun@oppo.com>
2023-09-28 22:13:37 +00:00
Zichun Zheng
89815ec103 ANDROID: GKI: export symbols to do reverse mapping within memcg and modify lru stats
Export the symbols below to modify LRU state:
  root_mem_cgroup
  __mod_lruvec_state
  mem_cgroup_update_lru_size
  folio_referenced

Bug: 302230539
Change-Id: I27ac888f0fa09981ef4497bc04e4254318af7077
Signed-off-by: Zichun Zheng <zhengzichun@oppo.com>
2023-09-28 22:13:19 +00:00
Bart Van Assche
45fe413fdf ANDROID: gki_defconfig: Enable CONFIG_BLK_CGROUP_IOPRIO
Prepare for supporting I/O priority in the storage stack.

Bug: 186902601
Change-Id: I387ac4792c89d88d131c5146b116a0393c01b096
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-09-28 11:30:27 -07:00
Prakruthi Deepak Heragu
c240f4ed00 ANDROID: gunyah: Convert mutex_lock_interruptible to mutex_lock
Crosvm thread can get interrupted while making a call to the Resource
Manager. If we wait on mutext_lock_interruptible, the RM call might be
incomplete and as part of the cleanup if there are further RM calls that
need to be made, they will also return without making the RM call
because there is a signal on the thread. Use mutex_lock while making the
RM calls to ensure the RM call completes and only if there is a geniune
error, we can clean up.

Bug: 302322730
Change-Id: I961aa917588a72bb8733e6f80d80f3ceed179076
Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@quicinc.com>
2023-09-27 23:07:38 +00:00
Xin Liu
6305df8009 UPSTREAM: bpf, sockmap: fix deadlocks in the sockhash and sockmap
[ Upstream commit ed17aa92dc ]

When huang uses sched_switch tracepoint, the tracepoint
does only one thing in the mounted ebpf program, which
deletes the fixed elements in sockhash ([0])

It seems that elements in sockhash are rarely actively
deleted by users or ebpf program. Therefore, we do not
pay much attention to their deletion. Compared with hash
maps, sockhash only provides spin_lock_bh protection.
This causes it to appear to have self-locking behavior
in the interrupt context.

  [0]:https://lore.kernel.org/all/CABcoxUayum5oOqFMMqAeWuS8+EzojquSOSyDA3J_2omY=2EeAg@mail.gmail.com/

Bug: 293551383
Reported-by: Hsin-Wei Hung <hsinweih@uci.edu>
Fixes: 604326b41a ("bpf, sockmap: convert to generic sk_msg interface")
Signed-off-by: Xin Liu <liuxin350@huawei.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/r/20230406122622.109978-1-liuxin350@huawei.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f333854dce)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I913aa014f16e294ab9f9fec04d3e63afb8aa803f
2023-09-27 18:28:29 +00:00
valis
7999b48d76 UPSTREAM: net: sched: sch_qfq: Fix UAF in qfq_dequeue()
[ Upstream commit 8fc134fee2 ]

When the plug qdisc is used as a class of the qfq qdisc it could trigger a
UAF. This issue can be reproduced with following commands:

  tc qdisc add dev lo root handle 1: qfq
  tc class add dev lo parent 1: classid 1:1 qfq weight 1 maxpkt 512
  tc qdisc add dev lo parent 1:1 handle 2: plug
  tc filter add dev lo parent 1: basic classid 1:1
  ping -c1 127.0.0.1

and boom:

[  285.353793] BUG: KASAN: slab-use-after-free in qfq_dequeue+0xa7/0x7f0
[  285.354910] Read of size 4 at addr ffff8880bad312a8 by task ping/144
[  285.355903]
[  285.356165] CPU: 1 PID: 144 Comm: ping Not tainted 6.5.0-rc3+ #4
[  285.357112] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
[  285.358376] Call Trace:
[  285.358773]  <IRQ>
[  285.359109]  dump_stack_lvl+0x44/0x60
[  285.359708]  print_address_description.constprop.0+0x2c/0x3c0
[  285.360611]  kasan_report+0x10c/0x120
[  285.361195]  ? qfq_dequeue+0xa7/0x7f0
[  285.361780]  qfq_dequeue+0xa7/0x7f0
[  285.362342]  __qdisc_run+0xf1/0x970
[  285.362903]  net_tx_action+0x28e/0x460
[  285.363502]  __do_softirq+0x11b/0x3de
[  285.364097]  do_softirq.part.0+0x72/0x90
[  285.364721]  </IRQ>
[  285.365072]  <TASK>
[  285.365422]  __local_bh_enable_ip+0x77/0x90
[  285.366079]  __dev_queue_xmit+0x95f/0x1550
[  285.366732]  ? __pfx_csum_and_copy_from_iter+0x10/0x10
[  285.367526]  ? __pfx___dev_queue_xmit+0x10/0x10
[  285.368259]  ? __build_skb_around+0x129/0x190
[  285.368960]  ? ip_generic_getfrag+0x12c/0x170
[  285.369653]  ? __pfx_ip_generic_getfrag+0x10/0x10
[  285.370390]  ? csum_partial+0x8/0x20
[  285.370961]  ? raw_getfrag+0xe5/0x140
[  285.371559]  ip_finish_output2+0x539/0xa40
[  285.372222]  ? __pfx_ip_finish_output2+0x10/0x10
[  285.372954]  ip_output+0x113/0x1e0
[  285.373512]  ? __pfx_ip_output+0x10/0x10
[  285.374130]  ? icmp_out_count+0x49/0x60
[  285.374739]  ? __pfx_ip_finish_output+0x10/0x10
[  285.375457]  ip_push_pending_frames+0xf3/0x100
[  285.376173]  raw_sendmsg+0xef5/0x12d0
[  285.376760]  ? do_syscall_64+0x40/0x90
[  285.377359]  ? __static_call_text_end+0x136578/0x136578
[  285.378173]  ? do_syscall_64+0x40/0x90
[  285.378772]  ? kasan_enable_current+0x11/0x20
[  285.379469]  ? __pfx_raw_sendmsg+0x10/0x10
[  285.380137]  ? __sock_create+0x13e/0x270
[  285.380673]  ? __sys_socket+0xf3/0x180
[  285.381174]  ? __x64_sys_socket+0x3d/0x50
[  285.381725]  ? entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[  285.382425]  ? __rcu_read_unlock+0x48/0x70
[  285.382975]  ? ip4_datagram_release_cb+0xd8/0x380
[  285.383608]  ? __pfx_ip4_datagram_release_cb+0x10/0x10
[  285.384295]  ? preempt_count_sub+0x14/0xc0
[  285.384844]  ? __list_del_entry_valid+0x76/0x140
[  285.385467]  ? _raw_spin_lock_bh+0x87/0xe0
[  285.386014]  ? __pfx__raw_spin_lock_bh+0x10/0x10
[  285.386645]  ? release_sock+0xa0/0xd0
[  285.387148]  ? preempt_count_sub+0x14/0xc0
[  285.387712]  ? freeze_secondary_cpus+0x348/0x3c0
[  285.388341]  ? aa_sk_perm+0x177/0x390
[  285.388856]  ? __pfx_aa_sk_perm+0x10/0x10
[  285.389441]  ? check_stack_object+0x22/0x70
[  285.390032]  ? inet_send_prepare+0x2f/0x120
[  285.390603]  ? __pfx_inet_sendmsg+0x10/0x10
[  285.391172]  sock_sendmsg+0xcc/0xe0
[  285.391667]  __sys_sendto+0x190/0x230
[  285.392168]  ? __pfx___sys_sendto+0x10/0x10
[  285.392727]  ? kvm_clock_get_cycles+0x14/0x30
[  285.393328]  ? set_normalized_timespec64+0x57/0x70
[  285.393980]  ? _raw_spin_unlock_irq+0x1b/0x40
[  285.394578]  ? __x64_sys_clock_gettime+0x11c/0x160
[  285.395225]  ? __pfx___x64_sys_clock_gettime+0x10/0x10
[  285.395908]  ? _copy_to_user+0x3e/0x60
[  285.396432]  ? exit_to_user_mode_prepare+0x1a/0x120
[  285.397086]  ? syscall_exit_to_user_mode+0x22/0x50
[  285.397734]  ? do_syscall_64+0x71/0x90
[  285.398258]  __x64_sys_sendto+0x74/0x90
[  285.398786]  do_syscall_64+0x64/0x90
[  285.399273]  ? exit_to_user_mode_prepare+0x1a/0x120
[  285.399949]  ? syscall_exit_to_user_mode+0x22/0x50
[  285.400605]  ? do_syscall_64+0x71/0x90
[  285.401124]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[  285.401807] RIP: 0033:0x495726
[  285.402233] Code: ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 11 b8 2c 00 00 00 0f 09
[  285.404683] RSP: 002b:00007ffcc25fb618 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[  285.405677] RAX: ffffffffffffffda RBX: 0000000000000040 RCX: 0000000000495726
[  285.406628] RDX: 0000000000000040 RSI: 0000000002518750 RDI: 0000000000000000
[  285.407565] RBP: 00000000005205ef R08: 00000000005f8838 R09: 000000000000001c
[  285.408523] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000002517634
[  285.409460] R13: 00007ffcc25fb6f0 R14: 0000000000000003 R15: 0000000000000000
[  285.410403]  </TASK>
[  285.410704]
[  285.410929] Allocated by task 144:
[  285.411402]  kasan_save_stack+0x1e/0x40
[  285.411926]  kasan_set_track+0x21/0x30
[  285.412442]  __kasan_slab_alloc+0x55/0x70
[  285.412973]  kmem_cache_alloc_node+0x187/0x3d0
[  285.413567]  __alloc_skb+0x1b4/0x230
[  285.414060]  __ip_append_data+0x17f7/0x1b60
[  285.414633]  ip_append_data+0x97/0xf0
[  285.415144]  raw_sendmsg+0x5a8/0x12d0
[  285.415640]  sock_sendmsg+0xcc/0xe0
[  285.416117]  __sys_sendto+0x190/0x230
[  285.416626]  __x64_sys_sendto+0x74/0x90
[  285.417145]  do_syscall_64+0x64/0x90
[  285.417624]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
[  285.418306]
[  285.418531] Freed by task 144:
[  285.418960]  kasan_save_stack+0x1e/0x40
[  285.419469]  kasan_set_track+0x21/0x30
[  285.419988]  kasan_save_free_info+0x27/0x40
[  285.420556]  ____kasan_slab_free+0x109/0x1a0
[  285.421146]  kmem_cache_free+0x1c2/0x450
[  285.421680]  __netif_receive_skb_core+0x2ce/0x1870
[  285.422333]  __netif_receive_skb_one_core+0x97/0x140
[  285.423003]  process_backlog+0x100/0x2f0
[  285.423537]  __napi_poll+0x5c/0x2d0
[  285.424023]  net_rx_action+0x2be/0x560
[  285.424510]  __do_softirq+0x11b/0x3de
[  285.425034]
[  285.425254] The buggy address belongs to the object at ffff8880bad31280
[  285.425254]  which belongs to the cache skbuff_head_cache of size 224
[  285.426993] The buggy address is located 40 bytes inside of
[  285.426993]  freed 224-byte region [ffff8880bad31280, ffff8880bad31360)
[  285.428572]
[  285.428798] The buggy address belongs to the physical page:
[  285.429540] page:00000000f4b77674 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xbad31
[  285.430758] flags: 0x100000000000200(slab|node=0|zone=1)
[  285.431447] page_type: 0xffffffff()
[  285.431934] raw: 0100000000000200 ffff88810094a8c0 dead000000000122 0000000000000000
[  285.432757] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
[  285.433562] page dumped because: kasan: bad access detected
[  285.434144]
[  285.434320] Memory state around the buggy address:
[  285.434828]  ffff8880bad31180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  285.435580]  ffff8880bad31200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  285.436264] >ffff8880bad31280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  285.436777]                                   ^
[  285.437106]  ffff8880bad31300: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
[  285.437616]  ffff8880bad31380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  285.438126] ==================================================================
[  285.438662] Disabling lock debugging due to kernel taint

Fix this by:
1. Changing sch_plug's .peek handler to qdisc_peek_dequeued(), a
function compatible with non-work-conserving qdiscs
2. Checking the return value of qdisc_dequeue_peeked() in sch_qfq.

Bug: 300131820
Fixes: 462dbc9101 ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
Reported-by: valis <sec@valis.email>
Signed-off-by: valis <sec@valis.email>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20230901162237.11525-1-jhs@mojatatu.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a18349dc8d)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I2be4a7b7eb1448df8281c145ee2ca441bd746c9a
2023-09-27 18:24:36 +00:00
Kees Cook
709dc094e3 UPSTREAM: ARM: ptrace: Restore syscall skipping for tracers
Since commit 4e57a4ddf6 ("ARM: 9107/1: syscall: always store
thread_info->abi_syscall"), the seccomp selftests "syscall_errno"
and "syscall_faked" have been broken. Both seccomp and PTRACE depend
on using the special value of "-1" for skipping syscalls. This value
wasn't working because it was getting masked by __NR_SYSCALL_MASK in
both PTRACE_SET_SYSCALL and get_syscall_nr().

Explicitly test for -1 in PTRACE_SET_SYSCALL and get_syscall_nr(),
leaving it exposed when present, allowing tracers to skip syscalls
again.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
Fixes: 4e57a4ddf6 ("ARM: 9107/1: syscall: always store thread_info->abi_syscall")
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230810195422.2304827-2-keescook@chromium.org
Change-Id: I5b13c06a9cca85d13beec809a695198a7696df45
Signed-off-by: Kees Cook <keescook@chromium.org>
(cherry picked from commit 4697b5848b)
Bug: 289991100
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-09-27 15:39:53 +00:00
Kees Cook
ea494b2716 UPSTREAM: ARM: ptrace: Restore syscall restart tracing
Since commit 4e57a4ddf6 ("ARM: 9107/1: syscall: always store
thread_info->abi_syscall"), the seccomp selftests "syscall_restart" has
been broken. This was caused by the restart syscall not being stored to
"abi_syscall" during restart setup before branching to the "local_restart"
label. Tracers would see the wrong syscall, and scno would get overwritten
while returning from the TIF_WORK path. Add the missing store.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Lecopzer Chen <lecopzer.chen@mediatek.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
Fixes: 4e57a4ddf6 ("ARM: 9107/1: syscall: always store thread_info->abi_syscall")
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230810195422.2304827-1-keescook@chromium.org
Change-Id: If78d334ed46335cf8eff33a4bbcb1da5e86de016
Signed-off-by: Kees Cook <keescook@chromium.org>
(cherry picked from commit cf00764747)
Bug: 289991100
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-09-27 15:39:53 +00:00
Neill Kapron
b374d94195 Revert "BACKPORT: FROMGIT: usb: gadget: udc: Handle gadget_connect failure during bind operation"
This reverts commit 251aa28d16.

Reason for revert: b/301670242

The connect_lock mutex is not being released in error path. This patch was reverted upstream.

Signed-off-by: Neill Kapron <nkapron@google.com>
Change-Id: I802a9a8afc9f23b1bf91fa4df4bfb5d207373b04
2023-09-27 12:21:55 +00:00
Jiyong Park
ae5ea9043d ANDROID: Move microdroid and crashdump defconfigs to common
They don't have device-specific modules. They are just generic configs
that are different from GKI.

Bug: 301852599
Test: run following commands
tools/bazel run //common:kernel_aarch64_microdroid_dist
tools/bazel run //common:kernel_x86_64_microdroid_dist
tools/bazel run //common:kernel_aarch64_microdroid_config -- menuconfig
tools/bazel run //common:kernel_x86_64_microdroid_config -- menuconfig
tools/bazel run //common:kernel_aarch64_crashdump_dist
tools/bazel run //common:kernel_x86_64_crashdump_dist
tools/bazel run //common:kernel_aarch64_crashdump_config -- menuconfig
tools/bazel run //common:kernel_x86_64_crashdump_config -- menuconfig

Change-Id: I8908a7499451ace0740979b694eb5fcc68398c61
Signed-off-by: Jiyong Park <jiyong@google.com>
2023-09-26 16:18:51 +00:00
Paolo Abeni
b548c046c7 UPSTREAM: net: prevent skb corruption on frag list segmentation
[ Upstream commit c329b261af ]

Ian reported several skb corruptions triggered by rx-gro-list,
collecting different oops alike:

[   62.624003] BUG: kernel NULL pointer dereference, address: 00000000000000c0
[   62.631083] #PF: supervisor read access in kernel mode
[   62.636312] #PF: error_code(0x0000) - not-present page
[   62.641541] PGD 0 P4D 0
[   62.644174] Oops: 0000 [#1] PREEMPT SMP NOPTI
[   62.648629] CPU: 1 PID: 913 Comm: napi/eno2-79 Not tainted 6.4.0 #364
[   62.655162] Hardware name: Supermicro Super Server/A2SDi-12C-HLN4F, BIOS 1.7a 10/13/2022
[   62.663344] RIP: 0010:__udp_gso_segment (./include/linux/skbuff.h:2858
./include/linux/udp.h:23 net/ipv4/udp_offload.c:228 net/ipv4/udp_offload.c:261
net/ipv4/udp_offload.c:277)
[   62.687193] RSP: 0018:ffffbd3a83b4f868 EFLAGS: 00010246
[   62.692515] RAX: 00000000000000ce RBX: 0000000000000000 RCX: 0000000000000000
[   62.699743] RDX: ffffa124def8a000 RSI: 0000000000000079 RDI: ffffa125952a14d4
[   62.706970] RBP: ffffa124def8a000 R08: 0000000000000022 R09: 00002000001558c9
[   62.714199] R10: 0000000000000000 R11: 00000000be554639 R12: 00000000000000e2
[   62.721426] R13: ffffa125952a1400 R14: ffffa125952a1400 R15: 00002000001558c9
[   62.728654] FS:  0000000000000000(0000) GS:ffffa127efa40000(0000)
knlGS:0000000000000000
[   62.736852] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   62.742702] CR2: 00000000000000c0 CR3: 00000001034b0000 CR4: 00000000003526e0
[   62.749948] Call Trace:
[   62.752498]  <TASK>
[   62.779267] inet_gso_segment (net/ipv4/af_inet.c:1398)
[   62.787605] skb_mac_gso_segment (net/core/gro.c:141)
[   62.791906] __skb_gso_segment (net/core/dev.c:3403 (discriminator 2))
[   62.800492] validate_xmit_skb (./include/linux/netdevice.h:4862
net/core/dev.c:3659)
[   62.804695] validate_xmit_skb_list (net/core/dev.c:3710)
[   62.809158] sch_direct_xmit (net/sched/sch_generic.c:330)
[   62.813198] __dev_queue_xmit (net/core/dev.c:3805 net/core/dev.c:4210)
net/netfilter/core.c:626)
[   62.821093] br_dev_queue_push_xmit (net/bridge/br_forward.c:55)
[   62.825652] maybe_deliver (net/bridge/br_forward.c:193)
[   62.829420] br_flood (net/bridge/br_forward.c:233)
[   62.832758] br_handle_frame_finish (net/bridge/br_input.c:215)
[   62.837403] br_handle_frame (net/bridge/br_input.c:298
net/bridge/br_input.c:416)
[   62.851417] __netif_receive_skb_core.constprop.0 (net/core/dev.c:5387)
[   62.866114] __netif_receive_skb_list_core (net/core/dev.c:5570)
[   62.871367] netif_receive_skb_list_internal (net/core/dev.c:5638
net/core/dev.c:5727)
[   62.876795] napi_complete_done (./include/linux/list.h:37
./include/net/gro.h:434 ./include/net/gro.h:429 net/core/dev.c:6067)
[   62.881004] ixgbe_poll (drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3191)
[   62.893534] __napi_poll (net/core/dev.c:6498)
[   62.897133] napi_threaded_poll (./include/linux/netpoll.h:89
net/core/dev.c:6640)
[   62.905276] kthread (kernel/kthread.c:379)
[   62.913435] ret_from_fork (arch/x86/entry/entry_64.S:314)
[   62.917119]  </TASK>

In the critical scenario, rx-gro-list GRO-ed packets are fed, via a
bridge, both to the local input path and to an egress device (tun).

The segmentation of such packets unsafely writes to the cloned skbs
with shared heads.

This change addresses the issue by uncloning as needed the
to-be-segmented skbs.

Reported-by: Ian Kumlien <ian.kumlien@gmail.com>
Tested-by: Ian Kumlien <ian.kumlien@gmail.com>
Fixes: 3a1296a38d ("net: Support GRO/GSO fraglist chaining.")
Change-Id: I6e79a4d19751becd42ec486233f1a8de4a0f3f7e
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-26 00:04:05 +00:00
xieliujie
060ebb378d ANDROID: ABI: Update oplus symbol list
INFO: 1 function symbol(s) added
  'int __traceiter_android_vh_percpu_rwsem_wq_add(void*, struct percpu_rw_semaphore*, bool)'

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

Bug: 301066838
Change-Id: Ie6be06a6c19959a992555f65cf9b5edef5c86010
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-09-22 20:08:20 +00:00
xieliujie
f451f4a599 ANDROID: vendor_hooks: Add hooks for oem percpu-rwsem optimaton
Recently we have discovered many lag issues caused by percpu_rwsem
lock-holding tasks not being scheduled for a long time. we need to
identify them and provide appropriate scheduling protection in our
oem scheduler.
To support this, we add one hook below:
	trace_android_vh_percpu_rwsem_wq_add

Bug: 301066838
Change-Id: Id770c1a7978842abfc62d3fa9aeb5ac7a1904972
Signed-off-by: xieliujie <xieliujie@oppo.com>
2023-09-22 17:33:39 +00:00
lfc
a3cb85bffe ANDROID: ABI: Update oplus symbol list
INFO: 5 function symbol(s) added
  'int __traceiter_android_vh_alloc_oem_binder_struct(void*, struct binder_transaction_data*, struct binder_transaction*, struct binder_proc*)'
  'int __traceiter_android_vh_binder_free_buf(void*, struct binder_proc*, struct binder_thread*, struct binder_buffer*)'
  'int __traceiter_android_vh_binder_special_task(void*, struct binder_transaction*, struct binder_proc*, struct binder_thread*, struct binder_work*, struct list_head*, bool, bool*)'
  'int __traceiter_android_vh_binder_transaction_received(void*, struct binder_transaction*, struct binder_proc*, struct binder_thread*, uint32_t)'
  'int __traceiter_android_vh_free_oem_binder_struct(void*, struct binder_transaction*)'

5 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_alloc_oem_binder_struct'
  'struct tracepoint __tracepoint_android_vh_binder_free_buf'
  'struct tracepoint __tracepoint_android_vh_binder_special_task'
  'struct tracepoint __tracepoint_android_vh_binder_transaction_received'
  'struct tracepoint __tracepoint_android_vh_free_oem_binder_struct'

Bug: 299328919

Change-Id: I3abb4eb46404ce7f68d1b86ac40cb972dfe48b33
Signed-off-by: lfc <lfc@oppo.com>
2023-09-21 23:30:37 +00:00
lfc
740a51391b ANDROID: vendor_hooks: Add hooks for binder
Add hooks to support oem's binder feature of improving binder_thread->task sched priority

1) Check if it is a specific task in trace_android_vh_binder_transaction_buffer() and store the flag to t->android_vendor_data1
2) If it is a specific binder task and binder_thread selected, raise the sched priority of binder_thread->task in runqueue.
3) If it is a specific binder task but no binder_thread selected (e.g pending_async or no free threads), insert t->work to the appropriate position in the list.
4) Reset the sched priority when BR_TRANSACTION or BC_FREE_BUFFER.
Some high-priority async binder task reset the sched priority when BC_FREE_BUFFER in trace_android_vh_binder_free_buf().
Some middle-priority async binder task reset the sched priority when driver return server "BR_TRANSACTION" in trace_android_vh_binder_transaction_received().

Bug: 299328919

Change-Id: Iab4939fe4a4881b31961aaa2fef500b51c944743
Signed-off-by: lfc <lfc@oppo.com>
2023-09-21 23:30:37 +00:00