Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1571564

[BUG] Probably bug concerning write to /proc/self/loginuid

From Stanisław Busza <s.busza@gmail.com>
Newsgroups linux.kernel
Subject [BUG] Probably bug concerning write to /proc/self/loginuid
Date 2017-02-01 14:40 +0100
Message-ID <t63iG-6y1-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[BUG] Probably bug concerning write to /proc/self/loginuid Stanisław Busza <s.busza@gmail.com> - 2017-02-01 14:40 +0100

csiph-web