Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the kernel upgrade #20

Open
wants to merge 776 commits into
base: lineage-15.1-treble
Choose a base branch
from
Open

Conversation

krishnasen2401
Copy link

@krishnasen2401 krishnasen2401 commented May 22, 2018

I am new in field for android building but the generic image which I have requires kernel 4.x

https://android.googlesource.com/kernel/msm/+/android-msm-wahoo-4.4-p-preview-1

https://android.googlesource.com/kernel/msm/+/android-p-preview-1_r0.2

I am able to flash dp1 without any error but it get stuck (android logo) as the version required is not sufficient

So I am requesting your help you can email me at 2401krishnasen@gmail.con

Pragaspathi Thilagaraj and others added 30 commits April 20, 2018 02:20
Add checks for return codes of dot11f_unpack functions.

Change-Id: I56149a2a767a9f13009710750a0588c0d658eb56
CRs-Fixed: 2213317
Add null check for pTLCb->atlSTAClients before dereferencing it.

Change-Id: Id3be987092a1d5129d9707fa3145de264a2eb4dd
CRs-Fixed: 2225758
MHI might be configured to MBIM aggregation.
For this to work TX prefetch needs to be disabled.

Change-Id: I52510f3a7fbe90d5a472703363136e6e909d301c
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Some hosts like Ubuntu does not send USB_CDC_SET_NTB_INPUT_SIZE
for setting NTB size for in endpoint. Hence update ntb_input_size
to default value in bind_config.

Change-Id: I9cb04d28c466069b5b992079199455a61a35a3b9
Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
USB-audio driver may leave a stray URB for the mixer interrupt when it
exits by some error during probe.  This leads to a use-after-free
error as spotted by syzkaller like:
  ==================================================================
  BUG: KASAN: use-after-free in snd_usb_mixer_interrupt+0x604/0x6f0
  Call Trace:
   <IRQ>
   __dump_stack lib/dump_stack.c:16
   dump_stack+0x292/0x395 lib/dump_stack.c:52
   print_address_description+0x78/0x280 mm/kasan/report.c:252
   kasan_report_error mm/kasan/report.c:351
   kasan_report+0x23d/0x350 mm/kasan/report.c:409
   __asan_report_load8_noabort+0x19/0x20 mm/kasan/report.c:430
   snd_usb_mixer_interrupt+0x604/0x6f0 sound/usb/mixer.c:2490
   __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779
   ....

  Allocated by task 1484:
   save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59
   save_stack+0x43/0xd0 mm/kasan/kasan.c:447
   set_track mm/kasan/kasan.c:459
   kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
   kmem_cache_alloc_trace+0x11e/0x2d0 mm/slub.c:2772
   kmalloc ./include/linux/slab.h:493
   kzalloc ./include/linux/slab.h:666
   snd_usb_create_mixer+0x145/0x1010 sound/usb/mixer.c:2540
   create_standard_mixer_quirk+0x58/0x80 sound/usb/quirks.c:516
   snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560
   create_composite_quirk+0x1c4/0x3e0 sound/usb/quirks.c:59
   snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560
   usb_audio_probe+0x1040/0x2c10 sound/usb/card.c:618
   ....

  Freed by task 1484:
   save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59
   save_stack+0x43/0xd0 mm/kasan/kasan.c:447
   set_track mm/kasan/kasan.c:459
   kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:524
   slab_free_hook mm/slub.c:1390
   slab_free_freelist_hook mm/slub.c:1412
   slab_free mm/slub.c:2988
   kfree+0xf6/0x2f0 mm/slub.c:3919
   snd_usb_mixer_free+0x11a/0x160 sound/usb/mixer.c:2244
   snd_usb_mixer_dev_free+0x36/0x50 sound/usb/mixer.c:2250
   __snd_device_free+0x1ff/0x380 sound/core/device.c:91
   snd_device_free_all+0x8f/0xe0 sound/core/device.c:244
   snd_card_do_free sound/core/init.c:461
   release_card_device+0x47/0x170 sound/core/init.c:181
   device_release+0x13f/0x210 drivers/base/core.c:814
   ....

Actually such a URB is killed properly at disconnection when the
device gets probed successfully, and what we need is to apply it for
the error-path, too.

In this patch, we apply snd_usb_mixer_disconnect() at releasing.
Also introduce a new flag, disconnected, to struct usb_mixer_interface
for not performing the disconnection procedure twice.

Change-Id: Ic8b1b10a13b8369e12324210a8351b4ec0335218
Git-commit: 124751d
Git-repo: https://github.com/torvalds/linux/commit
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Srinivasa Rao Kuppala <srkupp@codeaurora.org>
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Add HAL support to configure QPOWER using vendor command

Change-Id: I16b2ce0f2ac57a905e3c770f7172ab867bf13a15
CRs-Fixed: 2221796
Add afe_loopback_tx back-end dai to get EC reference data to
support Far Field Voice (FFV) algorithm.

CRs-Fixed: 2223496
Change-Id: Id85d846d28046174c3891f77e05c26277b3a0c46
Signed-off-by: Dhanalakshmi Siddani <dsiddani@codeaurora.org>
voice_svc_dev is allocated as a device managed resource
and need not be freed since it is freed automatically.
Remove the logic to free voice_svc_dev in probe failure
and remove functions to avoid double free.

CRs-Fixed: 2204285
Change-Id: If4f9ca840b00448b987f5ce443f66b0923b01969
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
(cherry-pick from 'commit a1b61bc ("msm: mdss: Increase
 fbmem buf ref count before use")') and made similar
changes for MDP3.

The reference count for fbmem buf is not incremented
before use, which means it can get freed unintentionally
when the ref countis decreased to "0". In this case,
there is a possibility of use after free. Ensure the
fbmem buf refcount is incremented before use.

Change-Id: Iab89ac332dd447b29514a6d5c3f251fcd145de4d
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
Add support to get platform info with respect
to MHI dynamically for sdx20.

Change-Id: Ie38df2d3bbe80856a0b7cd49511ce64cb9aa4ce8
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
Enable MHI mode boot up flag in device tree
to boot up IPA driver with MHI config.

Change-Id: I90994259b2a7346116a20136082fc929813ca088
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
WEXT IOCTL's iw_set_mode and iw_get_mode is very
unsafe to the driver and it needs to be
rejected.
Add changes to reject the IOCTL's iw_set_mode and
iw_get_mode.

Change-Id: Icba218feadabd5783568a75956a08cea09484be3
CRs-Fixed: 2230144
Currently as part of connect start tdls mode is disabled.
Tdls mode is not changed unless scan/bt coex changes the
the mode to enable.

Don't call the function "wlan_hdd_tdls_disable_offchan_and_
teardown_link" in connect start.

CRs-Fixed: 2226583
Change-Id: I73af7c142da442849518fcf42342c04e75493399
… chn

IOT AP is advertising ecsa with new channel same as the current
operating channel in probe response. DUT is dropping these frames
based on ecsa present check. This results in connection latency
as bss info of this AP is not informed to supplicant.

Fix is to drop probe response having ecsa element only if new
channel is different from APs current operating channel.

Change-Id: Ia42a889b71af14f628cf532b6944322d049f04d5
CRs-Fixed: 2217394
Checking stream status failure will return without
unlocking the acquired lock.

CRs-Fixed: 2149998
Change-Id: I5ed5cd8a4dfc02d0f6817078c7833b674465c988
Signed-off-by: Vijay Kumar TM <vtmuni@codeaurora.org>
There is an array out of bound access in
__wlan_hdd_change_station api while filling the supported channels
in local variable.

Add a check to make sure that supported channels array never
indexed beyond SIR_MAC_MAX_SUPP_CHANNELS.

Change-Id: If1031196001be3ccc583804ef3661a1afe5422fc
CRs-Fixed: 2231005
The skb_peek and skb_peek_tail functions can return NULL if the skb
list is empty. Check the return value before using the skb.

CRs-Fixed: 2121368
Change-Id: If14320104ec37b8b7504e930ed8fd06e72d08724
Signed-off-by: Chris Lew <clew@codeaurora.org>
Before going for suspend, suspend_noirq is called
to handle race condition

Change-Id: I5d0fd339fddd5cbf19868cb6869439099c74096f
CRs-Fixed: 2231816
Jaegeuk Kim and others added 23 commits June 29, 2018 18:07
Cherry-pick from origin/upstream-f2fs-stable-linux-3.18.y:
commit 1e79b9b ("Revert "f2fs: introduce f2fs_set_page_dirty_nobuffer")

This patch reverts copied f2fs_set_page_dirty_nobuffer to use generic function
for stability.

This reverts commit fe76b79.

Change-Id: Ie3084e047d91cd1d01eb1cc2cb324654ab908121
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Cherry-pick from origin/upstream-f2fs-stable-linux-3.18.y:
commit dae6d19 ("f2fs: check cap_resource only for data blocks")

This patch changes the rule to check cap_resource for data blocks, not inode
or node blocks in order to avoid selinux denial.

Change-Id: I02bc7b9eb78b64323d71cb945850b2c4828dcebd
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This patch clears PageError in some pages tagged by read path, but when we
write the pages with valid contents, writepage should clear the bit likewise
ext4.

Change-Id: I96f100b7710c18994e8f12b772e929f5664582c8
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 61ff769)
pageout() in MM traslates EAGAIN, so calls handle_write_error()
 -> mapping_set_error() -> set_bit(AS_EIO, ...).
 file_write_and_wait_range() will see EIO error, which is critical
 to return value of fsync() followed by atomic_write failure to user.

Change-Id: I1e1048eb271a58ddcb8a3050922d9e883aa0252c
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 8c088f4)
Cherry-picked from:
    origin/upstream-f2fs-stable-linux-3.18.y

0643d71 ("f2fs: turn down IO priority of discard from background")
6d85462 ("f2fs: don't split checkpoint in fstrim")
da639d1 ("f2fs: issue discard commands proactively in high fs utilization")
413fa22 ("f2fs: add fsync_mode=nobarrier for non-atomic files")
d7a1b25 ("f2fs: let fstrim issue discard commands in lower priority")

Change-Id: Ic83898da3eb921238ec154e839120e825325925c
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Cherry-picked from:
        origin/upstream-f2fs-stable-linux-3.18.y

We don't need to wait for whole bunch of discard candidates in fstrim, since
runtime discard will issue them in idle time.

Change-Id: I7dab8241370ccbb2222a513fadc50d1b479b32c2
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
 * https://source.android.com/devices/storage/faster-stats

Change-Id: Iad40e1d941bd6e8d311947d0e06249c334f1c1c4
 * Samsung driver version 1.4.16

 * From Samsung package version: G950FXXU1CRAP

Change-Id: I0a0f7365d432f0e006ecc6ca0d305008cc44444c
* And make WARNON debugging optional

Change-Id: Id59e908c8a60ded1238d3fd010f3d96cdde95f40
Signed-off-by: Paul Keith <javelinanddart@gmail.com>
 * From Samsung package version: G960USQU1ARBG

Change-Id: Ia4ba42dbd088701c23c09fbb4ba97a5654e19011
 * Update default charset for FAT to UTF-8, matching sdFAT's default.

Change-Id: I7b33b5f24e079509a47a35b3aeb06b269cdc86eb
Change-Id: I97f1169a7cfccc78530b9869a407b3a9eade31ab
Ensure valid start address to check for vaddress
bounds.

Change-Id: I02c0ce85d9a495880c133e66553b09159daa8f0c
Signed-off-by: Pratap Nirujogi <pratapn@codeaurora.org>
As part of the change to fix unmovable block migration over time, we
need to reduce the orders requested by ion to under order-5
allocations. In a future CL, we can add fixed-size larger-order pools
to improve performance when allocating large buffers.

Change-Id: I1ca336c8057b984987a5a5c28a86ab36488e08ea
 * We don't need the "fix", per cpu stats is created without it, what's
   worse, it tried to create duplicated sysfs nodes.

This reverts commit f68f1c61baacc8c4a86f71c354f2081d2588d6c7.

Change-Id: I408f33609ce85bae9230707d7aad8874e4553cdc
<4>[ 1567.351182] ------------[ cut here ]------------
<4>[ 1567.351224] WARNING: CPU: 5 PID: 836 at ../../../../../../kernel/xiaomi/msm8953/kernel/irq/manage.c:451 __enable_irq+0x4c/0x90()
<4>[ 1567.351229] Unbalanced enable for IRQ 72
<4>[ 1567.351237] Modules linked in:
<4>[ 1567.351253] CPU: 5 PID: 836 Comm: HwBinder:546_2 Tainted: G        W      3.18.71-perf-gc0bd711 #3
<4>[ 1567.351258] Hardware name: Qualcomm Technologies, Inc. MSM8953 + PMI8950 QRD SKU3 (DT)
<0>[ 1567.351263] Call trace:
<4>[ 1567.351283] [<ffffffc000089c88>] dump_backtrace+0x0/0x258
<4>[ 1567.351292] [<ffffffc000089f00>] show_stack+0x20/0x28
<4>[ 1567.351311] [<ffffffc000fcde18>] dump_stack+0x80/0xa4
<4>[ 1567.351323] [<ffffffc0000a76f8>] warn_slowpath_common+0x90/0xb4
<4>[ 1567.351340] [<ffffffc0000fe294>] __enable_irq+0x4c/0x90
<4>[ 1567.351368] [<ffffffc000810560>] ft5435_ts_resume.isra.12+0xb4/0xd8
<4>[ 1567.351392] [<ffffffc0000c5ed0>] notifier_call_chain+0x58/0x8c
<4>[ 1567.351412] [<ffffffc0000c6384>] blocking_notifier_call_chain+0x38/0x44
<4>[ 1567.351432] [<ffffffc00045ff80>] fb_blank+0x9c/0xc4
<4>[ 1567.351447] [<ffffffc0004609fc>] fb_ioctl+0x54/0x64
<4>[ 1586.198413] ------------[ cut here ]------------

