Commit Graph

355 Commits

Author SHA1 Message Date
Sarah Chin
bb7c1788d1
msm8974-common: libril: Fix OOB vulnerability in setGsm/CdmaSmsBroadcastConfigInfo
Error if length > 25

Test: lunch cf_x86_phone-userdebug && mm
Bug: 144046782
Change-Id: I18f9745174762a52fc20bfc7273c6b3fd2118da5
2020-11-27 17:14:35 -07:00
terrycrhuang
725f9e8f33
msm8974-common: libril: Encode MCC with 3 digit in CellIdentity
Bug: 145809537
Test: ril::util::mcc::test

Change-Id: Ie0b9d0a56530cc7a2146e9955d392867634d2b8b
2020-11-27 17:14:35 -07:00
Taesu Lee
4f09b93962
msm8974-common: libril: Fix typo
Test: build

Change-Id: I729888834881386d52f072e0444d50b480f85928
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
2020-11-27 17:14:35 -07:00
Elliott Hughes
8a32750c24
msm8974-common: libril: Remove unused includes.
Test: treehugger
Change-Id: Id6ee53aa0e2a83ef40ce9219092f8a0f519b3471
2020-11-27 17:14:34 -07:00
Lucchetto
a968e9600c
msm8974-common: Adapt libinit to Android 11
Change-Id: Ia6b6f753891b639dad4e380bdba6b594faf2a550
2020-11-27 17:14:34 -07:00
Steven Moreland
72fb75e332
msm8974-common: Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Iba2cd20b8b20fac3e7564de6b853b475fd4ebd2a
2020-10-29 15:43:06 -06:00
Wang Han
b9a1d97191
msm8974-common: Switch to TimeKeep
* SE policies are imported and modified from
   https://github.com/sonyxperiadev/device-sony-sepolicy.
   Modifications are needed because qcom legacy policy
   contains conflicting labels and rules.

Change-Id: Id04a824dea69976f6fc9d48bef77859cc82971ed
2020-09-07 05:28:51 -06:00
Kevin F. Haggerty
5e12cb3926
msm8974-common: Commonize libtime_genoff.so
Change-Id: Ie63e6864de5ae66e7058f140170f6081317690a7
2020-09-07 04:14:32 -06:00
Kevin F. Haggerty
16a190dd28
msm8974-common: sepolicy: Allow system_app to access storaged via IPC
avc: denied { call } for comm=4173796E635461736B202333
scontext=u:r:system_app:s0 tcontext=u:r:storaged:s0 tclass=binder
permissive=t0

Change-Id: I933dcebf2f5960d639ce47be379f62636e4ddd69
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
9f313b3cee
msm8974-common: sepolicy: Allow system_app to access wificond via IPC
avc: denied { call } for comm=4173796E635461736B202334
scontext=u:r:system_app:s0 tcontext=u:r:wificond:s0 tclass=binder
permissive=0

Change-Id: I5fed7bfa2362bce7fa26d22618b2584a145f5385
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
b17d75621e
msm8974-common: sepolicy: Allow mediaswcodec to use binder IPC
Change-Id: I866c7b0843cd0e64f9f0f2e743b571c87281b086
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
8326e1562c
msm8974-common: sepolicy: Allow system_app to read /proc/pagetypeinfo
avc: denied { read } for name="pagetypeinfo" dev="proc" ino=4026543033
scontext=u:r:system_app:s0 tcontext=u:object_r:proc_pagetypeinfo:s0
tclass=file permissive=0

Change-Id: I16465eb9acca9ff64a755d47f86f4ff424ebe4de
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
5404fa9536
msm8974-common: sepolicy: Quiet system_app attempts to find disallowed services
Change-Id: I6a17bef88c3b9fe9f075dc0ef3de5e203f5d9ce3
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
d6e781307f
msm8974-common: sepolicy: Quiet priv_app opening sysfs_android_usb files
* Reading these is disallowed globally, no need to see logspam of
  open attempts

Change-Id: I4c0094097d39456c65720cbdfb949d14439ce5f4
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
3377f79b53
msm8974-common: sepolicy: Allow system_app to access zram sysfs nodes
avc: denied { search } for name="zram0" dev="sysfs" ino=20744
scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir
permissive=0

