Thread (4 messages) flat view 4 messages, 2 authors, 2021-08-06

Re: [PATCH] net/mlx5e: Avoid field-overflowing memcpy()

From: Kees Cook <hidden>
Date: 2021-08-06 22:45:43
Also in: linux-hardening, lkml, netdev

On Fri, Aug 06, 2021 at 03:17:56PM -0700, Saeed Mahameed wrote:
On Fri, 2021-08-06 at 14:50 -0700, Kees Cook wrote:
quoted
[...]
So, split the memcpy() so the compiler can reason about the buffer
sizes.

"pahole" shows no size nor member offset changes to struct > > mlx5e_tx_wqe
nor struct mlx5e_umr_wqe. "objdump -d" shows no meaningful object
code changes (i.e. only source line number induced differences and
optimizations).
spiting the memcpy doesn't induce any performance degradation ? extra
instruction to copy the 1st 2 bytes ? 
Not meaningfully, but strictly speaking, yes, it's a different series of
instructions.
[...]
quoted
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
why only here ? mlx5 has at least 3 other places where we use this
unbound memcpy .. 
Can you point them out? I've been fixing only the ones I've been able to
find through instrumentation (generally speaking, those with fixed
sizes).

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help