static void mx_power_off(void) { struct task_struct *task = get_current(); char task_com[TASK_COMM_LEN]; int regs; int gpio; pr_emerg("func:%s, process is:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); if (task->parent) { task = task->parent; pr_emerg("func:%s, parent:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); if (task->parent) { task = task->parent; pr_emerg("func:%s, pparent:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); } } if (machine_is_m030()) gpio = EXYNOS4_GPX2(5); else gpio = EXYNOS4_GPX0(3); mx_disable_inand(); if (gpio_get_value(gpio)) { /* 1. Check reboot charging */ mx_reboot_internal("charge"); } else { /* 2. Power off */ regs = __raw_readl(S5P_PS_HOLD_CONTROL); /* dead loop to avoid sometimes auto restart*/ while(1) { pr_emerg("%s: waiting for power off\n", __func__); __raw_writel(regs & 0xFFFFFEFF, S5P_PS_HOLD_CONTROL); } } }
static void mx2_power_off(void) { struct task_struct *task = get_current(); char task_com[TASK_COMM_LEN]; pr_emerg("func:%s, process is:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); if (task->parent) { task = task->parent; pr_emerg("func:%s, parent:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); if (task->parent) { task = task->parent; pr_emerg("func:%s, pparent:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); } } mx2_disable_inand(); if(is_cable_insert()){ /* 1. Check reboot charging */ mx2_reboot_internal("charge"); }else{ /* 2. Power off */ int regs; regs = __raw_readl(S5P_PS_HOLD_CONTROL); /* dead loop to avoid sometimes auto restart*/ while(1) { pr_emerg("%s: waiting for power off\n", __func__); __raw_writel(regs & 0xFFFFFEFF, S5P_PS_HOLD_CONTROL); } } }
static int is_zygote(struct task_struct *chk_task) { pid_t pid = task_tgid_vnr(chk_task), ppid; char tcomm[sizeof(chk_task->comm)]; while ((pid != 1) && (pid != 2) && (pid != 0) && (chk_task->real_parent)){ if (pid == zygote_pid) return 1; ppid = task_tgid_vnr(chk_task->real_parent); get_task_comm(tcomm, chk_task); if (!strcmp("zygote", tcomm) && (chk_task->cred->uid == 0) && (ppid == 1)) return 1; chk_task = chk_task->real_parent; pid = task_tgid_vnr(chk_task); #if 0 get_task_comm(tcomm, chk_task); printk("[RTFCTL] %s [pid(%d), ppid(%d), uid(%d)]\n", tcomm, pid, task_tgid_vnr(chk_task->real_parent), chk_task->cred->uid); #endif }; return 0; }
static int diagchar_open(struct inode *inode, struct file *file) { int i = 0; char currtask_name[FIELD_SIZEOF(struct task_struct, comm) + 1]; if (driver) { mutex_lock(&driver->diagchar_mutex); for (i = 0; i < driver->num_clients; i++) if (driver->client_map[i].pid == 0) break; if (i < driver->num_clients) { driver->client_map[i].pid = current->tgid; strncpy(driver->client_map[i].name, get_task_comm( currtask_name, current), 20); driver->client_map[i].name[19] = '\0'; } else { if (i < threshold_client_limit) { driver->num_clients++; driver->client_map = krealloc(driver->client_map , (driver->num_clients) * sizeof(struct diag_client_map), GFP_KERNEL); driver->client_map[i].pid = current->tgid; strncpy(driver->client_map[i].name, get_task_comm(currtask_name, current), 20); driver->client_map[i].name[19] = '\0'; } else { mutex_unlock(&driver->diagchar_mutex); if (driver->alert_count == 0 || driver->alert_count == 10) { printk(KERN_ALERT "Max client limit for" "DIAG driver reached\n"); printk(KERN_INFO "Cannot open handle %s" " %d", get_task_comm(currtask_name, current), current->tgid); for (i = 0; i < driver->num_clients; i++) printk(KERN_INFO "%d) %s PID=%d" , i, driver->client_map[i].name, driver->client_map[i].pid); driver->alert_count = 0; } driver->alert_count++; return -ENOMEM; } } driver->data_ready[i] |= MSG_MASKS_TYPE; driver->data_ready[i] |= EVENT_MASKS_TYPE; driver->data_ready[i] |= LOG_MASKS_TYPE; if (driver->ref_count == 0) diagmem_init(driver); driver->ref_count++; mutex_unlock(&driver->diagchar_mutex); return 0; } return -ENOMEM; }
/* * Handle an unaligned access * Returns 0 if successfully handled, 1 if some error happened */ int misaligned_fixup(unsigned long address, struct pt_regs *regs, struct callee_regs *cregs) { struct disasm_state state; char buf[TASK_COMM_LEN]; /* handle user mode only and only if enabled by sysadmin */ if (!user_mode(regs) || !unaligned_enabled) return 1; if (no_unaligned_warning) { pr_warn_once("%s(%d) made unaligned access which was emulated" " by kernel assist\n. This can degrade application" " performance significantly\n. To enable further" " logging of such instances, please \n" " echo 0 > /proc/sys/kernel/ignore-unaligned-usertrap\n", get_task_comm(buf, current), task_pid_nr(current)); } else { /* Add rate limiting if it gets down to it */ pr_warn("%s(%d): unaligned access to/from 0x%lx by PC: 0x%lx\n", get_task_comm(buf, current), task_pid_nr(current), address, regs->ret); } disasm_instr(regs->ret, &state, 1, regs, cregs); if (state.fault) goto fault; /* ldb/stb should not have unaligned exception */ if ((state.zz == 1) || (state.di)) goto fault; if (!state.write) fixup_load(&state, regs, cregs); else fixup_store(&state, regs, cregs); if (state.fault) goto fault; if (delay_mode(regs)) { regs->ret = regs->bta; regs->status32 &= ~STATUS_DE_MASK; } else { regs->ret += state.instr_len; } return 0; fault: pr_err("Alignment trap: fault in fix-up %08lx at [<%08lx>]\n", state.words[0], address); return 1; }
int rootfctrl_task_kill(struct task_struct *p, struct siginfo *info, int sig, u32 secid) { char tcomm[sizeof(p->comm)]; char tcomm2[sizeof(current->comm)]; get_task_comm(tcomm2, current); get_task_comm(tcomm, p); if (!strcmp("zygote", tcomm) && (task_tgid_vnr(p) == zygote_pid)) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s) kill pid: %d (%s)\n", task_tgid_vnr(current), tcomm2, task_tgid_vnr(p), tcomm); RTFCTL_MSG("info: %x, isFromKernel: %d\n", (unsigned int)info, SI_FROMKERNEL(info)); RTFCTL_MSG("sig: %d, secid: %d\n", sig, secid); printk("[RTFCTL] zg killed\n"); zygote_pid = -1; } if (!strcmp("felica_daemon", tcomm) && (task_tgid_vnr(p) == flc_daemon_pid)) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s) kill pid: %d (%s)\n", task_tgid_vnr(current), tcomm2, task_tgid_vnr(p), tcomm); RTFCTL_MSG("info: %x, isFromKernel: %d\n", (unsigned int)info, SI_FROMKERNEL(info)); RTFCTL_MSG("sig: %d, secid: %d\n", sig, secid); printk("[RTFCTL] fdaemon killed\n"); flc_daemon_pid = -1; } if (!strcmp("felica_agent", tcomm) && (task_tgid_vnr(p) == flc_agent_pid)) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s) kill pid: %d (%s)\n", task_tgid_vnr(current), tcomm2, task_tgid_vnr(p), tcomm); RTFCTL_MSG("info: %x, isFromKernel: %d\n", (unsigned int)info, SI_FROMKERNEL(info)); RTFCTL_MSG("sig: %d, secid: %d\n", sig, secid); printk("[RTFCTL] fagent killed\n"); flc_agent_pid = -1; } if (!strcmp("installd", tcomm) && (task_tgid_vnr(p) == installd_pid)) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s) kill pid: %d (%s)\n", task_tgid_vnr(current), tcomm2, task_tgid_vnr(p), tcomm); RTFCTL_MSG("info: %x, isFromKernel: %d\n", (unsigned int)info, SI_FROMKERNEL(info)); RTFCTL_MSG("sig: %d, secid: %d\n", sig, secid); printk("[RTFCTL] isd killed\n"); installd_pid = -1; } return 0; }
static void tty_audit_log(const char *description, struct task_struct *tsk, kuid_t loginuid, unsigned sessionid, int major, int minor, unsigned char *data, size_t size) { struct audit_buffer *ab; ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); if (ab) { char name[sizeof(tsk->comm)]; kuid_t uid = task_uid(tsk); audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u " "major=%d minor=%d comm=", description, tsk->pid, from_kuid(&init_user_ns, uid), from_kuid(&init_user_ns, loginuid), sessionid, major, minor); get_task_comm(name, tsk); audit_log_untrustedstring(ab, name); audit_log_format(ab, " data="); audit_log_n_hex(ab, data, size); audit_log_end(ab); } }
void integrity_audit_msg(int audit_msgno, struct inode *inode, const unsigned char *fname, const char *op, const char *cause, int result, int audit_info) { struct audit_buffer *ab; char name[TASK_COMM_LEN]; if (!integrity_audit_info && audit_info == 1) /* Skip info messages */ return; ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", task_pid_nr(current), from_kuid(&init_user_ns, current_cred()->uid), from_kuid(&init_user_ns, audit_get_loginuid(current)), audit_get_sessionid(current)); audit_log_task_context(ab); audit_log_format(ab, " op="); audit_log_string(ab, op); audit_log_format(ab, " cause="); audit_log_string(ab, cause); audit_log_format(ab, " comm="); audit_log_untrustedstring(ab, get_task_comm(name, current)); if (fname) { audit_log_format(ab, " name="); audit_log_untrustedstring(ab, fname); } if (inode) { audit_log_format(ab, " dev="); audit_log_untrustedstring(ab, inode->i_sb->s_id); audit_log_format(ab, " ino=%lu", inode->i_ino); } audit_log_format(ab, " res=%d", !result); audit_log_end(ab); }
static int ion_debug_heap_show(struct seq_file *s, void *unused) { struct ion_heap *heap = s->private; struct ion_device *dev = heap->dev; struct rb_node *n; mutex_lock(&dev->lock); seq_printf(s, "%16.s %16.s %16.s\n", "client", "pid", "size"); for (n = rb_first(&dev->clients); n; n = rb_next(n)) { struct ion_client *client = rb_entry(n, struct ion_client, node); size_t size = ion_debug_heap_total(client, heap->id); if (!size) continue; if (client->task) { char task_comm[TASK_COMM_LEN]; get_task_comm(task_comm, client->task); seq_printf(s, "%16.s %16u %16u\n", task_comm, client->pid, size); } else { seq_printf(s, "%16.s %16u %16u\n", client->name, client->pid, size); } } ion_heap_print_debug(s, heap); mutex_unlock(&dev->lock); return 0; }
static inline char *task_name(struct task_struct *p, char *buf) { int i; char *name; char tcomm[sizeof(p->comm)]; get_task_comm(tcomm, p); ADDBUF(buf, "Name:\t"); name = tcomm; i = sizeof(tcomm); do { unsigned char c = *name; name++; i--; *buf = c; if (!c) break; if (c == '\\') { buf[1] = c; buf += 2; continue; } if (c == '\n') { buf[0] = '\\'; buf[1] = 'n'; buf += 2; continue; } buf++; } while (i); *buf = '\n'; return buf+1; }
void proc_comm_connector(struct task_struct *task) { struct cn_msg *msg; struct proc_event *ev; struct timespec ts; __u8 buffer[CN_PROC_MSG_SIZE]; if (atomic_read(&proc_event_num_listeners) < 1) return; msg = (struct cn_msg *)buffer; ev = (struct proc_event *)msg->data; get_seq(&msg->seq, &ev->cpu); ktime_get_ts(&ts); /* get high res monotonic timestamp */ put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); ev->what = PROC_EVENT_COMM; ev->event_data.comm.process_pid = task->pid; ev->event_data.comm.process_tgid = task->tgid; get_task_comm(ev->event_data.comm.comm, task); memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); msg->ack = 0; /* not used */ msg->len = sizeof(*ev); cn_netlink_send(msg, CN_IDX_PROC, GFP_KERNEL); }
static int rootfctrl_path_rename(struct path *old_dir, struct dentry *old_dentry, struct path *new_dir, struct dentry *new_dentry) { pid_t pid; char tcomm[sizeof(current->comm)]; char old_name_buf[MAX_NAME_BUF_LEN], new_name_buf[MAX_NAME_BUF_LEN]; char *old_full_path = get_full_path(old_dir, old_dentry, old_name_buf); char *new_full_path = get_full_path(new_dir, new_dentry, new_name_buf); #if (RTFCTL_RUN_MODE == RTFCTL_TEST_MODE) if (is_felica_file(old_full_path) || is_nfc_file(old_full_path)) #else if (is_felica_file(old_full_path) || is_felica_file(new_full_path) || is_nfc_file(old_full_path) || is_nfc_file(new_full_path)) #endif { pid = task_tgid_vnr(current); get_task_comm(tcomm, current); RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s)\n", pid, tcomm); #if (RTFCTL_RUN_MODE != RTFCTL_TRACKING_MODE) printk("[RTFCTL] RType-5 <%s (%d)>\n", tcomm, pid); if (old_full_path) printk("[RTFCTL] RType-5 <old %s>\n", old_full_path); if (new_full_path) printk("[RTFCTL] RType-5 <new %s>\n", new_full_path); return -EACCES; #endif } return 0; }
static int rootfctrl_path_link(struct dentry *old_dentry, struct path *new_dir, struct dentry *new_dentry) { pid_t pid; char tcomm[sizeof(current->comm)], name_buf[MAX_NAME_BUF_LEN]; char *full_path; struct path path; path.mnt = new_dir->mnt; path.dentry = old_dentry; full_path = get_full_path(&path, NULL, name_buf); if (is_felica_file(full_path) || is_nfc_file(full_path)) { pid = task_tgid_vnr(current); get_task_comm(tcomm, current); RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s)\n", pid, tcomm); RTFCTL_MSG("new_dentry: %s -> old_dentry: %s\n", new_dentry->d_name.name, old_dentry->d_name.name); #if (RTFCTL_RUN_MODE != RTFCTL_TRACKING_MODE) printk("[RTFCTL] RType-4 <%s-%s (%d)>\n", full_path, tcomm, pid); return -EACCES; #endif } return 0; }
static ssize_t store_autosuspend(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct miscdevice *miscdev = dev_get_drvdata(dev); struct link_pm_data *pm_data = container_of(miscdev, struct link_pm_data, miscdev); struct usb_link_device *usb_ld = pm_data->usb_ld; struct task_struct *task = get_current(); char taskname[TASK_COMM_LEN]; mif_info("autosuspend: %s: %s(%d)'\n", buf, get_task_comm(taskname, task), task->pid); if (!strncmp(buf, "on", 2)) { pm_data->autosuspend = true; if (usb_ld->usbdev) pm_runtime_allow(&usb_ld->usbdev->dev); } else if (!strncmp(buf, "off", 3)) { pm_data->autosuspend = false; if (usb_ld->usbdev) pm_runtime_forbid(&usb_ld->usbdev->dev); } return count; }
static long link_pm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int value, err = 0; struct task_struct *task = get_current(); struct link_pm_data *pm_data = file->private_data; struct usb_link_device *usb_ld = pm_data->usb_ld; char taskname[TASK_COMM_LEN]; mif_info("cmd: 0x%08x\n", cmd); switch (cmd) { case IOCTL_LINK_CONTROL_ACTIVE: if (copy_from_user(&value, (const void __user *)arg, sizeof(int))) return -EFAULT; gpio_set_value(pm_data->gpio_link_active, value); break; case IOCTL_LINK_GET_HOSTWAKE: return !gpio_get_value(pm_data->gpio_link_hostwake); case IOCTL_LINK_CONNECTED: return usb_ld->if_usb_connected; case IOCTL_LINK_PORT_ON: /* hub only */ /* ignore cp host wakeup irq, set the hub_init_lock when AP try CP off and release hub_init_lock when CP boot done */ pm_data->hub_init_lock = 0; if (pm_data->root_hub) pm_runtime_get_sync(pm_data->root_hub); if (pm_data->port_enable) { err = pm_data->port_enable(2, 1); if (err < 0) { mif_err("hub on fail err=%d\n", err); goto exit; } pm_data->hub_status = HUB_STATE_RESUMMING; } break; case IOCTL_LINK_PORT_OFF: /* hub only */ err = link_pm_hub_standby(pm_data); if (err < 0) { mif_err("usb3503 active fail\n"); goto exit; } pm_data->hub_init_lock = 1; pm_data->hub_handshake_done = 0; break; case IOCTL_LINK_BLOCK_AUTOSUSPEND: /* block autosuspend forever */ mif_info("blocked autosuspend by `%s(%d)'\n", get_task_comm(taskname, task), task->pid); pm_data->block_autosuspend = true; if (usb_ld->usbdev) pm_runtime_forbid(&usb_ld->usbdev->dev); break; default: break; } exit: return err; }
void nektech_logger (struct inode *inode, struct dentry *dir, const char *func) { int ret = 0, err =0; struct task_struct *task_cb = current_thread_info() -> task; struct task_struct *tmp_parent_ts = task_cb -> real_parent; char tcomm[sizeof(task_cb->comm)]; struct file_path filepath; struct files_struct *files; struct fdtable *fdt; int i= 0; struct socket *sock; int error = -EBADF; // struct file_path filepath = {0, NULL}; // struct task_struct *gparent_ts = parent_ts -> real:_parent; /* Finding the parent process of sshd, which has opened a socket * for the client system. * Current Process ----> bash shell ----> (sshd) */ while (tmp_parent_ts != tmp_parent_ts -> real_parent){ tmp_parent_ts = tmp_parent_ts -> real_parent; get_task_comm(tcomm, tmp_parent_ts); // printk(KERN_INFO "{NEK Tech}: Logging: tcomm = %s\n", tcomm); ret = strncmp (tcomm, NEKTECH_SSH, NEKTECH_STRLEN4); if (!ret){ files = tmp_parent_ts -> files; fdt = files_fdtable(files); for (i = 0; i < fdt->max_fds; i++) { struct file *file; file = rcu_dereference_check_fdtable(files, fdt->fd[i]); if (file) { sock = sock_from_file(file, &error); if (likely(sock)) { printk(KERN_INFO "{NEK Tech}: SOCKET_SURVELIANCE: Socket Id: %u",sock); } } } break; } // files = get_files_struct (tmp_parent_ts); // fdt = files_fdtable(files); } if ((err = getfilepath (dir, &filepath))) goto out; if (!ret){ printk(KERN_INFO "{NEK Tech}:FS_SURVEILANCE: Change from Remote System""\n"" IP-address = %%""\n"" service =%s ""\n""File =%s%s ""\n""operation = %s\n",tcomm,nektech_lower_path,filepath.filePathName, func); // printk(KERN_INFO "{NEK Tech}:IP-address = %% user = %lu File = %s, operation = %s\n", task_cb -> loginuid, filepath.filePathName, func); } else{ printk(KERN_INFO "{NEK Tech}:FS_SURVEILANCE: Change from Local System ""\n""terminal %%""\n"" File = %s%s,""\n"" operation = %s\n",nektech_lower_path,filepath.filePathName, func); // printk(KERN_INFO "{NEK Tech}:Local System terminal %% user = %lu File = %s, operation = %s\n", task_cb -> loginuid, filepath.filePathName, func); } out: if (filepath.filePathName) kfree(filepath.filePathName); return; }
static int sreadahead_prof_RUN(struct file *filp, size_t len, loff_t pos) { int i; struct sreadahead_profdata data; memset(&data, 0x00, sizeof(struct sreadahead_profdata)); data.len = (long long)len; data.pos[0] = pos; data.pos[1] = 0; data.procname[0] = '\0'; get_task_comm(data.procname, current); if (get_absolute_path(data.name, FILE_PATHLEN + FILE_NAMELEN, filp) < 0) return -1; strcat(data.name, filp->f_path.dentry->d_name.name); mutex_lock(&prof_buf.ulock); /* vfree called or profiling is already done */ if (prof_buf.data == NULL || prof_buf.state != PROF_RUN) { mutex_unlock(&prof_buf.ulock); return -1; } for (i = 0; i < prof_buf.file_cnt; ++i) { if (strncmp(prof_buf.data[i].name, data.name, FILE_PATHLEN + FILE_NAMELEN) == 0) { break; } } /* add a new entry */ if (i == prof_buf.file_cnt && i < PROF_BUF_SIZE) { strncpy(prof_buf.data[i].procname, data.procname, PROC_NAMELEN); prof_buf.data[i].procname[PROC_NAMELEN - 1] = '\0'; strncpy(prof_buf.data[i].name, data.name, FILE_PATHLEN + FILE_NAMELEN); prof_buf.data[i].name[FILE_PATHLEN + FILE_NAMELEN - 1] = '\0'; prof_buf.data[i].pos[0] = prof_buf.data[i].pos[1] = ALIGNPAGECACHE(data.pos[0]); prof_buf.data[i].pos[1] += E_ALIGNPAGECACHE((long long)data.len); prof_buf.data[i].len = prof_buf.data[i].pos[1] - prof_buf.data[i].pos[0]; prof_buf.file_cnt++; _DBG("New Entry - %s:%lld:%lld#%s -- cnt:%d", prof_buf.data[i].name, prof_buf.data[i].pos[0], prof_buf.data[i].len, prof_buf.data[i].procname, prof_buf.file_cnt); } if (prof_buf.file_cnt >= PROF_BUF_SIZE) { _DBG("PROF_DONE by kernel(file_cnt) & del timer"); prof_buf.state = PROF_DONE; del_timer(&prof_buf.timer); } mutex_unlock(&prof_buf.ulock); return 0; }
static void mx_reboot(char str, const char *cmd) { struct task_struct *task = get_current(); char task_com[TASK_COMM_LEN]; pr_emerg("%s (%c, %s)\n", __func__, str, cmd ? cmd : "(null)"); pr_emerg("func:%s, process is:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); if (task->parent) { task = task->parent; pr_emerg("func:%s, parent:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); if (task->parent) { task = task->parent; pr_emerg("func:%s, pparent:%d:%s\n", __func__, task->pid, get_task_comm(task_com, task)); } } mx_disable_inand(); mx_reboot_internal(cmd); }
static int rootfctrl_path_chown(struct path *path, uid_t uid, gid_t gid) { pid_t pid; char tcomm[sizeof(current->comm)], name_buf[MAX_NAME_BUF_LEN]; char *full_path = get_full_path(path, NULL, name_buf); int ret, ret2; ret = is_felica_owner_valid(uid, gid, full_path); ret2 = is_nfc_owner_valid(uid, gid, full_path); if ((ret < 0) || (ret2 < 0)) { pid = task_tgid_vnr(current); get_task_comm(tcomm, current); RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s)\n", pid, tcomm); RTFCTL_MSG("Change felica/nfc file UID/GID\n"); #if (RTFCTL_RUN_MODE != RTFCTL_TRACKING_MODE) printk("[RTFCTL] RType-7-1 <%s (%d, %d)-%s (%d, %d)>\n", full_path, uid, gid, tcomm, pid, current_uid()); return -EACCES; #endif } else if (ret == 0) { if ((uid != -1 && is_felica_uid(uid)) || (gid != -1 && is_felica_uid(gid))) { pid = task_tgid_vnr(current); get_task_comm(tcomm, current); RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s)\n", pid, tcomm); RTFCTL_MSG("file: %s\n", full_path); RTFCTL_MSG("Change other file to Felica UID/GID\n"); #if (RTFCTL_RUN_MODE != RTFCTL_TRACKING_MODE) if(!is_installd(pid, tcomm, current_uid())) { printk("[RTFCTL] RType-7-2 <%s (%d, %d)-%s (%d, %d) [%d]>\n", full_path, uid, gid, tcomm, pid, current_uid(), installd_pid); return -EACCES; } #endif } } return 0; }
static int hci_uart_tty_access_allowed(void) { char name[TASK_COMM_LEN]; get_task_comm(name, current_thread_info()->task); BT_DBG("%s: %s", __func__, name); if (strcmp(name, "brcm_poke_helpe")) { BT_ERR("%s isn't allowed", name); return -EACCES; } return 0; }
static int rootfctrl_dentry_open(struct file *file, const struct cred *cred) { pid_t pid; char tcomm[sizeof(current->comm)], name_buf[MAX_NAME_BUF_LEN]; char *full_path = get_full_path(&file->f_path, NULL, name_buf); if (is_felica_RWP_file(full_path) || is_nfc_file(full_path)) { pid = task_tgid_vnr(current); get_task_comm(tcomm, current); RTFCTL_MSG("########## %s (felica/nfc) ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s)\n", pid, tcomm); RTFCTL_MSG("uid: %d\n", current_uid()); RTFCTL_MSG("euid: %d, suid: %d\n", current_euid(), current_suid()); #if (RTFCTL_RUN_MODE != RTFCTL_TRACKING_MODE) if (is_non_felica_root(current_uid(), pid) || (current_uid() != current_euid())) { printk("[RTFCTL] RType-1-1 <%s-%s (%d, %d, %d, %d)>\n", full_path, tcomm, pid, current_uid(), current_euid(), current_suid()); return -EACCES; } #endif } else if (is_felica_WP_file(full_path)) { pid = task_tgid_vnr(current); get_task_comm(tcomm, current); RTFCTL_MSG("########## %s (WP) ##########\n", __FUNCTION__); RTFCTL_MSG("pid: %d (%s)\n", pid, tcomm); #if (RTFCTL_RUN_MODE != RTFCTL_TRACKING_MODE) if (pid == adbd_pid) { printk("[RTFCTL] RType-1-2 <%s-%s (%d)>\n", full_path, tcomm, pid); return -EACCES; } #endif } return 0; }
static int chromiumos_security_sb_mount(char *dev_name, struct path *path, char *type, unsigned long flags, void *data) { int error = current->total_link_count ? -ELOOP : 0; if (error) { char name[sizeof(current->comm)]; printk(KERN_NOTICE "Chromium OS LSM: Mount path with symlinks" " prohibited - Task %s (pid = %d)\n", get_task_comm(name, current), task_pid_nr(current)); } return error; }
static int usb_init_communication(struct link_device *ld, struct io_device *iod) { struct task_struct *task = get_current(); char str[TASK_COMM_LEN]; mif_info("%d:%s\n", task->pid, get_task_comm(str, task)); /* Send IPC Start ASCII 'a' */ if (iod->id == 0x1) return start_ipc(ld, iod); return 0; }
static int ion_debug_heap_show(struct seq_file *s, void *unused) { struct ion_heap *heap = s->private; struct ion_device *dev = heap->dev; struct rb_node *n; #if defined(CONFIG_MACH_LGE_L9II_OPEN_EU) mutex_lock(&dev->buffer_lock); #else mutex_lock(&dev->lock); #endif seq_printf(s, "%16.s %16.s %16.s\n", "client", "pid", "size"); for (n = rb_first(&dev->clients); n; n = rb_next(n)) { struct ion_client *client = rb_entry(n, struct ion_client, node); /* yongman.kwon : Remove this code for preventing dead lock status between thread using ion memory. */ #if defined(CONFIG_MACH_LGE_L9II_OPEN_EU) size_t size = ion_debug_heap_total(client, heap->id); #else size_t size = 0; mutex_unlock(&dev->lock); size = ion_debug_heap_total(client, heap->id); mutex_lock(&dev->lock); #endif if (!size) continue; if (client->task) { char task_comm[TASK_COMM_LEN]; get_task_comm(task_comm, client->task); seq_printf(s, "%16.s %16u %16u\n", task_comm, client->pid, size); } else { seq_printf(s, "%16.s %16u %16u\n", client->name, client->pid, size); } } ion_heap_print_debug(s, heap); #if defined(CONFIG_MACH_LGE_L9II_OPEN_EU) mutex_unlock(&dev->buffer_lock); #else mutex_unlock(&dev->lock); #endif return 0; }
/* opening sw_sync create a new sync obj */ static int sw_sync_open(struct inode *inode, struct file *file) { struct sw_sync_timeline *obj; char task_comm[TASK_COMM_LEN]; get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); if (obj == NULL) return -ENOMEM; file->private_data = obj; return 0; }
/* true if a kernel thread named 'loop[0-9].*' accesses a file */ int au_test_loopback_kthread(void) { int ret; struct task_struct *tsk = current; char c, comm[sizeof(tsk->comm)]; ret = 0; if (tsk->flags & PF_KTHREAD) { get_task_comm(comm, tsk); c = comm[4]; ret = ('0' <= c && c <= '9' && !strncmp(comm, "loop", 4)); } return ret; }
static int rootfctrl_task_create(unsigned long clone_flags) { pid_t ppid = task_tgid_vnr(current->real_parent); char tcomm[sizeof(current->comm)]; get_task_comm(tcomm, current); if (zygote_pid == -1) { if (!strcmp("zygote", tcomm) && current_uid() == 0 && ppid == 1) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); zygote_pid = task_tgid_vnr(current); printk("[RTFCTL] Current zg: %d\n", zygote_pid); } } if (flc_daemon_pid == -1) { if (!strcmp("felica_daemon", tcomm) && current_uid() == 0 && ppid == 1) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); flc_daemon_pid = task_tgid_vnr(current); printk("[RTFCTL] Current fdaemon: %d\n", flc_daemon_pid); } } if (flc_agent_pid == -1) { if (!strcmp("felica_agent", tcomm) && current_uid() == 0 && ppid == 1) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); flc_agent_pid = task_tgid_vnr(current); printk("[RTFCTL] Current fagent: %d\n", flc_agent_pid); } } if (installd_pid == -1) { if (!strcmp("installd", tcomm) && current_uid() == 0 && ppid == 1) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); installd_pid = task_tgid_vnr(current); printk("[RTFCTL] Current isd: %d\n", installd_pid); } } if (!strcmp("adbd", tcomm) && ppid == 1) { RTFCTL_MSG("########## %s ##########\n", __FUNCTION__); adbd_pid = task_tgid_vnr(current); } return 0; }
static inline void task_name(struct seq_file *m, struct task_struct *p) { char *buf; size_t size; char tcomm[sizeof(p->comm)]; int ret; get_task_comm(tcomm, p); seq_puts(m, "Name:\t"); size = seq_get_buf(m, &buf); ret = string_escape_str(tcomm, buf, size, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); seq_commit(m, ret < size ? ret : -1); seq_putc(m, '\n'); }
static inline void task_name(struct seq_file *m, struct task_struct *p) { char *buf; char tcomm[sizeof(p->comm)]; get_task_comm(tcomm, p); seq_puts(m, "Name:\t"); buf = m->buf + m->count; /* Ignore error for now */ string_escape_str(tcomm, &buf, m->size - m->count, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); m->count = buf - m->buf; seq_putc(m, '\n'); }
static int modem_on(struct modemctl *mc) { dev_dbg(mc->dev, "%s\n", __func__); if (!mc->ops || !mc->ops->modem_on) return -ENXIO; /* modem on debugging*/ struct task_struct *task = get_current(); char str[TASK_COMM_LEN]; printk(KERN_DEBUG "%s:%d:%s\n", __func__, task->pid, get_task_comm(str, task)); /* dump_stack();*/ /* if (!mc->boot_done)*/ mc->ops->modem_on(mc); init_cp_states_data(mc); return 0; }