Commit Graph

886563 Commits

Author SHA1 Message Date
Michael Specter
cb0830225a ANDROID: Adding kprobes build configs for Cuttlefish
Bug: 181054145
Change-Id: Ibb1362479469eae9c294f71a483e500db05b04e1
Signed-off-by: Michael Specter <mikespecter@google.com>
2021-02-28 04:50:28 +00:00
Paul Lawrence
75c93eb439 ANDROID: Incremental fs: Fix selinux issues
Bug: 177075428
Test: incfs_test passes
      atest GtsIncrementalInstallTestCases has only 8 failures
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I73accfc1982aec1cd7947996c25a23e4a97cfdac
2021-02-23 07:26:29 -08:00
Paul Lawrence
28688d32ed ANDROID: Incremental fs: Set credentials before reading/writing
Bug: 174692664
Test: incfs_test passes, incremental installs work with ag/13082306
Signed-off-by: Paul Lawrence <paullawrence@google.com>

Change-Id: Ib1c924bbaff759f58f7d83bad8e23d7224ba7ed9
2021-02-23 07:26:18 -08:00
Paul Lawrence
152fd8f044 ANDROID: Incremental fs: Fix memory leak on closing file
Bug: 179271514
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Idc42d02b1df5ac84bdd04e728bfcca5f4cc5d07b
2021-02-23 07:03:08 -08:00
Masaya Takahashi
29b2beadc6 ANDROID: GKI: update Sony KMI symbol list
Update the Sony abi list for ledtrig_transient.ko

Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function void led_set_brightness_nosleep(led_classdev*, led_brightness)'

Bug: 180692386
Signed-off-by: Masaya Takahashi <masaya.a.takahashi@sony.com>
Change-Id: I097a124fda2b5b48a2d7ad7d92d033eaa571bc21
2021-02-19 20:59:46 +09:00
John Stultz
c382bf8373 ANDROID: ABI updates for db845c (enabling wifi)
Update the db845c abi list after enabling wifi

Generated with:
  BUILD_CONFIG=common/build.config.db845c build/build_abi.sh -u
  build/build_abi.sh -u

Leaf changes summary: 34 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 34 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

34 Added functions:

  [A] 'function void __ieee80211_schedule_txq(ieee80211_hw*, ieee80211_txq*, bool)'
  [A] 'function int dev_pm_genpd_set_performance_state(device*, unsigned int)'
  [A] 'function void* device_get_mac_address(device*, char*, int)'
  [A] 'function thermal_cooling_device* devm_thermal_of_cooling_device_register(device*, device_node*, char*, void*, const thermal_cooling_device_ops*)'
  [A] 'function sk_buff* ieee80211_beacon_get_template(ieee80211_hw*, ieee80211_vif*, ieee80211_mutable_offsets*)'
  [A] 'function void ieee80211_beacon_loss(ieee80211_vif*)'
  [A] 'function u8 ieee80211_csa_update_counter(ieee80211_vif*)'
  [A] 'function ieee80211_sta* ieee80211_find_sta_by_ifaddr(ieee80211_hw*, const u8*, const u8*)'
  [A] 'function void ieee80211_iter_chan_contexts_atomic(ieee80211_hw*, void (ieee80211_hw*, ieee80211_chanctx_conf*, void*)*, void*)'
  [A] 'function void ieee80211_iterate_stations_atomic(ieee80211_hw*, void (void*, ieee80211_sta*)*, void*)'
  [A] 'function void ieee80211_manage_rx_ba_offl(ieee80211_vif*, const u8*, unsigned int)'
  [A] 'function ieee80211_txq* ieee80211_next_txq(ieee80211_hw*, u8)'
  [A] 'function void ieee80211_sta_register_airtime(ieee80211_sta*, unsigned char, unsigned int, unsigned int)'
  [A] 'function void ieee80211_tdls_oper_request(ieee80211_vif*, const u8*, nl80211_tdls_operation, u16, gfp_t)'
  [A] 'function sk_buff* ieee80211_tx_dequeue(ieee80211_hw*, ieee80211_txq*)'
  [A] 'function void ieee80211_tx_rate_update(ieee80211_hw*, ieee80211_sta*, ieee80211_tx_info*)'
  [A] 'function void ieee80211_txq_get_depth(ieee80211_txq*, unsigned long int*, unsigned long int*)'
  [A] 'function bool ieee80211_txq_may_transmit(ieee80211_hw*, ieee80211_txq*)'
  [A] 'function void ieee80211_txq_schedule_start(ieee80211_hw*, u8)'
  [A] 'function int pcie_capability_write_word(pci_dev*, int, u16)'
  [A] 'function const char* reg_initiator_name(nl80211_reg_initiator)'
  [A] 'function int rproc_add(rproc*)'
  [A] 'function void rproc_add_subdev(rproc*, rproc_subdev*)'
  [A] 'function rproc* rproc_alloc(device*, const char*, const rproc_ops*, const char*, int)'
  [A] 'function int rproc_coredump_add_custom_segment(rproc*, dma_addr_t, size_t, void (rproc*, rproc_dump_segment*, void*)*, void*)'
  [A] 'function int rproc_coredump_add_segment(rproc*, dma_addr_t, size_t)'
  [A] 'function int rproc_del(rproc*)'
  [A] 'function u32 rproc_elf_get_boot_addr(rproc*, const firmware*)'
  [A] 'function void rproc_free(rproc*)'
  [A] 'function rproc* rproc_get_by_child(device*)'
  [A] 'function void rproc_remove_subdev(rproc*, rproc_subdev*)'
  [A] 'function void rproc_report_crash(rproc*, rproc_crash_type)'
  [A] 'function thermal_cooling_device* thermal_cooling_device_register(const char*, void*, const thermal_cooling_device_ops*)'
  [A] 'function void wiphy_read_of_freq_limits(wiphy*)'

Bug: 146449535
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I6e3c8a52a394b7f151065f4792d22a5a94c7e8fa
2021-02-18 16:34:56 -08:00
John Stultz
2ae7c28a04 ANDROID: db845c_gki.fragment: Enable wifi on db845c w/ android-5.4
Add config settings to enable wifi via modules on db845c

Bug: 146449535
Change-Id: I81892c4cc48db7839fe99aa5fb0b0a0782cab321
Signed-off-by: John Stultz <john.stultz@linaro.org>
2021-02-18 16:25:02 -08:00
Bjorn Andersson
8f96c722f5 UPSTREAM: arm64: dts: qcom: sdm845: Add APSS watchdog node
commit ef8576789e869b7584684ae81126a465eb1deeb6 upstream.

Add a node describing the watchdog found in the application subsystem.

Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
(cherry picked from commit ef8576789e869b7584684ae81126a465eb1deeb6)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I835d512c13c392e356c5190e865c0617e97041c2
2021-02-18 16:24:28 -08:00
Bjorn Andersson
1d2d51a301 UPSTREAM: arm64: dts: qcom: db845c: Move remoteproc firmware to sdm845
The redistributable firmware should work on any engineering device, so
lets push this to qcom/sdm845, rather than qcom/db845c. Also specify the
path for the modem firmware.

Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20191113203951.3704428-1-bjorn.andersson@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
(cherry picked from commit 82b1cc447a2c7c5121ce34f15f9840110ee3499f)
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Ica785dd7faee17dce933379dbb6ada32a3697bdb
2021-02-18 16:23:58 -08:00
Bjorn Andersson
a09a63360b UPSTREAM: ath10k: qmi: Sleep for a while before assigning MSA memory
commit b70b3a36ec33a2c8d3292f3b33fe2047a8f57b9a upstream.

Unless we sleep for a while before transitioning the MSA memory to WLAN
the MPSS.AT.4.0.c2-01184-SDM845_GEN_PACK-1 firmware triggers a security
violation fairly reliably. Unforutnately recovering from this failure
always results in the entire system freezing.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
(cherry picked from commit b70b3a36ec33a2c8d3292f3b33fe2047a8f57b9a)
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: Ie44e86d404f1897b7cc349a03972178374fef89c
2021-02-18 16:23:20 -08:00
Jeffrey Hugo
2d00c82d25 UPSTREAM: soc: qcom: qmi: Return EPROBE_DEFER if no address family
If a client comes up early in the boot process (perhaps was a built-in
driver), qmi_handle_init() will likely fail with a EAFNOSUPPORT since the
underlying ipc router hasn't init'd and registered the address family.
This should not be a fatal error since chances are, the router will come
up later, so recode the error to EPROBE_DEFER so that clients will retry
later.

Signed-off-by: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
Link: https://lore.kernel.org/r/20191106230511.1290-1-jeffrey.l.hugo@gmail.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
(cherry picked from commit 52af26e33e700158e6549f1465fcf9da099fabfa)
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I26a0dabe9b1f3b8e9cc793f7f52ee8f658ecdce3
2021-02-18 16:22:46 -08:00
Tony Truong
240e180bd8 ANDROID: ABI: Update allowed list for QCOM
Add the following symbols to QCOM allowed-list:
-- pcie_bus_configure_settings

Bug: 180475310
Change-Id: I49ed1ada673a9199370344cf2b89d7369f92d3f2
Signed-off-by: Tony Truong <truong@codeaurora.org>
2021-02-18 14:25:28 +00:00
Masaya Takahashi
224ea2cd2c ANDROID: GKI: update Sony symbol list for texfat
Leaf changes summary: 60 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 60 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

60 Added functions:

  [A] 'function void __bforget(buffer_head*)'
  [A] 'function void __filemap_set_wb_err(address_space*, int)'
  [A] 'function void __pagevec_release(pagevec*)'
  [A] 'function void __sb_end_write(super_block*, int)'
  [A] 'function int __sb_start_write(super_block*, int, bool)'
  [A] 'function int __test_set_page_writeback(page*, bool)'
  [A] 'function int add_to_page_cache_locked(page*, address_space*, unsigned long int, gfp_t)'
  [A] 'function void balance_dirty_pages_ratelimited(address_space*)'
  [A] 'function int blkdev_issue_discard(block_device*, long long unsigned int, long long unsigned int, unsigned int, unsigned long int)'
  [A] 'function void block_invalidatepage(page*, unsigned int, unsigned int)'
  [A] 'function bool capable_wrt_inode_uidgid(const inode*, int)'
  [A] 'function int clear_page_dirty_for_io(page*)'
  [A] 'function int current_umask()'
  [A] 'function dentry* d_splice_alias(inode*, dentry*)'
  [A] 'function void end_page_writeback(page*)'
  [A] 'function int fiemap_check_flags(fiemap_extent_info*, u32)'
  [A] 'function int fiemap_fill_next_extent(fiemap_extent_info*, u64, u64, u64, u32)'
  [A] 'function int file_remove_privs(file*)'
  [A] 'function int file_update_time(file*)'
  [A] 'function int file_write_and_wait_range(file*, loff_t, loff_t)'
  [A] 'function int filemap_fdatawrite(address_space*)'
  [A] 'function int filemap_flush(address_space*)'
  [A] 'function int filemap_write_and_wait(address_space*)'
  [A] 'function int filemap_write_and_wait_range(address_space*, loff_t, loff_t)'
  [A] 'function ssize_t generic_file_direct_write(kiocb*, iov_iter*)'
  [A] 'function ssize_t generic_perform_write(file*, iov_iter*, loff_t)'
  [A] 'function ssize_t generic_write_checks(kiocb*, iov_iter*)'
  [A] 'function page* grab_cache_page_write_begin(address_space*, unsigned long int, unsigned int)'
  [A] 'function inode* igrab(inode*)'
  [A] 'function inode* ilookup5(super_block*, unsigned long int, int (inode*, void*)*, void*)'
  [A] 'function void inode_dio_wait(inode*)'
  [A] 'function int inode_newsize_ok(const inode*, long long int)'
  [A] 'function void inode_set_flags(inode*, unsigned int, unsigned int)'
  [A] 'function void iov_iter_advance(iov_iter*, unsigned long int)'
  [A] 'function unsigned long int iov_iter_alignment(const iov_iter*)'
  [A] 'function long int iov_iter_get_pages(iov_iter*, page**, unsigned long int, unsigned int, unsigned long int*)'
  [A] 'function ssize_t iter_file_splice_write(pipe_inode_info*, file*, loff_t*, size_t, unsigned int)'
  [A] 'function kmem_cache* kmem_cache_create_usercopy(const char*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, void (void*)*)'
  [A] 'function void ktime_get_coarse_real_ts64(timespec64*)'
  [A] 'function void ll_rw_block(int, int, int, buffer_head**)'
  [A] 'function void lru_cache_add_file(page*)'
  [A] 'function void mark_buffer_write_io_error(buffer_head*)'
  [A] 'function void mnt_drop_write_file(file*)'
  [A] 'function unsigned long int page_cache_next_miss(address_space*, unsigned long int, unsigned long int)'
  [A] 'function unsigned long int page_cache_prev_miss(address_space*, unsigned long int, unsigned long int)'
  [A] 'function unsigned int pagevec_lookup_range_tag(pagevec*, address_space*, unsigned long int*, unsigned long int, unsigned int)'
  [A] 'function int param_set_byte(const char*, const kernel_param*)'
  [A] 'function void put_pages_list(list_head*)'
  [A] 'function int redirty_page_for_writepage(writeback_control*, page*)'
  [A] 'function void set_nlink(inode*, unsigned int)'
  [A] 'function int setattr_prepare(dentry*, iattr*)'
  [A] 'function long long unsigned int simple_strtoull(const char*, char**, unsigned int)'
  [A] 'function int sync_inode_metadata(inode*, int)'
  [A] 'function void sync_inodes_sb(super_block*)'
  [A] 'function void tag_pages_for_writeback(address_space*, unsigned long int, unsigned long int)'
  [A] 'function void truncate_setsize(inode*, loff_t)'
  [A] 'function void try_to_writeback_inodes_sb(super_block*, wb_reason)'
  [A] 'function int vfs_fsync_range(file*, long long int, long long int, int)'
  [A] 'function void wait_on_page_bit(page*, int)'
  [A] 'function void writeback_inodes_sb(super_block*, wb_reason)'

Bug: 178455529
Signed-off-by: Masaya Takahashi <masaya.a.takahashi@sony.com>
Change-Id: I39c6be26264b1eba59e3fc0ba2a086dc4f9e1baa
2021-02-18 18:43:30 +09:00
Yongqin Liu
19c89b6bbf ANDROID: GKI: update KMI for db845c with idr_alloc_u32 added
to resolve the idr_alloc_u32 symbol not found problem,
like reported as the following:
    [    9.718675] init: Loading module /lib/modules/qrtr.ko with args ""
    [    9.724987] qcom-pcie 1c08000.pci: 1c08000.pci supply vddpe-3v3 not found, using dummy regulator
    [    9.733909] qcom-pcie 1c08000.pci: host bridge /soc@0/pci@1c08000 ranges:
    [    9.741378] qrtr: Unknown symbol idr_alloc_u32 (err -2)
    [    9.746741] qcom-pcie 1c08000.pci:    IO 0x40200000..0x402fffff -> 0x40200000
    [    9.753958] qcom-pcie 1c08000.pci:   MEM 0x40300000..0x5fffffff -> 0x40300000
    [    9.784507] init: Failed to insmod '/lib/modules/qrtr.ko' with args ''
    [    9.791151] init: LoadWithAliases was unable to load /lib/modules/qrtr.ko
    [    9.798037] init: LoadWithAliases was unable to load qrtr_tun
    [    9.804055] init: Failed to load kernel modules

Add this symbol to the .xml file:

Leaf changes summary: 1 artifact changed (80 filtered out)
Changed leaf types summary: 0 (80 filtered out) leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int idr_alloc_u32(idr*, void*, unsigned int*, unsigned long int, unsigned int)'

Test: boot tested with db845c android11 build
Fixes: 4ef63e3654 ("net: qrtr: fix usage of idr in port assignment to socket")
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I62bf3ac2cccbc2fe7ca70986939ba4f593ca86a2
2021-02-17 19:18:53 +01:00
Greg Kroah-Hartman
9394e52285 Merge tag 'android11-5.4.86_r00' from 'android11-5.4-lts' into 'android11-5.4'
This merges the 5.4.86 upstream LTS release into the android11-5.4
branch so that all devices can get the needed important security and
other bugfixes that are in here.  All devices must upgrade to remain
properly secure from known issues.

Bug: 180469075
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1041e0d08d55a3eb2e0f49b7d2384960f48d9b11
2021-02-17 16:57:46 +01:00
Manaf Meethalavalappu Pallikunhi
d3c11f4ae4 ANDROID: ABI: Update allowed list for QCOM
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int clk_notifier_unregister(clk*, notifier_block*)'

Bug: 180475184
Change-Id: Ifbbdfbb67dd5582144e345d0a2fa45065d0215ba
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
2021-02-17 15:27:50 +00:00
Raviteja Tamatam
6b4f6cd53f ANDROID: ABI: update allowed list for QCOM
Update the android/abi_gki_aarch64_qcom with recent symbol additions.

No need to update the .xml file, as no new symbol addition.

Bug: 180426964
Signed-off-by: Raviteja Tamatam <travitej@codeaurora.org>
Change-Id: I301d36b0385756d6cfd5924c2655d5b728637a24
2021-02-17 10:08:51 +05:30
Xiaowen Wu
1d9c43fa3b ANDROID: ABI: Update allowed list for QCOM
Leaf changes summary: 11 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 11 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

11 Added functions:

  [A] 'function int drm_atomic_set_crtc_for_plane(drm_plane_state*, drm_crtc*)'
  [A] 'function void drm_atomic_set_fb_for_plane(drm_plane_state*, drm_framebuffer*)'
  [A] 'function void drm_connector_list_update(drm_connector*)'
  [A] 'function int drm_dp_mst_atomic_check(drm_atomic_state*)'
  [A] 'function void drm_dp_mst_dump_topology(seq_file*, drm_dp_mst_topology_mgr*)'
  [A] 'function bool drm_is_current_master(drm_file*)'
  [A] 'function drm_master* drm_master_get(drm_master*)'
  [A] 'function void drm_master_put(drm_master**)'
  [A] 'function void drm_mode_prune_invalid(drm_device*, list_head*, bool)'
  [A] 'function void drm_mode_sort(list_head*)'
  [A] 'function void drm_rect_rotate(drm_rect*, int, int, unsigned int)'

