Commit Graph

1146367 Commits

Author SHA1 Message Date
Vincent Donnefort
bf019165fe ANDROID: KVM: arm64: Cleanup useless declarations
While introducing ("KVM: arm64: Rework pKVM module locking") some bits
have been missed. Remove them.

Bug: 254835242
Change-Id: Ib2b5c84c6d900cfa452232c9ec62483dd230af0c
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-14 09:08:30 +00:00
Vincent Donnefort
425c421e77 ANDROID: CONFIG_MODPROBE_PATH to toolbox's modprobe
Early loading of pKVM modules (i.e. before deprivilege) implies to let
the kernel call modprobe. Notice this doesn't really enable
request_module: UMH is still "disabled" due to
CONFIG_STATIC_USERMODEHELPER_PATH="".

Bug: 254835242
Change-Id: I753ac4177e5017f7d913804bb8439f676d7c2fd8
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-14 09:08:30 +00:00
Sangmoon Kim
68e294c322 ANDROID: ABI: update symbol list for galaxy
12 function symbol(s) added
  'int __traceiter_android_rvh_arm64_serror_panic(void*, struct pt_regs*, unsigned long)'
  'int __traceiter_android_rvh_die_kernel_fault(void*, const char*, unsigned long, unsigned long, struct pt_regs*)'
  'int __traceiter_android_rvh_do_el1_bti(void*, struct pt_regs*, unsigned long)'
  'int __traceiter_android_rvh_do_el1_fpac(void*, struct pt_regs*, unsigned long)'
  'int __traceiter_android_rvh_do_sea(void*, unsigned long, unsigned long, struct pt_regs*)'
  'int __traceiter_android_rvh_do_sp_pc_abort(void*, unsigned long, unsigned long, struct pt_regs*)'
  'int __traceiter_android_rvh_do_undefinstr(void*, struct pt_regs*, unsigned long)'
  'int __traceiter_android_rvh_panic_unhandled(void*, struct pt_regs*, const char*, unsigned long)'
  'int __traceiter_android_rvh_report_bug(void*, const char*, unsigned int, unsigned long)'
  'int __traceiter_android_vh_try_to_freeze_todo(void*, unsigned int, unsigned int, bool)'
  'int __traceiter_android_vh_try_to_freeze_todo_unfrozen(void*, struct task_struct*)'
  'int __traceiter_android_vh_watchdog_timer_softlockup(void*, int, struct pt_regs*, bool)'

12 variable symbol(s) added
  'struct tracepoint __tracepoint_android_rvh_arm64_serror_panic'
  'struct tracepoint __tracepoint_android_rvh_die_kernel_fault'
  'struct tracepoint __tracepoint_android_rvh_do_el1_bti'
  'struct tracepoint __tracepoint_android_rvh_do_el1_fpac'
  'struct tracepoint __tracepoint_android_rvh_do_sea'
  'struct tracepoint __tracepoint_android_rvh_do_sp_pc_abort'
  'struct tracepoint __tracepoint_android_rvh_do_undefinstr'
  'struct tracepoint __tracepoint_android_rvh_panic_unhandled'
  'struct tracepoint __tracepoint_android_rvh_report_bug'
  'struct tracepoint __tracepoint_android_vh_try_to_freeze_todo'
  'struct tracepoint __tracepoint_android_vh_try_to_freeze_todo_unfrozen'
  'struct tracepoint __tracepoint_android_vh_watchdog_timer_softlockup'

Bug: 273189923
Change-Id: I47e18fd50b182370bc663239dc49d10ea5293a52
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
2023-03-13 20:34:25 +00:00
Sangmoon Kim
bb8c223f2f ANDROID: arm64: add vendor hooks for unusal abort cases
Add hooks to gather data of unsual aborts and summarize it with
other information.

Bug: 273189923

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I74eb36b8551ed9a5e6dc87507939a7f4d81c9c18
(cherry picked from commit 102255d1e4)
2023-03-13 20:34:25 +00:00
Sangmoon Kim
2d9a325f0c ANDROID: arm64: add vendor hooks for kernel fault cases
Add hooks to gather data of kernel fault and summarize it with
other information.

Bug: 273189923

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I7d6a66837f2e896a413bd8d878f26928669d96e6
(cherry picked from commit 61d7b6c741)
2023-03-13 20:34:25 +00:00
Sangmoon Kim
c5ea4db533 ANDROID: power: add vendor hooks for try_to_freeze fail
Add hooks to gather data of unfrozen tasks and summarize it
with other information.

Bug: 273189923

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I61da3d253bd9959c6f06e09c9a35c4b242cedafe
(cherry picked from commit 2232e3fc85)
2023-03-13 20:34:25 +00:00
Sangmoon Kim
8635a09118 ANDROID: softlockup: add vendor hook for a softlockup task
Add hook to gather data of softlockup and summarize it with
other information.

Bug: 273189923

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I5263bbd573c3fa4b4c981ac26c943721ce09506d
(cherry picked from commit 5cc613a916)
2023-03-13 20:34:25 +00:00
Sangmoon Kim
e74b4da791 ANDROID: bug: add vendor hook for bug trap
Add hook to gather data of bug trap and summarize it with other
information.

