Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp728614imm; Tue, 5 Jun 2018 03:36:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJW66u+3BiWIFRU4dj8+6QzTFVRRRNFquFzAMWgLD5q5gkzc083kgcxSmXGcdekOBFEHibX X-Received: by 2002:a17:902:6b8b:: with SMTP id p11-v6mr25379772plk.212.1528194963702; Tue, 05 Jun 2018 03:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528194963; cv=none; d=google.com; s=arc-20160816; b=Z8wg6zHqqMDGmNxk6YUCscRZ1iC/H0EVGmVfGdVMwiVp5y+YAx0DlR40QgTe5mipmR 1m/rkMbrTKsB5SgcpTBUkKo3p0A4/IZnDR26JQgHMUKynhTrOrW1jrva3B4WY2uVhUZI R04kgFXjTateTwF7Rl51EvNK5aFa4/4szkqsSk32glLRAaurogf3CEUWS8pnfQXqcRy2 bTuvvIi/WAVU25WU4mu1SjLzQAGP1a/Vnvq7Aqz5osrYmxNMndghGkl9MLesrmNu3RKD FcDV4OmXwKgktsNGvCsAtD2S9mTyp3XhiJUDv3kIm69DDHyUYwimDV3ojcQKfo+OsGgW t+nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=teHdvnfpAJr4plb9W1L7iUPYlVhhl3WYc7y2vU5KWw8=; b=kkKtHrBdxEucbxv+tI2aYaxsgMW/ysESBdv507arxpp/PZqKe75gUknnjc38YXuunq 8bBSiwzEZNHu1fZzhbITLjq8KOFrLshNXwrfQL0jqnZI0woS8OBe9SXBjlr7lwzqAtLB KJTXhvSvtRBP8Ek4mUQtVJ9AGsz2PLOC+S4yIthEwaMWV6K+KvERWbJGb4mNoRKzQ1RQ UErDxN9LrxGY31iWR0VTDpIiZcKjeFaMe/qNiP6lAesGx/l8jvm5msmha2MvqColA7Fy +n3IuVQqueobqQsT/br7DIx2jk+CM8h8aJfaa2N6Mcklzm2o8YEDGljmL9mgR18vVH7A s2Dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n68-v6si8228511pfb.152.2018.06.05.03.35.49; Tue, 05 Jun 2018 03:36:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751881AbeFEKeF (ORCPT + 99 others); Tue, 5 Jun 2018 06:34:05 -0400 Received: from www62.your-server.de ([213.133.104.62]:36291 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508AbeFEKeC (ORCPT ); Tue, 5 Jun 2018 06:34:02 -0400 Received: from [188.63.75.139] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1fQ9Hd-0001dI-GX; Tue, 05 Jun 2018 12:33:45 +0200 Subject: Re: [PATCH v5 2/3] media: rc: introduce BPF_PROG_LIRC_MODE2 To: Sean Young , Matthias Reichl , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Mauro Carvalho Chehab , netdev@vger.kernel.org, Devin Heitmueller , Y Song , Quentin Monnet References: <9f2c54d4956f962f44fcda739a824397ddea132c.1527419762.git.sean@mess.org> <20180604174730.sctfoklq7klswebp@camel2.lan> <20180605101629.yffyp64o7adg6hu5@gofer.mess.org> From: Daniel Borkmann Message-ID: <04cc36e7-4597-dc57-4ad7-71afcc17244a@iogearbox.net> Date: Tue, 5 Jun 2018 12:33:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180605101629.yffyp64o7adg6hu5@gofer.mess.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.3/24634/Tue Jun 5 06:38:21 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/2018 12:16 PM, Sean Young wrote: > On Mon, Jun 04, 2018 at 07:47:30PM +0200, Matthias Reichl wrote: [...] >>> @@ -1695,6 +1700,8 @@ static int bpf_prog_query(const union bpf_attr *attr, >>> case BPF_CGROUP_SOCK_OPS: >>> case BPF_CGROUP_DEVICE: >>> break; >>> + case BPF_LIRC_MODE2: >>> + return lirc_prog_query(attr, uattr); >> >> When testing this patch series I was wondering why I always got >> -EINVAL when trying to query the registered programs. >> >> Closer inspection revealed that bpf_prog_attach/detach/query and >> calls to them in the bpf syscall are in "#ifdef CONFIG_CGROUP_BPF" >> blocks - and as I built the kernel without CONFIG_CGROUP_BPF >> BPF_PROG_ATTACH/DETACH/QUERY weren't handled in the syscall switch >> and I got -EINVAL from the bpf syscall function. >> >> I haven't checked in detail yet, but it looks to me like >> bpf_prog_attach/detach/query could always be built (or when >> either cgroup bpf or lirc bpf are enabled) and the #ifdefs moved >> inside the switch(). So lirc bpf could be used without cgroup bpf. >> Or am I missing something? > > You are right, this features depends on CONFIG_CGROUP_BPF right now. This > also affects the BPF_SK_MSG_VERDICT, BPF_SK_SKB_STREAM_VERDICT and > BPF_SK_SKB_STREAM_PARSER type bpf attachments, and as far as I know > these shouldn't depend on CONFIG_CGROUP_BPF either. The latter three do depend on it from a bigger picture as sockmap progs are orchestrated via cgroups. But I'd be fine if you decouple lirc from it since there's really no dependency at all, and presumably there are valid cases where you would want to run it on low-end devices with minimal kernel. Thanks, Daniel