Exploit database

GH-ced46422045980b66bac7722582b6d48

wjnkac/cve-2019-2215-vivo-y66i

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2019-2215

37 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files7
wjnkac/cve-2019-2215-vivo-y66iRevision 54b4fa98e759

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

main/src/lkm/cred318.h

Text · 2,351 bytes
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * cred318.h —— msm-3.18.31 cred 兼容层的对外接口
 *
 * 用法(从 KernelPatch 的 lkm/supercall/ 里):
 *
 *     #include "../../src/apatch/cred318.h"
 *
 *     struct cred318_ops ops = {
 *         .prepare_creds  = (void *)kp_resolve("prepare_creds"),
 *         .get_task_cred  = (void *)kp_resolve("get_task_cred"),
 *         .put_cred       = (void *)kp_resolve("put_cred"),
 *         .commit_creds   = (void *)kp_resolve_or(commit_creds_318, 0x...),
 *         .init_task      = (void *)kp_resolve("init_task"),
 *     };
 *     cred318_set_ops(&ops);
 *
 *     struct cred *new = kp318_prepare_kernel_cred(NULL);
 *     if (new) commit_creds(new);
 *
 * 符号可用性 @ msm-3.18.31(见 docs/apatch-318-port.md §2):
 *
 *   prepare_creds      有符号  0xffffffc0000c0aa4   T
 *   get_task_cred      有符号  0xffffffc0000c0ee0   T
 *   put_cred           有符号  0xffffffc0000c0dfc   T  (与 revert_creds 同址别名)
 *   init_task          有符号  symbols/ks2.txt 查
 *   commit_creds       ★无符号名  函数体 @ 0xffffffc0000c0bb0
 *   prepare_kernel_cred ★不存在  ⇒ 用 kp318_prepare_kernel_cred() 顶替
 */

#ifndef _CRED318_H
#define _CRED318_H

#ifndef __KERNEL__
#include <stddef.h>
typedef unsigned char u8;
typedef unsigned int u32;
typedef unsigned long long u64;
#else
#include <linux/types.h>
#endif

struct cred318_ops {
	void *(*prepare_creds)(void);
	void *(*get_task_cred)(void *task);
	void (*put_cred)(const void *cred);
	int (*commit_creds)(void *new);
	void *init_task;
};

/* 注册原语(必需,否则 cred318_ready() 为 0) */
void cred318_set_ops(const struct cred318_ops *o);

/* 原语是否齐备(prepare_creds / put_cred / init_task 三者) */
int cred318_ready(void);

/*
 * prepare_kernel_cred(daemon) 的 3.18 等价实现。
 * daemon == NULL 时复制 init_task 的身份。
 * 成功返回新 cred(usage=1),调用方负责 commit_creds() 或 put_cred()。
 * 失败返回 NULL。
 */
void *kp318_prepare_kernel_cred(void *daemon);

/*
 * 在 [start, end) 内用特征扫描定位 commit_creds。
 * 骨架阶段未实现完整逻辑,恒返回 NULL —— 见 cred318.c 的说明。
 */
void *cred318_find_commit_creds(const void *start, const void *end);

#endif /* _CRED318_H */