Bug: 273189923

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I1f347c20629786f9bf0b9c50c7f96b50b4360504
(cherry picked from commit ba7e9d1a77)
2023-03-13 20:34:25 +00:00
Chris Lew
a0446b2a16 ANDROID: abi_gki_aarch64_qcom: Add vma apis
mtree_load and zap_vma_ptes are used to help transfer data through
rpmsg glink to users. Add it to the symbol list.

2 function symbol(s) added
  'void* mtree_load(struct maple_tree*, unsigned long)'
  'void zap_vma_ptes(struct vm_area_struct*, unsigned long, unsigned
long)'

Bug: 272816594
Change-Id: I674372e3d58f44074da242412e35767465ebb511
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
2023-03-13 13:51:25 +00:00
Vincent Donnefort
121922b1df ANDROID: KVM: arm64: Move hyp events in a hyp/ folder
Align with the host tracing events by adding another layer in the event
path. As no group exists at the moment, move all of them in a common
hyp/ one.

Bug: 249050813
Change-Id: I4c77d1ec676f896bba77f147e0a4b30bc9c92606
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
39862f2828 ANDROID: KVM: arm64: Allow single char for hyp tracing interface
Some userspace tools might poke hyp tracing files without a newline
char. Accomodate for them.

Bug: 249050813
Change-Id: I2641080897646dcd299ca491a562b36a7b9b22dc
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
4a7c893e15 ANDROID: KVM: arm64: Hyp tracing polling to 100ms
The nVHE hypervisor having no way of telling the host events occured,
the host needs to poll. A second long period has been proven to be a bit
too light compared to storm of events that can occur during this window.
Make it 10x shorter.

Bug: 249050813
Change-Id: I4ff243aff615f0a7d40193485b3da8970feeb5d2
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
c2b35d55f7 ANDROID: KVM: arm64: Fix nVHE enter/exit events
Some entry and exit points were not covered. This hopefully won't miss
anything: each SMC call is exiting EL2 and when a CPU is being turned on,
it goes directly through kvm_host_psci_cpu_entry().

Bug: 249050813
Change-Id: Ie88d36df249cb6f0f8e8a49df20654b0628d43d5
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
d1471dfdeb ANDROID: KVM: arm64: Handle pipe buffer overflow for hyp tracing
Hyp events can overflow the userspace buffer used for hyp trace_pipe.
Make sure no events is lost when this happens.

Bug: 249050813
Change-Id: I8b4032d89b327a2dc83f410d6c20ee59fdd30320
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
a262be0c41 ANDROID: KVM: arm64: Flush hyp trace pipe when tracing stops
The hyp having no way of telling the host events occured, hyp tracing
has to poll the hyp on a regular basis (RB_POLL_MS). The userspace has
currently no way of forcing a poll, so add one when tracing is disabled.

It improves support for tools such as trace-cmd which disable tracing
before killing their recording threads.

Aside, this removes most of the users of ht_iterator->trace_buffer. So
clean this thing out in the meantime.

Bug: 249050813
Change-Id: I4c5333eff21fc30fdcb4d8d96826beee8b78d56d
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
34411786c7 ANDROID: ring-buffer: Fix ring_buffer_read_page for external writers
No shortcut is possible for reading a page without removing it from
the ring-buffer. The reader needs to be moved and its timestamp
updated.

Bug: 249050813
Change-Id: I80fbc1e265500e419278346e2973df2488b7e8b3
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Nikita Ioffe
429edbe419 ANDROID: KVM: arm64: Add trace_clock for nVHE tracing
Added userspace file that describes what clock is used for hyp tracing.
Unlike tracefs root instance, the hyp tracing only supports boot clock,
hence the trace_clock file is read-only.

Bug: 249050813
Change-Id: Ib9cc1f582699245ed94cf745dae0888eb7556ced
Signed-off-by: Nikita Ioffe <ioffe@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
bd0f72e4ee ANDROID: KVM: arm64: Add common "trace_pipe" file for hyp tracing
Like the common "trace" file introduced previously, that new common
file aggregates a pipe version for all CPUs, similarly to the tracefs
root file of the same name.

Bug: 249050813
Change-Id: I1872bf3cfeef637902fcdfa5f589a903c0121d04
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
acfc8ff1d6 ANDROID: KVM: arm64: Allow to reset hyp trace buffers
Writing anything to the "trace" file will delete the content of the
buffer. When using the common "trace", the ring buffer will also be
unloaded from the hypervisor and all the memory will be freed.

At the same time, tracing_on will not reset the buffers anymore and
trace pipe interfaces will be able to setup the ring buffers, bringing
the hyp tracing interface a bit closer from the host behavior.

Bug: 249050813
Change-Id: I9d4ba7b18504440f3d03dbedf1186d384a53a990
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
ba3d509bb2 ANDROID: KVM: arm64: Add common "trace" file for hyp tracing
Extend the hyp tracing interface with a new hyp/trace file that merges
all per-CPU traces. This is similar to "trace" file found in the tracefs
root.

