Merge tag 'AUDIO.LA.8.0.r1-10100-KAILUA.0' into staging/lineage-21.0_merge-AUDIO.LA.8.0.r1-10100-KAILUA.0
AUDIO.LA.8.0.r1-10100-KAILUA.0
# By Partha Pratim Barman
# Via Gerrit - the friendly Code Review server (1) and others
* tag 'AUDIO.LA.8.0.r1-10100-KAILUA.0':
ipc: HWBinders: Add check for OOB read and sanitize value of size.
Change-Id: I3c6f9ea9977a4365f6c373d043834e4bbb07b1bd
diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..7ae4815
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/vendor/qcom/opensource/agm
diff --git a/ipc/HwBinders/agm_ipc_client/Android.mk b/ipc/HwBinders/agm_ipc_client/Android.mk
index 58ede6f..d167268 100644
--- a/ipc/HwBinders/agm_ipc_client/Android.mk
+++ b/ipc/HwBinders/agm_ipc_client/Android.mk
@@ -5,6 +5,7 @@
LOCAL_MODULE_OWNER := qti
LOCAL_VENDOR_MODULE := true
+LOCAL_CFLAGS := -Wno-format
LOCAL_SRC_FILES := \
src/agm_client_wrapper.cpp\
src/AGMCallback.cpp
diff --git a/ipc/HwBinders/agm_ipc_service/Android.mk b/ipc/HwBinders/agm_ipc_service/Android.mk
index 5619703..5111bf5 100644
--- a/ipc/HwBinders/agm_ipc_service/Android.mk
+++ b/ipc/HwBinders/agm_ipc_service/Android.mk
@@ -1,4 +1,6 @@
LOCAL_PATH := $(call my-dir)
+
+ifneq ($(QCPATH),)
include $(CLEAR_VARS)
LOCAL_MODULE := vendor.qti.hardware.AGMIPC@1.0-impl
@@ -7,7 +9,7 @@
LOCAL_CFLAGS += -v -Wall
LOCAL_CFLAGS += -D_ANDROID_
-LOCAL_C_INCLUDES := $(TOP)/vendor/qcom/opensource/agm/ipc/HwBinders/agm_ipc_client/
+LOCAL_C_INCLUDES := $(call project-path-for,qcom-audio)/agm/ipc/HwBinders/agm_ipc_client/
LOCAL_SRC_FILES := src/agm_server_wrapper.cpp
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
@@ -30,6 +32,8 @@
include $(BUILD_SHARED_LIBRARY)
+endif
+
ifneq ($(strip $(AUDIO_FEATURE_ENABLED_AGM_HIDL)),true)
include $(CLEAR_VARS)
@@ -39,7 +43,7 @@
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_OWNER := qti
-LOCAL_C_INCLUDES := $(TOP)/vendor/qcom/opensource/agm/ipc/HwBinders/agm_ipc_client/
+LOCAL_C_INCLUDES := $(call project-path-for,qcom-audio)/agm/ipc/HwBinders/agm_ipc_client/
LOCAL_SRC_FILES := src/service.cpp
LOCAL_SHARED_LIBRARIES := \
diff --git a/ipc/HwBinders/agm_ipc_service/vendor.qti.hardware.AGMIPC@1.0-service.rc b/ipc/HwBinders/agm_ipc_service/vendor.qti.hardware.AGMIPC@1.0-service.rc
index a9c4563..6c5e026 100644
--- a/ipc/HwBinders/agm_ipc_service/vendor.qti.hardware.AGMIPC@1.0-service.rc
+++ b/ipc/HwBinders/agm_ipc_service/vendor.qti.hardware.AGMIPC@1.0-service.rc
@@ -34,4 +34,3 @@
capabilities BLOCK_SUSPEND SYS_NICE
ioprio rt 4
task_profiles ProcessCapacityHigh HighPerformance
- writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks
diff --git a/ipc/HwBinders/interfaces/Android.bp b/ipc/HwBinders/interfaces/Android.bp
index dcd9e26..102a219 100644
--- a/ipc/HwBinders/interfaces/Android.bp
+++ b/ipc/HwBinders/interfaces/Android.bp
@@ -4,5 +4,5 @@
hidl_package_root {
name: "vendor.qti.hardware.AGMIPC",
- path: "vendor/qcom/opensource/agm/ipc/HwBinders/interfaces/AGMIPC",
+ path: "hardware/qcom-caf/sm8550/audio/agm/ipc/HwBinders/interfaces/AGMIPC",
}
diff --git a/plugins/tinyalsa/Android.mk b/plugins/tinyalsa/Android.mk
index 7c422fd..a69cfea 100644
--- a/plugins/tinyalsa/Android.mk
+++ b/plugins/tinyalsa/Android.mk
@@ -21,6 +21,9 @@
libcutils \
liblog
+LOCAL_CFLAGS += -Wno-format -Wno-incompatible-pointer-types
+LOCAL_CFLAGS += -Wno-enum-conversion
+
#if android version is R, refer to qtitinyxx otherwise use upstream ones
#This assumes we would be using AR code only for Android R and subsequent versions.
ifneq ($(filter 11 R, $(PLATFORM_VERSION)),)
@@ -60,6 +63,8 @@
libutils \
liblog
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-variable
+
#if android version is R, refer to qtitinyxx otherwise use upstream ones
#This assumes we would be using AR code only for Android R and subsequent versions.
ifneq ($(filter 11 R, $(PLATFORM_VERSION)),)
@@ -103,6 +108,8 @@
libcutils \
liblog
+LOCAL_CFLAGS += -Wno-format -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function
+
# Use flag based selection to use QTI vs open source tinycompress project
ifeq ($(TARGET_USES_QTI_TINYCOMPRESS),true)
diff --git a/plugins/tinyalsa/src/agm_pcm_plugin.c b/plugins/tinyalsa/src/agm_pcm_plugin.c
index 52cc4ec..2444e72 100644
--- a/plugins/tinyalsa/src/agm_pcm_plugin.c
+++ b/plugins/tinyalsa/src/agm_pcm_plugin.c
@@ -39,6 +39,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <strings.h>
+#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <tinyalsa/pcm_plugin.h>
@@ -861,22 +862,16 @@
return munmap(addr, length);
}
-static int agm_pcm_ioctl(struct pcm_plugin *plugin, int cmd, ...)
+static int agm_pcm_ioctl(struct pcm_plugin *plugin, int cmd, __unused void *arg)
{
struct agm_pcm_priv *priv = plugin->priv;
uint64_t handle;
int ret = 0;
- va_list ap;
- void *arg;
ret = agm_get_session_handle(priv, &handle);
if (ret)
return ret;
- va_start(ap, cmd);
- arg = va_arg(ap, void *);
- va_end(ap);
-
switch (cmd) {
case SNDRV_PCM_IOCTL_RESET:
ret = agm_pcm_plugin_reset(plugin);
diff --git a/plugins/tinyalsa/test/Android.mk b/plugins/tinyalsa/test/Android.mk
index 8db0db3..eb951a8 100644
--- a/plugins/tinyalsa/test/Android.mk
+++ b/plugins/tinyalsa/test/Android.mk
@@ -7,10 +7,12 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-unused-variable
LOCAL_SRC_FILES := agmmixer.c
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
#if android version is R, refer to qtitinyxx otherwise use upstream ones
@@ -37,11 +39,13 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-unused-variable -Wno-format-insufficient-args
LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
LOCAL_SRC_FILES := agmplay.c
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
#if android version is R, refer to qtitinyxx otherwise use upstream ones
@@ -65,11 +69,13 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-format-insufficient-args
LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
LOCAL_SRC_FILES := agmcap.c
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
#if android version is R, refer to qtitinyxx otherwise use upstream ones
@@ -94,11 +100,13 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-format-insufficient-args -Wno-unused-variable
LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
LOCAL_SRC_FILES := agmhostless.c
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
#if android version is R, refer to qtitinyxx otherwise use upstream ones
@@ -123,6 +131,7 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-unused-variable
LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
@@ -132,6 +141,7 @@
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
# Use flag based selection to use QTI vs open source tinycompress project
@@ -160,6 +170,7 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-incompatible-pointer-types
LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
@@ -169,6 +180,7 @@
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
# Use flag based selection to use QTI vs open source tinycompress project
@@ -197,11 +209,14 @@
LOCAL_VENDOR_MODULE := true
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-result
+LOCAL_CFLAGS += -Wno-unused-variable -Wno-pointer-sign -Wno-varargs
+LOCAL_CFLAGS += -Wno-incompatible-function-pointer-types
LOCAL_CFLAGS += -DBACKEND_CONF_FILE=\"/vendor/etc/backend_conf.xml\"
LOCAL_SRC_FILES := agm_voiceui.c
LOCAL_HEADER_LIBRARIES := \
libagm_headers \
+ libarpal_headers \
libacdb_headers
#if android version is R, refer to qtitinyxx otherwise use upstream ones
diff --git a/service/Android.mk b/service/Android.mk
index 9af7423..f86e848 100644
--- a/service/Android.mk
+++ b/service/Android.mk
@@ -7,6 +7,7 @@
include $(BUILD_HEADER_LIBRARY)
# Build libagm
+ifneq ($(QCPATH),)
include $(CLEAR_VARS)
LOCAL_MODULE := libagm
@@ -41,6 +42,7 @@
src/device_hw_ep.c
LOCAL_HEADER_LIBRARIES := \
+ libarpal_headers \
libspf-headers \
libutils_headers \
libacdb_headers
@@ -75,3 +77,5 @@
include $(BUILD_SHARED_LIBRARY)
+endif
+
diff --git a/service/inc/public/agm/utils.h b/service/inc/public/agm/utils.h
index 1a76635..aae01bf 100644
--- a/service/inc/public/agm/utils.h
+++ b/service/inc/public/agm/utils.h
@@ -28,7 +28,31 @@
**/
#ifndef __UTILS_H__
-#include "ar_osal_error.h"
+// Numbers inferred from define list in utils.c
+#define AR_EOK 0
+#define AR_EFAILED 1
+#define AR_EBADPARAM 2
+#define AR_EUNSUPPORTED 3
+#define AR_EVERSION 4
+#define AR_EUNEXPECTED 5
+#define AR_EPANIC 6
+#define AR_ENORESOURCE 7
+#define AR_EHANDLE 8
+#define AR_EALREADY 9
+#define AR_ENOTREADY 10
+#define AR_EPENDING 11
+#define AR_EBUSY 12
+#define AR_EABORTED 13
+#define AR_ECONTINUE 14
+#define AR_EIMMEDIATE 15
+#define AR_ENOTIMPL 16
+#define AR_ENEEDMORE 17
+#define AR_ENOMEMORY 18
+#define AR_ENOTEXIST 19
+#define AR_ETERMINATED 20
+#define AR_ETIMEOUT 21
+#define AR_EIODATA 22
+#define AR_ESUBSYSRESET 23
#ifdef FEATURE_IPQ_OPENWRT
#include <audio_utils/log.h>