From: Martin KaFai Lau Subject: [PATCH bpf-next 0/2] Ensure line_info.insn_off cannot point to insn with zero code Date: Wed, 19 Dec 2018 13:01:01 -0800 Message-ID: <20181219210101.214574-1-kafai@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Alexei Starovoitov , Daniel Borkmann , To: Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:50906 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728823AbeLSVBP (ORCPT ); Wed, 19 Dec 2018 16:01:15 -0500 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.27/8.16.0.27) with SMTP id wBJKmR6c008399 for ; Wed, 19 Dec 2018 13:01:13 -0800 Received: from mail.thefacebook.com ([199.201.64.23]) by m0089730.ppops.net with ESMTP id 2pfu3ggp2x-15 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 19 Dec 2018 13:01:13 -0800 Sender: netdev-owner@vger.kernel.org List-ID: This series ensures the line_info (passed by the userspace during bpf_prog_load) cannot have its line_info.insn_off pointing to a zero bpf insn code. F.e. a broken userspace tool might generate a line_info.insn_off that points to the second 8 bytes of a BPF_LD_IMM64. The first patch is the kernel change. The second patch is a new test case. Martin KaFai Lau (2): bpf: Ensure line_info.insn_off cannot point to insn with zero code bpf: Add BPF_LD_IMM64 to the line_info test kernel/bpf/verifier.c | 8 ++++++++ tools/testing/selftests/bpf/test_btf.c | 27 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) -- 2.17.1