From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6166CC2D0DA for ; Sun, 29 Dec 2019 14:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F863206E4 for ; Sun, 29 Dec 2019 14:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577630274; bh=VvfvEo73yPIw6yqeF6MsAPk1zmjphfqDn7b2rB+Ty0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tvY1X08fPUTFml3mW7E6nGU+pFHzh3CP5ZCjd6MzNb7dbaG2lZZxbhEuEkPTmwTw1 ++nIsj3gmzkkrvYyhS4i7G9pMxs7ZjMgD/30xUbdoW3jjFDOKYRHnGdnjgLKUTYwTX 1//HGNAoYrr5aWgE8IPd3Q2ldu0H/19fOh5YTwc0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbfL2Ohx convert rfc822-to-8bit (ORCPT ); Sun, 29 Dec 2019 09:37:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34957 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726597AbfL2Ohx (ORCPT ); Sun, 29 Dec 2019 09:37:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-nBBww4CzPESMoQb7BWCZ0A-1; Sun, 29 Dec 2019 09:37:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1743E800D41; Sun, 29 Dec 2019 14:37:47 +0000 (UTC) Received: from krava.redhat.com (ovpn-204-25.brq.redhat.com [10.40.204.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F90D5DA2C; Sun, 29 Dec 2019 14:37:44 +0000 (UTC) From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, Andrii Nakryiko , Yonghong Song , Martin KaFai Lau , Jakub Kicinski , David Miller Subject: [PATCH 1/5] bpf: Allow non struct type for btf ctx access Date: Sun, 29 Dec 2019 15:37:36 +0100 Message-Id: <20191229143740.29143-2-jolsa@kernel.org> In-Reply-To: <20191229143740.29143-1-jolsa@kernel.org> References: <20191229143740.29143-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: nBBww4CzPESMoQb7BWCZ0A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org I'm not sure why the restriction was added, but I can't access pointers to POD types like const char * when probing vfs_read function. Removing the check and allow non struct type access in context. Signed-off-by: Jiri Olsa --- kernel/bpf/btf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index ed2075884724..ae90f60ac1b8 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3712,12 +3712,6 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type, /* skip modifiers */ while (btf_type_is_modifier(t)) t = btf_type_by_id(btf, t->type); - if (!btf_type_is_struct(t)) { - bpf_log(log, - "func '%s' arg%d type %s is not a struct\n", - tname, arg, btf_kind_str[BTF_INFO_KIND(t->info)]); - return false; - } bpf_log(log, "func '%s' arg%d has btf_id %d type %s '%s'\n", tname, arg, info->btf_id, btf_kind_str[BTF_INFO_KIND(t->info)], __btf_name_by_offset(btf, t->name_off)); -- 2.21.1