ANDROID: force struct selinux_state to be defined in KMI

struct selinux_state is defined in security/selinux/include/security.h,
however libabigail is not finding its definition based on the
instantiation of the hooks, so force it to be defined by defining a
dummy exported symbol. Since blk_mq_alloc_data is defined in a
subsystem-private header, create a new vendor_hooks.c file in
security/selinux to define the dummy symbol.

Bug: 233047575
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ia505c76db2eed339b3815073f847b500535cc954
This commit is contained in:
Todd Kjos
2022-09-21 21:36:04 +00:00
parent b71060e6eb
commit b9ac329a83
5 changed files with 29 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
[abi_symbol_list]
# for type visibility
GKI_struct_selinux_state

View File

@@ -10,6 +10,7 @@ ABI_DEFINITION=android/abi_gki_aarch64.xml
TIDY_ABI=1
KMI_SYMBOL_LIST=android/abi_gki_aarch64
ADDITIONAL_KMI_SYMBOL_LISTS="
android/abi_gki_aarch64_type_visibility
android/abi_gki_aarch64_core
android/abi_gki_aarch64_db845c
android/abi_gki_aarch64_exynos

View File

@@ -53,7 +53,6 @@
#include <trace/hooks/logbuf.h>
#include <trace/hooks/vmscan.h>
#include <trace/hooks/psi.h>
#include <trace/hooks/selinux.h>
#include <trace/hooks/hung_task.h>
#include <trace/hooks/mmc_core.h>
#include <trace/hooks/v4l2core.h>
@@ -336,7 +335,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dequeue_task_fair);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_stat_runtime_rt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_prepare_update_load_avg_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_finish_update_load_avg_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_selinux_is_initialized);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_inactive_ratio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_of_i2c_get_board_info);

View File

@@ -10,6 +10,8 @@ selinux-y := avc.o hooks.o selinuxfs.o netlink.o nlmsgtab.o netif.o \
ss/ebitmap.o ss/hashtab.o ss/symtab.o ss/sidtab.o ss/avtab.o \
ss/policydb.o ss/services.o ss/conditional.o ss/mls.o ss/context.o
selinux-$(CONFIG_ANDROID_VENDOR_HOOKS) += vendor_hooks.o
selinux-$(CONFIG_SECURITY_NETWORK_XFRM) += xfrm.o
selinux-$(CONFIG_NETLABEL) += netlabel.o

View File

@@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-2.0-only
/* vendor_hook.c
*
* Copyright 2022 Google LLC
*/
#ifndef __GENKSYMS__
#include "security.h"
#endif
#define CREATE_TRACE_POINTS
#include <trace/hooks/vendor_hooks.h>
#include <linux/tracepoint.h>
#include <trace/hooks/selinux.h>
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_selinux_is_initialized);
/*
* For type visibility
*/
struct selinux_state *GKI_struct_selinux_state;
EXPORT_SYMBOL_GPL(GKI_struct_selinux_state);