avc: denied { open } for name="mem_used_total" dev="sysfs" ino=20804
scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file
permissive=0

avc: denied { read } for name="mem_used_total" dev="sysfs" ino=20804
scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file
permissive=0

Change-Id: Ide9b1a9488b26fa69e7a2c8e73a8e657c8b28beb
2020-09-06 04:12:10 -06:00
Kevin F. Haggerty
a586ba7d50
msm8974-common: sepolicy: Quiet vold finding the bootctl hwservice
* We don't have this

Change-Id: I879f9b30e94c153dfec30ef369ae0ca31e3ab3d7
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
135f55810f
msm8974-common: sepolicy: Quiet zygote reading cmdline
Change-Id: I3fad2a7a3a7e2200453fd40ef325a9f98bce5506
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
39c71a0276
msm8974-common: sepolicy: Allow platform_app to getattr radio_data_file
avc: denied { getattr } for path="/data/user_de/0/com.android.phone"
dev="dm-0" ino=1545357 scontext=u:r:platform_app:s0:c512,c768
tcontext=u:object_r:radio_data_file:s0 tclass=dir permissive=0
app=com.android.systemui

Change-Id: I74744dde2a3af01a4f30e0898889cad13f95d563
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
98dd537e3c
msm8974-common: sepolicy: Allow the BT HAL to read /efs
avc: denied { search } for name="/" dev="mmcblk0p11" ino=2
scontext=u:r:hal_bluetooth_default:s0 tcontext=u:object_r:efs_file:s0
tclass=dir permissive=0

Change-Id: I1a8abfb3d02c5cb3c63c93ff20a2974ff70ecb87
2020-09-06 04:12:09 -06:00
Arne Coucheron
8462d2ec5b
msm8974-common: sepolicy: Allow ueventd to set sys_nice capability
avc: denied { sys_nice } for capability=23 scontext=u:r:ueventd:s0 tcontext=u:r:ueventd:s0 tclass=capability permissive=0

Change-Id: Icfa56283a9b4c67456bd4e714aa3922fece59436
2020-09-06 04:12:09 -06:00
Arne Coucheron
66dcc79709
msm8974-common: sepolicy: Allow gpuservice to read opengles_prop
avc: denied { read } for name="u:object_r:opengles_prop:s0" dev="tmpfs" ino=6353 scontext=u:r:gpuservice:s0 tcontext=u:object_r:opengles_prop:s0 tclass=file permissive=0

Change-Id: I455c5d681e301451ad11210e91d0a71b4b80239a
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
065046fd6d
msm8974-common: sepolicy: Allow fsck_untrusted appropriate access to sysfs_dm
avc: denied { search } for name="dm-0" dev="sysfs" ino=33209
scontext=u:r:fsck_untrusted:s0 tcontext=u:object_r:sysfs_dm:s0
tclass=dir permissive=0

avc: denied { read } for name="name" dev="sysfs" ino=33374
scontext=u:r:fsck_untrusted:s0 tcontext=u:object_r:sysfs_dm:s0
tclass=file permissive=0

Change-Id: I38d74974d23f94ddac4c45f1d5470288d4ee8a6f
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
7bfaa1d75f
msm8974-common: sepolicy: Allow ioctls necessary for physical sdcard operations
* Note: 0x1271 is note defined in system/sepolicy/public/ioctl_defines

avc: denied { ioctl } for path="/dev/block/vold/public:179,65"
dev="tmpfs" ino=19222 ioctlcmd=125e scontext=u:r:vold:s0
tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

avc: denied { ioctl } for path="/dev/block/vold/public:179,65"
dev="tmpfs" ino=20176 ioctlcmd=1271 scontext=u:r:vold:s0
tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

avc: denied { ioctl } for path="/dev/block/vold/public:179,65"
dev="tmpfs" ino=27110 ioctlcmd=125e scontext=u:r:fsck_untrusted:s0
tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

avc: denied { ioctl } for path="/dev/block/vold/public:179,65"
dev="tmpfs" ino=27110 ioctlcmd=1271 scontext=u:r:fsck_untrusted:s0
tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