Bug: 180427255
Change-Id: I18bec99816010ff942849bf1f253b00a773a014e
Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org>
2021-02-16 16:36:56 -05:00
Andrey Konovalov
f682b4505d ANDROID: build_config: drop CONFIG_KASAN_PANIC_ON_WARN
CONFIG_KASAN_PANIC_ON_WARN was added in a custom patch for Pixel kernels,
which would make KASAN panic the kernel after the first report regardless
of whether the panic_on_warn parameter is set. (Coincidentally, that patch
also would break instrumentation mode selection for KASAN.)

As that patch was never applied to the common kernel,
CONFIG_KASAN_PANIC_ON_WARN doesn't exist here. This change drops the
non-existent CONFIG_KASAN_PANIC_ON_WARN from build.config.gki_kasan.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I9f42bb5f3515f18e2a5774241ea73a59d8883955
2021-02-15 18:29:03 +00:00
Maciej Żenczykowski
0934349866 BACKPORT: bpf: add bpf_ktime_get_boot_ns()
On a device like a cellphone which is constantly suspending
and resuming CLOCK_MONOTONIC is not particularly useful for
keeping track of or reacting to external network events.
Instead you want to use CLOCK_BOOTTIME.

Hence add bpf_ktime_get_boot_ns() as a mirror of bpf_ktime_get_ns()
based around CLOCK_BOOTTIME instead of CLOCK_MONOTONIC.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
(cherry picked from commit 71d19214776e61b33da48f7c1b46e522c7f78221)
Change-Id: Ifd62c410dcc5112fd1a473a7e1f70231ca514bc0
2021-02-12 01:58:59 -08:00
Kamal Agrawal
2d04a808c6 ANDROID: ABI: update allowed list for QCOM
Update the android/abi_gki_aarch64_qcom with recent symbol additions.

Simple change and no need to update the .xml file, as no new symbol
addition.

Bug: 179747683
Signed-off-by: Neeraja P <neerp@codeaurora.org>
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
Change-Id: I1d5252ed623f83611a5b064a8e0e33e4f0d188c5
2021-02-09 12:57:28 +05:30
Anson Huang
9533cdc100 BACKPORT: clk: composite: Export clk_hw_register_composite()
Export clk_hw_register_composite() to support user built as module.

ERROR: modpost: "clk_hw_register_composite" [drivers/clk/imx/mxc-clk.ko]
undefined!

(cherry picked from commit d7d7518fdcc8f43da69fb40073273e77f24be24f)
[Jindong: Resolved minor conflict in drivers/clk/clk-composite.c ]
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: I54496d44d4bf6599af3a3ec9c40c02556d55cf17
2021-02-05 21:39:00 +00:00
Jindong Yue
a9cae6eab7 ANDROID: PCI: dwc: Export symbols for ep driver
Several symbols in DesignWare PCI Core driver are used
to support PCIe controller work at Endpoint Mode.
Export them to support such driver built as module.

Bug: 159736148
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Change-Id: I2c77bfbfbec750ecdf21f0cd1bbb20fe339a2f0c
2021-02-03 22:20:28 +00:00
Thomas Gleixner
904fb159c9 UPSTREAM: futex: Handle faults correctly for PI futexes
commit 34b1a1ce1458f50ef27c54e28eb9b1947012907a upstream

fixup_pi_state_owner() tries to ensure that the state of the rtmutex,
pi_state and the user space value related to the PI futex are consistent
before returning to user space. In case that the user space value update
faults and the fault cannot be resolved by faulting the page in via
fault_in_user_writeable() the function returns with -EFAULT and leaves
the rtmutex and pi_state owner state inconsistent.

A subsequent futex_unlock_pi() operates on the inconsistent pi_state and
releases the rtmutex despite not owning it which can corrupt the RB tree of
the rtmutex and cause a subsequent kernel stack use after free.

It was suggested to loop forever in fixup_pi_state_owner() if the fault
cannot be resolved, but that results in runaway tasks which is especially
undesired when the problem happens due to a programming error and not due
to malice.

As the user space value cannot be fixed up, the proper solution is to make
the rtmutex and the pi_state consistent so both have the same owner. This
leaves the user space value out of sync. Any subsequent operation on the
futex will fail because the 10th rule of PI futexes (pi_state owner and
user space value are consistent) has been violated.

As a consequence this removes the inept attempts of 'fixing' the situation
in case that the current task owns the rtmutex when returning with an
unresolvable fault by unlocking the rtmutex which left pi_state::owner and
rtmutex::owner out of sync in a different and only slightly less dangerous
way.

Fixes: 1b7558e457 ("futexes: fix fault handling in futex_lock_pi")
Reported-by: gzobqq@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 34b1a1ce1458f50ef27c54e28eb9b1947012907a)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iabd44dad5d4b8385b8a20e44d18308708cc3b701
2021-01-29 13:16:10 +01:00
Thomas Gleixner
dddad86240 UPSTREAM: futex: Simplify fixup_pi_state_owner()
commit f2dac39d93987f7de1e20b3988c8685523247ae2 upstream

Too many gotos already and an upcoming fix would make it even more
unreadable.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f2dac39d93987f7de1e20b3988c8685523247ae2)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5a97587c0f696d4f4b849f7f106990a5587fa402
2021-01-29 13:16:01 +01:00
Thomas Gleixner
d245cfa173 UPSTREAM: futex: Use pi_state_update_owner() in put_pi_state()
commit 6ccc84f917d33312eb2846bd7b567639f585ad6d upstream

No point in open coding it. This way it gains the extra sanity checks.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6ccc84f917d33312eb2846bd7b567639f585ad6d)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic34513518cd4996b3eb4cb82b669d727be522597
2021-01-29 13:15:51 +01:00
Thomas Gleixner
cfe591bb90 UPSTREAM: rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
commit 2156ac1934166d6deb6cd0f6ffc4c1076ec63697 upstream

