From: "Joshua Hudson" <joshudson@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Which process is associated with process ID 0 (swapper)
Date: Thu, 20 Apr 2006 09:39:55 -0700 [thread overview]
Message-ID: <bda6d13a0604200939m53a2abd0iba301fa2e064bf94@mail.gmail.com> (raw)
In-Reply-To: <4447B110.4080700@gmail.com>
On 4/20/06, Mikado <mikado4vn@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> linux-os (Dick Johnson) wrote:
> > This must be a trick question. Linux is not VAX/VMS. There is no
> > swapper process. Check in /proc. Processes start at 1. Even
> > kernel threads have PIDs greater than 1.
>
> Linux really has swapper process ;)
>
> > Portions of the kernel networking code operate detached. The code
> > gets the CPU from a timer queue or from an interrupt. When an
> > connection is attempted, the process attempting the connection
> > is either waiting, with its CPU time being used, or put to
> > sleep, while the timer queue's CPU time is being used. The
> > SYN/ACK handshake is handled during this time, therefore it
> > is possible to find who is attempting that connection. Netstat
> > gets that information from /proc/net and multiple socket
> > calls.
>
> I'm writing kernel module that hooks into netfilter code. I can catch
> packet's information and its owner process. The first SYN packet of
> handshaking belongs to real user-space socket/process. After timeout,
> several SYN packets are generated by kernel-space swapper process (PID
> 0) Is there anyway to find out the relationship between them in
> _kernel_space_ (module context).
>
I would recommend walking the list of sockets, and see what process(es) own
the socket that is bound to that quad (host IP, port; foreigh IP, port).
A better design might just be to hook connect(), but think hard on that one. If
you do it, your module cannot be removed.
next prev parent reply other threads:[~2006-04-20 16:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-20 14:58 Mikado
2006-04-20 15:30 ` linux-os (Dick Johnson)
2006-04-20 15:48 ` Mike Galbraith
2006-04-20 16:04 ` Mikado
2006-04-20 16:39 ` Joshua Hudson [this message]
2006-04-20 22:10 ` Jan Engelhardt
2006-04-20 22:15 ` Hua Zhong
2006-04-20 22:19 ` Jan Engelhardt
2006-04-20 23:12 ` Mikado
2006-04-21 12:46 ` Jan Engelhardt
2006-04-20 23:19 ` Mikado
2006-04-20 23:35 ` Mikado
2006-04-21 0:37 ` Patrick McHardy
2006-04-21 1:33 ` Mikado
2006-04-21 3:16 ` Bernd Eckenfels
2006-04-21 12:48 ` Jan Engelhardt
2006-04-21 12:52 ` Jan Engelhardt
2006-04-21 15:21 ` Mikado
2006-04-20 22:06 ` Jan Engelhardt
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=bda6d13a0604200939m53a2abd0iba301fa2e064bf94@mail.gmail.com \
--to=joshudson@gmail.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
all inboxes | Powered by JetHome®