kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: John Wood <john.wood@gmx.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Read the "real_parent" field of task_struct
Date: Wed, 30 Sep 2020 07:59:47 -0400	[thread overview]
Message-ID: <53033.1601467187@turing-police> (raw)
In-Reply-To: <20200925161142.GA2857@ubuntu>


[-- Attachment #1.1: Type: text/plain, Size: 1600 bytes --]

On Fri, 25 Sep 2020 18:11:42 +0200, John Wood said:

> There are more examples but are similars to the ones showed. So my question
> is how to read the "real_parent" field correctly. If I can understand all
> the above examples I think I will have the knowledge to implement my LSM in
> a correct way.

There's multiple data structures which contain a pointer to the "real_parent"
that we're interested in.  So depending on which data structure you're working
with, you'll be following a different path to the real_parent, and depending on
what locks (if any) the calling code already has, the access method may be
different.

It's similar to giving directions to where I used to live on Long Island. If
you were coming from the Boston area, you wanted to take I-95 South, then
either the Throg's Neck or Whitestone Bridge, get to I-495 (Long Island
Expressway),  get off at a given exit, take that road south, and turn left to
enter the neighborhood from the north, but if you're coming from New Jersey,
you want to get to Staten Island, Verazanno Narrows Bridge, then Southern State
Parkway to *its* exit for that same road going north, but the right turn  to enter the
neighborhood from the south isn't the same one as if you're coming from the
north (unless you prefer driving another 3/4 of a mile to turn at the same light
as if you were coming from the north...)

You end up at the same place, even though you're using different paths to get
there.  The inside of the kernel works the same way.  Which way you get to
'real_parent' depends on what data structure you are already working with.


[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2020-09-30 12:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 16:11 Read the "real_parent" field of task_struct John Wood
2020-09-30 11:59 ` Valdis Klētnieks [this message]
2020-10-01 17:49   ` John Wood
2020-10-02  0:29     ` Valdis Klētnieks
2020-10-02 16:59       ` John Wood
2020-10-08 17:05         ` John Wood

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=53033.1601467187@turing-police \
    --to=valdis.kletnieks@vt.edu \
    --cc=john.wood@gmx.com \
    --cc=kernelnewbies@kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).