No description
Find a file
John Fastabend bc1b4f013b bpf: sk_msg, improve offset chk in _is_valid_access
The check for max offset in sk_msg_is_valid_access uses sizeof()
which is incorrect because it would allow accessing possibly
past the end of the struct in the padded case. Further, it doesn't
preclude accessing any padding that may be added in the middle of
a struct. All told this makes it fragile to rely on.

To fix this explicitly check offsets with fields using the
bpf_ctx_range() and bpf_ctx_range_till() macros.

For reference the current structure layout looks as follows (reported
by pahole)

struct sk_msg_md {
	union {
		void *             data;                 /*           8 */
	};                                               /*     0     8 */
	union {
		void *             data_end;             /*           8 */
	};                                               /*     8     8 */
	__u32                      family;               /*    16     4 */
	__u32                      remote_ip4;           /*    20     4 */
	__u32                      local_ip4;            /*    24     4 */
	__u32                      remote_ip6[4];        /*    28    16 */
	__u32                      local_ip6[4];         /*    44    16 */
	__u32                      remote_port;          /*    60     4 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	__u32                      local_port;           /*    64     4 */
	__u32                      size;                 /*    68     4 */

	/* size: 72, cachelines: 2, members: 10 */
	/* last cacheline: 8 bytes */
};

So there should be no padding at the moment but fixing this now
prevents future errors.

Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-12-20 23:47:08 +01:00
arch bpf: sparc64: Enable sparc64 jit to provide bpf_line_info 2018-12-20 02:04:53 +01:00
block blk-mq: punt failed direct issue to dispatch list 2018-12-07 08:16:11 -07:00
certs
crypto crypto: user - Disable statistics interface 2018-12-07 13:56:08 +08:00
Documentation net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding 2018-12-10 12:07:56 -08:00
drivers nfp: bpf: optimize codegen for JSET with a constant 2018-12-20 17:28:29 +01:00
firmware
fs a fix for smb3 direct i/o, a fix for CIFS DFS for stable and a minor cifs Kconfig fix 2018-12-09 10:15:13 -08:00
include bpf: sockmap, metadata support for reporting size of msg 2018-12-19 00:27:23 +01:00
init initramfs: clean old path before creating a hardlink 2018-11-30 14:56:14 -08:00
ipc
kernel bpf/cpumap: make sure frame_size for build_skb is aligned if headroom isn't 2018-12-20 23:19:12 +01:00
lib Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-12-09 21:43:31 -08:00
LICENSES
mm dax fixes 4.20-rc6 2018-12-09 09:54:04 -08:00
net bpf: sk_msg, improve offset chk in _is_valid_access 2018-12-20 23:47:08 +01:00
samples samples: bpf: fix: seg fault with NULL pointer arg 2018-12-03 23:58:03 +01:00
scripts Fixes for stackleak 2018-12-07 13:13:07 -08:00
security selinux/stable-4.20 PR 20181129 2018-11-29 10:15:06 -08:00
sound ALSA: hda/realtek: Fix mic issue on Acer AIO Veriton Z4860G/Z6860G 2018-12-05 16:39:59 +01:00
tools bpf: sk_msg, fix sk_msg_md access past end test 2018-12-20 23:47:08 +01:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap mailmap: Update email for Punit Agrawal 2018-11-05 10:02:11 +00:00
COPYING
CREDITS MAINTAINERS: change Sparse's maintainer 2018-11-25 09:17:43 -08:00
Kbuild
Kconfig
MAINTAINERS Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-12-09 21:43:31 -08:00
Makefile Linux 4.20-rc6 2018-12-09 15:31:00 -08:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.