At the same time, align the output of the files with the host:

  [<CPU>] <timestamp>: <event>

Bug: 249050813
Change-Id: I816f8504b14480b13d40f8689f9b9f63706a4daf
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
59c0cb06cc ANDROID: KVM: arm64: Add __pkvm_enable_tracing
This newly introduced hypercall allows the host to disable tracing on
all CPUs, while keeping the tracing buffers loaded into the hypervisor.
This intends to later improve the userspace interface which will be able
to turn on and off tracing and reset (teardown for the hyp) the tracing
buffers.

As disabling buffers will switch the buffer status, rename those status
to nonwritable - writable - writing. Another way of identifying buffers
which have not been loaded is needed. See rb_cpu_loaded().

Bug: 249050813
Change-Id: I6080aafe71d5628e94b37c432bcd8616e68ddfe8
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Vincent Donnefort
a3ea16320c ANDROID: KVM: arm64: Empty buffer support for hyp tracing trace file
Previously, hyp/per_cpu/cpu*/trace files would return an error when no
buffer has been allocated (i.e. when no tracing has ever started).
Return an empty header instead.

Bug: 249050813
Change-Id: Ic88bbdf8c876b8f26101ce2b33d3aca26fb88c94
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Will Deacon
9c6dd2c51d ANDROID: KVM: arm64: Rename nVHE hyp event ELF sections
The ELF sections and delimiters used by the hyp events were not
following the convention used by other hyp sections. Align them all.

Bug: 249050813
Change-Id: I7b3ee4915c8904cd531911df59c1fd1853bbbe9f
Signed-off-by: Will Deacon <willdeacon@google.com>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
2023-03-13 13:36:34 +00:00
Sangmoon Kim
f811a96ace ANDROID: ABI: update symbol list for galaxy
9 function symbol(s) added
  'int __traceiter_android_vh_mutex_wait_finish(void*, struct mutex*)'
  'int __traceiter_android_vh_mutex_wait_start(void*, struct mutex*)'
  'int __traceiter_android_vh_rtmutex_wait_finish(void*, struct rt_mutex_base*)'
  'int __traceiter_android_vh_rtmutex_wait_start(void*, struct rt_mutex_base*)'
  'int __traceiter_android_vh_rwsem_read_wait_finish(void*, struct rw_semaphore*)'
  'int __traceiter_android_vh_rwsem_read_wait_start(void*, struct rw_semaphore*)'
  'int __traceiter_android_vh_rwsem_write_wait_finish(void*, struct rw_semaphore*)'
  'int __traceiter_android_vh_rwsem_write_wait_start(void*, struct rw_semaphore*)'
  'int __traceiter_android_vh_sched_show_task(void*, struct task_struct*)'

9 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_mutex_wait_finish'
  'struct tracepoint __tracepoint_android_vh_mutex_wait_start'
  'struct tracepoint __tracepoint_android_vh_rtmutex_wait_finish'
  'struct tracepoint __tracepoint_android_vh_rtmutex_wait_start'
  'struct tracepoint __tracepoint_android_vh_rwsem_read_wait_finish'
  'struct tracepoint __tracepoint_android_vh_rwsem_read_wait_start'
  'struct tracepoint __tracepoint_android_vh_rwsem_write_wait_finish'
  'struct tracepoint __tracepoint_android_vh_rwsem_write_wait_start'
  'struct tracepoint __tracepoint_android_vh_sched_show_task'

