Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1047665yba; Thu, 16 May 2019 13:21:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4kaalCKp+MMhiMJ+iWnDSzbba4F5ZAoes8iMS/4SWk0y+llTiBmCAMrhVTei2cWokYGDP X-Received: by 2002:a63:10d:: with SMTP id 13mr26747967pgb.176.1558038104637; Thu, 16 May 2019 13:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558038104; cv=none; d=google.com; s=arc-20160816; b=yDz6obdEkuLCB7JFmojlK1/tnCwQQCQN6Z7ip6xqQW8mNZkUSobnthoXofEtRmosXe vhMPq6n/YeZSyhAbQVkOrv4N6qYXdasmis/04wvMPNp31sazxsppav7HcGGpJgRsZwZV J2DlEfIu+3ta8uvFfyS7wGdOrJyZspxJ8wyGfU6TZ5IgLvrif3BIeEzRbkx8FLITM5VZ uReA531TQAqiAuWtiJdni8nVIMB4PpmF7/yJvNHQsHYVrNPgYPM2GwhuJJVhf4yVqmO9 A2H79EppTBTLJA6HKepTgPJ9Ty5ja4WkZfi9EmzoILcIVUBSnl1rgTYul0uIpmDzAWNW kznA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=RSXji2gu6PTmCCcGE3ApJyZXicrhpNir4c6ptrlMBZw=; b=nPQG3aH19phTklhCQYUUTnY8wexnUDIMMFI6bVaFm1UKHjz0Xui4wRk84ZfPVg6Uv0 GBf7dbC4czaMXce3Y1I1aUNpd7tp1YhzLWx7NMewDJBI70FWotMqkOFFoyfoxOh8J+xm uM7YxjLGG0WK4BH+RCfwk8J3hvpKMBDI/UP6KPs6FntV/J++cL5xfQ95OWQZUNw2ArHE kKbL6+81XkU2ZqRjsuqyM1/ppE20GtE7+cPLB6XijSQrocB5fY9dQKZzAJtC8TRigR2D VMtzO+p/ddQxNb1N/OhBBClMNT/ykqq+H2JAafAZNjX3IEYqbnzlA7lOI8ZkjylKtZwa 08BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=w8X3UASC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si5711481pll.151.2019.05.16.13.21.15; Thu, 16 May 2019 13:21:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=w8X3UASC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726342AbfEPQyy (ORCPT + 99 others); Thu, 16 May 2019 12:54:54 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:46295 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfEPQyy (ORCPT ); Thu, 16 May 2019 12:54:54 -0400 Received: by mail-qk1-f193.google.com with SMTP id a132so2644535qkb.13 for ; Thu, 16 May 2019 09:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=RSXji2gu6PTmCCcGE3ApJyZXicrhpNir4c6ptrlMBZw=; b=w8X3UASCEUM3vJvJ4NqGiATkR0s8WmNbhjJJSUDD4HQ5v2XUQijD5IJAoCIwFIhnIj yNJkhZYd7EOu7n7SoaVlYcXwxxjQKwyi/SFjLgKx66liMvMlrocYvplC/NEHCFvtfN1k Lhu4GdtukplsBg9cVyo/2p/lF/duxEKZhUOyrWibtP6yVb/v7XY3D179ye4XGcdRUpvw VBtXRW73769UYS9SMc3eo16qzfMNhEBSNnpV/FNMxkacKLujZ4mbEiM4GLZfmWc/0mh6 8V2onWzspsxdE4pGSB/44M+XrNRnL3RHDWgg+m1CIMruHaQFLlgAPhErMXplm+cg6ZnC pT+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=RSXji2gu6PTmCCcGE3ApJyZXicrhpNir4c6ptrlMBZw=; b=SCMmREu0NOtE7Db0YSJbyuiQkETcOXrqiM/jnrSlkG2wTn7xj4DxPjXLo5/nXzy/gE fNuR8f69kQrDXMqzTMoI/hnLx5UjE2xWSNMo0NlEcOnuXeKW1YI6w6baPu1WLL7jZ7yo PDSYm1LnUX/czKuAzLf8s+iXOYlI2NqxFNRdIc2jKD3AleAOjHHCNo9zjKIc8eXDqsRL NErLrNlPzxV8Y3m7+BiHMgBX4okaGkj8ydf6j7tcp6pJ+9fCnP9G7Rm3y8GOyAaLFZxs tv3T42PEo+2YY/7Z5Qo12mwpQyYySoxRJ1agsVeoxTbjUGhiy1xKU2CY24Y21V1SNM79 B5YQ== X-Gm-Message-State: APjAAAWVDJgwkZnQQB7Yf5HIHLStvoCepWFOHfMP981nimy53lM4l/hH lImCNetasRc+T1UDL/n4tKWaPg== X-Received: by 2002:a05:620a:144c:: with SMTP id i12mr12814987qkl.243.1558025693089; Thu, 16 May 2019 09:54:53 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id 91sm2696400qte.38.2019.05.16.09.54.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 16 May 2019 09:54:52 -0700 (PDT) Date: Thu, 16 May 2019 09:54:26 -0700 From: Jakub Kicinski To: Krzesimir Nowak Cc: bpf@vger.kernel.org, Iago =?UTF-8?B?TMOzcGV6?= Galeiras , "Alban Crequy (Kinvolk)" , Shuah Khan , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrey Ignatov , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ogerlitz@mellanox.com Subject: Re: [PATCH bpf v1 2/3] selftests/bpf: Print a message when tester could not run a program Message-ID: <20190516095426.2e0d838f@cakuba.netronome.com> In-Reply-To: References: <20190515134731.12611-1-krzesimir@kinvolk.io> <20190515134731.12611-3-krzesimir@kinvolk.io> <20190515144537.57f559e7@cakuba.netronome.com> <20190516085035.3cdb0ae6@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 May 2019 18:21:32 +0200, Krzesimir Nowak wrote: > On Thu, May 16, 2019 at 5:51 PM Jakub Kicinski wrote: > > On Thu, 16 May 2019 11:29:39 +0200, Krzesimir Nowak wrote: > > > > > diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c > > > > > index ccd896b98cac..bf0da03f593b 100644 > > > > > --- a/tools/testing/selftests/bpf/test_verifier.c > > > > > +++ b/tools/testing/selftests/bpf/test_verifier.c > > > > > @@ -825,11 +825,20 @@ static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val, > > > > > tmp, &size_tmp, &retval, NULL); > > > > > if (unpriv) > > > > > set_admin(false); > > > > > - if (err && errno != 524/*ENOTSUPP*/ && errno != EPERM) { > > > > > - printf("Unexpected bpf_prog_test_run error "); > > > > > - return err; > > > > > + if (err) { > > > > > + switch (errno) { > > > > > + case 524/*ENOTSUPP*/: > > > > > + printf("Did not run the program (not supported) "); > > > > > + return 0; > > > > > + case EPERM: > > > > > + printf("Did not run the program (no permission) "); > > > > > + return 0; > > > > > > > > Perhaps use strerror(errno)? > > > > > > As I said in the commit message, I open-coded those messages because > > > strerror for ENOTSUPP returns "Unknown error 524". > > > > Ah, sorry, missed that. I wonder if that's something worth addressing > > in libc, since the BPF subsystem uses ENOTSUPP a lot. > > The "not supported" errno situation seems to be a mess. There is an > ENOTSUP define in libc. ENOTSUP is usually defined to be EOPNOTSUPP > (taken from kernel), which in turn seems to have a different value > (95) than kernel's ENOTSUPP (524). Adding ENOTSUPP (with two Ps) to > libc would only add to the confusion. So it's kind of meh and I guess > people just moved on with workarounds. Yes, ENOTSUP is never used in the kernel, but it's a mess. This commit a while ago said ENOTSUPP is from NFS: commit 423b3aecf29085a52530d4f9167c56a84b081042 Author: Or Gerlitz Date: Thu Feb 23 12:02:41 2017 +0200 net/mlx4: Change ENOTSUPP to EOPNOTSUPP As ENOTSUPP is specific to NFS, change the return error value to EOPNOTSUPP in various places in the mlx4 driver. Signed-off-by: Or Gerlitz Suggested-by: Yotam Gigi Reviewed-by: Matan Barak Signed-off-by: Tariq Toukan Signed-off-by: David S. Miller But it's spreading throughout the kernel like a wildfire, I counted 1364 in my tree :/ Some are in tools/, but still. My understanding was that system calls should never return values above 512, but I'm probably wrong about that. Given the popularity, and the fact its an ABI at this point, we probably have no choice but to add it to libc, but to be clear IMO it's not a blocker for your patches.