From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Fastabend Subject: Re: [bpf-next PATCH 2/2] bpf: add sk_msg prog sk access tests to test_verifier Date: Thu, 17 May 2018 13:12:52 -0700 Message-ID: <245d2776-ff4c-0c55-6eb9-cde7452efc78@gmail.com> References: <20180517155305.21250.52379.stgit@john-Precision-Tower-5810> <20180517155409.21250.77305.stgit@john-Precision-Tower-5810> <20180517185703.4zdqjyynrc5gkt5q@kafai-mbp.dhcp.thefacebook.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org To: Martin KaFai Lau Return-path: Received: from mail-io0-f194.google.com ([209.85.223.194]:42200 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752060AbeEQUND (ORCPT ); Thu, 17 May 2018 16:13:03 -0400 Received: by mail-io0-f194.google.com with SMTP id a10-v6so3543955ioc.9 for ; Thu, 17 May 2018 13:13:03 -0700 (PDT) In-Reply-To: <20180517185703.4zdqjyynrc5gkt5q@kafai-mbp.dhcp.thefacebook.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 05/17/2018 11:57 AM, Martin KaFai Lau wrote: > On Thu, May 17, 2018 at 08:54:10AM -0700, John Fastabend wrote: >> Add tests for BPF_PROG_TYPE_SK_MSG to test_verifier for read access >> to new sk fields. >> >> Signed-off-by: John Fastabend >> --- [...] >> + { >> + "invalid read past end of SK_MSG", >> + .insns = { >> + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, >> + offsetof(struct sk_msg_md, local_port) + 4), >> + BPF_EXIT_INSN(), >> + }, >> + .errstr = "", > no errstr in this case? > >> + .result = REJECT, >> + .prog_type = BPF_PROG_TYPE_SK_MSG, >> + }, >> + { >> + "invalid read offset in SK_MSG", >> + .insns = { >> + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, >> + offsetof(struct sk_msg_md, family) + 1), >> + BPF_EXIT_INSN(), >> + }, >> + .errstr = "", > same here. > >> + .result = REJECT, >> + .prog_type = BPF_PROG_TYPE_SK_MSG, >> + }, >> + { >> "direct packet read for SK_MSG", >> .insns = { >> BPF_LDX_MEM(BPF_DW, BPF_REG_2, BPF_REG_1, >> > Other than the above, > For completeness I guess we should have the err string included. I'll send a v2 and push ACKs forward. > Acked-by: Martin KaFai Lau >