Nothing uses the argument. Remove it as preparation to use
pi_state_update_owner().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2156ac1934166d6deb6cd0f6ffc4c1076ec63697)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I126088d93c5f05db654e508dfd4195e5c1696164
2021-01-29 13:15:42 +01:00
Thomas Gleixner
a60fba3000 UPSTREAM: futex: Provide and use pi_state_update_owner()
commit c5cade200ab9a2a3be9e7f32a752c8d86b502ec7 upstream

Updating pi_state::owner is done at several places with the same
code. Provide a function for it and use that at the obvious places.

This is also a preparation for a bug fix to avoid yet another copy of the
same code or alternatively introducing a completely unpenetratable mess of
gotos.

Originally-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c5cade200ab9a2a3be9e7f32a752c8d86b502ec7)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I17a67806a035338a55b27eea673d707fc4d8c529
2021-01-29 13:15:27 +01:00
Thomas Gleixner
97500641e2 UPSTREAM: futex: Replace pointless printk in fixup_owner()
commit 04b79c55201f02ffd675e1231d731365e335c307 upstream

If that unexpected case of inconsistent arguments ever happens then the
futex state is left completely inconsistent and the printk is not really
helpful. Replace it with a warning and make the state consistent.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 04b79c55201f02ffd675e1231d731365e335c307)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I32bd64130d9414f65155ecd80646d01eb4374a60
2021-01-29 13:15:18 +01:00
Thomas Gleixner
3a0f91fd81 UPSTREAM: futex: Ensure the correct return value from futex_lock_pi()
commit 12bb3f7f1b03d5913b3f9d4236a488aa7774dfe9 upstream

In case that futex_lock_pi() was aborted by a signal or a timeout and the
task returned without acquiring the rtmutex, but is the designated owner of
the futex due to a concurrent futex_unlock_pi() fixup_owner() is invoked to
establish consistent state. In that case it invokes fixup_pi_state_owner()
which in turn tries to acquire the rtmutex again. If that succeeds then it
does not propagate this success to fixup_owner() and futex_lock_pi()
returns -EINTR or -ETIMEOUT despite having the futex locked.

Return success from fixup_pi_state_owner() in all cases where the current
task owns the rtmutex and therefore the futex and propagate it correctly
through fixup_owner(). Fixup the other callsite which does not expect a
positive return value.

Fixes: c1e2f0eaf0 ("futex: Avoid violating the 10th rule of futex")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 12bb3f7f1b03d5913b3f9d4236a488aa7774dfe9)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6dfb7407620fdf8293edbfbe54463f0c8ff63a57
2021-01-29 13:15:05 +01:00
Wang Hai
19193ef53a UPSTREAM: Revert "mm/slub: fix a memory leak in sysfs_slab_add()"
commit 757fed1d0898b893d7daa84183947c70f27632f3 upstream.

This reverts commit dde3c6b72a16c2db826f54b2d49bdea26c3534a2.

syzbot report a double-free bug. The following case can cause this bug.

 - mm/slab_common.c: create_cache(): if the __kmem_cache_create() fails,
   it does:

	out_free_cache:
		kmem_cache_free(kmem_cache, s);

 - but __kmem_cache_create() - at least for slub() - will have done

	sysfs_slab_add(s)
		-> sysfs_create_group() .. fails ..
		-> kobject_del(&s->kobj); .. which frees s ...

We can't remove the kmem_cache_free() in create_cache(), because other
error cases of __kmem_cache_create() do not free this.

So, revert the commit dde3c6b72a16 ("mm/slub: fix a memory leak in
sysfs_slab_add()") to fix this.

Reported-by: syzbot+d0bd96b4696c1ef67991@syzkaller.appspotmail.com
Fixes: dde3c6b72a16 ("mm/slub: fix a memory leak in sysfs_slab_add()")
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 757fed1d0898b893d7daa84183947c70f27632f3)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3743749e527dddde63620ac16a0db66c475ac404
2021-01-29 13:15:03 +01:00
Dan Carpenter
364ec3d27d UPSTREAM: futex: Don't enable IRQs unconditionally in put_pi_state()
commit 1e106aa3509b86738769775969822ffc1ec21bf4 upstream.

The exit_pi_state_list() function calls put_pi_state() with IRQs disabled
and is not expecting that IRQs will be enabled inside the function.

Use the _irqsave() variant so that IRQs are restored to the original state
instead of being enabled unconditionally.

Fixes: 153fbd1226 ("futex: Fix more put_pi_state() vs. exit_pi_state_list() races")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201106085205.GA1159983@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2192d905df)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I10bc011b54ffc6d66c0a499ecebfa5b2d96d58ce
2021-01-29 13:13:00 +01:00
Mike Galbraith
6f8f2dc71c UPSTREAM: futex: Handle transient "ownerless" rtmutex state correctly
commit 9f5d1c336a10c0d24e83e40b4c1b9539f7dba627 upstream.

Gratian managed to trigger the BUG_ON(!newowner) in fixup_pi_state_owner().
This is one possible chain of events leading to this:

Task Prio       Operation
T1   120	lock(F)
T2   120	lock(F)   -> blocks (top waiter)
T3   50 (RT)	lock(F)   -> boosts T1 and blocks (new top waiter)
XX   		timeout/  -> wakes T2
		signal
T1   50		unlock(F) -> wakes T3 (rtmutex->owner == NULL, waiter bit is set)
T2   120	cleanup   -> try_to_take_mutex() fails because T3 is the top waiter
     			     and the lower priority T2 cannot steal the lock.
     			  -> fixup_pi_state_owner() sees newowner == NULL -> BUG_ON()

The comment states that this is invalid and rt_mutex_real_owner() must
return a non NULL owner when the trylock failed, but in case of a queued
and woken up waiter rt_mutex_real_owner() == NULL is a valid transient
state. The higher priority waiter has simply not yet managed to take over
the rtmutex.

The BUG_ON() is therefore wrong and this is just another retry condition in
fixup_pi_state_owner().

Drop the locks, so that T3 can make progress, and then try the fixup again.

Gratian provided a great analysis, traces and a reproducer. The analysis is
to the point, but it confused the hell out of that tglx dude who had to
page in all the futex horrors again. Condensed version is above.

[ tglx: Wrote comment and changelog ]

