Bug 1990930 - Review Request: rust-rd-agent - Management agent for resctl-demo
Summary: Review Request: rust-rd-agent - Management agent for resctl-demo
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Neal Gompa
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1990649 1990906 1990908 1990909
Blocks: 1997730 1997731
TreeView+ depends on / blocked
 
Reported: 2021-08-06 15:25 UTC by Davide Cavalca
Modified: 2021-10-21 19:52 UTC (History)
3 users (show)

Fixed In Version: rust-rd-agent-2.1.2-1.fc36
Clone Of:
Environment:
Last Closed: 2021-10-21 19:52:51 UTC
Type: ---
Embargoed:
ngompa13: fedora-review+


Attachments (Terms of Use)

Description Davide Cavalca 2021-08-06 15:25:19 UTC
Spec URL: https://dcavalca.fedorapeople.org/review/rust-rd-agent/rust-rd-agent.spec
SRPM URL: https://dcavalca.fedorapeople.org/review/rust-rd-agent/rust-rd-agent-2.0.0-1.fc35.src.rpm

Description:
Management agent for resctl-demo.

Fedora Account System Username: dcavalca

Comment 1 Davide Cavalca 2021-08-06 16:53:42 UTC
Note: this needs to execute files from /var/lib/resctl-demo so it'll need some SELinux policy work. Right now it fails with a bunch of AVCs with SELinux enabled:

Aug 06 09:45:52 fedora systemd[1]: Started rd-sideloader.service /var/lib/resctl-demo/misc-bin/sideloader.py --config /var/lib/resctl-demo/sideloader/config.json --jobdir /var/lib/resctl-demo/sideloader/jobs.d --status /var/lib/resctl-demo/sideloader/status.json --svc-prefix rd-sideload- --dev sda --dont-fix.
Aug 06 09:45:52 fedora audit[2603]: AVC avc:  denied  { execute } for  pid=2603 comm="(oader.py)" name="sideloader.py" dev="sda2" ino=332220 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file permissive=0
Aug 06 09:45:52 fedora systemd[2603]: rd-sideloader.service: Failed to locate executable /var/lib/resctl-demo/misc-bin/sideloader.py: Permission denied
Aug 06 09:45:52 fedora systemd[2603]: rd-sideloader.service: Failed at step EXEC spawning /var/lib/resctl-demo/misc-bin/sideloader.py: Permission denied

When in permissive mode:

Aug 06 09:49:14 fedora systemd[1]: Started rd-sideloader.service /var/lib/resctl-demo/misc-bin/sideloader.py --config /var/lib/resctl-demo/sideloader/config.json --jobdir /var/lib/resctl-demo/sideloader/jobs.d --status /var/lib/resctl-demo/sideloader/status.json --svc-prefix rd-sideload- --dev sda --dont-fix.
Aug 06 09:49:14 fedora audit[2788]: AVC avc:  denied  { execute } for  pid=2788 comm="(oader.py)" name="sideloader.py" dev="sda2" ino=332220 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file permissive=1
Aug 06 09:49:14 fedora audit[2788]: AVC avc:  denied  { execute_no_trans } for  pid=2788 comm="(oader.py)" path="/var/lib/resctl-demo/misc-bin/sideloader.py" dev="sda2" ino=332220 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file permissive=1

Comment 2 Davide Cavalca 2021-08-06 17:34:50 UTC
Also, rd-agent needs /var/lib/resctl-demo as root/wheel/2775 and will create it / fix the permissions if it doesn't match. I've added it as a %dir in the spec, but I'm not sure if it should be a %ghost instead. Also, this shows up as an error in rpmlint due to the permissions, but it seems in line with what other packages do (e.g. mock).

Comment 3 Davide Cavalca 2021-08-06 18:01:15 UTC
Filed https://github.com/facebookexperimental/resctl-demo/issues/238 so we don't need to download a tarball at runtime and can ship a packaged version instead.

Comment 4 Davide Cavalca 2021-08-06 19:48:59 UTC
Updated to include https://github.com/facebookexperimental/resctl-demo/pull/239 and ship the tarball in a rd-agent-data subpackage.

Comment 6 Fabio Valentini 2021-09-05 15:55:37 UTC
Not a formal review (since I have no idea how SELinux policies are supposed to work).

You'll need to determine the license for the subpackage that contains the "%{_bindir}/rd-agent" binary.

