linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] Probably bug concerning write to /proc/self/loginuid
@ 2017-02-01 13:37 Stanisław Busza
  0 siblings, 0 replies; only message in thread
From: Stanisław Busza @ 2017-02-01 13:37 UTC (permalink / raw)
  To: linux-kernel

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 */
    rcu_read_lock();
    if (current != pid_task(proc_pid(inode), PIDTYPE_PID)) {
        rcu_read_unlock();
        return -EPERM;
    }
    rcu_read_unlock();


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

Problem occurs when multithreaded application tries to write
/proc/self/loginuid.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-01 13:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01 13:37 [BUG] Probably bug concerning write to /proc/self/loginuid Stanisław Busza

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).