static int dlopen_eh(struct uretprobe_instance *ri, struct pt_regs *regs);
static int dlopen_rh(struct uretprobe_instance *ri, struct pt_regs *regs);
static struct probe_info_new pin_dlopen = MAKE_URPROBE(dlopen_eh, dlopen_rh, 0);
-struct probe_new p_dlopen_pool = {
- .info = &pin_dlopen
-};
-struct probe_new p_dlopen_daemon = {
+struct probe_new p_dlopen = {
.info = &pin_dlopen
};
static int dlsym_eh(struct uretprobe_instance *ri, struct pt_regs *regs);
static int dlsym_rh(struct uretprobe_instance *ri, struct pt_regs *regs);
static struct probe_info_new pin_dlsym = MAKE_URPROBE(dlsym_eh, dlsym_rh, 0);
-struct probe_new p_dlsym_pool = {
- .info = &pin_dlsym
-};
-struct probe_new p_dlsym_daemon = {
+struct probe_new p_dlsym = {
.info = &pin_dlsym
};
* = the variables are initialized by the user =
* ============================================================================
*/
-static const char *lpad_path_pool;
-static struct dentry *lpad_dentry_pool;
-
-static const char *lpad_path_daemon;
-static struct dentry *lpad_dentry_daemon;
+static const char *lpad_path;
+static struct dentry *lpad_dentry;
static const char *libappcore_path;
static struct dentry *libappcore_dentry;
static bool is_init(void)
{
- return lpad_dentry_pool && lpad_dentry_daemon && libappcore_dentry &&
+ return lpad_dentry && libappcore_dentry &&
cb_offset.flag_create && cb_offset.flag_reset;
}
return -EINVAL;
}
-static int do_set_lpad_info(bool is_process_pool, const char *path,
- unsigned long dlopen, unsigned long dlsym)
+static int do_set_lpad_info(const char *path, unsigned long dlopen,
+ unsigned long dlsym)
{
struct dentry *dentry;
const char *new_path;
return -ENOMEM;
}
- if (is_process_pool) {
- kfree(lpad_path_pool);
- lpad_path_pool = new_path;
- lpad_dentry_pool = dentry;
- p_dlopen_pool.offset = dlopen;
- p_dlsym_pool.offset = dlsym;
- } else {
- kfree(lpad_path_daemon);
- lpad_path_daemon = new_path;
- lpad_dentry_daemon = dentry;
- p_dlopen_daemon.offset = dlopen;
- p_dlsym_daemon.offset = dlsym;
- }
+ kfree(lpad_path);
+
+ lpad_path = new_path;
+ lpad_dentry = dentry;
+ p_dlopen.offset = dlopen;
+ p_dlsym.offset = dlsym;
return 0;
}
struct dentry *app_dentry;
struct pf_group *pfg;
-
- struct dentry *lpad_dentry;
- struct probe_new *p_dlopen;
- struct probe_new *p_dlsym;
};
static LIST_HEAD(nsp_data_list);
-static struct nsp_data *nsp_data_create(bool is_process_pool,
- const char *app_path)
+static struct nsp_data *nsp_data_create(const char *app_path)
{
struct dentry *dentry;
struct nsp_data *data;
data->app_dentry = dentry;
data->pfg = NULL;
- if (is_process_pool) {
- data->lpad_dentry = lpad_dentry_pool;
- data->p_dlopen = &p_dlopen_pool;
- data->p_dlsym = &p_dlsym_pool;
- } else {
- data->lpad_dentry = lpad_dentry_daemon;
- data->p_dlopen = &p_dlopen_daemon;
- data->p_dlsym = &p_dlsym_daemon;
- }
-
return data;
}
int ret;
struct pf_group *pfg;
- pfg = get_pf_group_by_dentry(data->lpad_dentry,
- (void *)data->app_dentry);
+ pfg = get_pf_group_by_dentry(lpad_dentry, (void *)data->app_dentry);
if (pfg == NULL)
return -ENOMEM;
- ret = pin_register(data->p_dlsym, pfg, data->lpad_dentry);
+ ret = pin_register(&p_dlsym, pfg, lpad_dentry);
if (ret)
goto put_g;
- ret = pin_register(data->p_dlopen, pfg, data->lpad_dentry);
+ ret = pin_register(&p_dlopen, pfg, lpad_dentry);
if (ret)
goto ur_dlsym;
return 0;
ur_dlopen:
- pin_unregister(data->p_dlopen, pfg, data->lpad_dentry);
+ pin_unregister(&p_dlopen, pfg, lpad_dentry);
ur_dlsym:
- pin_unregister(data->p_dlsym, pfg, data->lpad_dentry);
+ pin_unregister(&p_dlsym, pfg, lpad_dentry);
put_g:
put_pf_group(pfg);
return ret;
static void nsp_data_uninst(struct nsp_data *data)
{
pin_unregister(&p_appcore, data->pfg, libappcore_dentry);
- pin_unregister(data->p_dlopen, data->pfg, data->lpad_dentry);
- pin_unregister(data->p_dlsym, data->pfg, data->lpad_dentry);
-
+ pin_unregister(&p_dlopen, data->pfg, lpad_dentry);
+ pin_unregister(&p_dlsym, data->pfg, lpad_dentry);
put_pf_group(data->pfg);
data->pfg = NULL;
}
-static int __nsp_add(bool is_process_pool, const char *app_path)
+static int __nsp_add(const char *app_path)
{
struct nsp_data *data;
if (nsp_data_find_by_path(app_path))
return -EEXIST;
- data = nsp_data_create(is_process_pool, app_path);
+ data = nsp_data_create(app_path);
if (IS_ERR(data))
return PTR_ERR(data);
#define F_ARG1(m, t, a) m(t, a)
#define F_ARG2(m, t, a, ...) m(t, a), F_ARG1(m, __VA_ARGS__)
#define F_ARG3(m, t, a, ...) m(t, a), F_ARG2(m, __VA_ARGS__)
-#define F_ARG4(m, t, a, ...) m(t, a), F_ARG3(m, __VA_ARGS__)
#define F_ARG(n, m, ...) F_ARG##n(m, __VA_ARGS__)
#define M_TYPE_AND_ARG(t, a) t a
#define DECLARE_SAFE_FUNC1(name, _do, ...) DECLARE_SAFE_FUNC(1, name, _do, __VA_ARGS__);
#define DECLARE_SAFE_FUNC2(name, _do, ...) DECLARE_SAFE_FUNC(2, name, _do, __VA_ARGS__);
#define DECLARE_SAFE_FUNC3(name, _do, ...) DECLARE_SAFE_FUNC(3, name, _do, __VA_ARGS__);
-#define DECLARE_SAFE_FUNC4(name, _do, ...) DECLARE_SAFE_FUNC(4, name, _do, __VA_ARGS__);
static DEFINE_MUTEX(stat_mutex);
static enum nsp_stat stat = NS_OFF;
-DECLARE_SAFE_FUNC2(nsp_add, __nsp_add, bool, is_process_pool,
- const char *, app_path);
+DECLARE_SAFE_FUNC1(nsp_add, __nsp_add, const char *, app_path);
DECLARE_SAFE_FUNC1(nsp_rm, __nsp_rm, const char *, app_path);
DECLARE_SAFE_FUNC0(nsp_rm_all, __nsp_rm_all);
DECLARE_SAFE_FUNC2(nsp_set_offset, do_set_offset,
enum offset_t, os, unsigned long, offset);
-DECLARE_SAFE_FUNC4(nsp_set_lpad_info, do_set_lpad_info, bool, is_process_pool,
+DECLARE_SAFE_FUNC3(nsp_set_lpad_info, do_set_lpad_info,
const char *, path, unsigned long, dlopen,
unsigned long, dlsym);
DECLARE_SAFE_FUNC2(nsp_set_appcore_info, do_set_appcore_info,
/*
* format:
- * is_process_pool:app_path
+ * app_path
*
* sample:
- * 1:/bin/app_sample
+ * /bin/app_sample
*/
static int do_add(const char *buf, size_t len)
{
- int n, ret, pool;
+ int n, ret;
char *app_path;
- const char fmt[] = "%%d:/%%%ds";
+ const char fmt[] = "/%%%ds";
char fmt_buf[64];
n = snprintf(fmt_buf, sizeof(fmt_buf), fmt, PATH_MAX - 2);
if (app_path == NULL)
return -ENOMEM;
- n = sscanf(buf, fmt_buf, &pool, app_path + 1);
- if (n != 2) {
+ n = sscanf(buf, fmt_buf, app_path + 1);
+ if (n != 1) {
ret = -EINVAL;
- goto free_app_info;
+ goto free_app_path;
}
app_path[0] = '/';
- if (pool != 0 && pool != 1) {
- ret = -EINVAL;
- goto free_app_info;
- }
-
- ret = nsp_add(pool, app_path);
+ ret = nsp_add(app_path);
-free_app_info:
+free_app_path:
kfree(app_path);
return ret;
}
/*
* format:
- * is_process_pool:dlopen_addr@plt:dlsym_addr@plt:launchpad_path
+ * dlopen_addr@plt:dlsym_addr@plt:launchpad_path
*
* sample:
- * 1:0x000234:0x000342:/usr/bin/launchpad-loader
+ * 0x000234:0x000342:/usr/bin/launchpad-loader
*/
static int do_set_lpad_info(const char *data, size_t len)
{
- int n, ret, pool;
+ int n, ret;
unsigned long dlopen_addr;
unsigned long dlsym_addr;
char *lpad_path;
- const char fmt[] = "%%d:%%lx:%%lx:/%%%ds";
+ const char fmt[] = "%%lx:%%lx:/%%%ds";
char fmt_buf[64];
n = snprintf(fmt_buf, sizeof(fmt_buf), fmt, PATH_MAX - 2);
if (lpad_path == NULL)
return -ENOMEM;
- n = sscanf(data, fmt_buf, &pool, &dlopen_addr, &dlsym_addr,
- lpad_path + 1);
- if (n != 4) {
+ n = sscanf(data, fmt_buf, &dlopen_addr, &dlsym_addr, lpad_path + 1);
+ if (n != 3) {
ret = -EINVAL;
goto free_lpad_path;
}
lpad_path[0] = '/';
- if (pool != 0 && pool != 1) {
- ret = -EINVAL;
- goto free_lpad_path;
- }
-
- ret = nsp_set_lpad_info(pool, lpad_path, dlopen_addr, dlsym_addr);
+ ret = nsp_set_lpad_info(lpad_path, dlopen_addr, dlsym_addr);
free_lpad_path:
kfree(lpad_path);
{
const char help[] =
"use:\n"
- "\ta $process_pool:$app_path - add\n"
+ "\ta $app_path - add\n"
"\tr $app_path - remove\n"
"\tc - remove all\n"
- "\tb $process_pool:$dlopen_addr@plt:$dlsym_addr@plt:$launchpad_path\n"
+ "\tb $dlopen_addr@plt:$dlsym_addr@plt:$launchpad_path\n"
"\tl $appcore_efl_main:$libappcore-efl_path\n"
"\ts $param $val - set parameter";
ssize_t ret;