You can do this by running a mock build like
  mock -r fedora-rawhide-x86_64 ./*.src.rpm --without check
then installing dnf-utils into the chroot with
  mock -r fedora-rawhide-x86_64 install dnf-utils
then entering the mock chroot with
  mock -r fedora-rawhide-x86_64 shell
and printing the licenses of all installed Rust crates with
  dnf repoquery --cacheonly "rust-*-devel" --installed --qf "# %{LICENSE}: %{source_name} %{version}"

This will give you a list of crate packages, their versions, and their License tags.
The "License" tag of the %{crate} subpackage will then be the effective license combined from that list.

Alternatively, the following snippet will give you a short, sorted list of licenses;
which might be an easier starting point for calculating the "effective" license:

for i in $(rpm -qa | grep "rust-.*-devel"); do
   rpm -q $i --qf "%{LICENSE}\n";
done | sort | uniq

Comment 7 Davide Cavalca 2021-09-21 15:59:13 UTC
Effective license calculation:
(0BSD or MIT or ASL 2.0) and (ASL 2.0 or Boost) and (ASL 2.0 or MIT) and ASL 2.0 and (MIT or ASL 2.0) and MIT and (Unlicense or MIT) and (zlib or ASL 2.0 or MIT) = ASL 2.0 and MIT

Full list:
# 0BSD or MIT or ASL 2.0: rust-adler 1.0.2
# ASL 2.0 or Boost: rust-ryu 1.0.5
# ASL 2.0 or MIT: rust-autocfg 1.0.1
# ASL 2.0 or MIT: rust-rayon 1.5.1
# ASL 2.0 or MIT: rust-rayon-core 1.9.1
# ASL 2.0: rust-rd-agent-intf 2.1.2
# ASL 2.0: rust-rd-hashd-intf 2.1.2
# ASL 2.0: rust-rd-util 2.1.2
# MIT or ASL 2.0 or zlib: rust-tinyvec_macros 0.1.0
# MIT or ASL 2.0: rust-anyhow 1.0.43
# MIT or ASL 2.0: rust-bitflags 1.3.1
# MIT or ASL 2.0: rust-cc 1.0.70
# MIT or ASL 2.0: rust-cfg-if 1.0.0
# MIT or ASL 2.0: rust-chrono 0.4.19
# MIT or ASL 2.0: rust-crc32fast 1.2.1
# MIT or ASL 2.0: rust-crossbeam 0.8.1
# MIT or ASL 2.0: rust-crossbeam-channel 0.5.1
# MIT or ASL 2.0: rust-crossbeam-deque 0.8.1
# MIT or ASL 2.0: rust-crossbeam-epoch 0.9.5
# MIT or ASL 2.0: rust-crossbeam-queue 0.3.2
# MIT or ASL 2.0: rust-crossbeam-utils 0.8.5
# MIT or ASL 2.0: rust-ctrlc 3.2.0
# MIT or ASL 2.0: rust-either 1.6.1
# MIT or ASL 2.0: rust-env_logger 0.8.4
# MIT or ASL 2.0: rust-err-derive 0.2.4
# MIT or ASL 2.0: rust-flate2 1.0.21
# MIT or ASL 2.0: rust-form_urlencoded 1.0.1
# MIT or ASL 2.0: rust-getrandom 0.2.3
# MIT or ASL 2.0: rust-git2 0.13.20
# MIT or ASL 2.0: rust-glob 0.3.0
# MIT or ASL 2.0: rust-hex 0.4.3
# MIT or ASL 2.0: rust-humantime 2.1.0
# MIT or ASL 2.0: rust-idna 0.2.3
# MIT or ASL 2.0: rust-itoa 0.4.8
# MIT or ASL 2.0: rust-jobserver 0.1.24
# MIT or ASL 2.0: rust-json 0.12.4
# MIT or ASL 2.0: rust-lazy_static 1.4.0
# MIT or ASL 2.0: rust-libc 0.2.101
# MIT or ASL 2.0: rust-libgit2-sys 0.12.21
# MIT or ASL 2.0: rust-libz-sys 1.1.3
# MIT or ASL 2.0: rust-linux_proc 0.1.1
# MIT or ASL 2.0: rust-log 0.4.14
# MIT or ASL 2.0: rust-num 0.4.0
# MIT or ASL 2.0: rust-num-bigint 0.4.2
# MIT or ASL 2.0: rust-num-complex 0.4.0
# MIT or ASL 2.0: rust-num-integer 0.1.44
# MIT or ASL 2.0: rust-num-iter 0.1.42
# MIT or ASL 2.0: rust-num-rational 0.4.0
# MIT or ASL 2.0: rust-num-traits 0.2.14
# MIT or ASL 2.0: rust-num_cpus 1.13.0
# MIT or ASL 2.0: rust-once_cell 1.8.0
# MIT or ASL 2.0: rust-page_size 0.4.2
# MIT or ASL 2.0: rust-percent-encoding 2.1.0
# MIT or ASL 2.0: rust-pkg-config 0.3.19
# MIT or ASL 2.0: rust-ppv-lite86 0.2.10
# MIT or ASL 2.0: rust-proc-macro-error 1.0.4
# MIT or ASL 2.0: rust-proc-macro-error-attr 1.0.4
# MIT or ASL 2.0: rust-proc-macro2 1.0.29
# MIT or ASL 2.0: rust-procfs 0.9.1
# MIT or ASL 2.0: rust-quote 1.0.9
# MIT or ASL 2.0: rust-rand 0.8.4
# MIT or ASL 2.0: rust-rand_chacha 0.3.1
# MIT or ASL 2.0: rust-rand_core 0.6.3
# MIT or ASL 2.0: rust-regex 1.5.4
# MIT or ASL 2.0: rust-regex-syntax 0.6.25
# MIT or ASL 2.0: rust-rustc_version 0.4.0
# MIT or ASL 2.0: rust-rustversion 1.0.5
# MIT or ASL 2.0: rust-scopeguard 1.1.0
# MIT or ASL 2.0: rust-semver 1.0.4
# MIT or ASL 2.0: rust-serde 1.0.130
# MIT or ASL 2.0: rust-serde_derive 1.0.130
# MIT or ASL 2.0: rust-serde_json 1.0.67
# MIT or ASL 2.0: rust-simplelog 0.10.0
# MIT or ASL 2.0: rust-syn 1.0.76
# MIT or ASL 2.0: rust-terminal_size 0.1.17
# MIT or ASL 2.0: rust-thiserror 1.0.28
# MIT or ASL 2.0: rust-thiserror-impl 1.0.28
# MIT or ASL 2.0: rust-time0.1 0.1.44
# MIT or ASL 2.0: rust-unicode-bidi 0.3.6
# MIT or ASL 2.0: rust-unicode-normalization 0.1.19
# MIT or ASL 2.0: rust-unicode-width 0.1.8
# MIT or ASL 2.0: rust-unicode-xid 0.2.2
# MIT or ASL 2.0: rust-url 2.2.2
# MIT or ASL 2.0: rust-vec_map 0.8.2
# MIT or ASL 2.0: rust-vergen 5.1.15
# MIT or ASL 2.0: rust-version_check 0.9.3
# MIT or zlib or ASL 2.0: rust-miniz_oxide 0.4.4
# MIT: rust-ansi_term0.11 0.11.0
# MIT: rust-atty 0.2.14
# MIT: rust-clap2 2.33.3
# MIT: rust-console 0.14.1
# MIT: rust-doc-comment 0.3.3
# MIT: rust-enum-iterator 0.6.0
# MIT: rust-enum-iterator-derive 0.6.0
# MIT: rust-getset 0.1.1
# MIT: rust-matches 0.1.9
# MIT: rust-memoffset 0.6.4
# MIT: rust-nix 0.22.1
# MIT: rust-nix0.20 0.20.0
# MIT: rust-partition-identity 0.2.8
# MIT: rust-proc-mounts 0.2.4
# MIT: rust-rustbus 0.17.0
# MIT: rust-rustbus_derive 0.4.0
# MIT: rust-scan_fmt 0.2.6
# MIT: rust-strsim 0.10.0
# MIT: rust-synstructure 0.12.5
# MIT: rust-sysinfo 0.19.2
# MIT: rust-textwrap0.11 0.11.0
# MIT: rust-users 0.11.0
# Unlicense or MIT: rust-aho-corasick 0.7.18
# Unlicense or MIT: rust-byteorder 1.4.3
# Unlicense or MIT: rust-memchr 2.4.1
# Unlicense or MIT: rust-termcolor 1.1.2
# zlib or ASL 2.0 or MIT: rust-tinyvec 1.3.1

Comment 8 Davide Cavalca 2021-09-21 16:12:30 UTC
Spec URL: https://dcavalca.fedorapeople.org/review/rust-rd-agent/rust-rd-agent.spec
SRPM URL: https://dcavalca.fedorapeople.org/review/rust-rd-agent/rust-rd-agent-2.1.2-1.fc36.src.rpm

Changelog:
- Update to 2.1.2
- Update effective license

Comment 9 Davide Cavalca 2021-09-21 16:48:54 UTC
Scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=76068698

Comment 10 Davide Cavalca 2021-10-21 00:44:30 UTC
Spec URL: https://dcavalca.fedorapeople.org/review/rust-rd-agent/rust-rd-agent.spec
SRPM URL: https://dcavalca.fedorapeople.org/review/rust-rd-agent/rust-rd-agent-2.1.2-1.fc36.src.rpm

Changelog:
- Add stub selinux policy and scaffolding

Comment 12 Davide Cavalca 2021-10-21 18:10:54 UTC
Scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=77622470

Comment 13 Neal Gompa 2021-10-21 18:34:43 UTC
Package was generated through rust2rpm, simplifying the review considerably.

- Conforms to packaging guidelines (rust2rpm generated spec)
- license correct and valid
- only executables produced, so no devel packages included
- selinux policy looks correct
- builds and installs

PACKAGE APPROVED.

Comment 14 Davide Cavalca 2021-10-21 18:40:19 UTC
Thanks!

$ fedpkg request-repo rust-rd-agent 1990930
https://pagure.io/releng/fedora-scm-requests/issue/37284

Comment 15 Gwyn Ciesla 2021-10-21 19:01:19 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-rd-agent


Note You need to log in before you can comment on or make changes to this bug.