Re: [PATCH] netlink: fix locking around NETLINK_LIST_MEMBERSHIPS

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

 



From: David Herrmann <dh.herrmann@xxxxxxxxx>
Date: Wed, 21 Oct 2015 11:47:43 +0200

> Currently, NETLINK_LIST_MEMBERSHIPS grabs the netlink table while copying
> the membership state to user-space. However, grabing the netlink table is
> effectively a write_lock_irq(), and as such we should not be triggering
> page-faults in the critical section.
> 
> This can be easily reproduced by the following snippet:
>     int s = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
>     void *p = mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
>     int r = getsockopt(s, 0x10e, 9, p, (void*)((char*)p + 4092));
> 
> This should work just fine, but currently triggers EFAULT and a possible
> WARN_ON below handle_mm_fault().
> 
> Fix this by reducing locking of NETLINK_LIST_MEMBERSHIPS to a read-side
> lock. The write-lock was overkill in the first place, and the read-lock
> allows page-faults just fine.
> 
> Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
> Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxx>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]