Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5095355pxb; Sun, 6 Feb 2022 13:37:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJPOs3hkApqgSJAovqwxpV/B5INLt+M+B9c9DbeCeabROSsgdIZfmSQO9rSA+yUqtpYts7 X-Received: by 2002:a17:902:db01:: with SMTP id m1mr13893144plx.53.1644183422478; Sun, 06 Feb 2022 13:37:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644183422; cv=none; d=google.com; s=arc-20160816; b=zhKDfvtRFBtY//KzX2McyMlgF64Lq/53fRaKfrTA1Fv/C6uTtusw6gA1r0N9W4Atvd StQK+tR5T1DsWRwB7ZbmSZwQxkCjIlmG5PJiqVzPwjgHIPF2/j2iDUXiJSylVMRf+2B+ j/rHphlkOfYck1+NHHuBOTDfvgP3x3atz96EF6mbPLCF3JpigRyzXjzUSBCAYUTqU8KT Ll3Z5AYn7qA+9csjFY6vNt2aIgHZv6CSeeDaEHRosRYOwkaTmczFIGfT6AIPVqOg75Sl PleiGet0E7K0NZAhcjNXysARU0gC1X24fr0MVBcK4PeTy+P5H7Ntwq8Lx9PKXNPxJPDj zWBw== 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=L5dLU4EAVWGYM7Yk8YJmAlAnD7IzyAIW7kZVpagkypg=; b=i0zxr72iiLD6DfYzLvJd8BKlbZmho8ULMLRUkwEUHTWOZzxpSdmypSbkLqW3DDvDxh vqd9YLeF72NTTSTgY6UQIa4pyR7X7lfc34SKEEwLMUf2wCh92uGQZ4x+uMcLVFR/vr1e 89UAiFk3MwVXtOppfYgTZdKOMyFFugppLS1Sx1hO7eR77KQ9gKkP7yH87lejFID3Ts/9 xBQ0+ssZrjJdJWub3aof6jY/PDEOP0sU+K3uO7H0vyZVUttJ1o1OukeUP4tVmppNA5dD YE/hcjag4Dre/u8p2owI926SM22u8VWEf6vOHXojbqn4bmTofcP/AYQoxoaWJoyhwUgV E9sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ctt4DPTU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm17si476374pjb.148.2022.02.06.13.36.51; Sun, 06 Feb 2022 13:37:02 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=Ctt4DPTU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234339AbiBDTiB (ORCPT + 99 others); Fri, 4 Feb 2022 14:38:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233941AbiBDTiA (ORCPT ); Fri, 4 Feb 2022 14:38:00 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34E58C061714; Fri, 4 Feb 2022 11:38:00 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id h14so6033886plf.1; Fri, 04 Feb 2022 11:38:00 -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=L5dLU4EAVWGYM7Yk8YJmAlAnD7IzyAIW7kZVpagkypg=; b=Ctt4DPTUdPcxcqshyQk5fK/wryEC1i6k4Lk+HOFZb7y2CzNO0n4sYu2KgWzgAhHGA1 s5JlHee1DaJNJE6cOyWsnGA4lmEPx0/Mx+gY08n4k1PO1Dlty84bGvXEIzxW6PpbZO5n arvXeN4Wow0QULCZAMS44RrXQ22V8lw3tx87/lkC+VPheqwZzicGWkBzHrYfXg5yBIxe 9M7TY7basXq5Ziw8tsdXbNPvJ5Ehu9bHDBoaj6chiO0h9VJJuxWYmpIZwxB5q2bqCUtA W/ZHbFH6DCAm4as8QGiUCFGFP5tjkL5FqImcxtMK/e12VF/RvX6gppfdys9vd+ro0D48 jvRA== 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=L5dLU4EAVWGYM7Yk8YJmAlAnD7IzyAIW7kZVpagkypg=; b=8A48kmvt+ngjo2YTo0KQ4daPrTmgqqnzYkHGTRmi/ZF2UOQIdMX8uawJRRXJy02xEU GrPXLHIuIs8v3bAHIlDWfgUhzy0NKcDqGKmBT+fGGrgPHpN8j2tLrloopvTEkqEDUNwH V01i7+5vWo9883lMN0V3VbTmFwqUT6mUyYkkLqlyAHSn9Z1NSTvOtsoCRAdmszs2Uitz 57rMisDz0HMXDNuaMaFo3ofkpiGHhgyQniZrclYwDpKIKCgySgmF9gTyCvtJirepQVip jFOIMh/A3mkh2ik/TNUPxfRta2kGZ28WIEpk4fvJ2PFaYyTWv4mnAJpd8XQWIOu3XDIN 35kw== X-Gm-Message-State: AOAM531Tc0fRaqsJSyUuaMKcaNqKJs/aARACWz6bw49PWWallg9+aXGv F3AYMGKTJR05vN5DT94bY7Rdh/SeYQgAB8HhZDM= X-Received: by 2002:a17:902:d4c5:: with SMTP id o5mr4743370plg.116.1644003479467; Fri, 04 Feb 2022 11:37:59 -0800 (PST) MIME-Version: 1.0 References: <20220204005519.60361-1-mcroce@linux.microsoft.com> <20220204005519.60361-3-mcroce@linux.microsoft.com> In-Reply-To: <20220204005519.60361-3-mcroce@linux.microsoft.com> From: Alexei Starovoitov Date: Fri, 4 Feb 2022 11:37:48 -0800 Message-ID: Subject: Re: [PATCH bpf-next v3 2/2] selftests/bpf: test maximum recursion depth for bpf_core_types_are_compat() To: Matteo Croce Cc: bpf , Daniel Borkmann , Andrii Nakryiko , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 3, 2022 at 4:55 PM Matteo Croce wrote: > --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c > +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c > @@ -13,6 +13,11 @@ > #define CREATE_TRACE_POINTS > #include "bpf_testmod-events.h" > > +typedef int (*func_proto_typedef___match)(long); > +typedef int (*func_proto_typedef___overflow)(func_proto_typedef___match); There is no need for "___flavor" on the kernel side of type definition. It makes the test confusing to read. > +func_proto_typedef___match funcp = NULL; > +func_proto_typedef___overflow funcp_of = NULL; We have BTF_TYPE_EMIT() macro to avoid unnecessary declaration. > +typedef int (*func_proto_typedef___match)(long); > +typedef int (*func_proto_typedef___overflow)(func_proto_typedef___match); With <=1 in the previous patch such single depth of func_proto was reaching the recursion limit. Hence the fix <=0 was necessary. I've also changed this test to: +typedef int (*func_proto_typedef)(long); +typedef int (*func_proto_typedef_nested1)(func_proto_typedef); +typedef int (*func_proto_typedef_nested2)(func_proto_typedef_nested1); in bpf_testmod.c and in progs/core_kern_overflow.c and bpf_core_type_exists(func_proto_typedef_nested2); to go above the limit. Also added bpf_core_type_exists(func_proto_typedef_nested1) to progs/core_kern.c to stay at the limit. Please see the result in bpf-next.