lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240103174719.2b2c1565@kernel.org>
Date: Wed, 3 Jan 2024 17:47:19 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Lin Ma <linma@....edu.cn>
Cc: jk@...econstruct.com.au, matt@...econstruct.com.au, davem@...emloft.net,
 edumazet@...gle.com, pabeni@...hat.com, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v1] net: mctp: use deprecated parser in
 mctp_set_link_af

On Thu, 28 Dec 2023 15:02:58 +0800 Lin Ma wrote:
> In mctp set_link_af implementation `mctp_set_link_af`, it uses strict
> parser nla_parse_nested to parse the nested attribute. This is fine in
> most cases but not here, as the rtnetlink uses *bad magic* in setlink
> code, see code snippet in function `do_setlink`.
> 
>   nla_for_each_nested(af, tb[IFLA_AF_SPEC], rem) {
>     const struct rtnl_af_ops *af_ops;
>     BUG_ON(!(af_ops = rtnl_af_lookup(nla_type(af)))); <= (1)
>     err = af_ops->set_link_af(dev, af, extack);       <= (2)
> 
> That is, in line (1), the attribute type of af will used to look up the
> af_ops, and for MCTP case will use AF_MCTP here to get mctp_af_ops.
> Therefore, the attribute with type AF_MCTP will never survive in the
> check within the nla_parse_nested.
> 
>   if (!(nla->nla_type & NLA_F_NESTED)) {  <= nla_type is AF_MCTP
>     NL_SET_ERR_MSG_ATTR(extack, nla, "NLA_F_NESTED is missing");
>     return -EINVAL;  <= always invalid
>   }
> 
> For other set_link_af users IPV4 and IPV6 both make a trick here by
> using nla_parse_nested_deprecated, which will check the NLA_F_NESTED
> then able to use this type field as family value. This patch simply port
> the MCTP code also to deprecated parser to make it work.

Did you test this? It's a suspiciously detailed and yet seemingly
incorrect explanation..
-- 
pv-bot: s
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