Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Revert "Revert "ANDROID: GKI: Add module load time protected symbol l…
…ookup"" This reverts commit 5e1f58c. Reason for revert: Presubmit breakage has been addressed by aosp/1946327 Bug: 200082547 Bug: 214445388 Change-Id: I2be3fedba240eac3bab67a96566f4103deb7bc24 Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
- Loading branch information
Ramji Jiyani
committed
Jan 14, 2022
1 parent
2c9f5bc
commit 5ffc4c2275478f8d4c17795dc5f1b552559fff26
Showing
9 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [abi_symbol_list] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [abi_symbol_list] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // SPDX-License-Identifier: GPL-2.0-only | ||
| /* | ||
| * Copyright 2021 Google LLC | ||
| * Author: ramjiyani@google.com (Ramji Jiyani) | ||
| */ | ||
|
|
||
| #include <linux/bsearch.h> | ||
| #include <linux/errno.h> | ||
| #include <linux/kernel.h> | ||
| #include <linux/printk.h> | ||
| #include <linux/string.h> | ||
|
|
||
| /* | ||
| * Build time generated header files | ||
| * | ||
| * gki_module_exported.h -- Symbols protected from _export_ by unsigned modules | ||
| * gki_module_protected.h -- Symbols protected from _access_ by unsigned modules | ||
| */ | ||
| #include "gki_module_protected.h" | ||
| #include "gki_module_exported.h" | ||
|
|
||
| #define MAX_STRCMP_LEN (max(MAX_PROTECTED_NAME_LEN, MAX_EXPORTED_NAME_LEN)) | ||
|
|
||
| /* bsearch() comparision callback */ | ||
| static int cmp_name(const void *sym, const void *protected_sym) | ||
| { | ||
| return strncmp(sym, protected_sym, MAX_STRCMP_LEN); | ||
| } | ||
|
|
||
| /** | ||
| * gki_is_module_protected_symbol - Is a symbol protected from unsigned module? | ||
| * | ||
| * @name: Symbol being checked against protection from unsigned module | ||
| */ | ||
| bool gki_is_module_protected_symbol(const char *name) | ||
| { | ||
| return bsearch(name, gki_protected_symbols, NO_OF_PROTECTED_SYMBOLS, | ||
| MAX_PROTECTED_NAME_LEN, cmp_name) != NULL; | ||
| } | ||
|
|
||
| /** | ||
| * gki_is_module_exported_symbol - Is a symbol exported from a GKI module? | ||
| * | ||
| * @name: Symbol being checked against exported symbols from GKI modules | ||
| */ | ||
| bool gki_is_module_exported_symbol(const char *name) | ||
| { | ||
| return bsearch(name, gki_exported_symbols, NO_OF_EXPORTED_SYMBOLS, | ||
| MAX_EXPORTED_NAME_LEN, cmp_name) != NULL; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters