Re: [PATCH] sock: Make sock->sk_tstamp thread-safe

2018-12-23 Thread Deepa Dinamani
On Sat, Dec 22, 2018 at 11:31 PM Eric Dumazet wrote: > > > > On 12/21/2018 12:27 PM, Deepa Dinamani wrote: > > Al Viro mentioned that there is probably a race condition > > lurking in accesses of sk_tstamp on 32-bit machines. > > > > sock->sk_tstamp is of type ktime_t which is always an s64. > >

Re: [PATCH] sock: Make sock->sk_tstamp thread-safe

2018-12-22 Thread Eric Dumazet
On 12/21/2018 12:27 PM, Deepa Dinamani wrote: > Al Viro mentioned that there is probably a race condition > lurking in accesses of sk_tstamp on 32-bit machines. > > sock->sk_tstamp is of type ktime_t which is always an s64. > On a 32 bit architecture, we might run into situations of > unsafe

Re: [PATCH] sock: Make sock->sk_tstamp thread-safe

2018-12-22 Thread David Miller
From: Deepa Dinamani Date: Fri, 21 Dec 2018 12:27:33 -0800 > Al Viro mentioned that there is probably a race condition > lurking in accesses of sk_tstamp on 32-bit machines. > > sock->sk_tstamp is of type ktime_t which is always an s64. > On a 32 bit architecture, we might run into situations

Re: [PATCH] sock: Make sock->sk_tstamp thread-safe

2018-12-22 Thread Arnd Bergmann
On 12/21/18, Deepa Dinamani wrote: > diff --git a/include/net/sock.h b/include/net/sock.h > index fe58aec00d09..2cb641606533 100644 > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -2311,8 +2313,11 @@ sock_recv_timestamp(struct msghdr *msg, struct sock > *sk, struct sk_buff *skb) >

Re: [PATCH] sock: Make sock->sk_tstamp thread-safe

2018-12-22 Thread Deepa Dinamani
> Are we actually worried about concurrent writers here? I thought the > only problem was a race between writer and reader, which would mean > that we could solve it using only a seqcount_t which is cheaper to > update than a seqlock_t. I considered using just the seqcount_t. But, I think we do

[PATCH] sock: Make sock->sk_tstamp thread-safe

2018-12-21 Thread Deepa Dinamani
Al Viro mentioned that there is probably a race condition lurking in accesses of sk_tstamp on 32-bit machines. sock->sk_tstamp is of type ktime_t which is always an s64. On a 32 bit architecture, we might run into situations of unsafe access as the access to the field becomes non atomic. Use