Received: by 2002:a25:4b06:0:0:0:0:0 with SMTP id y6csp14500yba; Fri, 8 May 2020 05:07:33 -0700 (PDT) X-Google-Smtp-Source: APiQypJgxjvjrDXZ7RRtNC3OZmqvtzkvsTRqcsSA1rAc5JOvpz5Fd1vfOWj1xXP/H2XzK5KGwgo1 X-Received: by 2002:a17:906:16d0:: with SMTP id t16mr1516941ejd.303.1588939652859; Fri, 08 May 2020 05:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588939652; cv=none; d=google.com; s=arc-20160816; b=ZEzTvCvYc6ZvCG4XXNYcAaFt72HFKcoNOwJR7HlFXliCwSakYNyjWxMCiBsnRXzCLt Z5bwtkjyp+uhT9SqQ6EiZSaOlDTdjOJ8ziUKnhsqdHn8AcOCw7ayxb3jbMTepSSQ0GyQ LzUgtXqZxWKXUfGsW6o27B8gXWLExdc1mixYMVcrI27n8opEh24kR3mcWzUn5QZMBWdO 2fYWBfc1t0KA5C89C+W6e7Fw5/mUOMalpmLKPeGo+duBzMQRlV4+jzTwg7OyNcQbu6zM kA8r6NSWITa994Sv5FvYRA9DA6rZ4Mk6BcHuitc/iJoHIv2+wQwL9fI7qyKlkKtan5pf 9uLQ== 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 :message-id:date:subject:cc:to:from; bh=C3xzhZ5C6GlT07a/ia7PlZqqnaBsQpneWc2LC6xKisk=; b=yoCU+2INNclDMzhSVcuE3Acf0dsRqf435fQJC+yJX6o0oQAtSETExSxzeeWH/jmjag jEDpDgzArHkjFAeQi960endvcZW56Oy8gt0YVpxnx6xA/XUzjkqCvLcbS0K55g9kbJZK EhbqIYjunEOqqTmVjR0xNpFKlq3MsysQlEUpTO+8ogrgdWLL1sCoGggIUyV5Z+3deJSi XUOitohIhkB7d4TZQavLbie7T81o82eQeAkvfEY/OTHhaxyRkWgC3LE8baK6UFc6SLq2 u7/pjyyS0VkAETKXnq2WukxtwB+oTjg6JHkH8Vt/rfou8y/hr10pqJ/PwGwbw9sTfdX0 GNgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si823167edf.138.2020.05.08.05.07.09; Fri, 08 May 2020 05:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbgEHMFW (ORCPT + 99 others); Fri, 8 May 2020 08:05:22 -0400 Received: from 4.mo2.mail-out.ovh.net ([87.98.172.75]:49657 "EHLO 4.mo2.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726616AbgEHMFW (ORCPT ); Fri, 8 May 2020 08:05:22 -0400 Received: from player773.ha.ovh.net (unknown [10.110.103.132]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id A695C1D602B for ; Fri, 8 May 2020 14:05:19 +0200 (CEST) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player773.ha.ovh.net (Postfix) with ESMTPSA id C44C5123D2ECB; Fri, 8 May 2020 12:05:13 +0000 (UTC) From: Stephen Kitt To: "David S . Miller" , Joe Perches , Jakub Kicinski , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH v2] net: Protect INET_ADDR_COOKIE on 32-bit architectures Date: Fri, 8 May 2020 14:04:57 +0200 Message-Id: <20200508120457.29422-1-steve@sk2.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 5404038079545232676 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrkedvgdegjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepufhtvghphhgvnhcumfhithhtuceoshhtvghvvgesshhkvddrohhrgheqnecuggftrfgrthhtvghrnhepteegudfgleekieekteeggeetveefueefteeugfduieeitdfhhedtfeefkedvfeefnecukfhppedtrddtrddtrddtpdekvddrieehrddvhedrvddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejjeefrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit c7228317441f ("net: Use a more standard macro for INET_ADDR_COOKIE") added a __deprecated marker to the cookie name on 32-bit architectures, with the intent that the compiler would flag uses of the name. However since commit 771c035372a0 ("deprecate the '__deprecated' attribute warnings entirely and for good"), __deprecated doesn't do anything and should be avoided. This patch changes INET_ADDR_COOKIE to declare a dummy struct so that any subsequent use of the cookie's name will in all likelihood break the build. It also removes the __deprecated marker. Signed-off-by: Stephen Kitt --- Changes since v1: - use a dummy struct rather than a typedef include/net/inet_hashtables.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index ad64ba6a057f..889d9b00c905 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -301,8 +301,9 @@ static inline struct sock *inet_lookup_listener(struct net *net, ((__sk)->sk_bound_dev_if == (__sdif))) && \ net_eq(sock_net(__sk), (__net))) #else /* 32-bit arch */ +/* Break the build if anything tries to use the cookie's name. */ #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ - const int __name __deprecated __attribute__((unused)) + struct {} __name __attribute__((unused)) #define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif, __sdif) \ (((__sk)->sk_portpair == (__ports)) && \ -- 2.20.1