Re: How to determine the value of 'current' is valid or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, Jan.

Thank you for your reply.


On Mon, May 03, 2004 at 23:09:38 +0200, Jan Hudec wrote:
> Every function in fs/*.c has known calling rules that state, whether it
> can be called in interrupt (either (1) or (2)) context or not. If it
> can, it must never use current.

I made hooks (that refer to 'current') inside the following functions.

fs/exec.c
    do_execve()
    sys_uselib()
fs/open.c
    filp_open()
    do_sys_truncate()
    sys_chroot()
fs/namei.c
    open_namei()
    sys_mknod()
    sys_mkdir()
    sys_rmdir()
    sys_unlink()
    sys_symlink()
    sys_link()
    do_rename()
    link_path_walk()
fs/namespace.c
    sys_mount()
    sys_pivot_root()

I have LXR(linux cross references) of kernel source 2.4.26,
so I can check from where the functions listed above are called.
But I can't determine the caller function is a interrupt handler or not.
If there is a rule (for example, functions with suffix "_no_current"
must not refer to current, and functions without suffix "_no_current" may
refer to current), I can determine.
I think functions with prefix "sys_" may refer to current.
Also, I think functions which use semaphore operations may refer to current,
but I'm not sure.

> Either the function should do something with current -- and must not be
> called in interrupt context (which you may check, if you want to be sure
> -- BUG_ON(in_interrupt())), or it does not do anything to current (nor
> any other things forbidden in interrupt) and can be called there.

If in_interrupt() always returns 0 even when interrupts are disabled by
spin_lock_irqsave() (or something else) during the state (3), I can manage
by "Just leave from the hook functions if in_interrupt() returns non-zero".


Thank you.

--
     Tetsuo   (a5497108 _at_ anet.ne.jp)

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux