Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: [dhd] Allow bundling keys into kernel and bootloader. JB#54649 OMP#OS-7115 #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dseight
Copy link

@dseight dseight commented Jun 11, 2021

No description provided.

@dseight dseight changed the title [dhd] Allow bundling keys into kernel and bootloader. JB#54649 OMP#OS-7115 Draft: [dhd] Allow bundling keys into kernel and bootloader. JB#54649 OMP#OS-7115 Jun 30, 2021
Copy link
Contributor

@Thaodan Thaodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks very vendor specific is that standardized between vendors e.g other socs?


# Copy trusted keys into kernel source directory
echo "$KERNEL_DIRS" |
while IFS= read -r kernel; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly pass the find output to read, see: https://github.com/koalaman/shellcheck/wiki/SC2044

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing output directly is a bash-specific thing, it won't work with plain POSIX shell. Is it okay to use bashisms here?

# Copy trusted keys into kernel source directory
echo "$KERNEL_DIRS" |
while IFS= read -r kernel; do
cp -r /etc/keys/kernel/* ${kernel}/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird how could or should come these keys from the rootfs of the build host?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are supposed to be provided by system-keys-kernel package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't they go then into /usr/lib?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/usr/lib is intended for storing object files and libraries. But keys are neither of them, they are much closer to configuration files (which should go into /etc/*). Also, Linux Kernel is using /etc/keys/ path by default for storing IMA certificate.

So, /etc/keys seems to be a better fit here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package supplied configuration files that should not be edited are now days in /usr/lib not in /etc, etc is for file created outside of the package-manager or those that should be edit.
Also note that the FHS is out of date and doesn't reflect the current state of things (see e.g. UsrMove).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I am agree on moving static data to /usr (which especially makes sense on RO filesystems), I'm not really sure that /usr/lib fits well for storing keys and certificates.

Maybe /usr/share then? As /usr/lib is primarily targeted for storing executable things (e.g. libraries and plugins), and quite rarely used for storing arbitrary data.

@dseight
Copy link
Author

dseight commented Jul 12, 2021

this looks very vendor specific is that standardized between vendors e.g other socs?

All of the vendors that I've seen so far use the same paths for bootloader. At least, these paths are the same on something like a 15 different device models (most of them were Mediatek-based devices and some are Qualcomm-based devices).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants