Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp486600pxt; Fri, 6 Aug 2021 06:50:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7RQlL5j9Vswjc8ywjXk00C9PuaibY6X7Lrkrpg0i/7uBbsqG1cwhQ86ZFshpwnkssNDeQ X-Received: by 2002:a17:906:c251:: with SMTP id bl17mr9956399ejb.219.1628257831719; Fri, 06 Aug 2021 06:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628257831; cv=none; d=google.com; s=arc-20160816; b=VIrWvE/7YpPZK/mnkcgrcE4vMfme3Y5k/QUrnPyjvISBlE9MMVX6U4Q3W+1EAswgfP 5t9ccDVuNHGpa2qZuXlVsfbJUcDX2ucPZwqJ2JYJOHg8TFOxnAC4c57RepLxpA9c7/ZZ 6tRFEP1OENCFYaJHkIikk6LDDFvc/oAFYMZTfcp6aeUAPZ/MizjUq7iDDg/rvyUD5p46 Khsk8y5YwFTj1TAAReHCejTM9348YM61+3gU+MOfm7ClEe3eL9y51e+DkYqdajiPXRbM hmsG1UUM+8W82nD2RT6mDtvDtNQcvp4+dtIH5DlzfYoHBx1fFwlipim5YyN/DPqtB0EJ GUew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aXIoFSPXbStCVWBUmwqxgQGnxNtZSi3ijdWJxWdjwxc=; b=SBjN2Fv1xCIv0lEoy5MdTat50WD9zi8BphHU6nnv3uGw2ibEYeFeIsYl8FzahjsDU1 s39puF2k6RHQ6vcUByujnXi/6CkEtyOQCRDkTEc1pwSz0cgqxTInWMC6buUvn/vKa2uA sPGjy5S41Z3v0Ucqh5obDyJRpiDLJd//ACj/Vl/CjkNbc+TUt54NtHK9R5JwosPAjwLe l4yO7NEV+x+u+cOgIGN9VWR+Pug4cOrQzPc/TUEkK/y7fCZrCFKWbLC5t8Y11XirQqf2 ImIZPWfZCacaluehEVZsv0y5LxWh+QWRj8t1RZKt/y2pg06VcXXxX3C6RWMkCU1BHKwz ciQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="R7B/WlWh"; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si8665765eds.228.2021.08.06.06.50.07; Fri, 06 Aug 2021 06:50:31 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b="R7B/WlWh"; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244422AbhHFIXC (ORCPT + 99 others); Fri, 6 Aug 2021 04:23:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:50976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243999AbhHFITv (ORCPT ); Fri, 6 Aug 2021 04:19:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 626DD611F0; Fri, 6 Aug 2021 08:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237974; bh=4r1dCxAxu4ZWEMqsIZGQNr3rovCELk59h1Qr4gCXHvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7B/WlWhllqMABUOnX/SSKiEOVcYk/G93O+syEhzeU6ERnpXUxvX8FMhsl9ArwuW/ o2n6ahC8gnnOf0xruzAt7YBvmyRAWJSXPTXazymzQxFVa0Iq4EzeAhr9ZvsrRlj8mr i9ZwWUjgXJDwEPLRLsc5lbhS61djpIAkIeOrSLb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Yonghong Song , Daniel Borkmann , Song Liu , Ovidiu Panait Subject: [PATCH 5.10 25/30] selftests/bpf: Add a test for ptr_to_map_value on stack for helper access Date: Fri, 6 Aug 2021 10:17:03 +0200 Message-Id: <20210806081113.981351079@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081113.126861800@linuxfoundation.org> References: <20210806081113.126861800@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yonghong Song commit b4b638c36b7e7acd847b9c4b9c80f268e45ea30c upstream Change bpf_iter_task.c such that pointer to map_value may appear on the stack for bpf_seq_printf() to access. Without previous verifier patch, the bpf_iter test will fail. Signed-off-by: Yonghong Song Signed-off-by: Daniel Borkmann Acked-by: Song Liu Link: https://lore.kernel.org/bpf/20201210013350.943985-1-yhs@fb.com Signed-off-by: Ovidiu Panait Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/bpf/progs/bpf_iter_task.c | 3 ++- tools/testing/selftests/bpf/verifier/unpriv.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) --- a/tools/testing/selftests/bpf/progs/bpf_iter_task.c +++ b/tools/testing/selftests/bpf/progs/bpf_iter_task.c @@ -11,9 +11,10 @@ int dump_task(struct bpf_iter__task *ctx { struct seq_file *seq = ctx->meta->seq; struct task_struct *task = ctx->task; + static char info[] = " === END ==="; if (task == (void *)0) { - BPF_SEQ_PRINTF(seq, " === END ===\n"); + BPF_SEQ_PRINTF(seq, "%s\n", info); return 0; } --- a/tools/testing/selftests/bpf/verifier/unpriv.c +++ b/tools/testing/selftests/bpf/verifier/unpriv.c @@ -108,8 +108,9 @@ BPF_EXIT_INSN(), }, .fixup_map_hash_8b = { 3 }, - .errstr = "invalid indirect read from stack off -8+0 size 8", - .result = REJECT, + .errstr_unpriv = "invalid indirect read from stack off -8+0 size 8", + .result_unpriv = REJECT, + .result = ACCEPT, }, { "unpriv: mangle pointer on stack 1",