Re: [Linux-kernel-mentees] [PATCH net v2] xdp: Prevent kernel-infoleak in xsk_getsockopt()

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

 



On Tue, Jul 28, 2020 at 12:53:59PM +0200, Daniel Borkmann wrote:
> On 7/28/20 7:36 AM, Peilin Ye wrote:
> > xsk_getsockopt() is copying uninitialized stack memory to userspace when
> > `extra_stats` is `false`. Fix it.
> > 
> > Fixes: 8aa5a33578e9 ("xsk: Add new statistics")
> > Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > Signed-off-by: Peilin Ye <yepeilin.cs@xxxxxxxxx>
> > ---
> > Doing `= {};` is sufficient since currently `struct xdp_statistics` is
> > defined as follows:
> > 
> > struct xdp_statistics {
> > 	__u64 rx_dropped;
> > 	__u64 rx_invalid_descs;
> > 	__u64 tx_invalid_descs;
> > 	__u64 rx_ring_full;
> > 	__u64 rx_fill_ring_empty_descs;
> > 	__u64 tx_ring_empty_descs;
> > };
> > 
> > When being copied to the userspace, `stats` will not contain any
> > uninitialized "holes" between struct fields.
> 
> I've added above explanation to the commit log since it's useful reasoning for later
> on 'why' something has been done a certain way. Applied, thanks Peilin!

Ah, I see. Thank you for reviewing the patch!

Peilin Ye



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux