All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] netlink: use TID instead of PID for automatic id assignment
@ 2010-10-31 19:14 Jan Engelhardt
  2010-11-01  2:25 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2010-10-31 19:14 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Herbert Xu

parent 3985c7ce85039adacdf882904ca096f091d39346 (v2.6.36-9871-g3985c7c)
commit 183ded547d51508f23f6c18a999f6c165e66c99e
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Sun Oct 31 20:09:36 2010 +0100

netlink: use TID instead of PID for automatic id assignment

This makes it easier to identify processes in the output of `ss -af
netlink` - as I see no reason to force negative space numbers upon
all but the first socket in a thread group.

Turns out this reverts v2.6.15-rc4~65.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 net/netlink/af_netlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 478181d..568d07c 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -545,7 +545,7 @@ static int netlink_autobind(struct socket *sock)
 	struct hlist_head *head;
 	struct sock *osk;
 	struct hlist_node *node;
-	s32 pid = task_tgid_vnr(current);
+	s32 pid = task_pid_vnr(current);
 	int err;
 	static s32 rover = -4097;
 
-- 
# Created with git-export-patch


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] netlink: use TID instead of PID for automatic id assignment
  2010-10-31 19:14 [patch] netlink: use TID instead of PID for automatic id assignment Jan Engelhardt
@ 2010-11-01  2:25 ` Herbert Xu
  2010-11-01  8:27   ` Jan Engelhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2010-11-01  2:25 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: David S. Miller, netdev

On Sun, Oct 31, 2010 at 08:14:00PM +0100, Jan Engelhardt wrote:
> parent 3985c7ce85039adacdf882904ca096f091d39346 (v2.6.36-9871-g3985c7c)
> commit 183ded547d51508f23f6c18a999f6c165e66c99e
> Author: Jan Engelhardt <jengelh@medozas.de>
> Date:   Sun Oct 31 20:09:36 2010 +0100
> 
> netlink: use TID instead of PID for automatic id assignment
> 
> This makes it easier to identify processes in the output of `ss -af
> netlink` - as I see no reason to force negative space numbers upon
> all but the first socket in a thread group.
> 
> Turns out this reverts v2.6.15-rc4~65.
> 
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>

Nack.  Sockets are typically shared amongst threads so using the
ID of the thread that created it doesn't make much sense when
all the threads in that group use it to send/receive messages.

In any case, this field should not be relied on (please google
the thread "netlink nlmsg_pid supposed to be pid or tid?") as
anybody can claim your PID in the netlink name space.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] netlink: use TID instead of PID for automatic id assignment
  2010-11-01  2:25 ` Herbert Xu
@ 2010-11-01  8:27   ` Jan Engelhardt
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2010-11-01  8:27 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev


On Monday 2010-11-01 03:25, Herbert Xu wrote:
>> 
>> netlink: use TID instead of PID for automatic id assignment
>> 
>> This makes it easier to identify processes in the output of `ss -af
>> netlink` - as I see no reason to force negative space numbers upon
>> all but the first socket in a thread group.
>> 
>> Turns out this reverts v2.6.15-rc4~65.
>> 
>> Cc: Herbert Xu <herbert@gondor.apana.org.au>
>> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
>
>Nack.  Sockets are typically shared amongst threads so using the
>ID of the thread that created it doesn't make much sense when
>all the threads in that group use it to send/receive messages.

That would be fine, because they are in the same process.

>In any case, this field should not be relied on (please google
>the thread "netlink nlmsg_pid supposed to be pid or tid?") as
>anybody can claim your PID in the netlink name space.

I am aware of that. But then it raises the question why we are
giving the first socket a non-negative value in the first place.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-01  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-31 19:14 [patch] netlink: use TID instead of PID for automatic id assignment Jan Engelhardt
2010-11-01  2:25 ` Herbert Xu
2010-11-01  8:27   ` Jan Engelhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.