Re: Read the "real_parent" field of task_struct

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

 



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: pgpn4tUoA2QRX.pgp
Description: PGP signature

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

[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