Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3191066pxb; Tue, 12 Jan 2021 08:28:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIUP4QsXxCA+eJHep0Ke2fTeUbAEUSj9LgLgwRg9d07hfLio8ZfhLuE8ePVKwFAtuJ8JMf X-Received: by 2002:a17:907:1629:: with SMTP id hb41mr3618268ejc.197.1610468913679; Tue, 12 Jan 2021 08:28:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610468913; cv=none; d=google.com; s=arc-20160816; b=m3Fw8x6ahajX4gU3KYNqcHbedrwuBlXMLwpVJ33jhloEGd5wslbz+KG4mlopZuddHw QiIYTiWGDUno6krIYocGfdOtzpHXUmyyxdnuytS4UqfA8cfBk21o1juDP4mfgI2tSR5q /L0dcZrhxj5rYY/SDqdq4lVJeGYgeY80ERJy+M9lP67OzkJ64chtwh+QC6GfGqdo4owM 95tIY83G88JrH9W0fp0Z7FnppPgNthRTk+L4OZ8/VuXVfNwHyloP5a0q9vvDIhMgRrpE Nuw4BkNHzM+j05cPKTdIOkKQbu/LD4DKSooFAzvlQ3EvSCJ3JeyQdPHIv06Z1pDWW0VN vl3A== 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=iGUOQadPWSCb+M2tubDadgLJtsAfcFueSrYLY47ldr8=; b=VO8pUIlUldK8uRx7T7aXcvC5jlTZtxHl06iO8S0wTPpdc8yHSoOVaDc2toOzdfGdN1 51d2qky9cybhty/pYP2Yg1kIiBKn9FBcBf0rHM6GL9pX+7QU+Loe/IBBJrBDp7WcW28o fwcsBRUiiQ8SIzHgXaTEAlpW2d90uDZpJX8KNyx/RpvF28RMg11kMk3WuZ4jA7zoYFhO fjbxLzm0/9gRe03f3JF8TEOcYIblsEh85k/AEyqpf/Ix9Ld8cNfuiOJem04wpxP9/OqL wRGXQ3KwrwgvU/1LbxLM0Pzo0hVpnoBtG9BpWul9O62tornOw59/S22KRq7p7g3UZ0Uz w9Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="jFtyhe/N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si1297215eja.372.2021.01.12.08.28.09; Tue, 12 Jan 2021 08:28:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="jFtyhe/N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2406849AbhALQZa (ORCPT + 99 others); Tue, 12 Jan 2021 11:25:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406612AbhALQZ3 (ORCPT ); Tue, 12 Jan 2021 11:25:29 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D14B1C061786; Tue, 12 Jan 2021 08:24:48 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id b9so4393992ejy.0; Tue, 12 Jan 2021 08:24:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iGUOQadPWSCb+M2tubDadgLJtsAfcFueSrYLY47ldr8=; b=jFtyhe/N9YphvozoOZmONoarlQE9uW7cDoOkO3RjAU9gMzCJ9Kpi7BwzIDbB6e9T2P 1vKUmiklLcl49OCk1RkN/iwcZAi4rqb/r3QyJXuwre+hMlljRqgUsOxBsBaRAffg/okn GurzSGm4kNd625gTsIKgH20+bt3sNvs2fwvICKFI8OuxDExSa7o017aiKHjtBWtH4C1I vyxoHlGNTDCP+43F+7zY/HvIsr+eNnWKNVel/FYZdPUlmStBcU4SYRuSWaUh2CzdikTt fFEC0OAs8enBu9lgbEbMdsL0u5I5odyRfsFgIpiggUafnfaCXkdPr4XlfMc0fCtiyfC7 QkfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iGUOQadPWSCb+M2tubDadgLJtsAfcFueSrYLY47ldr8=; b=oV3IkrBe+xu17l3vyj+TS67fk1dUqKLyxP63C5ZDGnzZVhcuFE2OJmPJZoHZhjUMDp gVUDIq8wdj/5Q6RBQWem6a8vge6JhW7G5v9BcwCsbKLSkNG0RlBdvx1aIPGLv2C3rWFQ 92cG/kS7UuSIS428fO0ph+4nA+5zxdlVEvQjyQARpiH0ZRRJwh8CIKcJZewTQCretkt0 oS53vjP7kYQyHenFHQw0mBQLa0ne0ezcRr+CpeAKougFL50warWk0mEShxb4jAmJIryo FBp5JpHKp4xlWA2qDVjWfedKAUysFcWvkp6sU2p8+uLKKcYsMAm7+YaRh9JFq71QpOOU ee+g== X-Gm-Message-State: AOAM530xt9X1YCinZP9fywU/P6TzPp2bXHSnzX8hVaHvtldEotrYo+OV UXMDH5NhnArUmmSLMS6vpKqAg1yJM5ebhRtDzQ5uKHuvzJcO/Q== X-Received: by 2002:a17:907:3e06:: with SMTP id hp6mr3823290ejc.254.1610468687427; Tue, 12 Jan 2021 08:24:47 -0800 (PST) MIME-Version: 1.0 References: <20210112091545.10535-1-gilad.reti@gmail.com> <60034a79-573f-125c-76b0-17e04941a155@iogearbox.net> In-Reply-To: From: Gilad Reti Date: Tue, 12 Jan 2021 18:24:10 +0200 Message-ID: Subject: Re: [PATCH 2/2] selftests/bpf: add verifier test for PTR_TO_MEM spill To: KP Singh Cc: Daniel Borkmann , bpf , Shuah Khan , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , linux-kselftest@vger.kernel.org, Networking , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2021 at 6:17 PM KP Singh wrote: > > On Tue, Jan 12, 2021 at 4:43 PM Daniel Borkmann wrote: > > > > On 1/12/21 4:35 PM, Gilad Reti wrote: > > > On Tue, Jan 12, 2021 at 4:56 PM KP Singh wrote: > > >> On Tue, Jan 12, 2021 at 10:16 AM Gilad Reti wrote: > > >>> > > >>> Add test to check that the verifier is able to recognize spilling of > > >>> PTR_TO_MEM registers. > > >> > > >> It would be nice to have some explanation of what the test does to > > >> recognize the spilling of the PTR_TO_MEM registers in the commit > > >> log as well. > > >> > > >> Would it be possible to augment an existing test_progs > > >> program like tools/testing/selftests/bpf/progs/test_ringbuf.c to test > > >> this functionality? > > > > How would you guarantee that LLVM generates the spill/fill, via inline asm? > > Yeah, I guess there is no sure-shot way to do it and, adding inline asm would > just be doing the same thing as this verifier test. You can ignore me > on this one :) > > It would, however, be nice to have a better description about what the test is > actually doing./ > > I will re-submit the patch tomorrow. Thank you all for your patience. > > > > > It may be possible, but from what I understood from Daniel's comment here > > > > > > https://lore.kernel.org/bpf/17629073-4fab-a922-ecc3-25b019960f44@iogearbox.net/ > > > > > > the test should be a part of the verifier tests (which is reasonable > > > to me since it is > > > a verifier bugfix) > > > > Yeah, the test_verifier case as you have is definitely the most straight > > forward way to add coverage in this case.