mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: kosaki.motohiro@jp.fujitsu.com, Meelis Roos <mroos@linux.ee>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	linux-alpha@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Kentaro Takeda <takedakn@nttdata.co.jp>
Subject: Re: Tomoyo compile failure on alpha: sys_get[p]pid undefined
Date: Mon, 27 Sep 2010 12:16:19 +0900 (JST)	[thread overview]
Message-ID: <20100927121505.6B42.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <20100924075116.GA2303@infradead.org>

> On Fri, Sep 24, 2010 at 09:10:37AM +0300, Meelis Roos wrote:
> > 2.6.36-rc5+git as of yesterday:
> > 
> >   LD      .tmp_vmlinux1
> > security/built-in.o: In function `tomoyo_supervisor':(.text+0xea98): undefined reference to `sys_getpid'
> > security/built-in.o: In function `tomoyo_supervisor':(.text+0xeab0): undefined reference to `sys_getpid'
> > security/built-in.o: In function `tomoyo_supervisor':(.text+0xeac0): undefined reference to `sys_getppid'
> > security/built-in.o: In function `tomoyo_supervisor':(.text+0xeac4): undefined reference to `sys_getppid'
> > 
> > Seems alpha has different mechanisms for using these syscalls from 
> > inside the kernel?
> 
> The real problem is that kernel code should never call system calls.
> The correct fix is to get rid of this abuse.

I agree.

The problem function is here.

---------------------------------------------------------------
static char *tomoyo_print_header(struct tomoyo_request_info *r)
{
        struct timeval tv;
        const pid_t gpid = task_pid_nr(current);
        static const int tomoyo_buffer_len = 4096;
        char *buffer = kmalloc(tomoyo_buffer_len, GFP_NOFS);
        if (!buffer)
                return NULL;
        do_gettimeofday(&tv);
        snprintf(buffer, tomoyo_buffer_len - 1,
                 "#timestamp=%lu profile=%u mode=%s (global-pid=%u)"
                 " task={ pid=%u ppid=%u uid=%u gid=%u euid=%u"
                 " egid=%u suid=%u sgid=%u fsuid=%u fsgid=%u }",
                 tv.tv_sec, r->profile, tomoyo_mode[r->mode], gpid,
                 (pid_t) sys_getpid(), (pid_t) sys_getppid(),
                 current_uid(), current_gid(), current_euid(),
                 current_egid(), current_suid(), current_sgid(),
                 current_fsuid(), current_fsgid());
        return buffer;
}
---------------------------------------------------------------

It has alread used task_pid_nr(). there is no reason to avoid
to call task_tgid_vnr() directly. I bet.

IOW, I think tomoyo can fix this issue easily.




      parent reply	other threads:[~2010-09-27  3:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24  6:10 Meelis Roos
2010-09-24  6:21 ` Tetsuo Handa
2010-09-24  7:51 ` Christoph Hellwig
2010-09-24 10:23   ` Tetsuo Handa
2010-09-27  3:16   ` KOSAKI Motohiro [this message]

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=20100927121505.6B42.A69D9226@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=hch@infradead.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=takedakn@nttdata.co.jp \
    /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

all inboxes | Powered by JetHome®