Bug 2234867 - Review Request: optee_os - OP-TEE firmware for various ARMv8-A SoCs.
Summary: Review Request: optee_os - OP-TEE firmware for various ARMv8-A SoCs.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: 40
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Javier Martinez Canillas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-25 15:45 UTC by Enric Balletbo i Serra
Modified: 2024-03-29 08:20 UTC (History)
4 users (show)

Fixed In Version: optee_os-4.1.0-1.fc40
Clone Of:
Environment:
Last Closed: 2024-03-29 08:20:09 UTC
Type: ---
Embargoed:
fmartine: fedora-review+


Attachments (Terms of Use)

Description Enric Balletbo i Serra 2023-08-25 15:45:36 UTC
Spec URL: https://download.copr.fedorainfracloud.org/results/eballetbo/fedora/fedora-rawhide-aarch64/06344073-optee_os/optee_os.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/eballetbo/fedora/fedora-rawhide-aarch64/06344073-optee_os/optee_os-3.22.0-1.fc40.src.rpm
Description: OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a
non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone
technology. OP-TEE implements TEE Internal Core API v1.1.x which is the API
exposed to Trusted Applications.

Note: the contents of this package are generally just consumed by bootloaders
such as u-boot. As such the binaries aren't of general interest to users.

Fedora Account System Username: eballetbo

Comment 1 Javier Martinez Canillas 2023-09-15 06:15:07 UTC
Below is my review, it looks mostly good to me but I've some questions with regard to bundled libraries and multiple licenses:

Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed


