Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread Andreas Hartmann
On 01/24/2018 at 06:31 AM Andreas Hartmann wrote: > On 01/23/2018 at 04:47 PM Oliver Freyermuth wrote: >> Am 23.01.2018 um 16:28 schrieb David Miller: >>> Looking at how these DMA counters are handled, there appears to be a >>> requirement that the memory buffer is 64-byte aligned. >>> >>> [...] >>

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread Andreas Hartmann
On 01/23/2018 at 04:47 PM Oliver Freyermuth wrote: > Am 23.01.2018 um 16:28 schrieb David Miller: >> Looking at how these DMA counters are handled, there appears to be a >> requirement that the memory buffer is 64-byte aligned. >> >> [...] >> >> Therefore the driver needs to allocate "size + (64 -

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread David Miller
From: Oliver Freyermuth Date: Wed, 24 Jan 2018 02:21:55 +0100 > Am 23.01.2018 um 23:13 schrieb Francois Romieu: >> >> It helps. Can you try the snippet below ? > > It seems to fix the issue - I could not reproduce memory corruption > anymore neither on an Ubuntu 17.10.1 live system (with patche

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread Oliver Freyermuth
Am 23.01.2018 um 23:13 schrieb Francois Romieu: > > It helps. Can you try the snippet below ? It seems to fix the issue - I could not reproduce memory corruption anymore neither on an Ubuntu 17.10.1 live system (with patched kernel module) nor on my Gentoo system (4.14.12 with your patch applied)

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread Francois Romieu
Oliver Freyermuth : [...] > This looks like it could very well match the structure found in memory, > so something would be broken related to rtl8169_do_counters, in the DMA > transfer. > > Does this help - can I provide more info? I get the feeling this affects > many tens of thousands of syste

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread Oliver Freyermuth
Am 23.01.2018 um 16:28 schrieb David Miller: > Looking at how these DMA counters are handled, there appears to be a > requirement that the memory buffer is 64-byte aligned. > > [...] > > Therefore the driver needs to allocate "size + (64 - 1)" bytes and do > the 64-byte alignment of the CPU point

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-23 Thread David Miller
From: Oliver Freyermuth Date: Mon, 22 Jan 2018 23:55:58 +0100 > Checking through the driver sources, I find rtnl_link_stats64 can > not be the culprit, since it has rx_packets and only after > tx_packets. However, struct rtl8169_counters looks like: > > struct rtl8169_counters { > __le64

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-22 Thread Oliver Freyermuth
Dear Francois, other r8169 experts, Am 22.01.2018 um 01:09 schrieb Francois Romieu: > Are you able to retrieve the layout ? That is, does it appear to match: > > - r8169 hardware stats DMA buffer ? > TxOk, RxOk, TxErr, RxErr, ... > > - rtnl_link_stats ? > rx_packets, tx_packets, rx_bytes, t

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-21 Thread Oliver Freyermuth
Am 22.01.2018 um 01:09 schrieb Francois Romieu: > You said: > > Oliver Freyermuth : > [...] >> The values found in overwritten memory match those contained in >> /proc/self/net/dev for the realtek ethernet device. > > Are you able to retrieve the layout ? That is, does it appear to match: > > -

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-21 Thread Francois Romieu
Oliver Freyermuth : > Am 21.01.2018 um 21:48 schrieb Francois Romieu: > > Oliver Freyermuth : [...] > > Is it an AMD based system ? > > > > No, all the systems on which I have observed this up to now are Intel-based. > Two Haswell and one Sandy Bridge system. Ok. You said: Oliver Freyermut

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-21 Thread Oliver Freyermuth
Hi, Am 21.01.2018 um 21:48 schrieb Francois Romieu: > Oliver Freyermuth : > [...] > > Is it an AMD based system ? > No, all the systems on which I have observed this up to now are Intel-based. Two Haswell and one Sandy Bridge system. Cheers, Oliver

Re: Memory corruption with r8169 across several device revisions and kernels

2018-01-21 Thread Francois Romieu
Oliver Freyermuth : [...] Is it an AMD based system ? -- Ueimor

Memory corruption with r8169 across several device revisions and kernels

2018-01-20 Thread Oliver Freyermuth
Dear network experts, please redirect me if this is the wrong place. I have reproduced the following issue across three devices with different Realtek card revisions and different Distros (Debian 9, Ubuntu 17.04, Gentoo with kernels 4.9, 4.11.3, 4.14.12). It's safely reproducible with at lea