Search Linux Wireless

Re: [PATCH v2] cfg80211: add local BSS receive time to survey information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2019-08-28 at 22:24 +0200, Marcel Holtmann wrote:
> Hi Johannes,
> 
> > > > No, as usual, that would break ABI. PAD is a regular attribute, just
> > > > empty and ignored for aligning 64-bit values.
> > > 
> > > then I do not grok on how the nla_put_u64_64bit works, but that is
> > > fine.
> > > 
> > > I assumed these are similar to the NL80211_SURVEY_INFO_MAX which we
> > > also always move, but also not expected to be part of the API as a
> > > fixed value.
> > 
> > No no, the _MAX is just the token we use for knowing what we want as the
> > maximum when parsing etc.
> > 
> > The _PAD is actually a real attribute, basically nla_put_u64_64bit()
> > will do "nla_put_flag(_PAD)" if and only if "offset % 8 == 0", in order
> > to actually 64-bit align the 64-bit value in the following attribute.
> > 
> > (Note that offset % 8 can only be 0 or 4, due to the way netlink
> > attributes work.)
> 
> I get that part now. So the kernel is inserting a _PAD, but userspace
> is still not doing that. 

Yeah, and I forgot to say - if we renumbered _PAD, then newer userspace
would think old kernel's _PAD is really _BSS_RX, so things would break.

> So for NL80211_ATTR_WDEV we should be doing the same actually?

Not really. The kernel doesn't rely on it, nla_get_u64() uses
nla_memcpy() so doesn't care about alignment.

Even userspace doesn't (usually) rely on the alignment, it also
typically uses nla_get_u64() from libnl which also uses nla_memcpy() or
memcpy() (depending on the version), so it's all not really necessary.

I think some libraries or tools like maybe iproute2 didn't do it
correctly and just dereferenced a pointer there, causing alignment
violations, and so basically the decision was to get rid of unaligned
64-bit attributes to prevent that once and for all.

johannes




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux