lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 27 Sep 2010 12:16:19 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	kosaki.motohiro@...fujitsu.com, Meelis Roos <mroos@...ux.ee>,
	Linux Kernel list <linux-kernel@...r.kernel.org>,
	linux-alpha@...r.kernel.org,
	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
	Kentaro Takeda <takedakn@...data.co.jp>
Subject: Re: Tomoyo compile failure on alpha: sys_get[p]pid undefined

> 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.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