Change-Id: Idcc9ef2309dd30518c114deabe9f5f14a7b7b8ee
Update Kconfig.iosched and do the related Makefile changes to include
kernel configuration options for BFQ. Also add the bfqio controller
to the cgroups subsystem.

Change-Id: I9a935f01f91d9abdc6813a65fc6bd5cd86fbfc74
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Add the BFQ-v7r8 I/O scheduler to 3.18.0.
The general structure is borrowed from CFQ, as much of the code for
handling I/O contexts. Over time, several useful features have been
ported from CFQ as well (details in the changelog in README.BFQ). A
(bfq_)queue is associated to each task doing I/O on a device, and each
time a scheduling decision has to be made a queue is selected and served
until it expires.

    - Slices are given in the service domain: tasks are assigned
      budgets, measured in number of sectors. Once got the disk, a task
      must however consume its assigned budget within a configurable
      maximum time (by default, the maximum possible value of the
      budgets is automatically computed to comply with this timeout).
      This allows the desired latency vs "throughput boosting" tradeoff
      to be set.

    - Budgets are scheduled according to a variant of WF2Q+, implemented
      using an augmented rb-tree to take eligibility into account while
      preserving an O(log N) overall complexity.

    - A low-latency tunable is provided; if enabled, both interactive
      and soft real-time applications are guaranteed a very low latency.

    - Latency guarantees are preserved also in the presence of NCQ.

    - Also with flash-based devices, a high throughput is achieved
      while still preserving latency guarantees.

    - BFQ features Early Queue Merge (EQM), a sort of fusion of the
      cooperating-queue-merging and the preemption mechanisms present
      in CFQ. EQM is in fact a unified mechanism that tries to get a
      sequential read pattern, and hence a high throughput, with any
      set of processes performing interleaved I/O over a contiguous
      sequence of sectors.

    - BFQ supports full hierarchical scheduling, exporting a cgroups
      interface.  Since each node has a full scheduler, each group can
      be assigned its own weight.

    - If the cgroups interface is not used, only I/O priorities can be
      assigned to processes, with ioprio values mapped to weights
      with the relation weight = IOPRIO_BE_NR - ioprio.

    - ioprio classes are served in strict priority order, i.e., lower
      priority queues are not served as long as there are higher
      priority queues.  Among queues in the same class the bandwidth is
      distributed in proportion to the weight of each queue. A very
      thin extra bandwidth is however guaranteed to the Idle class, to
      prevent it from starving.

Change-Id: I8da08487ff332f178a121c3d906f972f37a71da9
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
A set of processes may happen  to  perform interleaved reads, i.e.,requests
whose union would give rise to a  sequential read  pattern.  There are two
typical  cases: in the first  case,   processes  read  fixed-size chunks of
data at a fixed distance from each other, while in the second case processes
may read variable-size chunks at  variable distances. The latter case occurs
for  example with  QEMU, which  splits the  I/O generated  by the  guest into
multiple chunks,  and lets these chunks  be served by a  pool of cooperating
processes,  iteratively  assigning  the  next  chunk of  I/O  to  the first
available  process. CFQ  uses actual  queue merging  for the  first type of
rocesses, whereas it  uses preemption to get a sequential  read pattern out
of the read requests  performed by the second type of  processes. In the end
it uses  two different  mechanisms to  achieve the  same goal: boosting the
throughput with interleaved I/O.

