Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2052684rwe; Fri, 2 Sep 2022 07:53:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4A7c0/JI7y16A47iTrZA0Eqjmy/2FkVZElDaRSn28Lsu3ZyqhNnSyEeoMECclyvNay8MZo X-Received: by 2002:a17:902:ec90:b0:16e:d8d8:c2db with SMTP id x16-20020a170902ec9000b0016ed8d8c2dbmr35642103plg.69.1662130383893; Fri, 02 Sep 2022 07:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662130383; cv=none; d=google.com; s=arc-20160816; b=NTzxF096iohm6V/VZv9VxNVoWLqG50tKs4Dswl3ls8JXIG7247JWsmPeD6dZ7sqAII 76+51dE22azpWBI5ADWXmfAK3XcN2YCvyOjMuL1itIAhiyHI9h4bYfCEfptLWdlK2lnx /x5yMAFuLg36rucg6pDOLTvyVYShnmMljbWCAyfSaw9KCq/rj0VFXo3Y8IFX09Zvxpzt mxfB1XsqgQspvi2thMOWvqqKCxUA3bRVzQxV7am2BPDD7oq44ySfWPbC8zhMrZMjs+G5 GPklFkdFeeVh64Jv+exwRs3hFqJdak7zJhNoowPtnnE+5+/3nUwZqk39sGrfS4z88AgE yp5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=10S2baNmGpvfbB3rWC8TV3GU8jc51um5+NmqwLplTxA=; b=AybAcA563ZARK/0D5vOTLlYUd9D1sE0Ugx0b9KXBjXKnW0UmP+8SVQ+laJ8Opexvcx Ch+iG8rPm8muVUuJWznQhBjYtEBFW46zGXMeRf+LKJlJvWfPhVF95GrGTMBWjWs7z8Ih QLFP4FCzFzInOIn5YHjYRv8XQrDlIj21rL5qcyJiiFzC1zluv2Aaen7NtI8YBYUjNOAY DcfJN8/jDjIi11MD0842O1bLkNQAOOatvHuan7cdPY4X320ErH5dbU9Piq4Hy7eVrnYC 2i67Nnh4cCAjg1Jgi4Nh+rtrV1Z04BNbMAYEQ3bZDGvR5tBdvjXTW2GqVQgZB+HUHjPz 2ztg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OaqsduRm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a170902e75200b0017543086eb4si2455932plf.421.2022.09.02.07.52.51; Fri, 02 Sep 2022 07:53:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OaqsduRm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237280AbiIBNeL (ORCPT + 99 others); Fri, 2 Sep 2022 09:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236314AbiIBNdt (ORCPT ); Fri, 2 Sep 2022 09:33:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348FE3FA38 for ; Fri, 2 Sep 2022 06:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662124312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=10S2baNmGpvfbB3rWC8TV3GU8jc51um5+NmqwLplTxA=; b=OaqsduRmC/k7/up3Y+Yxz1BiXMJqaV0IAPC22l2AwBITcWSC+CZXfo7LhGCbDGmcEgvBXk +13oFwN5C3XFgOuP3AHB4BibB6DAMIRuH77cZQkVYGUTn9qB8Pb1jNKAc1r8dCCEV/mUsC CYb97maX0COEjHQJIGernbkIE8nwR5w= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-498-VNNnkzr-Npy__uScprD9lA-1; Fri, 02 Sep 2022 09:11:50 -0400 X-MC-Unique: VNNnkzr-Npy__uScprD9lA-1 Received: by mail-pj1-f70.google.com with SMTP id z8-20020a17090a014800b001fac4204c7eso1120685pje.8 for ; Fri, 02 Sep 2022 06:11:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=10S2baNmGpvfbB3rWC8TV3GU8jc51um5+NmqwLplTxA=; b=iyB57GtLm77O5Lgg0ouUC/Hl6Pg93OK8DOAW1PvZF+1hxOQRdJqoAxKUXy773FP/Wq 2X91eh4mtJZ53Gtzq3FNrQHuGHlWoYSZpBt3GK/yd6OMt4KqyBy1PnSTm4Qg6iZGmsMF FUOkzobW3a5iJqAOEV3jEK5aQgnwVbXgNDHLzXoLSzGRZp1jozAN8sRwUHCXEB6BAQYJ ovLs8JhRgRWRbYYy4ySEmjgQQ/KyZ8rJMxIUSNfi0r4nW6K8sx99xV7ufGqO2TITtE0e hw9CtxLOLYfcs+44RWe3gpHtL92OX0s1HQokyLQLA04sAGWdiRL6MnzSGhBk7lDK+NCr nEjA== X-Gm-Message-State: ACgBeo1AiuFptLGJnZNCY+Gt3jHqZIGa1ywpCCwln2PO6nc2zNXu3V79 2+4UwaOeqXiBuM0X/p7mT1QNWfeFIAXSRcRjXvvs1LlBCtKFvsPjdSxRK9DNdQdboTVz9hBHg27 yPU2Hb0QBnXvq8JhYFzCNPBtuhVuS7SbV312zceNA X-Received: by 2002:a17:902:b58a:b0:16e:f91a:486b with SMTP id a10-20020a170902b58a00b0016ef91a486bmr36558498pls.119.1662124309712; Fri, 02 Sep 2022 06:11:49 -0700 (PDT) X-Received: by 2002:a17:902:b58a:b0:16e:f91a:486b with SMTP id a10-20020a170902b58a00b0016ef91a486bmr36558475pls.119.1662124309461; Fri, 02 Sep 2022 06:11:49 -0700 (PDT) MIME-Version: 1.0 References: <20220824134055.1328882-1-benjamin.tissoires@redhat.com> <20220824134055.1328882-2-benjamin.tissoires@redhat.com> In-Reply-To: From: Benjamin Tissoires Date: Fri, 2 Sep 2022 15:11:38 +0200 Message-ID: Subject: Re: [PATCH bpf-next v9 01/23] bpf/verifier: allow all functions to read user provided context To: Kumar Kartikeya Dwivedi Cc: Alexei Starovoitov , Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Dave Marchevsky , Joe Stringer , Jonathan Corbet , Tero Kristo , LKML , "open list:HID CORE LAYER" , Network Development , bpf , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 2, 2022 at 5:50 AM Kumar Kartikeya Dwivedi wrote: > > On Thu, 1 Sept 2022 at 18:48, Benjamin Tissoires > wrote: > > > > [...] > > If the above is correct, then yes, it would make sense to me to have 2 > > distinct functions: one to check for the args types only (does the > > function definition in the problem matches BTF), and one to check for > > its use. > > Behind the scenes, btf_check_subprog_arg_match() calls > > btf_check_func_arg_match() which is the one function with entangled > > arguments type checking and actually assessing that the values > > provided are correct. > > > > I can try to split that btf_check_func_arg_match() into 2 distinct > > functions, though I am not sure I'll get it right. > > FYI, I've already split them into separate functions in my tree > because it had become super ugly at this point with all the new > support and I refactored it to add the linked list helpers support > using kfuncs (which requires some special handling for the args), so I > think you can just leave it with a "processing_call" check in for your > series for now. > great, thanks a lot. Actually, writing the patch today with the "processing_call" was really easy now that I have turned the problem in my head a lot yesterday. I am about to send v10 with the reviews addressed. Cheers, Benjamin