Skip to content

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

Open
dseight wants to merge 1 commit into
mer-hybris:masterfrom
dseight:jb54649
Open

Draft: [dhd] Allow bundling keys into kernel and bootloader. JB#54649 OMP#OS-7115#302
dseight wants to merge 1 commit into
mer-hybris:masterfrom
dseight:jb54649

Conversation

@dseight

@dseight dseight commented Jun 11, 2021

Copy link
Copy Markdown

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
…-7115

Signed-off-by: Dmitry Gerasimov <d.gerasimov@omp.ru>

@Thaodan Thaodan left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread droid-hal-device.inc

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

Copy link
Copy Markdown
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
Copy Markdown
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?

Comment thread droid-hal-device.inc
# Copy trusted keys into kernel source directory
echo "$KERNEL_DIRS" |
while IFS= read -r kernel; do
cp -r /etc/keys/kernel/* ${kernel}/

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

dseight commented Jul 12, 2021

Copy link
Copy Markdown
Author

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