This patch introduces  Early Queue Merge (EQM), a unified mechanism to get a
sequential  read pattern  with both  types of  processes. The  main idea is
checking newly arrived requests against the next request of the active queue
both in case of actual request insert and in case of request merge. By doing
so, both the types of processes can be handled by just merging their queues.
EQM is  then simpler and  more compact than the  pair of mechanisms used in
CFQ.

Finally, EQM  also preserves the  typical low-latency properties of BFQ, by
properly restoring the weight-raising state of a queue when it gets back to
a non-merged state.

Change-Id: Ie7e0818fe5a7cb58ba84c1605ec6f4cc0414dafd
Signed-off-by: Mauro Andreolini <mauro.andreolini@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Change-Id: I322e8344badc5e8626f99f43d2ea6ecf83eebbd5
This reverts commit e8bf562.

Change-Id: I6152dc909c40d615385ccc98d9a558debd265c1e
…g/quic/la/kernel/msm-3.18 into HEAD

"LA.UM.6.6.r1-09000-89xx.0"

* tag 'LA.UM.6.6.r1-09000-89xx.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.18: (160 commits)
  msm: mdss: Signal the fences when there is a dma_done timeout
  usb: dwc3: Enable evicting endpoint cache after flow control
  xt_quota2: Send netlink event on quota reach, without fail.
  diag: Validate query dci event and log mask size properly
  defconfig: msm: Enable secure touch for MSM8909 devices
  ARM: dts: msm: Add WCD9326 support for apq8009 som platform
  usb: gadget: Send BRK signal to host on flow disable ioctl
  msm: ipa: ipa_usb: remove SUSPEND_IN_PROGRESS state
  msm: ipa: gsi: mhi: Couple of code changes
  ais: isp2: Release buffer lock after use
  msm: pcie: Add proper check before accessing variables
  msm: ipa: fix to not allow NAT DMA command without device initialization
  packet: in packet_do_bind, test fanout with bind_lock held
  packet: hold bind lock when rebinding to fanout hook
  regulator: core: Fix buffer overflow issue
  msm: mdss: Add support to wait for dma_done in pan display
  msm: mdss: Add support for handling secure buffer use-cases in MDP3
  msm: mdss: Add separate function for mapping
  um: Fix out-of-tree build
  um: Remove copy&paste code from init.h
  ...

Change-Id: I5b784b67e44f8751dd118800945c362f930e9de5
…g/quic/la/platform/vendor/qcom-opensource/wlan/prima into HEAD

"LA.UM.6.6.r1-09000-89xx.0"

* tag 'LA.UM.6.6.r1-09000-89xx.0' of https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/wlan/prima: (107 commits)
  wlan: Update needed_headroom with LIBRA_HW_NEEDED_HEADROOM
  wlan: Advertize flag WIPHY_WOWLAN_ANY in wiphy wowlan config
  wlan: Don't access adapter after netdev is freed
  wlan: Fix frame lenth information to cfg80211
  wlan: Use proper length to send the beacon/probe to kernel
  wlan: Resolve memory leak while processing SET_PACKET_FILTER IOCTL
  wlan: Initialize channel switch completion variable during SAP OPEN
  wlan: NULL pointer access in wlan_hdd_free_cache_channels
  wlan: Abort ongoing scan on disable agg indication
  wlan: Reject invalid subsequent set disable channel command
  wlan: Use max tx power allowed to compute link report power
  Wlan: Do not flush disconnect command from sme on receiving connect
  wlan: Use request manager while processing driver commands
  wlan: Revert "wlan: Use request manager for GETFWSTATS and GETBCNMISSRATE"
  wlan: While processing get current antenna request wait for the WDA response
  wlan: Use request manager while processing monitor mode start/stop request
  wlan: Add support to dynamically configure BTC and Concurrent dwell time
  wlan: Correctly report 20 MHz bandwidth in Linux 4.x
  wlan: Increase MAX_CFG_INI_ITEMS to 1024
  wlan: Do not start auto bmps timer when aggregation is disabled
  ...

Change-Id: Ifacb8caabd0aaf1a677378dcc70ebee52839039e
@TheScarastic TheScarastic force-pushed the lineage-15.1 branch 2 times, most recently from 1628002 to b9a68dc Compare July 23, 2018 13:57
Marc Zyngier and others added 2 commits July 23, 2018 19:28
We call arm64_apply_bp_hardening() from post_ttbr_update_workaround,
which has the unexpected consequence of being triggered on every
exception return to userspace when ARM64_SW_TTBR0_PAN is selected,
even if no context switch actually occured.

