[lkml]   [2017]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[BUG] Probably bug concerning write to /proc/self/loginuid
Hello, this is my first message to the linux kernel development list.

I probably found a bug in the linux kernel.

It affects all kernels since 2.6.12, especially 4.9 that i use.

Lets take a look at the file: fs/proc/base.c and function
proc_loginuid_write() (circa 1264 line):

static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
size_t count, loff_t *ppos)
struct inode * inode = file_inode(file);
uid_t loginuid;
kuid_t kloginuid;
int rv;

/* here is check that is interesting for us */
if (current != pid_task(proc_pid(inode), PIDTYPE_PID)) {
return -EPERM;

I marked with comment the place where function checks which process is
writing to file.

Problem occurs when multithreaded application tries to write

For first thread that is spawned write succeeds. For any other thread
write fails (threads have different pids in linux).

So my question is whether this is a bug or intentional behavior.

Stanisław Busza

 \ /
  Last update: 2017-02-01 14:38    [W:0.024 / U:14.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site