Issues:
=======
- The License field must be a valid SPDX expression.
  Note: Not a valid SPDX expression 'BSD'. It seems that you are using the
  old Fedora license abbreviations. Try `license-fedora2spdx' for
  converting it to SPDX.
  See: https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_1


===== MUST items =====

C/C++:
[-]: Provides: bundled(gnulib) in place as required.
     Note: Sources not installed
[x]: Package does not contain kernel modules.
[x]: If your application is a C or C++ application you must list a
     BuildRequires against gcc, gcc-c++ or clang.
[x]: Package does not contain any libtool archives (.la)
[x]: Package contains no static executables.
[x]: Rpath absent or only used for internal libs.

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[?]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "*No copyright* GNU General Public
     License, Version 2", "BSD 2-Clause License", "BSD 3-Clause License",
     "Apache License 2.0", "BSD 3-Clause License BSD 2-Clause License",
     "MIT License", "*No copyright* BSD 2-Clause License", "*No copyright*
     BSD 2-Clause License GNU General Public License", "The Unlicense",
     "zlib License", "*No copyright* Apache License 2.0", "ISC License",
     "GNU General Public License, Version 2", "MIT License BSD 2-Clause
     License", "BSD 3-Clause License [generated file]", "Boost Software
     License 1.0", "*No copyright* The Unlicense", "*No copyright* The
     Unlicense Public domain", "BSD 2-Clause License GNU Lesser General
     Public License v2.1 or later", "The Unlicense GNU General Public
     License". 378 files have unknown license. Detailed output of
     licensecheck in
     /home/javier/devel/linux/2234867-optee_os/licensecheck.txt
[x]: %build honors applicable compiler flags or justifies otherwise.
[?]: Package contains no bundled libraries without FPC exception.
     Note: Especially check following dirs for bundled code:
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/ldelf/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/crypto/crypto_api/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/crypto/versal/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libdl/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libutils/isoc/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libutils/isoc/arch/arm/softfloat/source/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/crypto/se050/core/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/lib/libtomcrypt/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/ta/avb/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/arch/arm/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/lib/libfdt/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/ta/trusted_keys/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/crypto/caam/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/imx/dcp/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libunw/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/ta/pkcs11/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libmbedtls/mbedtls/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libutee/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/lib/scmi-server/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/crypto/se050/adaptors/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/arch/riscv/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libmbedtls/include,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/lib/libutils/ext,
     /home/javier/devel/linux/2234867-optee_os/upstream-
     unpacked/Source0/optee_os-3.22.0/core/drivers/crypto/se050/glue/include
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[-]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Package is not known to require an ExcludeArch tag.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: No rpmlint messages.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 273 bytes in 1 files.
[x]: Packages must not store files under /srv, /opt or /usr/local

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[x]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[-]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Fully versioned dependency in subpackages if applicable.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Large data in /usr/share should live in a noarch subpackage if package
     is arched.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: optee_os-3.22.0-1.fc39.src.rpm
=========================================================================================================== rpmlint session starts ===========================================================================================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
rpmlintrc: [PosixPath('/tmp/tmp2gmgmb2b')]
checks: 31, packages: 1

============================================================================ 1 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.2 s ============================================================================




Rpmlint (installed packages)
----------------------------
Cannot parse rpmlint output:


Source checksums
----------------
https://github.com/OP-TEE/optee_os/archive/3.22.0/optee_os-3.22.0.tar.gz :
  CHECKSUM(SHA256) this package     : 2f15d07f20bf164e6bd38bf955eed70328b7f070eff63b4934bd307dbba5c2bc
  CHECKSUM(SHA256) upstream package : 2f15d07f20bf164e6bd38bf955eed70328b7f070eff63b4934bd307dbba5c2bc


Requires
--------


Provides
--------


Generated by fedora-review 0.10.0 (e79b66b) last change: 2023-07-24
Command line :/usr/bin/fedora-review -b 2234867 --mock-config fedora-39-aarch64
Buildroot used: fedora-39-aarch64
Active plugins: Shell-api, Generic, C/C++
Disabled plugins: Python, Java, fonts, PHP, SugarActivity, Perl, Haskell, R, Ocaml
Disabled flags: EXARCH, EPEL6, EPEL7, DISTTAG, BATCH

Comment 2 Marcin Juszkiewicz 2023-09-15 17:15:45 UTC
At some moment in future optee_os package will also interest RISC-V people as some support for their architecture is present.

Licenses needs to be collected and listed. From quick view I see at least mix of BSD-2-Clause, Apache-2.0, Public Domain, MIT-CMU ones.

Libraries in lib/ directory look like internal ones except mbedtls. For that one I would recommend checking is it synced from upstream and is copy present already in Fedora [1] good enough (optee_os has 2.28.1, Fedora 37+ has 2.28.4). Note that it is not used as shared library in optee_os.

1. https://src.fedoraproject.org/rpms/mbedtls

I did not run rpmlint or tried to build. Comments are due to IRC discussion.

Comment 3 Javier Martinez Canillas 2023-09-18 06:19:24 UTC
For example, the LICENSE field in the kernel (that contains multiple licenses) is https://src.fedoraproject.org/rpms/kernel/blob/rawhide/f/kernel.spec#_639

Comment 4 Enric Balletbo i Serra 2023-09-19 10:52:00 UTC
The version of mbedtls library inside optee_os is a trimmed down version of the upstream 2.28.1 release plus 4 patches that seems fixes:

   e5353ad98910f0cfc5cb867a51e6d6814b8a2e05 libmbedtls: Fix cipher_wrap.c for nist_kw
   06de6080fba5890357f9075b37caf940cc8eb93f libmbedtls: add fault mitigation in mbedtls_rsa_rsassa_pkcs1_v15_verify()
   a846630f4435a7127bdee968781e6d6eb296f5fa libmbedtls: add fault mitigation in mbedtls_rsa_rsassa_pss_verify_ext()
   23ef3871cb5814f45010171373add4d339285616 libmbedtls: fix cipher_wrap.c for chacha20 and chachapoly

As Marcin Juszkiewicz said Fedora ships 2.28.4 which is slightly newer than the one used in optee_os package. A quick report about the differences is as follows:

   $ git diff --shortstat v2.28.1..v2.28.4 
 702 files changed, 91476 insertions(+), 86418 deletions(-)

Note that mbedtls library is **is not used as shared library** but linked statically to build the firmware binaries.

Here is another version of the spec for review. Changes since the first version are:

-  Collect and list the licenses as Javier and Marcin suggested
-  Update the date of the changelog

Spec URL: https://download.copr.fedorainfracloud.org/results/eballetbo/fedora/fedora-rawhide-aarch64/06417210-optee_os/optee_os.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/eballetbo/fedora/fedora-rawhide-aarch64/06417210-optee_os/optee_os-3.22.0-1.fc40.src.rpm
Description: OP-TEE is a Trusted Execution Environment (TEE) designed as companion to a
non-secure Linux kernel running on Arm; Cortex-A cores using the TrustZone
technology. OP-TEE implements TEE Internal Core API v1.1.x which is the API
exposed to Trusted Applications.

Note: the contents of this package are generally just consumed by bootloaders
such as u-boot. As such the binaries aren't of general interest to users.

Fedora Account System Username: eballetbo

Comment 5 Enric Balletbo i Serra 2023-09-19 15:11:08 UTC
And here is version 3 of the spec for review. Changes since the first version are:

Changes since v2:
- Fix incorrect encoding in the .spec file
Changes since v1:
-  Collect and list the licenses as Javier and Marcin suggested
-  Update the date of the changelog

Spec URL: https://download.copr.fedorainfracloud.org/results/eballetbo/fedora/fedora-39-aarch64/06418176-optee_os/optee_os.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/eballetbo/fedora/fedora-39-aarch64/06418176-optee_os/optee_os-3.22.0-1.fc39.src.rpm

Comment 6 Javier Martinez Canillas 2023-09-19 15:14:49 UTC
It all looks good to me now.

Comment 7 Fedora Admin user for bugzilla script actions 2023-09-19 15:28:15 UTC
The Pagure repository was created at https://src.fedoraproject.org/rpms/optee_os

Comment 8 Sandro Bonazzola 2024-03-29 08:20:09 UTC
Included in Fedora 40 Beta: https://bodhi.fedoraproject.org/updates/FEDORA-2024-5aead4b28d


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