Change-Id: I7bf2346b9517196160e4dde51baa550fb343bfdf
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
61d3a4eafa
msm8974-common: sepolicy: Allow untrusted fsck to getattr block_device dirs
avc: denied { getattr } for path="/dev/block" dev="tmpfs" ino=6914
scontext=u:r:fsck_untrusted:s0 tcontext=u:object_r:block_device:s0
tclass=dir permissive=0

Change-Id: I03c1086a21edba4e193f81b473e6785aac890364
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
631007d58c
msm8974-common: sepolicy: Update for move of init.{qcom,target}.rc to /vendor
Change-Id: Ic0042ed52e7aeb3faba856411fd0a1b298446125
2020-09-06 04:12:09 -06:00
Kevin F. Haggerty
d9fdcde7d2
Revert "msm8974-common: Make the external camera provider ignore internal cameras"
* Even though camera.device@3.4-external-impl still will look for the
  file, this is seemingly no longer required in Q due to changes
  elsewhere in the stack.

This reverts commit cf207232cb.

Change-Id: Ibd19f4d7abeafb7f4d8af1ca6226d6065058538c
2020-09-06 04:12:07 -06:00
Marc Bourgoin
85c6a473c4
msm8974-common: Symlink bootdevice for Lineage Recovery
* It is needed by OpenGApps install script.

Change-Id: Idb90a6ecaae541e74a9878c1ca93459cc2fdd949
2020-09-02 04:07:16 -06:00
Kevin F. Haggerty
c85904857b
Merge branch 'lineage-16.0' of http://www.github.com/LineageOS/android_device_samsung_msm8974-common into lineage-17.1
* 'lineage-16.0' of http://www.github.com/LineageOS/android_device_samsung_msm8974-common:
  msm8974-common: Build common legacy gnss hal
  msm8974-common: Switch to GNSS HIDL HAL
  msm8974-common: gps: Fix for buffer overrun crash at copying nmea string
  msm8974-common: gps: Replacing copy headers with header libraries
  msm8974-common: gps: Don't rely on transitively included headers
  msm8974-common: gps: Remove nmea log
  msm8974-common: gps: Return the correct length of nmea sentence
  msm8974-common: gps: Default apn ip type to ipv4
  msm8974-common: gps: Suppress unused-parameter warnings
  msm8974-common: gps: Remove owner of gps hal modules

Change-Id: I910806396d54c33727ef3b807404d71786aa74e6
2020-06-28 08:57:55 -06:00
Arne Coucheron
d7a9d16a0f
msm8974-common: Build common legacy gnss hal
Change-Id: I56095b9c3bba065779c90b6aeb61ebfed6af7e77
2020-06-27 16:45:22 -06:00
Kevin F. Haggerty
8e016489ce
msm8974-common: Switch to GNSS HIDL HAL
Change-Id: I881206bed97e700d0022080ec5785fa3756c39bd
2020-06-27 16:44:17 -06:00
Katz Yamada
b3094b1fb9
msm8974-common: gps: Fix for buffer overrun crash at copying nmea string
Add zero clearing of allocated nmea buffer to ensure
the nmea string is null terminated.

Change-Id: Ie36010a7d3eca16dabb3067ae891a94e4b63b10c
CRs-Fixed: 2041933
2020-06-26 18:45:34 -06:00
Vijay Venkatraman
98f5543b46
msm8974-common: gps: Replacing copy headers with header libraries
Bug: 33241851
Test: Build target and pass CTS location tests
Change-Id: I75db5e6de3c4194a6a46e0d37fcd899ea1d1db04
2020-06-26 18:33:09 -06:00
Jiyong Park
2d0c543adb
msm8974-common: gps: Don't rely on transitively included headers
One must explicitly include what it need.
time.h for struct tm.

Bug: 37629934
Test: build

Merged-In: Iacd5317d958f61df062fca40fbf2e8992c7fbb44
Change-Id: I19e1043f23dbe85836b73714a4f1440159ebe419
2020-06-26 18:33:09 -06:00
Dante Russo
1647e1d120
msm8974-common: gps: Remove nmea log
Nmea log print is removed, as it can be
excessive during gps tracking.

