Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1359020ybl; Wed, 28 Aug 2019 13:29:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCFNd8I3U6Bs4RZ4kPDj8S+AHl+wLHp251he5Ybz3sy7tg3VnfSRUzOaKTbGtXoMhVPTew X-Received: by 2002:a17:90a:234f:: with SMTP id f73mr6211649pje.130.1567024189013; Wed, 28 Aug 2019 13:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567024189; cv=none; d=google.com; s=arc-20160816; b=0Eeoo6u6XKxBHeM5f4Bh2UWqL0mfH8eTUVtO51Tytf8JOJxLeHqBfL/CvKKyZcwN9g KiPgHuHMARgSNz62fYCDJlOhQCgnzqXsjZuh90d2w+/uzU2JyTpaPqWN5jH/qsLShPwj icy/JuVRVZ3QsJqoBwa6rNCxcQMEqdUTMoFQXrd6AOQ+pU2PEJ0DkZqj1EsPX6TH6Yrc HL4uxrrc4c164Wswtc/YIVYMf7stMT4NCncrSkP1Qd2ffaAB81YJUm7pmgeDFeFiE6h+ qUReUnyZ/Mr8ztt26fMin+9/+XxjsSnCy2kKKznxeUeCGxw0x/5rzrsdZ4rZo2ydPA5B mYkA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=cmRW6jjgAdQ/pI2K1z+qmpciob5l5F6PyrgR0i3tVY0=; b=PcCnfoehM5bMfgJzn674EtsnNDCNr0vTpe75eaB+qK5qwA2NzH6BX0sIp0DIoSZNsO 24ZrsAio4N0YtK21i+V7sAQgTVE/rbKHqtC1aYD97XikBvEb8yZVXHj8R4NLGUNSCmR+ BkETupukh8V7wZFlRmqyTlWTmRphKRIyBgK6ArFOGNmB9RBH3jZZSaFH48eb7Ofp5F5a bOs53A99uWF7RctSoCbZ5pPaJ5xfYwz+EN+TSdd/W6TOTHFZ3QJEf7A8wDpEzpdf1cZO eTfHHWUuJW2rUE3Gy+nLvBwpbdrSeqUraI1PP5W2OEQf0b52axDeG6CVyyh6MzFfBt0a +tjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 y1si5165plr.164.2019.08.28.13.29.33; Wed, 28 Aug 2019 13:29:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbfH1U2v (ORCPT + 99 others); Wed, 28 Aug 2019 16:28:51 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:42268 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbfH1U2t (ORCPT ); Wed, 28 Aug 2019 16:28:49 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.1) (envelope-from ) id 1i34Yf-0000AZ-9X; Wed, 28 Aug 2019 22:28:45 +0200 Message-ID: <8fc1716ca0dd522b7149160be02aed5f8cd1c882.camel@sipsolutions.net> Subject: Re: [PATCH v2] cfg80211: add local BSS receive time to survey information From: Johannes Berg To: Marcel Holtmann Cc: Felix Fietkau , linux-wireless@vger.kernel.org Date: Wed, 28 Aug 2019 22:28:43 +0200 In-Reply-To: References: <20190828102042.58016-1-nbd@nbd.name> <9189B2C1-6E5B-4457-9354-A010F946EE33@holtmann.org> <18c4232675c7b4f13fbfe9e5d8e9364a0908f316.camel@sipsolutions.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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