Fixes: c1e2f0eaf0 ("futex: Avoid violating the 10th rule of futex")
Reported-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/87a6w6x7bb.fsf@ni.com
Link: https://lore.kernel.org/r/87sg9pkvf7.fsf@nanos.tec.linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2716e78a64)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9ab0878641624448cacb1951506b5accb4c92a00
2021-01-29 13:12:13 +01:00
Mateusz Nosek
4fe499637b UPSTREAM: futex: Fix incorrect should_fail_futex() handling
[ Upstream commit 921c7ebd1337d1a46783d7e15a850e12aed2eaa0 ]

If should_futex_fail() returns true in futex_wake_pi(), then the 'ret'
variable is set to -EFAULT and then immediately overwritten. So the failure
injection is non-functional.

Fix it by actually leaving the function and returning -EFAULT.

The Fixes tag is kinda blury because the initial commit which introduced
failure injection was already sloppy, but the below mentioned commit broke
it completely.

[ tglx: Massaged changelog ]

Fixes: 6b4f4bc9cb ("locking/futex: Allow low-level atomic operations to return -EAGAIN")
Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200927000858.24219-1-mateusznosek0@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2db7590371)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I22198b7a65630cb5649f3e889810783b147bfada
2021-01-29 13:12:05 +01:00
Todd Kjos
52fd679fec ANDROID: add macros to create OEM data fields
Adds ANDROID_OEM_DATA and ANDROID_OEM_DATA_ARRAY macros
to add OEM-specific fields to kernel data structures
to enable value-added features implemented in vendor modules.
Fields defined with these macros must not be used by
SoC vendors who must use the ANDROID_VENDOR_DATA* macros
to add vendor fields.

Bug: 156285741
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I93a8a182a17854cc4f0a86835e833bf9b00ea0b8
2021-01-27 09:43:29 +00:00
Robin Murphy
c6617edf72 BACKPORT: arm64: perf: Support new DT compatibles
Add support for matching the new PMUs. For now, this just wires them up
as generic PMUv3 such that people writing DTs for new SoCs can do the
right thing, and at least have architectural and raw events be usable.
We can come back and fill in event maps for sysfs and/or perf tools at
a later date.

Change-Id: I0c0839f6fff87934e97708176f783514bdee7f58
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 29cc4ceeac1274ab8363a11b81ebd99f3b023985
 git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-next/perf)

Bug: 176519087
Link: https://lore.kernel.org/linux-arm-kernel/20200225190125.GA2781@bogus/T/#mdaa003324f263cc9541d412f7ba6b9519d6603fe
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Change-Id: I335d4c9a9bfcfcfeb18b096cfe660209d3b62820
2021-01-27 08:48:28 +00:00
Ikjoon Jang
b227e97836 UPSTREAM: usb: xhci-mtk: fix unreleased bandwidth data
xhci-mtk needs XHCI_MTK_HOST quirk functions in add_endpoint() and
drop_endpoint() to handle its own sw bandwidth management.

It stores bandwidth data into an internal table every time
add_endpoint() is called, and drops those in drop_endpoint().
But when bandwidth allocation fails at one endpoint, all earlier
allocation from the same interface could still remain at the table.

This patch moves bandwidth management codes to check_bandwidth() and
reset_bandwidth() path. To do so, this patch also adds those functions
to xhci_driver_overrides and lets mtk-xhci to release all failed
endpoints in reset_bandwidth() path.

