Commit 0f28bc71 authored by Magnus Karlsson's avatar Magnus Karlsson Committed by Yang Yingliang
Browse files

xsk: Add missing check on user supplied headroom size



mainline inclusion
from mainline-v5.7-rc2
commit 99e3a236
category: bugfix
bugzilla: 13690
CVE: CVE-2020-12659

-------------------------------------------------

Add a check that the headroom cannot be larger than the available
space in the chunk. In the current code, a malicious user can set the
headroom to a value larger than the chunk size minus the fixed XDP
headroom. That way packets with a length larger than the supported
size in the umem could get accepted and result in an out-of-bounds
write.

Fixes: c0c77d8f ("xsk: add user memory registration support sockopt")
Reported-by: default avatarBui Quang Minh <minhquangbui99@gmail.com>
Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=207225
Link: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Conflicts:
  net/xdp/xdp_umem.c
[yyl: adjust context]

Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarWenan Mao <maowenan@huawei.com>
Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 3125e015
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment