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.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 653E6C4CEC5 for ; Fri, 13 Sep 2019 13:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B22F208C2 for ; Fri, 13 Sep 2019 13:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380347; bh=M+v2Cj/tTTedh66FI140lfs8CvMvkDan5ezh2dq2XJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zbZTb5obI/hv9i2ls1UKzPv3H0ctKrIqkloGA5BaNTbRlkHx9ScsW4VmP4aiMVfJ6 rYkjN/4Kt2W5SfWbNcxVaW7VQ5Bs2vT0BwIdfnKszKIQdHlqboewjZsz0eooB4hnpZ V2Ff5bUx2IRj7I+vSn/GKsJnPVjmHlvjZXEHlg10= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389147AbfIMNM0 (ORCPT ); Fri, 13 Sep 2019 09:12:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389142AbfIMNMZ (ORCPT ); Fri, 13 Sep 2019 09:12:25 -0400 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B650206BB; Fri, 13 Sep 2019 13:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568380344; bh=M+v2Cj/tTTedh66FI140lfs8CvMvkDan5ezh2dq2XJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfwPpAdGE/lSpDw/sB3PAueq1YVn66TsZsg1fsfLhQYb3wsp53em/0slNwVUGC/LJ ffsYHwGm6uEEvzV3b/9ONZrBrVJcEOyW1W4pHm9NU4Yq5nJRkdlIfinaDuDIQxc88j 0pEOt304ES2N3H7RZle0278ArL+Wmd07YMfc2KzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Randy Dunlap , Lubomir Rintel , James Morris , Mat Martineau , Stephan Mueller , Andrew Morton , Linus Torvalds , James Morris , Sasha Levin Subject: [PATCH 4.19 034/190] keys: Fix the use of the C++ keyword "private" in uapi/linux/keyctl.h Date: Fri, 13 Sep 2019 14:04:49 +0100 Message-Id: <20190913130602.388568147@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913130559.669563815@linuxfoundation.org> References: <20190913130559.669563815@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ 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