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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1620FC433F5 for ; Sun, 19 Dec 2021 05:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbhLSFFa (ORCPT ); Sun, 19 Dec 2021 00:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbhLSFFa (ORCPT ); Sun, 19 Dec 2021 00:05:30 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEFDEC061574; Sat, 18 Dec 2021 21:05:29 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id m24so5361457pls.10; Sat, 18 Dec 2021 21:05:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CKlHcb/+a/+TIswdxAYFbQO/TW7Mb5GfbwGgKVPxekA=; b=fNK8NXziUwUMfacYtFD8DxekMIpi/o6br4Kq5IkLXdtqVR+mgIesvYHMAs6H50hNEc PNMTBQp3T+MyR1HxCC5ZNRFKY7O7mDQ8Iy74XPmOq56hZ/GHq5eA766+bQ1kPmGZxDTz vTnCnB/CWtrupCqovqX1dddnfCbPw9Y2bDabf2W+cxSdgGjiNbXnm2ddrsfkjksPYS2W RHKspWP3/ZMMewt8xM2MrbBmwVqWr7zA+U6hj9ar7D0a3VZr73E9Q+uraEHZEWGLYwdb xxdoLU5yImYw57S+rjKl63VseTS3iAK2ZYON3w6Tg20Qzi7QMe7MhZQTOdM7EB7CUkJQ 5x2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CKlHcb/+a/+TIswdxAYFbQO/TW7Mb5GfbwGgKVPxekA=; b=m/nJxhSMq02Gq6mATsve5WfVHFgh8yR7lrIBOKVyOYmzFdU0HthWgosDCz+dEPCIya DktwDeYUvc3CsP1rGP138lRV2rtNxGBit+9EhTIUUarg/NuCpBsCp3tqs8s+O4NoQ3cl vmDVLRaSkb9w+xaHD4nbiPcyCT583nvDdupb9nShsY8lH9Iu7EgLh0eCFfx+aO5iaqDQ 02409aOr+TM6TuaoarjBL9JuT8dMgpZcg9bKz6CEO7lO/d1u9IE9Hr/fXkPUW9uZdO+E MVoo/Yeq7gtB6jaWdtoz4rumh0VWTisxKK9I30ZM19XwSk3YqzRMDFC5JuiaWeKgVIgC 7aTQ== X-Gm-Message-State: AOAM531NCxdyTra1KLYypxmGPcxaISS6gbapE1/pccZGxYfiJFwiob34 B9wH+0H+pZ26aV1k/80B0Sxf/LfvXWL6tl33c0U= X-Google-Smtp-Source: ABdhPJzPBKpoYAI9l/FmEWILykSkdeIX+56IGgjKAsCKC1IU3AI8wndMrl/nr2NU02bf5XledeEmtzkKKIDPuaRKKes= X-Received: by 2002:a17:90b:798:: with SMTP id l24mr20970684pjz.122.1639890329314; Sat, 18 Dec 2021 21:05:29 -0800 (PST) MIME-Version: 1.0 References: <20211217015031.1278167-1-memxor@gmail.com> <20211217015031.1278167-7-memxor@gmail.com> <20211219022839.kdms7k3jte5ajubt@ast-mbp> <20211219031822.k2bfjhgazvvy5r7l@apollo.legion> <20211219043349.mmycwjnxcqc7lc2c@apollo.legion> In-Reply-To: <20211219043349.mmycwjnxcqc7lc2c@apollo.legion> From: Alexei Starovoitov Date: Sat, 18 Dec 2021 21:05:18 -0800 Message-ID: Subject: Re: [PATCH bpf-next v4 06/10] bpf: Track provenance for pointers formed from referenced PTR_TO_BTF_ID To: Kumar Kartikeya Dwivedi Cc: bpf , Network Development , netfilter-devel , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , Maxim Mikityanskiy , Pablo Neira Ayuso , Florian Westphal , Jesper Dangaard Brouer , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Sat, Dec 18, 2021 at 8:33 PM Kumar Kartikeya Dwivedi wrote: > > It is, but into parent_ref_obj_id, to match during release_reference. > > > Shouldn't r2 get a different ref_obj_id after r2 = r1->next ? > > It's ref_obj_id is still 0. > > Thinking about this more, we actually only need 1 extra bit of information in > reg_state, not even a new member. We can simply copy ref_obj_id and set this > bit, then we can reject this register during release but consider it during > release_reference. It seems to me that this patch created the problem and it's trying to fix it at the same time. mark_btf_ld_reg() shouldn't be copying ref_obj_id. If it keeps it as zero the problem will not happen, no?