aboutsummaryrefslogtreecommitdiff
path: root/lib/libcasper/services/cap_grp
Commit message (Collapse)AuthorAgeFilesLines
* libcasper: fix warnings when _ALIGN preserves typesBrooks Davis2025-12-101-2/+2
| | | | | | | | | | | Without the void * casts, the compiler complains about an alignment requirement increase. Reviewed by: kib, markj Obtained from: CheriBSD Effort: CHERI upstreaming Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D53946
* libcasper: Move everything to the libcasper packageLexi Winter2025-11-051-2/+0
| | | | | | | | | | | | The libcasper package exists to contain libcasper, but for some reason only the libcap_net service was in the package, with libcasper itself and the rest of the services being in runtime. Move everything to the libcasper package, except tests which stay in the tests package. MFC after: 1 day Reviewed by: emaste Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D53576
* manuals: Misc syntax fixesGraham Percival2024-10-071-1/+1
| | | | | | | | | | | | | | | These were reported by `mandoc -T lint ...` as errors. The rendered output (in ascii and html) is not affected by this commit. Additional clarification: there was a non-breaking space in lib/libcasper/services/cap_grp/cap_grp.3. Signed-off-by: Graham Percival <gperciva@tarsnap.com> Reviewed by: mhorne MFC after: 3 days Sponsored by: Tarsnap Backup Inc. Pull Request: https://github.com/freebsd/freebsd-src/pull/1449
* Remove "All Rights Reserved" from FreeBSD Foundation copyrightsEd Maste2024-07-303-3/+0
| | | | | | | These ones were unambiguous cases where the Foundation was the only listed copyright holder. Sponsored by: The FreeBSD Foundation
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* libcasper: document that most libcasper functions are not thread-safeAlan Somers2023-12-081-1/+6
| | | | | | | | | | | | | And neither are most libcasper services' functions, because internally they all use cap_xfer_nvlist. cap_xfer_nvlist sends and then receives data over a unix domain socket and associated with the cap_channel_t argument. So absent synchronization, two threads may not use the same cap_channel_t argument or they risk receiving the other's reply. MFC after: 2 weeks Sponsored by: Axcient Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D42928
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* libcasper: Neuter false positive -Wuse-after-free warnings from GCC 13John Baldwin2023-11-151-0/+3
| | | | | | | | | | | | | | | | GCC 13 incorrectly thinks a call to free after a failed realloc is a use after free. lib/libcasper/services/cap_grp/cap_grp.c: In function 'group_resize': lib/libcasper/services/cap_grp/cap_grp.c:65:17: error: pointer 'buf' may be used after 'realloc' [-Werror=use-after-free] 65 | free(buf); | ^~~~~~~~~ lib/libcasper/services/cap_grp/cap_grp.c:63:19: note: call to 'realloc' here 63 | gbuffer = realloc(buf, gbufsize); | ^~~~~~~~~~~~~~~~~~~~~~ Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D42576
* dirdeps: Update Makefile.depend* files with empty contentsStephen J. Kiernan2023-10-291-0/+8
| | | | | Some Makefile.depend* files were committed with no contents or empty DIRDEPS list, but they should have DIRDEPS with some contents.
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-9/+0
|
* libcasper: Move helper libraries from /lib/casper to /lib.John Baldwin2023-03-291-1/+1
| | | | | | | | | These libraries are linked to directly by applications rather than opened at runtime via dlopen(). Discussed with: oshogbo Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D39245
* libcasper/cap_grp tests: Reset the group database handleMark Johnston2021-01-211-0/+4
| | | | | | | | | | | | Some tests verify that the capgrp capability does not permit calls to setgrent(3), but all tests need to ensure that they reset the capability's group database handle, otherwise the local process and casper process will be out of sync. The cap_pwd tests already handle this. Sponsored by: The FreeBSD Foundation MFC after: 1 month
* build: provide a default WARNS for all in-tree buildsKyle Evans2020-09-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The current default is provided in various Makefile.inc in some top-level directories and covers a good portion of the tree, but doesn't cover parts of the build a little deeper (e.g. libcasper). Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that variable is defined. This lets us relatively cleanly provide a default WARNS no matter where you're building in the src tree without breaking things outside of the tree. Crunchgen has been updated as a bootstrap tool to work on this change because it needs r365605 at a minimum to succeed. The cleanup necessary to successfully walk over this change on WITHOUT_CLEAN builds has been added. There is a supplemental project to this to list all of the warnings that are encountered when the environment has WARNS=6 NO_WERROR=yes: https://warns.kevans.dev -- this project will hopefully eventually go away in favor of CI doing a much better job than it. Reviewed by: emaste, brooks, ngie (all earlier version) Reviewed by: emaste, arichardson (depend-cleanup.sh change) Differential Revision: https://reviews.freebsd.org/D26455 Notes: svn path=/head/; revision=365887
* libcasper(3): Document HISTORY within the manpagesGordon Bergling2020-06-161-1/+6
| | | | | | | | | | Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D24695 Notes: svn path=/head/; revision=362230
* libcasper(3): Export functions to C++Conrad Meyer2020-04-071-0/+7
| | | | | | | | | | | | We must wrap C declarations in __BEGIN / __END_DECLS to avoid C++ name-mangling of the declaration when including the C header; name-mangling causes the linker to attempt to locate the wrong (C++ ABI) symbol name. Reviewed by: markj, oshogbo (earlier version both) Differential Revision: https://reviews.freebsd.org/D24323 Notes: svn path=/head/; revision=359696
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* pkgbase: Move libcap_ to FreeBSD-runtimeEmmanuel Vadot2019-09-051-1/+1
| | | | | | | | | | | A lot of binaries present in FreeBSD-runtime depend on it so move the libs there. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21501 Notes: svn path=/head/; revision=351853
* libcasper: using explicit_bzero in cap_grp serviceMariusz Zaborski2018-11-041-1/+1
| | | | | | | | | | Please notice that we still don't clean information in nvlist structures. Submitted by: David CARLIER <devnexen@gmail.com> Differential Revision: https://reviews.freebsd.org/D16777 Notes: svn path=/head/; revision=340142
* The gids argument can be declared as const.Mariusz Zaborski2018-03-183-5/+5
| | | | | | | We don't modified it in this function. Notes: svn path=/head/; revision=331146
* nv was moved to the 9 section.Mariusz Zaborski2018-02-261-2/+2
| | | | | | | Fix reference to it. Notes: svn path=/head/; revision=330031
* Fix typo.Mariusz Zaborski2018-02-261-2/+2
| | | | Notes: svn path=/head/; revision=330025
* Introduce channel flags in libcasper.Mariusz Zaborski2018-02-172-5/+5
| | | | | | | | | | | | | Instead of passing flags (which describe a type of nvlist) every send/recv we remember them in channel. It's enough for use to extract them only during unwrap. This simplify use of Casper. Reviewed by: bruffer@, bcr@ (both man page) Differential Revision: https://reviews.freebsd.org/D14196 (man page) Notes: svn path=/head/; revision=329452
* Add SPDX tags for libcasper(3) and services.Mariusz Zaborski2018-01-272-0/+4
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=328473
* Document the grp Casper service.Mariusz Zaborski2018-01-272-0/+244
| | | | | | | | Reviewed by: brueffer@, bcr@ Differential Revision: https://reviews.freebsd.org/D13821 Notes: svn path=/head/; revision=328471
* Build service tests with Casper support.Mariusz Zaborski2018-01-051-0/+1
| | | | Notes: svn path=/head/; revision=327583
* Casper work's only as shared library - disable building static ones.Mariusz Zaborski2017-11-041-1/+1
| | | | | | | | Reviewed by: bdrewery@ Differential Revision: https://reviews.freebsd.org/D12917 Notes: svn path=/head/; revision=325398
* Add `static` to `cap_setgrent` prototype in !WITH_CASPER caseEnji Cooper2017-10-311-1/+1
| | | | | | | This unbreaks the default powerpc/sparc64 build configuration after r325062. Notes: svn path=/head/; revision=325208
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+20
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Introduce caspermocks.Mariusz Zaborski2017-10-284-1/+41
| | | | | | | | | | | | | | | | | | | | The idea behinds mocks is that we don't need to ifdef a lot of code in tools itself but those defines are hidden in the casper library. Right now the mocks are implemented as define/inlines functions. There was a very long discussion how this should be implemented. This approach has some advantages like we don't need to link to any additional libraries. Unfortunately there are also some disadvantages for example it is easy to get library out of sync between two versions of functions or that we need extra define to compile program with casper support. This isn't an ideal solution but it's good enough for now and should simplify capsicumizing programs. This also doesn't close us any other ways to do those mocks and this should evolve in time. Discussed with: pjd, emaste, ed, rwatson, bapt, cem, bdrewery Differential Revision: https://reviews.freebsd.org/D8753 Notes: svn path=/head/; revision=325062
* Add supporting changes for `Add limited sandbox capability to "make check"`Enji Cooper2017-08-141-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-tests/... changes: - Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration and propagate the appropriate environment down to *.test.mk. tests/... changes: - Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner, since tests/... is a special subdirectory tree compared to the others. MFC after: 2 months MFC with: r322511 Reviewed by: arch (silence), testing (silence) Differential Revision: D12014 Notes: svn path=/head/; revision=322515
| * Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | | | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* | Fix result printingEnji Cooper2017-08-131-0/+3
|/ | | | | | | | | | | - Flushing stdout prevents the buffer from being printed twice, fixing issues with stdout printing out the testplan, etc, twice. - Don't print out raw source/line numbers; hide them behind comments. MFC after: 1 week Notes: svn path=/head/; revision=322447
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Set SHLIBDIR before .including src.opts.mk in libcapser servicesEd Maste2016-10-241-1/+2
| | | | | | | | | | | bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so SHLIBDIR must be set before including either one of them. MFC with: 305626 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=307863
* Move libcasper tests from regression/capsicum/libcasper/ toMariusz Zaborski2016-09-083-0/+1567
| | | | | | | | | | lib/libcasper/service/${service_name}/tests. Reviewed by: emaste, ngie Differential Revision: https://reviews.freebsd.org/D7759 Notes: svn path=/head/; revision=305626
* Add flags to the Casper services.Mariusz Zaborski2016-06-081-1/+1
| | | | | | | | | | CASPER_SERVICE_STDIO - Casper will not close the first three descriptors (stdin, stdout and stderr) this can be helpful for debugging. CASPER_SERVICE_FD - Capser will not close all other descriptors, this can be useful for a filesystem service. Notes: svn path=/head/; revision=301572
* Don't call setgrent() in an unportable way.Ed Schouten2016-06-011-1/+3
| | | | | | | | | | | | | | | | For FreeBSD 12, I'm considering updating setgrent() to have a function prototype that conforms to POSIX. FreeBSD seems to be the only operating system that lets setgrent() return an integer. It's also inconsistent with setpwent(). It looks like our libcasper depends on setgrent() returning an integer. Get rid of that. Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D6659 Notes: svn path=/head/; revision=301167
* MFHGlen Barber2016-03-021-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
* Update dependencies.Bryan Drewery2016-02-261-0/+20
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296127
* Remove unneeded lines.Bryan Drewery2016-02-261-3/+0
| | | | | | | | | | | - WARNS can be inherited from lib/Makefile.inc - CFLAGS referred to a non-existent directory and this shouldn't be needed anyhow due to the build picking up includes from WORLDTMP. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296126
* Convert casperd(8) daemon to the libcasper.Mariusz Zaborski2016-02-253-0/+864
After calling the cap_init(3) function Casper will fork from it's original process, using pdfork(2). Forking from a process has a lot of advantages: 1. We have the same cwd as the original process. 2. The same uid, gid and groups. 3. The same MAC labels. 4. The same descriptor table. 5. The same routing table. 6. The same umask. 7. The same cpuset(1). From now services are also in form of libraries. We also removed libcapsicum at all and converts existing program using Casper to new architecture. Discussed with: pjd, jonathan, ed, drysdale@google.com, emaste Partially reviewed by: drysdale@google.com, bdrewery Approved by: pjd (mentor) Differential Revision: https://reviews.freebsd.org/D4277 Notes: svn path=/head/; revision=296047