From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5AB5C3A5A2 for ; Tue, 3 Sep 2019 16:39:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BCC0233A1 for ; Tue, 3 Sep 2019 16:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567528785; bh=8O/nJ8QsWRakObntQlxlpgwBzmx15+PaEmBLe0UqJvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NPtahydiyx2Ye6DbT/3F2h/VFc3/yvMx5BbLcl+ChhmA1NQ/fyNd+ic6zw3mtzmco k90QqEhwuZvtMmiFj3bZYQNmM3tuE9uz9pp4SPJfHadE5ky0hXlb49oi4hQNSyp+1W dEDuHbfQRG1UuvDvZ1uyNnjN3QViLih/CP+JMjwE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731465AbfICQjo (ORCPT ); Tue, 3 Sep 2019 12:39:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:45656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730402AbfICQZb (ORCPT ); Tue, 3 Sep 2019 12:25:31 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 41FC12377F; Tue, 3 Sep 2019 16:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567527930; bh=8O/nJ8QsWRakObntQlxlpgwBzmx15+PaEmBLe0UqJvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yEJb1tIBTTEVop6iIZjIc/ueqiFD9kKfXkAKuUrugFNiENnSMfjTodlzp6y5tDxg0 AB0U3zplzxrvkx7MxN0yOwonn/URhhYpQ82d72HnWmpdMretcsQLedGFd9gfPssCqh R+2VVFop9JTvgAm5nN6gONvcCXjqKdHvJIYSkvRU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: David Howells , Randy Dunlap , Lubomir Rintel , James Morris , Mat Martineau , Stephan Mueller , Andrew Morton , Linus Torvalds , James Morris , Sasha Levin , keyrings@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 005/167] keys: Fix the use of the C++ keyword "private" in uapi/linux/keyctl.h Date: Tue, 3 Sep 2019 12:22:37 -0400 Message-Id: <20190903162519.7136-5-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190903162519.7136-1-sashal@kernel.org> References: <20190903162519.7136-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells [ Upstream commit 2ecefa0a15fd0ef88b9cd5d15ceb813008136431 ] 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 Signed-off-by: James Morris Signed-off-by: Sasha Levin --- 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 7b8c9e19bad1c..0f3cb13db8e93 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; }; -- 2.20.1