Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp665288pxb; Thu, 17 Feb 2022 12:00:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwebYsCw3KE/iE0rhAlLVw4Rj0yM1WzmPx4HXLtraeXTw3Fl3gg4hXaZqVRF6tQDDnlTC7f X-Received: by 2002:a17:90b:3508:b0:1b9:92fb:239d with SMTP id ls8-20020a17090b350800b001b992fb239dmr8867089pjb.224.1645128006319; Thu, 17 Feb 2022 12:00:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645128006; cv=none; d=google.com; s=arc-20160816; b=jqmJs4VWkbmX01fMgKkNCm9W10R5Bwc4pIenRBW3cycW42peYnKGrt0LbbjwnYPNIZ JeGuVeJKiPYvj4yqYZ7bpDbIOO8Ly3pQGQNwmiggdQMui4OWtazydvMUX8AHGswzUt9n eikloGQSbh6cbsvxHA/7SG4kTFWxnNXAainu3RN3JEwoK27IaPegMyK68cXXc1UzucBR 07MfdMjks0izG02feGQGe6ujPLlIR7lKNmZOAFHlu7Nt7r9bMlzIKoXBukYpGkq9EN4n dHO9YOngRdkMVLvzv2UfvTjC9VfFefOlJWYyAPbnxdMIHssoUNP/SahC6Xk01Uaq2Tnw Xk7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=ZQAkjp762TK/U4Oy3B+5J1AoA9nqbrKNVvDDfiiPoqs=; b=IrO95vtdhBwh/sQ3mFiGDIhBiPo7KItC6LlBf4OzlLfRAsmcW863D6bEsCPvIrhJQM Y5yRQ5oO8k95pDtPdptDKF6ErwIIUxYp/vapmCWz/RqPI8DEwSptSxHQbfDAHBdEZBan +1+6asy3GKIDgkL6hJHpiQU4rVyB04t6WiArkAhVkyS04muTwVif3iM9cYCwghLCFvEI PVHlyQU986tdMMpma0TUTYYJn76l3fc1LmEo27oqmMZOfO4oRUbUBahYP2Z5/pduwTmO pbnY4mfzLdhrYsNQoosHhCqgW6/tqhQ2FCv4NVRG4lxSyPGsm8V3PdYH893vST/cdzRE JOuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=vNnrgBLM; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c16si520634pfr.139.2022.02.17.12.00.02; Thu, 17 Feb 2022 12:00:06 -0800 (PST) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=vNnrgBLM; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236126AbiBQOqz (ORCPT + 22 others); Thu, 17 Feb 2022 09:46:55 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242045AbiBQOqx (ORCPT ); Thu, 17 Feb 2022 09:46:53 -0500 Received: from smtp.sws.net.au (smtp.sws.net.au [IPv6:2a01:4f8:201:1e6::dada:cafe]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A443AF5400 for ; Thu, 17 Feb 2022 06:46:38 -0800 (PST) Received: from xev.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id 33FBCF004 for ; Fri, 18 Feb 2022 01:46:36 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1645109196; bh=ZQAkjp762TK/U4Oy3B+5J1AoA9nqbrKNVvDDfiiPoqs=; l=3689; h=Date:From:To:Subject:From; b=vNnrgBLMP8DzFO+hRjN51gormmG7C+LBmlM32KdBG1ZrsrmnT/bFYNdd1JH3Y2ICr 3si0acQ5ch+xeM8Sf/GmVycYM7xfzgf7iJlzFQudt7J5tyQPs/DsCxhKDxPu+k8C++ YD/mIbKWsTqRI1tDFqRAVYGA50aUX/DxlFG/wfe0= Received: by xev.coker.com.au (Postfix, from userid 1001) id A9FDA1734F0B; Fri, 18 Feb 2022 01:46:31 +1100 (AEDT) Date: Fri, 18 Feb 2022 01:46:31 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] rasdaemon V2 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Same as before but with the needed summary and removed the obsolete lockdown rule. Should be ready for merging now. Signed-off-by: Russell Coker Index: refpolicy-2.20220217/policy/modules/kernel/filesystem.if =================================================================== --- refpolicy-2.20220217.orig/policy/modules/kernel/filesystem.if +++ refpolicy-2.20220217/policy/modules/kernel/filesystem.if @@ -5485,6 +5485,43 @@ interface(`fs_getattr_tracefs_files',` ######################################## ## +## Read/write trace filesystem files +## +## +## +## Domain allowed access. +## +## +# +interface(`fs_write_tracefs_files',` + gen_require(` + type tracefs_t; + ') + + allow $1 tracefs_t:dir list_dir_perms; + allow $1 tracefs_t:file rw_file_perms; +') + +######################################## +## +## create trace filesystem directories +## +## +## +## Domain allowed access. +## +## +# +interface(`fs_create_tracefs_dirs',` + gen_require(` + type tracefs_t; + ') + + allow $1 tracefs_t:dir { create rw_dir_perms }; +') + +######################################## +## ## Mount a XENFS filesystem. ## ## Index: refpolicy-2.20220217/policy/modules/services/rasdaemon.fc =================================================================== --- /dev/null +++ refpolicy-2.20220217/policy/modules/services/rasdaemon.fc @@ -0,0 +1,3 @@ +/usr/sbin/rasdaemon -- gen_context(system_u:object_r:rasdaemon_exec_t,s0) +/var/lib/rasdaemon(/.*)? gen_context(system_u:object_r:rasdaemon_var_t,s0) + Index: refpolicy-2.20220217/policy/modules/services/rasdaemon.if =================================================================== --- /dev/null +++ refpolicy-2.20220217/policy/modules/services/rasdaemon.if @@ -0,0 +1 @@ +## RAS (Reliability, Availability and Serviceability) logging tool Index: refpolicy-2.20220217/policy/modules/services/rasdaemon.te =================================================================== --- /dev/null +++ refpolicy-2.20220217/policy/modules/services/rasdaemon.te @@ -0,0 +1,47 @@ +policy_module(rasdaemon, 1.0.0) + +# rasdaemon is a RAS (Reliability, Availability and Serviceability) logging +# tool. It currently records memory errors, using the EDAC tracing events. +# EDAC are drivers in the Linux kernel that handle detection of ECC errors +# from memory controllers for most chipsets on x86 and ARM architectures. +# +# https://git.infradead.org/users/mchehab/rasdaemon.git + +######################################## +# +# Declarations +# + +type rasdaemon_t; +type rasdaemon_exec_t; +init_daemon_domain(rasdaemon_t, rasdaemon_exec_t) + +type rasdaemon_var_t; +files_type(rasdaemon_var_t) + +######################################## +# +# Local policy +# + +allow rasdaemon_t self:unix_dgram_socket create_socket_perms; + +allow rasdaemon_t rasdaemon_var_t:dir manage_dir_perms; +allow rasdaemon_t rasdaemon_var_t:file manage_file_perms; + +kernel_read_debugfs(rasdaemon_t) +kernel_read_system_state(rasdaemon_t) +kernel_read_vm_overcommit_sysctl(rasdaemon_t) +kernel_search_fs_sysctls(rasdaemon_t) + +dev_list_sysfs(rasdaemon_t) +dev_read_urand(rasdaemon_t) + +files_read_etc_symlinks(rasdaemon_t) +files_search_var_lib(rasdaemon_t) +fs_write_tracefs_files(rasdaemon_t) +fs_create_tracefs_dirs(rasdaemon_t) + +logging_send_syslog_msg(rasdaemon_t) +miscfiles_read_localization(rasdaemon_t) +