From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1778) id 01BA13860C38; Wed, 29 Jul 2020 18:35:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01BA13860C38 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Aurelien Jarno To: glibc-cvs@sourceware.org Subject: [glibc/release/2.31/master] Disable warnings due to deprecated libselinux symbols used by nss and nscd X-Act-Checkin: glibc X-Git-Author: Arjun Shankar X-Git-Refname: refs/heads/release/2.31/master X-Git-Oldrev: 6f3459f9859a7b506c64fa1823769ab631072c6e X-Git-Newrev: 21b760cc2fa2c83bc9746ff315686c0c98e15415 Message-Id: <20200729183525.01BA13860C38@sourceware.org> Date: Wed, 29 Jul 2020 18:35:24 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2020 18:35:25 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=21b760cc2fa2c83bc9746ff315686c0c98e15415 commit 21b760cc2fa2c83bc9746ff315686c0c98e15415 Author: Arjun Shankar Date: Thu Jul 23 12:20:38 2020 +0200 Disable warnings due to deprecated libselinux symbols used by nss and nscd The SELinux API deprecated several symbols in its 3.1 release, including security_context_t, matchpathcon, avc_init, and sidput, which are used in makedb and nscd. While the usage of these should eventually be replaced by newer interfaces, this commit disables GCC warnings due to the use of the above symbols. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell (cherry picked from commit 04726be814c6fd6d9cf974e15d684dd3ac1a180e) Diff: --- nscd/selinux.c | 15 +++++++++++++++ nss/makedb.c | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/nscd/selinux.c b/nscd/selinux.c index a4ea8008e2..1ebf924826 100644 --- a/nscd/selinux.c +++ b/nscd/selinux.c @@ -33,6 +33,7 @@ #ifdef HAVE_LIBAUDIT # include #endif +#include #include "dbg_log.h" #include "selinux.h" @@ -320,6 +321,12 @@ avc_free_lock (void *lock) } +/* avc_init (along with several other symbols) was marked as deprecated by the + SELinux API starting from version 3.1. We use it here, but should + eventually switch to the newer API. */ +DIAG_PUSH_NEEDS_COMMENT +DIAG_IGNORE_NEEDS_COMMENT (10, "-Wdeprecated-declarations"); + /* Initialize the user space access vector cache (AVC) for NSCD along with log/thread/lock callbacks. */ void @@ -335,7 +342,14 @@ nscd_avc_init (void) audit_init (); #endif } +DIAG_POP_NEEDS_COMMENT + +/* security_context_t and sidput (along with several other symbols) were marked + as deprecated by the SELinux API starting from version 3.1. We use them + here, but should eventually switch to the newer API. */ +DIAG_PUSH_NEEDS_COMMENT +DIAG_IGNORE_NEEDS_COMMENT (10, "-Wdeprecated-declarations"); /* Check the permission from the caller (via getpeercon) to nscd. Returns 0 if access is allowed, 1 if denied, and -1 on error. @@ -422,6 +436,7 @@ out: return rc; } +DIAG_POP_NEEDS_COMMENT /* Wrapper to get AVC statistics. */ diff --git a/nss/makedb.c b/nss/makedb.c index 8e389a1683..8e1e8ec9ad 100644 --- a/nss/makedb.c +++ b/nss/makedb.c @@ -38,6 +38,7 @@ #include #include #include "nss_db/nss_db.h" +#include /* Get libc version number. */ #include "../version.h" @@ -841,6 +842,13 @@ print_database (int fd) #ifdef HAVE_SELINUX + +/* security_context_t and matchpathcon (along with several other symbols) were + marked as deprecated by the SELinux API starting from version 3.1. We use + them here, but should eventually switch to the newer API. */ +DIAG_PUSH_NEEDS_COMMENT +DIAG_IGNORE_NEEDS_COMMENT (10, "-Wdeprecated-declarations"); + static void set_file_creation_context (const char *outname, mode_t mode) { @@ -870,6 +878,7 @@ set_file_creation_context (const char *outname, mode_t mode) freecon (ctx); } } +DIAG_POP_NEEDS_COMMENT static void reset_file_creation_context (void)