Bugs: 29499503 29272976
Change-Id: Ia60295207b6bbbcb24bbede4f1802c0c7a2f2544
2020-06-26 18:33:09 -06:00
Dante Russo
9af0ec4c51
msm8974-common: gps: Return the correct length of nmea sentence
Return the correct length of nmea sentence in the
function loc_eng_nmea_put_checksum(). The correct
length is length of NMEA string including ‘$’
character alongwith length of checksum.

CRs-Fixed: 1020044
Change-Id: I50d80b9c4492de4664bb3ccb7295b0eb4fee15a9
2020-06-26 18:33:09 -06:00
Dante Russo
8483bcb6c9
msm8974-common: gps: Default apn ip type to ipv4
If a apn ip type is not found for a agps
data connection, default to using ipv4
instead of invalid.

CRs-fixed: 1007417

Bug: 28986221

Change-Id: Icc71de1fab3fd5967901c39a5c11eaea17b7766c
Signed-off-by: D. Andrei Măceș <Andrei.Maces@alumni.nd.edu>
2020-06-26 18:33:09 -06:00
Aurimas Liutikas
9f30bd7912
msm8974-common: gps: Suppress unused-parameter warnings
Bug: 26936282
Change-Id: I7fdf58d232a59c0ba0d5f52c0f958f6eab0c4514
2020-06-26 18:33:09 -06:00
Dante Russo
0830f02f9e
msm8974-common: gps: Remove owner of gps hal modules
Owner does not need to be specified for
this project.

Change-Id: I918a767ed3b83e134c5e63ded5b25070b3399ac8
2020-06-26 18:23:52 -06:00
Gary Jian
1f78746f18
msm8974-common: libril: Add RIL_UNSOL_KEEPALIVE_STATUS in ril_unsol_commands.h
Bug: 134048171
Test: 1. Build Pass
      2. Running atest android.net.cts.ConnectivityManagerTest
         #testSocketKeepaliveLimitTelephony and make sure the
         Telephony FWK can receive RIL_UNSOL_KEEPALIVE_STATUS.

Change-Id: I98f8d4a95a6c9c3c078a02aa9fd8722779623f12
2020-06-26 18:11:46 -06:00
Yu Shan
5c0cc31e7c
msm8974-common: libril: Use 32BIT nanopb library.
Test: None
Bug: 122292884
[haggertk: This is only the libril side of this change. We quite
 obviously do not carry our own librilutils]

Change-Id: Idb0d56749e41aa97a760dfed5246330041c3da3a
2020-06-26 18:11:46 -06:00
Gohulan Balachandran
672b247a16
msm8974-common: libril: Handle MCC/MNC in data registration state provided by legacy vendor RILs
Include MCC/MNC provided by legacy (versions 14 and older) vendor RIL
implementations as part of data registration state, in data registration
state reported to clients of the radio HAL service.

Bug: 119904357
Test: local build and did the local test on Marlin device,
      the mcc/mnc value are correct (not -1 and empty string value).

[haggertk: This purposely omits updating the numStrings check in
 getDataRegistrationStateResponse(), given that we purposely changed
 that check in our libril]

Change-Id: I5a26939402b86d889133e16f3508ab76b8bedddc
2020-06-26 18:11:46 -06:00
Tim Lin
1878e1f3b3
msm8974-common: libril: set initial value to GW timingAdvance
RIL_SignalStrength_v10 not support gw.timingAdvance. But default 0 will
be taken as valid value. Set to INT_MAX as invalid value.

