Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3046352pxb; Tue, 12 Jan 2021 05:10:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6BEiseNNyJe6zyN3igxwL6T2leJVVNI1AGlzVAKpVoT5nANMHHMJTjdtNTsFs0p58Iiq4 X-Received: by 2002:a17:906:7687:: with SMTP id o7mr3249532ejm.209.1610457032041; Tue, 12 Jan 2021 05:10:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610457032; cv=none; d=google.com; s=arc-20160816; b=JZYTwRxctiso4HSBz5ii4/1vk2yBNbVClCQtG/j96E+ILAHlTm+ZAea8RXuxOlL6he X57dqZTP5O2utGbEmJ5IHFOWQk8tGfo+cjUBg8eikGm+4Pii0C4usoFPQ2fXGAx8HJ4e 5CR3ig9OcsPefhWScczU9Fv3CPkd0D4/2ztsYNPDkk2PygmYO9jvFdr8EdqoUqYCF1dh YtckWvGYUbkiebD/KM7kbcWbw4iGTe9vbP31plQpL0DAH3hWFL3Ef36UB5s/lWb/lQ5S KHpFKaD/7uo4wyPYlpxrrRe5E15JYkCK21aTzrTvrzVQ+yaqQ9OeXXczdCfMw+ori4Xs Ex6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=cd88PZYioyCzHHKMFonziFg/jnmE70xrn0dgHm2km3k=; b=w9V8NBEePtZZOdHj9JAcEoPGxKLLzT5eiFeMiFqInpKBhSWxQR4HsyvRokxBIIO0Nn tyaE5yH+XWlaKYIvB79MGcz5AGrxLKGoVHPpMz4hpXiINRbvYRNZnUtnmLTbzMkxsno0 dCKynZYUOYFbjacJvGUjX3eqDo1TTPwFQG/Y7wz4T+qWnaq59B4ZFart/tuZLNV4s6iV zfqftDhz4f0qJVMlTXOeUBR84jeBbh9i/scj2Umevjbm8DKqFdkBY8I6EPCxE3I2RmdW v/Yd9QBWR1K4+36IDrQ/OT0OWOd+lp/pT5Y913dutABue4uGjKsvPqb/Ri9r6HU3aL0P vsuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TzAvlCGG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h17si1128059ejg.46.2021.01.12.05.10.06; Tue, 12 Jan 2021 05:10:32 -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=@google.com header.s=20161025 header.b=TzAvlCGG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387893AbhALMj7 (ORCPT + 99 others); Tue, 12 Jan 2021 07:39:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbhALMj6 (ORCPT ); Tue, 12 Jan 2021 07:39:58 -0500 Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4314CC061794 for ; Tue, 12 Jan 2021 04:39:18 -0800 (PST) Received: by mail-wr1-x449.google.com with SMTP id z8so1107332wrh.5 for ; Tue, 12 Jan 2021 04:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=cd88PZYioyCzHHKMFonziFg/jnmE70xrn0dgHm2km3k=; b=TzAvlCGGlQ+J9NrqFbrScSC7TakMIWh2ybIIr5nC9dcgjeGuJU53u6b/Jmme6C5JYo 0oL/UDqvroaKC1rIFJRwdutaz8EWIaH0vTOpIJqMVxmPAQgV6I2VJ5+bs+7yrd5ysr/3 0/mxidw4zwMPHlEIwpEdnAnowFPAPJ+3fVmyMSr5ToXwx4ZgB7iDbPgRAPlnLwaduUfo U2ncMuTnku2hCqYzVdyOfZXsRCaBZwItPDlIGe5f3GBvy6tj79WbJoR55h5zztQfUr+q neLIDh08dAz13aT+vGCjC1W2WjLC1dIb1EdxbqufhGYiqWwUU1U6KTj9qpvz0/uz1GH7 bgUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=cd88PZYioyCzHHKMFonziFg/jnmE70xrn0dgHm2km3k=; b=FIA1f/bb6+QteGPCSFtx+bkONRscHvAsvUDIWgse7cDC5rUUJnVZh+viD090Of7LAm vy/uyroj/udLHixf3sCMu8LWwLn92XAtTOIToqDZefU6x1Fxla4zN31lSQmP4oMPbbcA FK73yZC/GV/aNsZnXpDWyX+kKChvQw2KHEkXExTY1TVFYrpMTNWy2LTsN/Q9JYCflps2 a+l7IWPJ0+yKTKP72tNjBGqYWDmefGqK1l2zNPs+Kn1R5D4/xsnloJtEZxr1w65Lo0XB hs8IndmKCb/Z80ABzsPqXMJYh/XD6r/wa/bn0rirEa7CxxCfI736MTtVdBRN0W7CLYFP ObMw== X-Gm-Message-State: AOAM531zBpjw1m7aouwNPzGFwSNowwGFCDQ/VnTmUDUSj/rVFEaXMTXk 0X6Eg/IsJrWp4yb/2dvIcZfiO0QMJD5RpQ== Sender: "jackmanb via sendgmr" X-Received: from beeg.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:11db]) (user=jackmanb job=sendgmr) by 2002:a1c:cc19:: with SMTP id h25mr3485213wmb.124.1610455156789; Tue, 12 Jan 2021 04:39:16 -0800 (PST) Date: Tue, 12 Jan 2021 12:39:13 +0000 Message-Id: <20210112123913.2016804-1-jackmanb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH bpf-next] bpf: Fix a verifier message for alloc size helper arg From: Brendan Jackman To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , KP Singh , Florent Revest , linux-kernel@vger.kernel.org, Brendan Jackman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The error message here is misleading, the argument will be rejected unless it is a known constant. Signed-off-by: Brendan Jackman --- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 17270b8404f1..5534e667bdb1 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -4319,7 +4319,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg, err = mark_chain_precision(env, regno); } else if (arg_type_is_alloc_size(arg_type)) { if (!tnum_is_const(reg->var_off)) { - verbose(env, "R%d unbounded size, use 'var &= const' or 'if (var < const)'\n", + verbose(env, "R%d is not a known constant'\n", regno); return -EACCES; } base-commit: e22d7f05e445165e58feddb4e40cc9c0f94453bc -- 2.30.0.284.gd98b1dd5eaa7-goog