Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8630364ybi; Tue, 23 Jul 2019 12:04:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpJ3MhfIGchwYqSWj4BW9dx/gHg9RSjiVnLcN9SGXuUJxEoP1Pb7LjCqxe+8+j2wGtM3a0 X-Received: by 2002:a65:654f:: with SMTP id a15mr75732292pgw.73.1563908687417; Tue, 23 Jul 2019 12:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563908687; cv=none; d=google.com; s=arc-20160816; b=UZG8k+aMjH7LhQg8UZBx5Q8LNQfwS+xWBmq2Zu0x0L5E5vwS8IXwqcXSKd6JBp7h9F a8kP8x6STHo4V7BtK36P1c2DFtseNbk0vLhCIeiI+ppc9++ZPPdHtLLUyNEn93p7neOS y9dbGvabvyfeFrS7gGWO6rN0iLrAq8ZuhQ3l8HiVI6R037tdTYT0dtpZptdrv3QN4O8l XOFbEsen1u6pwKHfyHrb6inD01vvJkgBL7IvzM7RKWgzzSmxPtHrBPW9oazugUlnjmY7 omVZejfRv2SAoawUQRFrWt3DszSnXVGSAJLtsMG7d3Vg8FK4hoblMG3ygPqUxLGCCAIn 7ihA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:organization :references:in-reply-to:date:cc:to:from:subject:message-id; bh=MLuo10PIqx4I0C2vzqQgiSmTm0DHnXvN2YVIsUY8SK4=; b=YJuOsIFgcYqQ/ZsoXwmcFhHMKco9tZAIIwOwBint3XOssX01YnSlqIGZzcs8sccKTd cQU+GkM8eVWMAYmiKGwvKve/13F0T7/k2T6sEi6KiRJpydkzmvkleqUOWS3WOYtULD2H 4RLyxOOsMTYomij/4NbwVOcbTjhlU+zyhOWuz/f6LZWzdPhgFKmkQGmhAoBZbEQE3gQi IV6J9wAgPhr3ODOm9fhx0EIFI6o1W6v/7E2O1oLuGqJ05ORNCa4u8LMKe7un+EVeMaTD l8LN0jnZjbtt+MDJtOvQ+nsQvFJego6C8X9CfSEKiU2viZ9+NQpPg3uI3rQVMi+9FfPS uWoQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e30si13421326pfm.78.2019.07.23.12.04.31; Tue, 23 Jul 2019 12:04:47 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730048AbfGWJ2N (ORCPT + 99 others); Tue, 23 Jul 2019 05:28:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41860 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbfGWJ2N (ORCPT ); Tue, 23 Jul 2019 05:28:13 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 718A4308421A; Tue, 23 Jul 2019 09:28:12 +0000 (UTC) Received: from ovpn-117-106.ams2.redhat.com (ovpn-117-106.ams2.redhat.com [10.36.117.106]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B1F15D9C5; Tue, 23 Jul 2019 09:28:09 +0000 (UTC) Message-ID: Subject: Re: [PATCH net-next v2 3/3] netlink: add validation of NLA_F_NESTED flag From: Thomas Haller To: Michal Kubecek , netdev@vger.kernel.org Cc: "David S. Miller" , Johannes Berg , David Ahern , linux-kernel@vger.kernel.org Date: Tue, 23 Jul 2019 11:28:03 +0200 In-Reply-To: <20190723090908.GA2204@unicorn.suse.cz> References: <6b6ead21c5d8436470b82ab40355f6bd7dbbf14b.1556806084.git.mkubecek@suse.cz> <0fc58a4883f6656208b9250876e53d723919e342.camel@redhat.com> <20190723090908.GA2204@unicorn.suse.cz> Organization: Red Hat Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-uB+G14xSU2RvYRVTrtZV" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 23 Jul 2019 09:28:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-uB+G14xSU2RvYRVTrtZV Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2019-07-23 at 11:09 +0200, Michal Kubecek wrote: > On Tue, Jul 23, 2019 at 10:57:54AM +0200, Thomas Haller wrote: > > Does this flag and strict validation really provide any value? > > Commonly a netlink message is a plain TLV blob, and the meaning > > depends entirely on the policy. > >=20 > > What I mean is that for example > >=20 > > NLA_PUT_U32 (msg, ATTR_IFINDEX, (uint32_t) ifindex) > > NLA_PUT_STRING (msg, ATTR_IFNAME, "net") > >=20 > > results in a 4 bytes payload that does not encode whether the data > > is > > a number or a string. > >=20 > > Why is it valuable in this case to encode additional type > > information > > inside the message, when it's commonly not done and also not > > necessary? >=20 > One big advantage of having nested attributes explicitly marked is > that > it allows parsers not aware of the semantics to recognize nested > attributes and parse their inner structure. >=20 > This is very important e.g. for debugging purposes as without the > flag, > wireshark can only recurse into nested attributes if it understands > the > protocol and knows they are nested, otherwise it displays them only > as > an opaque blob (which is what happens for most netlink based > protocols). > Another example is mnl_nlmsg_fprintf() function from libmnl which is > also a valuable debugging aid but without NLA_F_NESTED flags it > cannot > show message structure properly. Hi, I don't question the use of the flag. I question whether it's necessary for kernel to strictly require the sending side to aid debuggability. "e.g. for debugging purposes" makes it sound like it would be important for something else. I wonder what else. Anyway. What you elaborate makes sense!! Thanks My main point was to raise awareness that this is a problem for libnl3. best, Thomas --=-uB+G14xSU2RvYRVTrtZV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEESep8Zw4IUOdBlRT2KcI2bk38VygFAl020yMACgkQKcI2bk38 Vygegg//bjBYvpsSC7cGBhu9f7Eysloqq9pL8gVujgicZwpVU/vtK3MlieaUEoYU Dm04WNKYXh7cIiD6k0BBvKnyG9wB3xEUr90PvvFn7Q5hUqLipO4boZ4fvNy5R9qA bfteE9nfcwuz65XxIHgjZGnKoR8Xf3N4F9SuLNJIs0hyJLBeEyjjrcHDw0vwnvDF z838zDyY9QnOlNYrpFKjeanRv+Wk3sdvKAfuXEcs8v/JV+wj6N7K+WM04Tx1x1XW pC+Pw4JTj3mqO3wRWzyDJKkVQcwf1MJlhJEpHRXNQlINJ0OUNacretzySMA7Q1uG 6sChzfMK9mt3KjjyN17qZYlAz4PxqXarl9Q+j6nix5zRDsXy6xsjTigAZIH0j9zN DPh9Q8htI4Re1m6GXhwaNthpHJgjyMRhWVJ5FJRRtnUHsMRUBREiDmSsoAEZe7ac BXVffSYtfaT78NaIubqUT3D5Ab0pJPNPqjf15779nI/UAyCByXZFnCo3fJYnC1JC 6Yv7hlJY9KneSSmbJ/Iz0D0VMJQi9FhoboMLCvAD0yJO0MS6X8q9ozWRSFeIsNJ8 CeO9/JKIORS7cyQb8s6DnkUrGIW121lxCmzzHWViZXBQ+VXe2jc2gWzKK0NY8N0F EegOD736E/ZkOlEQBBR7QJ63tkc97q1xAg14hRL2rQWH2FH3z5I= =poN7 -----END PGP SIGNATURE----- --=-uB+G14xSU2RvYRVTrtZV--