public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prasanna Meda <pmeda@akamai.com>
To: linux-kernel@vger.kernel.org
Subject: One more get_task_comm()
Date: Wed, 17 Nov 2004 13:55:27 -0800	[thread overview]
Message-ID: <419BC8CF.424232E6@akamai.com> (raw)


Looking at  get_task_comm patch:
http://linus.bkbits.net:8080/linux-2.5/patch@1.1803.144.3

There is one other place where task->comm is accessed
outside current.  There are two issues.  The code is
trying to copy to temp space without task_lock. It is not
using temp space for actual user copy.

--- arch/mips/kernel/sysirix.c.saved    Wed Nov 17 13:18:50 2004
+++ arch/mips/kernel/sysirix.c  Wed Nov 17 13:29:11 2004
@@ -282,7 +282,7 @@
                int pid = (int) regs->regs[base + 5];
                char *buf = (char *) regs->regs[base + 6];
                struct task_struct *p;
-               char comm[16];
+               char  comm[sizeof(current->comm)];

                retval = verify_area(VERIFY_WRITE, buf, 16);
                if (retval)
@@ -294,11 +294,11 @@
                        retval = -ESRCH;
                        break;
                }
-               memcpy(comm, p->comm, 16);
+               get_task_comm(comm, p);
                read_unlock(&tasklist_lock);

                /* XXX Need to check sizes. */
-               copy_to_user(buf, p->comm, 16);
+               copy_to_user(buf, comm, 16);
                retval = 0;
                break;
        }

Related questions:


             reply	other threads:[~2004-11-17 20:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 21:55 Prasanna Meda [this message]
2004-11-17 22:11 ` One more get_task_comm() Prasanna Meda
2004-11-17 22:14 ` Prasanna Meda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=419BC8CF.424232E6@akamai.com \
    --to=pmeda@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox