Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp99725imm; Thu, 27 Sep 2018 16:53:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV61oeXOGub8A2aF4TI0A05o9r4QkemKGTWXqUVeDtQjdYPppsDVlGdWAj81bY4Q8wxiVjdDf X-Received: by 2002:a63:646:: with SMTP id 67-v6mr11819730pgg.230.1538092402463; Thu, 27 Sep 2018 16:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538092402; cv=none; d=google.com; s=arc-20160816; b=I7SAb9lkpZrNlrUpjKV7+D11DQhfa4xHiZ9ZXBJxjQCPiH7ifp8lqsKWfvwNy9evbd PEAGshET+iLONnbdohy82Fb13Ah8ZY5yrDJJwsHJl5UGpgcJt/M1dlsZ9Y1068eOXw+4 lmlMzLK25Z/JyKwGwY611D6v6QDP8PK2i+4H/kvrwiwzrPG8baRJWIj+5pKfyeNWTWYS 08YaWSWAE9s1n2ZBYR83ImRagNr1DG8Rda5KQQVUkzcP0cHgw0h2h1uMCCW7WJtESLX4 I6s0UJOaJU2IGyT6mlPpow0I8MBkcxensSUDkyeBkuxL1QlcBxsZZruerHlWWTRiS/Xa GZkw== 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:message-id:date:cc:to:from:subject:organization; bh=+vDtVFyBV0XsPU02GN8y+jyyTTKBDcFuLzCROrgz1ms=; b=YlICgZBO9jBOGrcqknJ3aI9ds+6TMqfnEX0gmF+p//OuRYfXQP1fwG87efxmQSK6Og tetveCeO3ewYLYI4CqrFjU1u7NZ6JrwxNsdmwYLmgZi3qOnFSYDdLq2z4aDe/1Rn/k7Y vZ4ez013/IEQj3UNcqHLRLo9DE3+kbPSyizpvNa4lxV4xuU/dcIsQxhHlRxDtaxQzIPJ gatnphjYZXgwAOXyscs03m6fbLjRC5xUBfA84I36Idb51N4NzR55tSeVw7bzX+Xa88wJ F/ysPTD15lXUTi3+djB/rSWaxSMQcCihHja/vGlGfT1gXQAEgKdB7ZNwU4J6FmliN1GG ygSw== 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 b9-v6si3252615pgl.446.2018.09.27.16.53.06; Thu, 27 Sep 2018 16:53:22 -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 S1727093AbeI1GMO (ORCPT + 99 others); Fri, 28 Sep 2018 02:12:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47042 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbeI1GMO (ORCPT ); Fri, 28 Sep 2018 02:12:14 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E165B86647; Thu, 27 Sep 2018 23:51:23 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-123-84.rdu2.redhat.com [10.10.123.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19A682010D58; Thu, 27 Sep 2018 23:51:20 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH] keys: Fix the use of the C++ keyword "private" in uapi/linux/keyctl.h From: David Howells To: jmorris@namei.org Cc: Randy Dunlap , Lubomir Rintel , Mat Martineau , Stephan Mueller , Andrew Morton , Linus Torvalds , stable@vger.kernel.org, dhowells@redhat.com, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, lkundrak@v3.sk, rdunlap@infradead.org, linux-kernel@vger.kernel.org Date: Fri, 28 Sep 2018 00:51:20 +0100 Message-ID: <153809228025.23030.6619415372705612845.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 27 Sep 2018 23:51:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The keyctl_dh_params struct in uapi/linux/keyctl.h contains the symbol "private" which means that the header file will cause compilation failure if #included in to a C++ program. Further, the patch that added the same struct to the keyutils package named the symbol "priv", not "private". The previous attempt to fix this (commit 8a2336e549d3) did so by simply renaming the kernel's copy of the field to dh_private, but this then breaks existing userspace and as such has been reverted (commit 8c0f9f5b309d). [And note, to those who think that wrapping the struct in extern "C" {} will work: it won't; that only changes how symbol names are presented to the assembler and linker.]. Instead, insert an anonymous union around the "private" member and add a second member in there with the name "priv" to match the one in the keyutils package. The "private" member is then wrapped in !__cplusplus cpp-conditionals to hide it from C++. Fixes: ddbb41148724 ("KEYS: Add KEYCTL_DH_COMPUTE command") Fixes: 8a2336e549d3 ("uapi/linux/keyctl.h: don't use C++ reserved keyword as a struct member name") Signed-off-by: David Howells cc: Randy Dunlap cc: Lubomir Rintel cc: James Morris cc: Mat Martineau cc: Stephan Mueller cc: Andrew Morton cc: Linus Torvalds cc: stable@vger.kernel.org --- include/uapi/linux/keyctl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h index 7b8c9e19bad1..0f3cb13db8e9 100644 --- a/include/uapi/linux/keyctl.h +++ b/include/uapi/linux/keyctl.h @@ -65,7 +65,12 @@ /* keyctl structures */ struct keyctl_dh_params { - __s32 private; + union { +#ifndef __cplusplus + __s32 private; +#endif + __s32 priv; + }; __s32 prime; __s32 base; };