Bug: 123096279
Test: Build pass. Correct value for GW timingAdvance in radio log.
01-22 16:22:41.150  1779  1910 V RILJ    : [UNSL]< UNSOL_SIGNAL_STRENGTH
SignalStrength:{ mGsm=CellSignalStrengthGsm: rssi=2147483647 ber=99 mTa=2147483647

[haggertk: Upstream commit updated to patch both
 convertRilSignalStrengthToHalV8 and convertRilSignalStrengthToHalV10,
 as the upstream libril only has a single convertRilSignalStrengthToHal]

Change-Id: I37cc2c246d045a07ffad863fb0cc852d8184c3ca
2020-06-26 18:11:46 -06:00
Ryuto Sawada
1dbd1b2145
msm8974-common: libril: The index value shall be -1 if there is no relevant application
The index value for GSM/CDMA/IMS application shall be -1 if there is no
relevant application according to the comment written for CardStatus
structure in radio/types.hal, so it shall be initialized to -1.

Bug: 63967442
Test: Confirm that the index values are correctly initialized.

Change-Id: I692e9049145d0f0c3c57879c25d0697879c76b39
2020-06-26 18:11:46 -06:00
Ashit Sood
0902dcd5a7
msm8974-common: libril: Replace strncpy with strlcpy.
Use strlcpy instead of strncpy when copying strings to make sure
the copy is always null-terminated.

Bug:73436938

[haggertk: Our original CAF base had the actual "replace strncpy
 with strlcpy" part of this change already. This just adds the
 expected sendErrorResponse()]

Change-Id: I12d4883c22a180e2136dc8c85bc0394ddcdcb706
2020-06-26 18:11:45 -06:00
Nathan Harold
e11fb2c255
msm8974-common: libril: Encode the Number of MNC Digits in CellIdentity
Legacy RIL uses an integer to encode the number of
MNC digits. Because the size is not fixed, leading
zeroes result in ambiguity in the length of the mnc.

This change adds support for passing the number of
encoded digits in the most-significant nibble of the
mnc integer (which is only 10 bits). Thus, on any
implementation that is 16-bits or wider, the mnc info
will be properly encoded and decoded with the
correctly-sized string.

Bug: 111971808
Test: ril::util::mnc::test
Change-Id: I24aeba5328a63f80b0d6b25b068bd19160191dff
2020-06-26 18:11:45 -06:00
Arne Coucheron
7f220cbdb2
msm8974-common: Build common legacy gnss hal
Change-Id: I56095b9c3bba065779c90b6aeb61ebfed6af7e77
2020-06-26 18:07:43 -06:00
Kevin F. Haggerty
7cae0f93e6
Merge branch 'lineage-16.0' of http://www.github.com/LineageOS/android_device_samsung_msm8974-common into lineage-17.1
* 'lineage-16.0' of http://www.github.com/LineageOS/android_device_samsung_msm8974-common:
  msm8974-common: gps: Correct week rollover timestamps
  msm8974-common: gps: Fix race condition when GPS app is closed around an SSR event
  msm8974-common: gps: Adding fix for KW warning
  msm8974-common: gps: Assure event mask is set properly to get positions
  msm8974-common: gps: Fix unable to clear existing event bitmasks
  msm8974-common: gps: Add tech_mask in UlpLocation to support report
  msm8974-common: gps: NMEA report indication to ULP
  msm8974-common: gps: Making SUPL ES run time configurable
  msm8974-common: gps: Fixes SUPL_MODE
  msm8974-common: gps: Consider nsec while ranking the timer objects
  msm8974-common: gps: Adding a new NMEA sentence : $GNGSA.
  msm8974-common: gps: Set correct target for msm baseband
  msm8974-common: gps: Add Cleanstep.mk

Change-Id: Ibfdb99e86d3bc3829b565ee8732a7a399ff27915
2020-06-26 18:06:01 -06:00
jlask
b5d2115316
msm8974-common: gps: Correct week rollover timestamps
This adjustment will help with applications checking the time coming from gps.
Some applictions will consider times in the far past as an error.

Change-Id: I69d6971249c4898ac3895f725e46f268cdb2b00d
2020-06-26 09:50:03 -06:00
Harikrishnan Hariharan
2a42d86692
msm8974-common: gps: Fix race condition when GPS app is closed around an SSR event
Fix race condition to get avoid stuck in modem if GPS application
is closed right around a SSR event.This fix will prevent resume the
session once HAL loc_stop has been called.

Change-Id: I4e5c3f09c097b835d8a685a8b465eb86dd06cd7a
CRs-Fixed: 1058559
2020-06-26 09:50:03 -06:00
Saurabh Srivastava
6b9221934a
msm8974-common: gps: Adding fix for KW warning
Fix for buffer overflow possibility for the thread name passed in to
pthread_setname_np() method.

Change-Id: Id323dd058eddcf50d6fd9ec8908e9997b30c561b
CRs-Fixed: 999457
2020-06-26 09:50:03 -06:00