Fixes: 08e469de87 ("usb: xhci-mtk: supports bandwidth scheduling with multi-TT")
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Link: https://lore.kernel.org/r/20210113180444.v6.1.Id0d31b5f3ddf5e734d2ab11161ac5821921b1e1e@changeid
Cc: stable <stable@vger.kernel.org>
(cherry picked from commit 1d69f9d901ef14d81c3b004e3282b8cc7b456280
  https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I211875090c3b8080292a415fdb182fd4b8ac9729
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2021-01-26 18:23:27 +01:00
Yun Hsiang
b7f31af2f1 ANDROID: sched: add em_pd_energy vendor hook
We add a vendor hook for util to freq calculation in schedutil,
so we need to do corresponding change for energy calculation.

android_vh_em_pd_energy
	adjust energy calculation

Bug: 178021064

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: Iae772cf07881602eea3f27aeb75fba753e7c2635
2021-01-21 10:32:49 +08:00
Yun Hsiang
68ecddcda8 ANDROID: schedutil: add vendor hook for adjusting util to freq calculation
Currently, the frequency is calculated by max freq * 1.25 * util / max cap.
Add a vendor hook to adjust the frequency when the calculation
overestimate.

android_vh_map_util_freq
	adjust util to freq calculation

Bug: 177845438

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I9aa9079f00af7d3380b19f2fe21b75cddd107d15
2021-01-19 19:02:47 +00:00
jian.gong
247d907f7b ANDROID: ABI: update symbols of unisoc whitelist
Update whitelist for the symbols used by the unisoc device and
update the ABI representation accordingly

Leaf changes summary: 0 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

Bug: 175337500
Change-Id: I2efd0a7074ddcb0a4f48564e7df0d8a1a7fd5ca9
Signed-off-by: jian.gong <jian.gong@unisoc.com>
2021-01-19 08:13:45 +00:00
Quentin Perret
1a955566df Revert "BACKPORT: FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once"
This reverts commit fd0edef76b.

Reason for revert: Breaks CTS

Change-Id: I6d04bbe3bf119971b855a874acd374df911fb971
Signed-off-by: Quentin Perret <qperret@google.com>
2021-01-18 16:25:18 +00:00
Peter Collingbourne
fd0edef76b BACKPORT: FROMGIT: mm: improve mprotect(R|W) efficiency on pages referenced once
In the Scudo memory allocator [1] we would like to be able to detect
use-after-free vulnerabilities involving large allocations by issuing
mprotect(PROT_NONE) on the memory region used for the allocation when it
is deallocated.  Later on, after the memory region has been "quarantined"
for a sufficient period of time we would like to be able to use it for
another allocation by issuing mprotect(PROT_READ|PROT_WRITE).

Before this patch, after removing the write protection, any writes to the
memory region would result in page faults and entering the copy-on-write
code path, even in the usual case where the pages are only referenced by a
single PTE, harming performance unnecessarily.  Make it so that any pages
in anonymous mappings that are only referenced by a single PTE are
immediately made writable during the mprotect so that we can avoid the
page faults.

This program shows the critical syscall sequence that we intend to use in
the allocator:

  #include <string.h>
  #include <sys/mman.h>

  enum { kSize = 131072 };

  int main(int argc, char **argv) {
    char *addr = (char *)mmap(0, kSize, PROT_READ | PROT_WRITE,
                              MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
    for (int i = 0; i != 100000; ++i) {
      memset(addr, i, kSize);
      mprotect((void *)addr, kSize, PROT_NONE);
      mprotect((void *)addr, kSize, PROT_READ | PROT_WRITE);
    }
  }

The effect of this patch on the above program was measured on a
DragonBoard 845c by taking the median real time execution time of 10 runs.

Before: 3.19s
After:  0.79s

The effect was also measured using one of the microbenchmarks that
we normally use to benchmark the allocator [2], after modifying it
to make the appropriate mprotect calls [3]. With an allocation size
of 131072 bytes to trigger the allocator's "large allocation" code
path the per-iteration time was measured as follows:

Before: 33364ns
After:   6886ns

This patch means that we do more work during the mprotect call itself
in exchange for less work when the pages are accessed. In the worst
case, the pages are not accessed at all. The effect of this patch in
such cases was measured using the following program:

  #include <string.h>
  #include <sys/mman.h>

  enum { kSize = 131072 };

  int main(int argc, char **argv) {
    char *addr = (char *)mmap(0, kSize, PROT_READ | PROT_WRITE,
                              MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
    memset(addr, 1, kSize);
    for (int i = 0; i != 100000; ++i) {
  #ifdef PAGE_FAULT
      memset(addr + (i * 4096) % kSize, i, 4096);
  #endif
      mprotect((void *)addr, kSize, PROT_NONE);
      mprotect((void *)addr, kSize, PROT_READ | PROT_WRITE);
    }
  }

With PAGE_FAULT undefined (0 pages touched after removing write
protection) the median real time execution time of 100 runs was measured
as follows:

Before: 0.325928s
After:  0.365493s

With PAGE_FAULT defined (1 page touched) the measurements were
as follows:

Before: 0.441516s
After:  0.380251s

So it seems that even with a single page fault the new approach is faster.

I saw similar results if I adjusted the programs to use a larger mapping
size.  With kSize = 1048576 I get these numbers with PAGE_FAULT undefined:

Before: 1.563078s
After:  1.607476s

i.e. around 3%.

And these with PAGE_FAULT defined:

Before: 1.684663s
After:  1.683272s

i.e. about the same.

What I think we may conclude from these results is that for smaller
mappings the advantage of the previous approach, although measurable, is
wiped out by a single page fault.  I think we may expect that there should
be at least one access resulting in a page fault (under the previous
approach) after making the pages writable, since the program presumably
made the pages writable for a reason.

For larger mappings we may guesstimate that the new approach wins if the
density of future page faults is > 0.4%.  But for the mappings that are
large enough for density to matter (not just the absolute number of page
faults) it doesn't seem like the increase in mprotect latency would be
very large relative to the total mprotect execution time.

Link: https://lkml.kernel.org/r/20201230004134.1185017-1-pcc@google.com
Link: https://linux-review.googlesource.com/id/I98d75ef90e20330c578871c87494d64b1df3f1b8
Link: [1] https://source.android.com/devices/tech/debug/scudo
Link: [2] https://cs.android.com/android/platform/superproject/+/master:bionic/benchmarks/stdlib_benchmark.cpp;l=53;drc=e8693e78711e8f45ccd2b610e4dbe0b94d551cc9
Link: [3] https://github.com/pcc/llvm-project/commit/scudo-mprotect-secondary
Signed-off-by: Peter Collingbourne <pcc@google.com>
[pcc: resolved minor conflict]
Cc: Kostya Kortchinsky <kostyak@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
(cherry picked from commit 2a9e75c907fa2de626d77dd4051fc038f0dbaf52
 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm)
Bug: 135772972
Change-Id: I98d75ef90e20330c578871c87494d64b1df3f1b8
2021-01-14 22:08:03 +00:00
Todd Kjos
fec1dfacf2 ANDROID: simplify vendor hooks for non-GKI builds
Vendor hooks required explicitly defining macros or inline functions
to handle the non-GKI build case (!CONFIG_ANDROID_VENDOR_HOOKS). Added
support for generating them automatically so the macros are no longer
required.

Both models are now supported so we can transition.

Bug: 177416721
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I01acc389d315a5d509b0c48116854342a42e1058
2021-01-14 11:05:22 -08:00
Masaya Takahashi
5327444e83 ANDROID: GKI: Add Sony KMI symbol list
add initial abi_gki_aarch64_sony file.

Leaf changes summary: 5 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 5 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

5 Added functions:

  [A] 'function gpio_desc* devm_gpiod_get_from_of_node(device*, device_node*, const char*, int, gpiod_flags, const char*)'
  [A] 'function void devm_gpiod_unhinge(device*, gpio_desc*)'
  [A] 'function const char* devm_kstrdup_const(device*, const char*, gfp_t)'
  [A] 'function void led_trigger_blink_oneshot(led_trigger*, unsigned long int*, unsigned long int*, int)'
  [A] 'function int request_any_context_irq(unsigned int, irq_handler_t, unsigned long int, const char*, void*)'

Bug: 176874947
Change-Id: Ic17a468ed326e94263e636df6ca75b2fbcced7f6
Signed-off-by: Masaya Takahashi <masaya.a.takahashi@sony.com>
2021-01-08 10:14:50 +09:00
Greg Kroah-Hartman
c9251a891e Merge branch 'android11-5.4' into 'android11-5.4-lts'
Sync up with android11-5.4 for the following commits:

158eae7173 ANDROID: ABI: update symbols of unisoc whitelist
39327dc306 ANDROID: usb: f_accessory: Don't drop NULL reference in acc_disconnect()
e0ea2cf766 ANDROID: usb: f_accessory: Avoid bitfields for shared variables
13dd1a33bc ANDROID: usb: f_accessory: Cancel any pending work before teardown
f0e78b6595 ANDROID: usb: f_accessory: Don't corrupt global state on double registration
7f7a5de5ec ANDROID: usb: f_accessory: Fix teardown ordering in acc_release()
cfe6761167 ANDROID: usb: f_accessory: Add refcounting to global 'acc_dev'
62adf8c605 ANDROID: usb: f_accessory: Wrap '_acc_dev' in get()/put() accessors
21d2a9d7c7 ANDROID: usb: f_accessory: Remove useless assignment
82262d09f1 ANDROID: usb: f_accessory: Remove useless non-debug prints
4df304a4df ANDROID: usb: f_accessory: Remove stale comments
a917582672 ANDROID: USB: f_accessory: Check dev pointer before decoding ctrl request
d61ede24cb ANDROID: Update abi_gki_aarch64_goldfish
c29fbd7cd7 UPSTREAM: driver core: Fix lockdep warning on wfs_lock
f85485b301 ANDROID: ABI: update allowed list for galaxy
a9911f2a9a UPSTREAM: arm64: pgtable: Fix pte_accessible()

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5eb6af3d9ed47b740851a586cd34535ab51482c8
2021-01-06 14:57:15 +01:00
jian.gong
158eae7173 ANDROID: ABI: update symbols of unisoc whitelist
Update whitelist for the symbols used by the unisoc device and
updates the ABI representation accordingly

Leaf changes summary: 11 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 10 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

10 Added functions:

  [A] 'function void clocks_calc_mult_shift(unsigned int*, unsigned int*, unsigned int, unsigned int, unsigned int)'
  [A] 'function void cpufreq_add_update_util_hook(int, update_util_data*, void (update_util_data*, typedef u64, unsigned int)*)'
  [A] 'function void cpufreq_remove_update_util_hook(int)'
  [A] 'function kobject* get_governor_parent_kobj(cpufreq_policy*)'
  [A] 'function void gov_attr_set_get(gov_attr_set*, list_head*)'
  [A] 'function void gov_attr_set_init(gov_attr_set*, list_head*)'
  [A] 'function unsigned int gov_attr_set_put(gov_attr_set*, list_head*)'
  [A] 'function bool have_governor_per_policy()'
  [A] 'function void irq_work_sync(irq_work*)'
  [A] 'function mbox_chan* mbox_request_channel_byname(mbox_client*, const char*)'

1 Added variable:

  [A] 'const sysfs_ops governor_sysfs_ops'

Bug: 175337500
Change-Id: Ibca2d9ef71b8f91e0ea62de4509f75ee902d30a4
Signed-off-by: jian.gong <jian.gong@unisoc.com>
2021-01-06 12:28:24 +00:00
Will Deacon
39327dc306 ANDROID: usb: f_accessory: Don't drop NULL reference in acc_disconnect()
If get_acc_dev() fails to obtain a reference to the current device,
acc_disconnect() will attempt to put_acc_dev() with the resulting NULL
pointer, leading to a crash:

 | Unable to handle kernel NULL pointer dereference at virtual address 00000074
 | [...]
 | [<c0abb288>] (acc_disconnect) from [<c0a91a38>] (android_disconnect+0x1c/0x7c)
 | [<c0a91a38>] (android_disconnect) from [<c0a93958>] (usb_gadget_udc_reset+0x10/0x34)
 | [<c0a93958>] (usb_gadget_udc_reset) from [<c0a4a9c4>] (dwc3_gadget_reset_interrupt+0x88/0x4fc)
 | [<c0a4a9c4>] (dwc3_gadget_reset_interrupt) from [<c0a491f8>] (dwc3_process_event_buf+0x60/0x3e4)
 | [<c0a491f8>] (dwc3_process_event_buf) from [<c0a49180>] (dwc3_thread_interrupt+0x24/0x3c)
 | [<c0a49180>] (dwc3_thread_interrupt) from [<c02b3404>] (irq_thread_fn+0x1c/0x58)
 | [<c02b3404>] (irq_thread_fn) from [<c02b326c>] (irq_thread+0x1ec/0x2f4)
 | [<c02b326c>] (irq_thread) from [<c0260804>] (kthread+0x1a8/0x1ac)
 | [<c0260804>] (kthread) from [<c0200138>] (ret_from_fork+0x14/0x3c)

Follow the pattern used elsewhere, and return early if we fail to obtain
a reference.

Bug: 173789633
Reported-by: YongQin Liu <yongqin.liu@linaro.org>
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I37a2bff5bc1b6b8269788d08191181763bf0e896
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-01-06 09:21:17 +00:00
Will Deacon
e0ea2cf766 ANDROID: usb: f_accessory: Avoid bitfields for shared variables
Using bitfields for shared variables is a "bad idea", as they require
a non-atomic read-modify-write to be generated by the compiler, which can
cause updates to unrelated bits in the same word to disappear.

Ensure the 'online' and 'disconnected' members of 'struct acc_dev' are
placed in separate variables by declaring them each as 'int'.

Bug: 173789633
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ia6031d82a764e83b2cc3502fbe5fb273511da752
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-01-06 09:21:17 +00:00
Will Deacon
13dd1a33bc ANDROID: usb: f_accessory: Cancel any pending work before teardown
Tearing down and freeing the 'acc_dev' structure when there is
potentially asynchronous work queued involving its member fields is
likely to lead to use-after-free issues.

Cancel any pending work before freeing the structure.

Bug: 173789633
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I68a91274aea18034637b738d558d043ac74fadf4
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-01-06 09:21:17 +00:00
Will Deacon
f0e78b6595 ANDROID: usb: f_accessory: Don't corrupt global state on double registration
If acc_setup() is called when there is already an allocated instance,
misc_register() will fail but the error path leaves a dangling pointer
to freed memory in the global 'acc_dev' state.

Fix this by ensuring that the refcount is zero before we start, and then
using a cmpxchg() from NULL to serialise any concurrent initialisers.

Bug: 173789633
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I2c26289dcce7dbc493964516c49b05d04aaa6839
Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-01-06 09:21:17 +00:00