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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 644C7C47258 for ; Fri, 1 May 2020 13:57:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 432302051A for ; Fri, 1 May 2020 13:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588341446; bh=u3WJmEf+Y+rA88Fg6ye7fFbRzFH5LlMsn1YCXE2XJ+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hbJZUNjHctKvfS4rloNRA0eK32fKWQjyQoXVhfrrGRRM8S+7eF7c8PFpYD/S2gJ1J KTFq87TFBN1jP2xHj+kS0nrL7bcxqSAUfws15uyrVJkvF6Rq81gk76yQ5ugzwNJIUH X7Y+ytGqFpsr7mr/hEZOc7rKQSssh7PRMVgCZpcU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729271AbgEANbX (ORCPT ); Fri, 1 May 2020 09:31:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730114AbgEANbV (ORCPT ); Fri, 1 May 2020 09:31:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E647C24953; Fri, 1 May 2020 13:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588339881; bh=u3WJmEf+Y+rA88Fg6ye7fFbRzFH5LlMsn1YCXE2XJ+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U1sEYvQr1RXf4vmeZ7BQIFXjiG+fZ+0K7QPBiCiOabOxzhF+5NnFZDepZFPq9xYq1 9iUcTrG9nlKmxGjdHQ/2Te+1to3TKO9MyKui33C81UT/6YRCifN83wGiYhLr3OY/aM BfiqBHwUo//HUhttQv+/OzbpMeEt7/aX3zBdAZ74= 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 , Guenter Roeck Subject: [PATCH 4.14 004/117] keys: Fix the use of the C++ keyword "private" in uapi/linux/keyctl.h Date: Fri, 1 May 2020 15:20:40 +0200 Message-Id: <20200501131545.904633704@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131544.291247695@linuxfoundation.org> References: <20200501131544.291247695@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 From: David Howells commit 2ecefa0a15fd0ef88b9cd5d15ceb813008136431 upstream. 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 Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- include/uapi/linux/keyctl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- 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; };