login
Header Space

 
 

Re: API for changing UIDs of other processes

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Enrico Weigelt <weigelt@...>
Cc: linux kernel list <linux-kernel@...>
Date: Friday, May 2, 2008 - 10:07 am

On Friday 2008-05-02 14:16, Enrico Weigelt wrote:

Not really hard, is it? Just look at something like oom_adj

static ssize_t myprocpid_euid_write(struct file *file,
    const char __user *inbuf, size_t size)
{
	struct task_struct *task;
	char buf[sizeof("4294967296")];
	unsigned int amount = min(size, sizeof(buf) - 1);

	if (copy_from_user(buf, inbuf, amount) != 0)
		return -EFAULT;
	buf[amount] = '\0';

	task = get_proc_task(file->f_path.dentry->d_inode);
	if (task == NULL)
		return -ESRCH;

	/* do error checking */
	task->euid = simple_strtoul(buf, NULL, 0);
	put_task_struct(task);
	return size;
}

So far the theory..
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
API for changing UIDs of other processes, Enrico Weigelt, (Fri May 2, 8:16 am)
Re: API for changing UIDs of other processes, Jan Engelhardt, (Fri May 2, 10:07 am)
Re: API for changing UIDs of other processes, Enrico Weigelt, (Mon May 5, 9:20 am)
speck-geostationary