This is a bit suboptimal, and it would be more logical to only
invalidate the branch predictor when we actually switch to
a different mm.

In order to solve this, move the call to arm64_apply_bp_hardening()
into check_and_switch_context(), where we're guaranteed to pick
a different mm context.

Change-Id: I28f2fb09b77544e5ead095e9dad1ad64b2b3ae36
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Git-commit: a8e4c0a
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
RahifM pushed a commit to RahifM/android_kernel_xiaomi_msm8953 that referenced this pull request Feb 2, 2020
commit 46cc0b4 upstream.

Current snapshot implementation swaps two ring_buffers even though their
sizes are different from each other, that can cause an inconsistency
between the contents of buffer_size_kb file and the current buffer size.

For example:

  # cat buffer_size_kb
  7 (expanded: 1408)
  # echo 1 > events/enable
  # grep bytes per_cpu/cpu0/stats
  bytes: 1441020
  # echo 1 > snapshot             // current:1408, spare:1408
  # echo 123 > buffer_size_kb     // current:123,  spare:1408
  # echo 1 > snapshot             // current:1408, spare:123
  # grep bytes per_cpu/cpu0/stats
  bytes: 1443700
  # cat buffer_size_kb
  123                             // != current:1408

And also, a similar per-cpu case hits the following WARNING:

Reproducer:

  # echo 1 > per_cpu/cpu0/snapshot
  # echo 123 > buffer_size_kb
  # echo 1 > per_cpu/cpu0/snapshot

WARNING:

  WARNING: CPU: 0 PID: 1946 at kernel/trace/trace.c:1607 update_max_tr_single.part.0+0x2b8/0x380
  Modules linked in:
  CPU: 0 PID: 1946 Comm: bash Not tainted 5.2.0-rc6 TheScarastic#20
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014
  RIP: 0010:update_max_tr_single.part.0+0x2b8/0x380
  Code: ff e8 dc da f9 ff 0f 0b e9 88 fe ff ff e8 d0 da f9 ff 44 89 ee bf f5 ff ff ff e8 33 dc f9 ff 41 83 fd f5 74 96 e8 b8 da f9 ff <0f> 0b eb 8d e8 af da f9 ff 0f 0b e9 bf fd ff ff e8 a3 da f9 ff 48
  RSP: 0018:ffff888063e4fca0 EFLAGS: 00010093
  RAX: ffff888066214380 RBX: ffffffff99850fe0 RCX: ffffffff964298a8
  RDX: 0000000000000000 RSI: 00000000fffffff5 RDI: 0000000000000005
  RBP: 1ffff1100c7c9f96 R08: ffff888066214380 R09: ffffed100c7c9f9b
  R10: ffffed100c7c9f9a R11: 0000000000000003 R12: 0000000000000000
  R13: 00000000ffffffea R14: ffff888066214380 R15: ffffffff99851060
  FS:  00007f9f8173c700(0000) GS:ffff88806d000000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000714dc0 CR3: 0000000066fa6000 CR4: 00000000000006f0
  Call Trace:
   ? trace_array_printk_buf+0x140/0x140
   ? __mutex_lock_slowpath+0x10/0x10
   tracing_snapshot_write+0x4c8/0x7f0
   ? trace_printk_init_buffers+0x60/0x60
   ? selinux_file_permission+0x3b/0x540
   ? tracer_preempt_off+0x38/0x506
   ? trace_printk_init_buffers+0x60/0x60
   __vfs_write+0x81/0x100
   vfs_write+0x1e1/0x560
   ksys_write+0x126/0x250
   ? __ia32_sys_read+0xb0/0xb0
   ? do_syscall_64+0x1f/0x390
   do_syscall_64+0xc1/0x390
   entry_SYSCALL_64_after_hwframe+0x49/0xbe

This patch adds resize_buffer_duplicate_size() to check if there is a
difference between current/spare buffer sizes and resize a spare buffer
if necessary.

Link: http://lkml.kernel.org/r/20190625012910.13109-1-devel@etsukata.com

Cc: stable@vger.kernel.org
Fixes: ad909e2 ("tracing: Add internal tracing_snapshot() functions")
Signed-off-by: Eiichi Tsukata <devel@etsukata.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Change-Id: I708de8ecc406d2e5667a01197eba8f56135b6c26
RahifM pushed a commit to RahifM/android_kernel_xiaomi_msm8953 that referenced this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet