From owner-svn-src-head@freebsd.org Tue Feb 11 18:13:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E71423E30E; Tue, 11 Feb 2020 18:13:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48H9rf3G7sz4Qj1; Tue, 11 Feb 2020 18:13:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B3B1C367; Tue, 11 Feb 2020 18:13:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01BIDsp6072297; Tue, 11 Feb 2020 18:13:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01BIDsgZ072296; Tue, 11 Feb 2020 18:13:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202002111813.01BIDsgZ072296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 11 Feb 2020 18:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357766 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 357766 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Feb 2020 18:13:54 -0000 Author: mjg Date: Tue Feb 11 18:13:53 2020 New Revision: 357766 URL: https://svnweb.freebsd.org/changeset/base/357766 Log: capsicum: restore the cap_rights_contains symbol It is expected to be provided by libc. PR: 244033 Reported by: Jan Kokemueller Modified: head/sys/kern/subr_capability.c head/sys/sys/capsicum.h Modified: head/sys/kern/subr_capability.c ============================================================================== --- head/sys/kern/subr_capability.c Tue Feb 11 18:03:45 2020 (r357765) +++ head/sys/kern/subr_capability.c Tue Feb 11 18:13:53 2020 (r357766) @@ -394,3 +394,27 @@ cap_rights_remove(cap_rights_t *dst, const cap_rights_ return (dst); } + +#ifndef _KERNEL +bool +cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little) +{ + unsigned int i, n; + + assert(CAPVER(big) == CAP_RIGHTS_VERSION_00); + assert(CAPVER(little) == CAP_RIGHTS_VERSION_00); + assert(CAPVER(big) == CAPVER(little)); + + n = CAPARSIZE(big); + assert(n >= CAPARSIZE_MIN && n <= CAPARSIZE_MAX); + + for (i = 0; i < n; i++) { + if ((big->cr_rights[i] & little->cr_rights[i]) != + little->cr_rights[i]) { + return (false); + } + } + + return (true); +} +#endif Modified: head/sys/sys/capsicum.h ============================================================================== --- head/sys/sys/capsicum.h Tue Feb 11 18:03:45 2020 (r357765) +++ head/sys/sys/capsicum.h Tue Feb 11 18:13:53 2020 (r357766) @@ -344,7 +344,7 @@ cap_rights_t *cap_rights_merge(cap_rights_t *dst, cons cap_rights_t *cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); void __cap_rights_sysinit(void *arg); - +#ifdef _KERNEL /* * We only support one size to reduce branching. */ @@ -390,6 +390,9 @@ cap_check_inline_transient(const cap_rights_t *havep, return (1); return (0); } +#else +bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little); +#endif __END_DECLS struct cap_rights_init_args {