Bug: 271799327

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: Ia207de00406cb138f30181e63548fa6c213d889a
2023-03-10 18:16:02 +00:00
Sangmoon Kim
1e6d82d241 ANDROID: Re-apply vendor hooks for information of blocked tasks
This reverts commit 66330b896c (Revert "ANDROID: vendor_hooks:
add waiting information for blocked tasks")

The original patch has been reverted to resolve merge issues
with 5.18-rc1. This patch adds again the vendor hooks for the
original purpose.

Bug: 271799327

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I86b9b7dd553b7b6a5930ace6280ecd66dc5dc4df
2023-03-10 18:16:02 +00:00
Subbaraman Narayanamurthy
5fca1f9b7e ANDROID: ABI: Add missing symbols to QCOM list
Add the following symbol for leds-qti-flash driver.

1 function symbol(s) added
  'int devm_led_classdev_flash_register_ext(struct device*, struct led_classdev_flash*, struct led_init_data*)'

Bug: 271902001
Change-Id: I76de8de2df578d78d0abd8af2cf784a8e193f6de
Signed-off-by: Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>
2023-03-10 13:56:34 +00:00
Neill Kapron
81c6641110 Revert "ANDROID: disble the UID_SYS_STATS driver"
This reverts commit d5c66205c2, which
disabled the uid_sys_stats driver in Android due to required hooks being
removed in the upstream kernel.

Bug: 219790626
Change-Id: I8398b1d711eee800520210c669c0022f4b660d03
Signed-off-by: Neill Kapron <nkapron@google.com>
2023-03-09 23:13:08 +00:00
Neill Kapron
bd772a54d2 Revert "exit: Remove profile_task_exit & profile_munmap"
This reverts commit 2d4bcf886e, which
removed hooks required for Android uid_sys_stats.c.

Bug: 219790626
Change-Id: Icea00bbf9abe2fb17312b25f2d575d29aa360999
[nkapron: resolve conflict with 2873cd31a2 exit: Remove profile_handoff_task]
Signed-off-by: Neill Kapron <nkapron@google.com>
2023-03-09 23:13:08 +00:00
John Stultz
3ff04317e4 FROMGIT: pstore: Revert pmsg_lock back to a normal mutex
This reverts commit 76d62f24db.

So while priority inversion on the pmsg_lock is an occasional
problem that an rt_mutex would help with, in uses where logging
is writing to pmsg heavily from multiple threads, the pmsg_lock
can be heavily contended.

After this change landed, it was reported that cases where the
mutex locking overhead was commonly adding on the order of 10s
of usecs delay had suddenly jumped to ~msec delay with rtmutex.

It seems the slight differences in the locks under this level
of contention causes the normal mutexes to utilize the spinning
optimizations, while the rtmutexes end up in the sleeping
slowpath (which allows additional threads to pile on trying
to take the lock).

In this case, it devolves to a worse case senerio where the lock
acquisition and scheduling overhead dominates, and each thread
is waiting on the order of ~ms to do ~us of work.

Obviously, having tons of threads all contending on a single
lock for logging is non-optimal, so the proper fix is probably
reworking pstore pmsg to have per-cpu buffers so we don't have
contention.

Additionally, Steven Rostedt has provided some furhter
optimizations for rtmutexes that improves the rtmutex spinning
path, but at least in my testing, I still see the test tripping
into the sleeping path on rtmutexes while utilizing the spinning
path with mutexes.

But in the short term, lets revert the change to the rt_mutex
and go back to normal mutexes to avoid a potentially major
performance regression. And we can work on optimizations to both
rtmutexes and finer-grained locking for pstore pmsg in the
future.

Cc: Wei Wang <wvw@google.com>
Cc: Midas Chien<midaschieh@google.com>
Cc: "Chunhui Li (李春辉)" <chunhui.li@mediatek.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: kernel-team@android.com
Fixes: 76d62f24db ("pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion")
Reported-by: "Chunhui Li (李春辉)" <chunhui.li@mediatek.com>
Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230308204043.2061631-1-jstultz@google.com
Bug: 271041816
Bug: 272453930
(cherry picked from commit 5239a89b06
 https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/pstore )
Change-Id: Iadf30bcbf5ba3895dd4af8c15c3a8aecf4301acb
Signed-off-by: John Stultz <jstultz@google.com>
2023-03-09 21:58:51 +00:00
Venkata Rao Kakani
85f5fd515e ANDROID: ABI: Update allowed list for QCOM
6 display function symbol added
  'void drm_connector_list_update(struct drm_connector*)'
  'struct drm_master* drm_master_get(struct drm_master*)'
  'void drm_master_put(struct drm_master**)'
  'struct drm_tile_group* drm_mode_create_tile_group(struct drm_device*, const char*)'
  'void drm_mode_prune_invalid(struct drm_device*, struct list_head*, bool)'
  'void drm_mode_sort(struct list_head*)'

4 video function symbol added
  'int __v4l2_ctrl_modify_range(struct v4l2_ctrl*, s64, s64, u64, s64)'
  'int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl*, s32)'
  'const char* v4l2_ctrl_get_name(u32)'
  'int v4l2_s_ctrl(struct v4l2_fh*, struct v4l2_ctrl_handler*, struct v4l2_control*)'

Bug: 271803384
Change-Id: I1b95b3d874369bd91183345cb2e80900d97b5909
Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com>
2023-03-09 12:17:08 +00:00
Maria Yu
250fe8bc75 ANDROID: ABI: Add missing symbols to QCOM list
Add the following symbols:
  __dev_kfree_skb_irq
  __get_random_u32_below
  idr_get_next_ul

Bug: 271815723
Change-Id: I672280c2186b8c7e964b17a57a94ed6087c77a00
Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
2023-03-06 07:21:30 -08:00
Kuen-Han Tsai
43b0fbcb54 ANDROID: usb: gadget: f_accessory: update to usb_gstrings_attach
For AOA re-connection, since the string ID of accessory has been changed
into a non-zero value, the f_accessory failes to call `usb_string_id` to
increment `next_string_id`. This makes the ADB interface display a wrong
name.

Bug: 270044830
Test: CTS Verifier: USB Accessory Test
Test: manual test
Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Change-Id: I807164588e80b28065e8715591a100392b04d3de
2023-03-04 12:46:11 +00:00
Charan Teja Kalla
5f28f5bc2d ANDROID: abi_gki_aarch64_qcom: whitelist some vm symbols
Whitelist the below symbols that will be used to work on the shmem pages
to move them across the LRU lists or reclaiming them:

reclaim_shmem_address_space
check_move_unevictable_pages
__pagevec_release.

Bug: 263340150
Change-Id: Icdd54d0f0b155cc0617479ef58273020f1fd4e35
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
2023-03-04 01:55:01 +00:00
Huang Yiwei
f1171f40b0 ANDROID: ABI: Update QCOM symbol list
Add the following symbols to the symbol list:

  - __traceiter_android_vh_check_uninterrupt_tasks
  - __traceiter_android_vh_check_uninterrupt_tasks_done
  - __tracepoint_android_vh_check_uninterrupt_tasks
  - __tracepoint_android_vh_check_uninterrupt_tasks_done

Bug: 271535428
Change-Id: Ie1d53f1d992ff494032b94c4202d686bd6e70e79
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2023-03-03 18:46:55 +00:00
YOUNGJIN JOO
36280321bc ANDROID: Add initial symbols list for galaxy
29 function symbol(s) added
  'struct block_device* I_BDEV(struct inode*)'
  'void* __devm_alloc_percpu(struct device*, size_t, size_t)'
  'int __get_task_ioprio(struct task_struct*)'
  'int __traceiter_android_vh_is_fpsimd_save(void*, struct task_struct*, struct task_struct*)'
  'int __traceiter_console(void*, const char*, size_t)'
  'int __traceiter_hrtimer_expire_entry(void*, struct hrtimer*, ktime_t*)'
  'int __traceiter_hrtimer_expire_exit(void*, struct hrtimer*)'
  'int __traceiter_irq_handler_entry(void*, int, struct irqaction*)'
  'int __traceiter_irq_handler_exit(void*, int, struct irqaction*, int)'
  'int __traceiter_workqueue_execute_start(void*, struct work_struct*)'
  'struct block_device* blkdev_get_by_dev(dev_t, fmode_t, void*)'
  'struct block_device* blkdev_get_by_path(const char*, fmode_t, void*)'
  'int blkdev_issue_flush(struct block_device*)'
  'void blkdev_put(struct block_device*, fmode_t)'
  'void file_ra_state_init(struct file_ra_state*, struct address_space*)'
  'int file_write_and_wait_range(struct file*, loff_t, loff_t)'
  'loff_t fixed_size_llseek(struct file*, loff_t, int, loff_t)'
  'ssize_t generic_file_read_iter(struct kiocb*, struct iov_iter*)'
  'ssize_t generic_perform_write(struct kiocb*, struct iov_iter*)'
  'ssize_t generic_write_checks(struct kiocb*, struct iov_iter*)'
  'u64 get_random_u64()'
  'struct gpio_chip* gpiochip_find(void*, int(*)(struct gpio_chip*, void*))'
  'dev_t name_to_dev_t(const char*)'
  'int param_get_uint(char*, const struct kernel_param*)'
  'int param_set_uint(const char*, const struct kernel_param*)'
  'void proc_set_size(struct proc_dir_entry*, loff_t)'
  'int pstore_register(struct pstore_info*)'
  'void pstore_unregister(struct pstore_info*)'
  'int vfs_fsync_range(struct file*, loff_t, loff_t, int)'

7 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_is_fpsimd_save'
  'struct tracepoint __tracepoint_console'
  'struct tracepoint __tracepoint_hrtimer_expire_entry'
  'struct tracepoint __tracepoint_hrtimer_expire_exit'
  'struct tracepoint __tracepoint_irq_handler_entry'
  'struct tracepoint __tracepoint_irq_handler_exit'
  'struct tracepoint __tracepoint_workqueue_execute_start'

Bug: 271472212
Change-Id: I9a95f28814d1e5c6dc5b275ca134242cd710a847
Signed-off-by: YOUNGJIN JOO <youngjin79.joo@samsung.com>
2023-03-03 17:15:34 +00:00
YOUNGJIN JOO
b97cdd877a ANDROID: printk: export symbol for tracepoint_console
Initial kernel bootup logs get overwritten after running
for a long time, and there can be debugging scenario where
we need initial ~100s bootup logs for debugging.
'tracepoint_console' is helping in achieving this purpose.

'tracepoint_console' replaces 'android_vh_log_buf' and
'android_vh_logbuf_pr_cong' vendor hooks in previous GKI kernels.

Bug: 271373835
Change-Id: If68801ba584e8e71e3e7aa16c64a5588c1f5a114
Signed-off-by: YOUNGJIN JOO <youngjin79.joo@samsung.com>
2023-03-03 17:15:34 +00:00
Greg Kroah-Hartman
e1300f4942 Merge 6.1.15 into android14-6.1
Changes in 6.1.15
	Fix XFRM-I support for nested ESP tunnels
	arm64: dts: rockchip: reduce thermal limits on rk3399-pinephone-pro
	arm64: dts: rockchip: drop unused LED mode property from rk3328-roc-cc
	ARM: dts: rockchip: add power-domains property to dp node on rk3288
	arm64: dts: rockchip: add missing #interrupt-cells to rk356x pcie2x1
	arm64: dts: rockchip: fix probe of analog sound card on rock-3a
	HID: elecom: add support for TrackBall 056E:011C
	HID: Ignore battery for Elan touchscreen on Asus TP420IA
	ACPI: NFIT: fix a potential deadlock during NFIT teardown
	pinctrl: amd: Fix debug output for debounce time
	btrfs: send: limit number of clones and allocated memory size
	arm64: dts: rockchip: align rk3399 DMC OPP table with bindings
	ASoC: rt715-sdca: fix clock stop prepare timeout issue
	IB/hfi1: Assign npages earlier
	powerpc: Don't select ARCH_WANTS_NO_INSTR
	ASoC: SOF: amd: Fix for handling spurious interrupts from DSP
	ARM: dts: stihxxx-b2120: fix polarity of reset line of tsin0 port
	neigh: make sure used and confirmed times are valid
	HID: core: Fix deadloop in hid_apply_multiplier.
	ASoC: codecs: es8326: Fix DTS properties reading
	HID: Ignore battery for ELAN touchscreen 29DF on HP
	selftests: ocelot: tc_flower_chains: make test_vlan_ingress_modify() more comprehensive
	x86/cpu: Add Lunar Lake M
	PM: sleep: Avoid using pr_cont() in the tasks freezing code
	bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state
	net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues().
	vc_screen: don't clobber return value in vcs_read
	drm/amd/display: Move DCN314 DOMAIN power control to DMCUB
	drm/amd/display: Fix race condition in DPIA AUX transfer
	usb: dwc3: pci: add support for the Intel Meteor Lake-M
	USB: serial: option: add support for VW/Skoda "Carstick LTE"
	usb: gadget: u_serial: Add null pointer check in gserial_resume
	arm64: dts: uniphier: Fix property name in PXs3 USB node
	usb: typec: pd: Remove usb_suspend_supported sysfs from sink PDO
	drm/amd/display: Properly reuse completion structure
	attr: add in_group_or_capable()
	fs: move should_remove_suid()
	attr: add setattr_should_drop_sgid()
	attr: use consistent sgid stripping checks
	fs: use consistent setgid checks in is_sxid()
	scripts/tags.sh: fix incompatibility with PCRE2
	USB: core: Don't hold device lock while reading the "descriptors" sysfs file
	Linux 6.1.15

Change-Id: I2489d74e0905d26c0afb69f1036cb43890bec060
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-03-03 12:21:45 +00:00
Greg Kroah-Hartman
42616e0f09 Linux 6.1.15
Link: https://lore.kernel.org/r/20230301180657.003689969@linuxfoundation.org
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Slade Watkins <srw@sladewatkins.net>
Tested-by: Rudi Heitbaum <rudi@heitbaum.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Ron Economos <re@w6rz.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:25 +01:00
Alan Stern
c87fb861ec USB: core: Don't hold device lock while reading the "descriptors" sysfs file
commit 45bf39f8df upstream.

Ever since commit 83e83ecb79 ("usb: core: get config and string
descriptors for unauthorized devices") was merged in 2013, there has
been no mechanism for reallocating the rawdescriptors buffers in
struct usb_device after the initial enumeration.  Before that commit,
the buffers would be deallocated when a device was deauthorized and
reallocated when it was authorized and enumerated.

This means that the locking in the read_descriptors() routine is not
needed, since the buffers it reads will never be reallocated while the
routine is running.  This locking can interfere with user programs
trying to read a hub's descriptors via sysfs while new child devices
of the hub are being initialized, since the hub is locked during this
procedure.

Since the locking in read_descriptors() hasn't been needed for over
nine years, we can remove it.

Reported-and-tested-by: Troels Liebe Bentsen <troels@connectedcars.dk>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: stable@vger.kernel.org
Link: https://lore.kernel.org/r/Y9l+wDTRbuZABzsE@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:25 +01:00
Carlos Llamas
c49bd6c2dd scripts/tags.sh: fix incompatibility with PCRE2
commit 6ec363fc61 upstream.

Starting with release 10.38 PCRE2 drops default support for using \K in
lookaround patterns as described in [1]. Unfortunately, scripts/tags.sh
relies on such functionality to collect all_compiled_soures() leading to
the following error:

  $ make COMPILED_SOURCE=1 tags
    GEN     tags
  grep: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)

The usage of \K for this pattern was introduced in commit 4f491bb6ea
("scripts/tags.sh: collect compiled source precisely") which speeds up
the generation of tags significantly.

In order to fix this issue without compromising the performance we can
switch over to an equivalent sed expression. The same matching pattern
is preserved here except \K is replaced with a backreference \1.

[1] https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC11

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Jialu Xu <xujialu@vimux.org>
Cc: Vipin Sharma <vipinsh@google.com>
Cc: stable@vger.kernel.org
Fixes: 4f491bb6ea ("scripts/tags.sh: collect compiled source precisely")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20230215183850.3353198-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:25 +01:00
Christian Brauner
a591d9fd70 fs: use consistent setgid checks in is_sxid()
commit 8d84e39d76 upstream.

Now that we made the VFS setgid checking consistent an inode can't be
marked security irrelevant even if the setgid bit is still set. Make
this function consistent with all other helpers.

Note that enforcing consistent setgid stripping checks for file
modification and mode- and ownership changes will cause the setgid bit
to be lost in more cases than useed to be the case. If an unprivileged
user wrote to a non-executable setgid file that they don't have
privilege over the setgid bit will be dropped. This will lead to
temporary failures in some xfstests until they have been updated.

Reported-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:25 +01:00
Christian Brauner
89f5f21b96 attr: use consistent sgid stripping checks
commit ed5a7047d2 upstream.

Currently setgid stripping in file_remove_privs()'s should_remove_suid()
helper is inconsistent with other parts of the vfs. Specifically, it only
raises ATTR_KILL_SGID if the inode is S_ISGID and S_IXGRP but not if the
inode isn't in the caller's groups and the caller isn't privileged over the
inode although we require this already in setattr_prepare() and
setattr_copy() and so all filesystem implement this requirement implicitly
because they have to use setattr_{prepare,copy}() anyway.

But the inconsistency shows up in setgid stripping bugs for overlayfs in
xfstests (e.g., generic/673, generic/683, generic/685, generic/686,
generic/687). For example, we test whether suid and setgid stripping works
correctly when performing various write-like operations as an unprivileged
user (fallocate, reflink, write, etc.):

echo "Test 1 - qa_user, non-exec file $verb"
setup_testfile
chmod a+rws $junk_file
commit_and_check "$qa_user" "$verb" 64k 64k

The test basically creates a file with 6666 permissions. While the file has
the S_ISUID and S_ISGID bits set it does not have the S_IXGRP set. On a
regular filesystem like xfs what will happen is:

sys_fallocate()
-> vfs_fallocate()
   -> xfs_file_fallocate()
      -> file_modified()
         -> __file_remove_privs()
            -> dentry_needs_remove_privs()
               -> should_remove_suid()
            -> __remove_privs()
               newattrs.ia_valid = ATTR_FORCE | kill;
               -> notify_change()
                  -> setattr_copy()

In should_remove_suid() we can see that ATTR_KILL_SUID is raised
unconditionally because the file in the test has S_ISUID set.

But we also see that ATTR_KILL_SGID won't be set because while the file
is S_ISGID it is not S_IXGRP (see above) which is a condition for
ATTR_KILL_SGID being raised.

So by the time we call notify_change() we have attr->ia_valid set to
ATTR_KILL_SUID | ATTR_FORCE. Now notify_change() sees that
ATTR_KILL_SUID is set and does:

ia_valid = attr->ia_valid |= ATTR_MODE
attr->ia_mode = (inode->i_mode & ~S_ISUID);

which means that when we call setattr_copy() later we will definitely
update inode->i_mode. Note that attr->ia_mode still contains S_ISGID.

Now we call into the filesystem's ->setattr() inode operation which will
end up calling setattr_copy(). Since ATTR_MODE is set we will hit:

if (ia_valid & ATTR_MODE) {
        umode_t mode = attr->ia_mode;
        vfsgid_t vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
        if (!vfsgid_in_group_p(vfsgid) &&
            !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
                mode &= ~S_ISGID;
        inode->i_mode = mode;
}

and since the caller in the test is neither capable nor in the group of the
inode the S_ISGID bit is stripped.

But assume the file isn't suid then ATTR_KILL_SUID won't be raised which
has the consequence that neither the setgid nor the suid bits are stripped
even though it should be stripped because the inode isn't in the caller's
groups and the caller isn't privileged over the inode.

If overlayfs is in the mix things become a bit more complicated and the bug
shows up more clearly. When e.g., ovl_setattr() is hit from
ovl_fallocate()'s call to file_remove_privs() then ATTR_KILL_SUID and
ATTR_KILL_SGID might be raised but because the check in notify_change() is
questioning the ATTR_KILL_SGID flag again by requiring S_IXGRP for it to be
stripped the S_ISGID bit isn't removed even though it should be stripped:

sys_fallocate()
-> vfs_fallocate()
   -> ovl_fallocate()
      -> file_remove_privs()
         -> dentry_needs_remove_privs()
            -> should_remove_suid()
         -> __remove_privs()
            newattrs.ia_valid = ATTR_FORCE | kill;
            -> notify_change()
               -> ovl_setattr()
                  // TAKE ON MOUNTER'S CREDS
                  -> ovl_do_notify_change()
                     -> notify_change()
                  // GIVE UP MOUNTER'S CREDS
     // TAKE ON MOUNTER'S CREDS
     -> vfs_fallocate()
        -> xfs_file_fallocate()
           -> file_modified()
              -> __file_remove_privs()
                 -> dentry_needs_remove_privs()
                    -> should_remove_suid()
                 -> __remove_privs()
                    newattrs.ia_valid = attr_force | kill;
                    -> notify_change()

The fix for all of this is to make file_remove_privs()'s
should_remove_suid() helper to perform the same checks as we already
require in setattr_prepare() and setattr_copy() and have notify_change()
not pointlessly requiring S_IXGRP again. It doesn't make any sense in the
first place because the caller must calculate the flags via
should_remove_suid() anyway which would raise ATTR_KILL_SGID.

While we're at it we move should_remove_suid() from inode.c to attr.c
where it belongs with the rest of the iattr helpers. Especially since it
returns ATTR_KILL_S{G,U}ID flags. We also rename it to
setattr_should_drop_suidgid() to better reflect that it indicates both
setuid and setgid bit removal and also that it returns attr flags.

Running xfstests with this doesn't report any regressions. We should really
try and use consistent checks.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:25 +01:00
Christian Brauner
c1df288f44 attr: add setattr_should_drop_sgid()
commit 72ae017c54 upstream.

The current setgid stripping logic during write and ownership change
operations is inconsistent and strewn over multiple places. In order to
consolidate it and make more consistent we'll add a new helper
setattr_should_drop_sgid(). The function retains the old behavior where
we remove the S_ISGID bit unconditionally when S_IXGRP is set but also
when it isn't set and the caller is neither in the group of the inode
nor privileged over the inode.

We will use this helper both in write operation permission removal such
as file_remove_privs() as well as in ownership change operations.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Christian Brauner
e44f23ef91 fs: move should_remove_suid()
commit e243e3f94c upstream.

Move the helper from inode.c to attr.c. This keeps the the core of the
set{g,u}id stripping logic in one place when we add follow-up changes.
It is the better place anyway, since should_remove_suid() returns
ATTR_KILL_S{G,U}ID flags.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Christian Brauner
18c2750856 attr: add in_group_or_capable()
commit 11c2a8700c upstream.

In setattr_{copy,prepare}() we need to perform the same permission
checks to determine whether we need to drop the setgid bit or not.
Instead of open-coding it twice add a simple helper the encapsulates the
logic. We will reuse this helpers to make dropping the setgid bit during
write operations more consistent in a follow up patch.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Stylon Wang
118ad80d27 drm/amd/display: Properly reuse completion structure
commit 0cf8307adb upstream.

[Why]
Connecting displays to TBT3 docks often produces invalid
replies for DPIA AUX requests. It turns out the completion
structure was not re-initialized before reusing it, resulting
in immature wake up to completion.

[How]
Properly call reinit_completion() on reused completion structure.

Cc: stable@vger.kernel.org
Reviewed-by: Solomon Chiu <solomon.chiu@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Stylon Wang <stylon.wang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: "Limonciello, Mario" <mario.limonciello@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Saranya Gopal
c9d3eb6151 usb: typec: pd: Remove usb_suspend_supported sysfs from sink PDO
commit e4e7b2dc27 upstream.

As per USB PD specification, 28th bit of fixed supply sink PDO
represents "higher capability" attribute and not "usb suspend
supported" attribute. So, this patch removes the usb_suspend_supported
attribute from sink PDO.

Fixes: 662a60102c ("usb: typec: Separate USB Power Delivery from USB Type-C")
Cc: stable <stable@kernel.org>
Reported-by: Rajaram Regupathy <rajaram.regupathy@intel.com>
Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230214114543.205103-1-saranya.gopal@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Kunihiko Hayashi
fb9a795579 arm64: dts: uniphier: Fix property name in PXs3 USB node
commit 2508d5efd7 upstream.

The property "snps,usb2_gadget_lpm_disable" is wrong.
It should be fixed to "snps,usb2-gadget-lpm-disable".

Cc: stable@vger.kernel.org
Fixes: 19fee1a109 ("arm64: dts: uniphier: Add USB-device support for PXs3 reference board")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/20230207021429.28925-1-hayashi.kunihiko@socionext.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Prashanth K
ec357cd3e8 usb: gadget: u_serial: Add null pointer check in gserial_resume
commit 5ec63fdbca upstream.

Consider a case where gserial_disconnect has already cleared
gser->ioport. And if a wakeup interrupt triggers afterwards,
gserial_resume gets called, which will lead to accessing of
gser->ioport and thus causing null pointer dereference.Add
a null pointer check to prevent this.

Added a static spinlock to prevent gser->ioport from becoming
null after the newly added check.

Fixes: aba3a8d01d ("usb: gadget: u_serial: add suspend resume callbacks")
Cc: stable <stable@kernel.org>
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/1676309438-14922-1-git-send-email-quic_prashk@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00
Florian Zumbiehl
ad5914431b USB: serial: option: add support for VW/Skoda "Carstick LTE"
commit 617c331d91 upstream.

Add support for VW/Skoda "Carstick LTE"

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1c9e ProdID=7605 Rev=02.00
S:  Manufacturer=USB Modem
S:  Product=USB Modem
C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

The stick has AT command interfaces on interfaces 1, 2, and 3, and does PPP
on interface 3.

Signed-off-by: Florian Zumbiehl <florz@florz.de>
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:52:24 +01:00