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

Backport upstream fixes to 059 #322

Merged
merged 17 commits into from
Apr 26, 2024

Conversation

aafeijoo-suse and others added 14 commits April 4, 2024 11:36
Since we are using `actions/labeler@main`, its format changed, displaying the
following error with every new PR:

```
Run actions/labeler@main
The configuration file (path: .github/labeler.yml) was not found locally, fetching via the api
Error: Error: found unexpected type for label 'repository' (should be array of config options)
Error: found unexpected type for label 'repository' (should be array of config options)
```

(cherry picked from commit de8ac63)
```
> valgrind --leak-check=full --show-leak-kinds=all ./dracut-install --kerneldir /lib/modules/$(uname -r)/ --modalias
...
==22005==
==22005== HEAP SUMMARY:
==22005==     in use at exit: 54,984 bytes in 1,286 blocks
==22005==   total heap usage: 585,546 allocs, 584,260 frees, 165,213,417 bytes allocated
==22005==
...
==22005==
==22005== LEAK SUMMARY:
==22005==    definitely lost: 4,390 bytes in 390 blocks
==22005==    indirectly lost: 0 bytes in 0 blocks
==22005==      possibly lost: 0 bytes in 0 blocks
==22005==    still reachable: 50,594 bytes in 896 blocks
==22005==         suppressed: 0 bytes in 0 blocks
==22005==
==22005== For lists of detected and suppressed errors, rerun with: -s
==22005== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
```
Use `regfree` to free memory allocated by `regcomp`. Quoting [1]:

"If the preg argument to regexec() or regfree() is not a compiled regular
expression returned by regcomp(), the result is undefined."

Therefore, `regfree` must only be called if `regcomp` succeeded.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html
The content of the kernel command line is assigned via `strdup`, but not freed
on exit. This happens after each call to `getarg(s)`, what makes an interesting
amount of bytes not released at every boot.

```
master> grep -r -o -e getarg -e getargs modules.d | wc -l
457
master> export CMDLINE=$(< /proc/cmdline)
master> echo ${#CMDLINE}
130
afeijoo@localhost:~/src/dracut/opensuse-fork/master> valgrind --leak-check=full --show-leak-kinds=all ./dracut-getarg security
==24270== Memcheck, a memory error detector
==24270== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==24270== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==24270== Command: ./dracut-getarg security
==24270==
apparmor
==24270==
==24270== HEAP SUMMARY:
==24270==     in use at exit: 131 bytes in 1 blocks
==24270==   total heap usage: 2 allocs, 1 frees, 1,155 bytes allocated
==24270==
==24270== 131 bytes in 1 blocks are definitely lost in loss record 1 of 1
==24270==    at 0x4838744: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24270==    by 0x490D839: strdup (in /lib64/libc-2.31.so)
==24270==    by 0x108AF6: getarg (util.c:188)
==24270==    by 0x108AF6: main (util.c:300)
==24270==
==24270== LEAK SUMMARY:
==24270==    definitely lost: 131 bytes in 1 blocks
==24270==    indirectly lost: 0 bytes in 0 blocks
==24270==      possibly lost: 0 bytes in 0 blocks
==24270==    still reachable: 0 bytes in 0 blocks
==24270==         suppressed: 0 bytes in 0 blocks
==24270==
==24270== For lists of detected and suppressed errors, rerun with: -s
==24270== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```
… dir

The `remove_hostonly_files` function should only remove (as its name suggests)
hostonly configuration and files. The initqueue/finished scripts considered as
hostonly that must be removed are added via `wait_for_dev`. But, the `hookdirs`
are always created at build time, and should not be removed.

This patch also allows to remove the `mkdir` workaround in the `network-manager`
module (copied-pasted into the `connman` module after), and avoids having to add
it tree-wide in many missing places.

Fixes 87e90d7
…y included

Some required libraries that used to be statically included are in the process
to be opened via `dlopen()`.

References:
- systemd/systemd#31131
- systemd/systemd#31550
- systemd/systemd#32019
@aafeijoo-suse
Copy link
Collaborator Author

I also want to merge dracutdevs#2591 in this batch once there is some agreement on the final location of the hooks, so we will be ready for systemd-v256.

Copy link
Collaborator

@tblume tblume left a comment

Choose a reason for hiding this comment

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

LGTM

systemd/systemd@4e1f0037 added a new `tpm2.target`,
which is now used by `systemd-pcrphase-initrd.service`, and
`systemd-tpm2-generator`, which adds a `Wants=` dependency from `sysinit.target`
to `tpm2.target` when it detects that the firmware discovered a TPM2 device but
the kernel didn't.
@aafeijoo-suse aafeijoo-suse marked this pull request as draft April 19, 2024 12:26
LaszloGombos and others added 2 commits April 19, 2024 14:40
Since systemd/systemd@ffc1ec73, /usr is mounted as
read-only in the initramfs by default.

Fixes dracutdevs#2588

Co-authored-by: Antonio Alvarez Feijoo <[email protected]>
(cherry picked from commit dracut-ng/dracut-ng@a45048b)
@aafeijoo-suse aafeijoo-suse marked this pull request as ready for review April 19, 2024 14:56
@aafeijoo-suse aafeijoo-suse merged commit 19b7c06 into openSUSE:SUSE/059 Apr 26, 2024
1 of 2 checks passed
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.

4 participants