Skip to content

Commit a38dcef

Browse files
committed
Move all symbol addresses into device_database library
1 parent b176b22 commit a38dcef

File tree

6 files changed

+19
-121
lines changed

6 files changed

+19
-121
lines changed

cred.c

+3-38
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,13 @@
1717
#include "kallsyms.h"
1818
#include "backdoor_mmap.h"
1919

20-
typedef struct _supported_device {
21-
device_id_t device_id;
22-
unsigned long int prepare_kernel_cred_address;
23-
unsigned long int commit_creds_address;
24-
} supported_device;
25-
26-
static supported_device supported_devices[] = {
27-
{ DEVICE_HTL21_1_29_970_1, 0xc00ab9d8, 0xc00ab4c4 },
28-
{ DEVICE_HTL22_1_05_970_1, 0xc00b2688, 0xc00b2174 },
29-
{ DEVICE_HTL22_1_07_970_4, 0xc00b26a0, 0xc00b218c },
30-
{ DEVICE_HTX21_1_20_971_1, 0xc00a6e54, 0xc00a6940 },
31-
{ DEVICE_IS17SH_01_00_04, 0xc01c66a8, 0xc01c5fd8 },
32-
{ DEVICE_LT26W_6_2_B_0_200, 0xc00b261c, 0xc00b2140 },
33-
{ DEVICE_LT29I_9_1_B_0_411, 0xc0095dec, 0xc0095910 },
34-
{ DEVICE_SC04E_MDI, 0xc0096068, 0xc0095b54 },
35-
{ DEVICE_SH04E_01_00_02, 0xc008d86c, 0xc008d398 },
36-
{ DEVICE_SH04E_01_00_03, 0xc008d99c, 0xc008d4c8 },
37-
{ DEVICE_SO01E_9_1_C_0_473, 0xc009843c, 0xc0097f60 },
38-
{ DEVICE_SOL21_9_1_D_0_395, 0xc0098584, 0xc00980a8 },
39-
};
40-
41-
static int n_supported_devices = sizeof(supported_devices) / sizeof(supported_devices[0]);
42-
4320
static bool
4421
get_creds_functions_addresses(void **prepare_kernel_cred_address, void **commit_creds_address)
4522
{
46-
device_id_t device_id = detect_device();
47-
int i;
48-
49-
for (i = 0; i < n_supported_devices; i++) {
50-
if (supported_devices[i].device_id != device_id) {
51-
continue;
52-
}
53-
54-
if (prepare_kernel_cred_address) {
55-
*prepare_kernel_cred_address = (void*)supported_devices[i].prepare_kernel_cred_address;
56-
}
57-
58-
if (commit_creds_address) {
59-
*commit_creds_address = (void*)supported_devices[i].commit_creds_address;
60-
}
23+
*prepare_kernel_cred_address = (void *)device_get_symbol_address(DEVICE_SYMBOL(prepare_kernel_cred));
24+
*commit_creds_address = (void*)device_get_symbol_address(DEVICE_SYMBOL(commit_creds));
6125

26+
if (*prepare_kernel_cred_address && *commit_creds_address) {
6227
return true;
6328
}
6429

device_database

Submodule device_database updated 2 files

libfj_hdcp_exploit

Submodule libfj_hdcp_exploit updated from 0def4c4 to cb172ec

libperf_event_exploit

mm.c

+3-30
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,13 @@
77
#include "kallsyms.h"
88
#include "mm.h"
99

10-
typedef struct _supported_device {
11-
device_id_t device_id;
12-
unsigned long int remap_pfn_range_address;
13-
} supported_device;
14-
15-
static supported_device supported_devices[] = {
16-
{ DEVICE_HTL21_1_29_970_1, 0xc00ff32c },
17-
{ DEVICE_HTL22_1_05_970_1, 0xc0128b10 },
18-
{ DEVICE_HTL22_1_07_970_4, 0xc0128b28 },
19-
{ DEVICE_HTX21_1_20_971_1, 0xc00fa8b0 },
20-
{ DEVICE_IS17SH_01_00_04, 0xc0208a34 },
21-
{ DEVICE_LT26W_6_2_B_0_200, 0xc0136294 },
22-
{ DEVICE_LT29I_9_1_B_0_411, 0xc010ac30 },
23-
{ DEVICE_SC01E_LJ3, 0xc0192124 },
24-
{ DEVICE_SC04E_MDI, 0xc011383c },
25-
{ DEVICE_SH04E_01_00_02, 0xc00e458c },
26-
{ DEVICE_SH04E_01_00_03, 0xc00e46bc },
27-
{ DEVICE_SO01E_9_1_C_0_473, 0xc010e1f4 },
28-
{ DEVICE_SOL21_9_1_D_0_395, 0xc010e33c },
29-
};
30-
31-
static int n_supported_devices = sizeof(supported_devices) / sizeof(supported_devices[0]);
32-
3310
unsigned long int
3411
_get_remap_pfn_range_address(void)
3512
{
36-
device_id_t device_id = detect_device();
37-
unsigned long int ret;
38-
int i;
13+
unsigned long int address = device_get_symbol_address(DEVICE_SYMBOL(remap_pfn_range));
3914

40-
for (i = 0; i < n_supported_devices; i++) {
41-
if (supported_devices[i].device_id == device_id){
42-
return supported_devices[i].remap_pfn_range_address;
43-
}
15+
if (address) {
16+
return address;
4417
}
4518

4619
return 0;

ptmx.c

+10-50
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,22 @@
77
#include "device_database/device_database.h"
88
#include "ptmx.h"
99

10-
typedef struct _supported_device {
11-
device_id_t device_id;
12-
unsigned long int ptmx_fops_address;
13-
} supported_device;
14-
15-
static supported_device supported_devices[] = {
16-
{ DEVICE_F05D_V08R31C, 0xc07bc164 },
17-
{ DEVICE_F05D_V11R40A, 0xc07bbf44 },
18-
// F10D: Fujitsu added a method in struct file_operations
19-
{ DEVICE_F10D_V21R48A, 0xc09a60dc + 4 },
20-
{ DEVICE_F11D_V24R40A, 0xc1056998 },
21-
{ DEVICE_FJL21_V23R39X, 0xc0ee31f8 },
22-
{ DEVICE_FJL21_V37R47A, 0xc0ee3378 },
23-
{ DEVICE_HTL21_1_29_970_1, 0xc0d1d944 },
24-
{ DEVICE_HTL22_1_05_970_1, 0xc0df467c },
25-
{ DEVICE_HTL22_1_07_970_4, 0xc0df52bc },
26-
{ DEVICE_HTX21_1_20_971_1, 0xc0ccc0b4 },
27-
{ DEVICE_ISW11F_V25R45A, 0xc080e268 },
28-
{ DEVICE_ISW11F_V27R47I, 0xc080e028 },
29-
{ DEVICE_ISW12K_010_0_3000, 0xc0dc0a10 },
30-
{ DEVICE_IS17SH_01_00_04, 0xc0edae90 },
31-
// ISW13F: Fujitsu added a method in struct file_operations
32-
{ DEVICE_ISW13F_V69R51I, 0xc09fc5fc + 4 },
33-
{ DEVICE_LT26W_6_2_B_0_200, 0xc0cc3dc0 },
34-
{ DEVICE_LT29I_9_1_B_0_411, 0xc0d01f60 },
35-
{ DEVICE_SC01E_LJ3, 0xc10a5a48 },
36-
{ DEVICE_SC04E_MDI, 0xc1169808 },
37-
{ DEVICE_SCL21_LJD, 0xc0c71dc0 },
38-
{ DEVICE_SH04E_01_00_02, 0xc0eed190 },
39-
{ DEVICE_SH04E_01_00_03, 0xc0eed190 },
40-
{ DEVICE_SO01E_9_1_C_0_473, 0xc0d03208 },
41-
{ DEVICE_SOL21_9_1_D_0_395, 0xc0d030c8 },
42-
{ DEVICE_SONYTABLET_S_RELEASE5A, 0xc06e4d18 },
43-
{ DEVICE_SONYTABLET_P_RELEASE5A, 0xc06e6da0 },
44-
};
45-
46-
static int n_supported_devices = sizeof(supported_devices) / sizeof(supported_devices[0]);
47-
4810
unsigned long int
4911
get_ptmx_fops_address(void)
5012
{
51-
device_id_t device_id = detect_device();
52-
int ret;
53-
int i;
13+
unsigned long int address;
5414

55-
for (i = 0; i < n_supported_devices; i++) {
56-
if (supported_devices[i].device_id == device_id) {
57-
return supported_devices[i].ptmx_fops_address;
58-
}
15+
address = device_get_symbol_address(DEVICE_SYMBOL(ptmx_fops));
16+
if (address) {
17+
return address;
5918
}
6019

61-
ret = kallsyms_get_symbol_address("ptmx_fops");
62-
if (!ret) {
63-
print_reason_device_not_supported();
64-
return 0;
20+
if (kallsyms_exist()) {
21+
address = kallsyms_get_symbol_address("ptmx_fops");
22+
if (address) {
23+
return address;
24+
}
6525
}
6626

67-
return ret;
27+
return 0;
6828
}

0 commit comments

Comments
 (0)