// SPDX-License-Identifier: GPL-2.0-or-later /* CacheFiles security management * * Copyright (C) 2007, 2021 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) */ #include #include #include "internal.h" /* * determine the security context within which we access the cache from within * the kernel */ int cachefiles_get_security_ID(struct cachefiles_cache *cache) { struct cred *new; int ret; _enter("{%s}", cache->secctx); new = prepare_kernel_cred(current); if (!new) { ret = -ENOMEM; goto error; } if (cache->secctx) { ret = set_security_override_from_ctx(new, cache->secctx); if (ret < 0) { put_cred(new); pr_err("Security denies permission to nominate security context: error %d\n", ret); goto error; } } cache->cache_cred = new; ret = 0; error: _leave(" = %d", ret); return ret; } /* * see if mkdir and create can be performed in the root directory */ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache, struct dentry *root) { int ret; ret = security_inode_mkdir(d_backing_inode(root), root, 0); if (ret < 0) { pr_err("Security denies permission to make dirs: error %d", ret); return ret; } ret = security_inode_create(d_backing_inode(root), root, 0); if (ret < 0) pr_err("Security denies permission to create files: error %d", ret); return ret; } /* * check the security details of the on-disk cache * - must be called with security override in force * - must return with a security override in force - even in the case of an * error */ int cachefiles_determine_cache_security(struct cachefiles_cache *cache, struct dentry *root, const struct cred **_saved_cred) { struct cred *new; int ret; _enter(""); /* duplicate the cache creds for COW (the override is currently in * force, so we can use prepare_creds() to do this) */ new = prepare_creds(); if (!new) return -ENOMEM; cachefiles_end_secure(cache, *_saved_cred); /* use the cache root dir's security context as the basis with * which create files */ ret = set_create_files_as(new, d_backing_inode(root)); if (ret < 0) { abort_creds(new); cachefiles_begin_secure(cache, _saved_cred); _leave(" = %d [cfa]", ret); return ret; } put_cred(cache->cache_cred); cache->cache_cred = new; cachefiles_begin_secure(cache, _saved_cred); ret = cachefiles_check_cache_dir(cache, root); if (ret == -EOPNOTSUPP) ret = 0; _leave(" = %d", ret); return ret; } 8.y Hosts the 0x221E linux distro kernel.Ubuntu
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2024-04-08accel/ivpu: Return max freq for DRM_IVPU_PARAM_CORE_CLOCK_RATEJacek Lawrynowicz
2024-04-08accel/ivpu: Remove d3hot_after_power_off WAJacek Lawrynowicz
2024-02-26Merge v6.8-rc6 into drm-nextDaniel Vetter
2024-02-19accel/ivpu: Rename VPU to NPU in message stringsJacek Lawrynowicz
2024-02-19accel/ivpu: Rename TILE_SKU_BOTH_MTL to TILE_SKU_BOTHJacek Lawrynowicz
2024-02-12accel/ivpu: Fix DevTLB errors on suspend/resume and recoveryJacek Lawrynowicz
2024-02-06accel/ivpu: Force snooping for MMU writesWachowski, Karol
2024-01-25accel/ivpu: Improve recovery and reset supportJacek Lawrynowicz
2024-01-12Merge tag 'drm-next-2024-01-10' of git://anongit.freedesktop.org/drm/drmLinus Torvalds
2023-12-11accel/ivpu/37xx: Fix interrupt_clear_with_0 WA initializationAndrzej Kacprowski
2023-11-28Merge v6.7-rc3 into drm-nextDaniel Vetter
2023-11-21accel/ivpu/37xx: Fix hangs related to MMIO resetJacek Lawrynowicz
2023-11-16accel/ivpu: Use threaded IRQ to handle JOB done messagesJacek Lawrynowicz
2023-11-15Merge drm/drm-next into drm-misc-nextMaxime Ripard
2023-11-01Merge tag 'drm-next-2023-10-31-1' of git://anongit.freedesktop.org/drm/drmLinus Torvalds
2023-10-31accel/ivpu/40xx: Allow to change profiling frequencyKrystian Pradzynski
2023-10-31Merge tag 'drm-misc-next-2023-10-27' of git://anongit.freedesktop.org/drm/drm...Dave Airlie
2023-10-30accel/ivpu: Add support for delayed D0i3 entry messageAndrzej Kacprowski
2023-10-30accel/ivpu/37xx: Print warning when VPUIP is not idle during power downStanislaw Gruszka
2023-10-30accel/ivpu: Pass D0i3 residency time to the VPU firmwareAndrzej Kacprowski
2023-10-30accel/ivpu: Remove reset from power up sequenceKarol Wachowski
2023-10-26accel/ivpu/37xx: Fix missing VPUIP interruptsKarol Wachowski
2023-10-23BackMerge tag 'v6.6-rc7' into drm-nextDave Airlie
2023-10-23accel/ivpu/37xx: Remove support for FPGA and simicsStanislaw Gruszka
2023-10-23accel/ivpu: Do not initialize parameters on power upStanislaw Gruszka
2023-10-19accel/ivpu: Don't enter d0i3 during FLRJacek Lawrynowicz
2023-09-04accel/ivpu: Print information about used workaroundsStanislaw Gruszka
2023-09-04accel/ivpu/37xx: Change register rename leftoversStanislaw Gruszka
2023-09-04accel/ivpu: Move set autosuspend delay to HW specific codeKrystian Pradzynski
2023-08-09accel/ivpu: Refactor memory ranges logicKarol Wachowski
2023-08-09accel/ivpu: Use generation based function and registers namesJacek Lawrynowicz
2023-08-09accel/ivpu: Rename sources to use generation based namesJacek Lawrynowicz