[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230913085737.2214180-1-xmarquiegui@ainguraiiot.com>
Date: Wed, 13 Sep 2023 10:57:37 +0200
From: Xabier Marquiegui <xabier.marquiegui@...il.com>
To: vinicius.gomes@...el.com
Cc: alex.maftei@....com,
chrony-dev@...ony.tuxfamily.org,
davem@...emloft.net,
horms@...nel.org,
mlichvar@...hat.com,
netdev@...r.kernel.org,
ntp-lists@...tcorallo.com,
reibax@...il.com,
richardcochran@...il.com,
rrameshbabu@...dia.com,
shuah@...nel.org
Subject: [PATCH net-next v2 2/3] ptp: support multiple timestamp event readers
> Using the pid of the task will break when using some form of file
> descriptor passing. e.g. Task A opened the chardev, called the ioctl()
> with some mask and then passed the fd to Task B, that's actually going
> to use the fd.
>
> Is this something that we want to support? Am I missing something?
Thank you very much for your valuable comments Vinicius,
Let me try to confirm if I understand what you are observing here.
Let's say we have a process with two threads. One of them opens the device
file to do IOCTL operations, and the other one opens the device file to
read timestamp events. Since both have the same PID, all the operations
(read,release...) would fail because I designed them under the assumption
that only one open operation would happen per PID.
This is indeed not as safe as it should be and I should try to improve it.
I am already looking at alternatives, but maybe someone can give me a hint.
Do you have any suggestions on what I could do to have file operations
(read, release...) determine which open instance they belong to?
Cheers.
Powered by blists - more mailing lists