Re: [PATCH 0/2] Two small fixes to gzip

2024-05-17 Thread Daniel Axtens
Hi Daniel, > Reviewed-by: Daniel Kiper for both patches... Thank you! > I assume I can add your SOB on your behalf... Oh! Yes! Sorry, 2 years of closed source development have apparently caused me to lose my 'git commit -s' habits! The sign-off for both patches is: Signed-off-by:

[PATCH 2/2] gzio: Properly init a table

2024-05-12 Thread Daniel Axtens
ARRAY_SIZE is the count of elements, but the element size is 4 bytes, so this was only initing the first 1/4th of the table. Detected with valgrind. This should only matter in error paths, and I've not been able to identify any actual misbehaviour that results from reading in-bounds but uninited

[PATCH 1/2] gzio: abort early when get_byte reads nothing

2024-05-12 Thread Daniel Axtens
This isn't intended to be a functional change, but it makes a lot of failures a lot faster, which is extremely helpful for fuzzing. Without this change, we keep trying and trying to read more bytes into our buffer, never being able to (read always returns 0) and so we just return old buffer

[PATCH 0/2] Two small fixes to gzip

2024-05-12 Thread Daniel Axtens
passes. Daniel Axtens (2): gzio: abort early when get_byte reads nothing gzio: Properly init a table grub-core/io/gzio.c | 55 - 1 file changed, 35 insertions(+), 20 deletions(-) -- 2.39.3 (Apple Git-145

Re: [PATCH v8 0/2] Introduce EROFS support

2024-05-01 Thread Daniel Axtens
bitrary input in all of grub. For this series: Tested-by: Daniel Axtens mailto:d...@axtens.net>> # fuzz testing only Kind regards, Daniel > Thanks, > Gao Xiang > >> Yifan Zhao (2): >> fs/erofs: Add support for EROFS >> fs/erofs: Add tests for EROFS in grub-f

Re: Module dependencies

2023-10-19 Thread Daniel Axtens
> There is the problem with the new bli module, that it requires the > part_gpt module to be loaded beforehand, but the module dependency list > for bli is emplty (see moddep.lst). > > The part_gpt module only exports one function, > grub_gpt_partition_map_iterate(). This is not used in the bli

Re: Module dependencies

2023-10-05 Thread Daniel Axtens
(Unless anything has changed dramatically in the last year:) Dependencies are calculated automatically on the basis of symbols that you use in your module. If you look at genmoddep.awk and work out from there you can get a handle on the process. If you only use symbols provided by the ‘kernel’,

[PATCH 3/6] tests: create a fuzzer for the png image format

2023-03-27 Thread Daniel Axtens
, that this would have been 2021-2022. The code was released to a cross-company grub security working group at this time. I left IBM in April 2022. Work subsequent to that is my own, and is unrelated to my subsequent employer. Signed-off-by: Daniel Axtens --- .gitignore | 1

[PATCH 2/6] bitmap.h: set smaller image size limit when fuzzing

2023-03-27 Thread Daniel Axtens
Large images mean large memory allocations, which could fail or at least be very slow. Also large images mean large files, which fuzzing generally cannot create. Finally, most parsing bugs (at least that we've found!) don't seem to rely on actually large images. So simply reduce the maximum

[PATCH 4/6] tests: create a fuzzer for the jpeg image format

2023-03-27 Thread Daniel Axtens
As with png, but this time testing jpeg. Signed-off-by: Daniel Axtens --- .gitignore | 1 + Makefile.util.def | 21 + grub-core/tests/fuzz/jpeg.c | 3 +++ 3 files changed, 25 insertions(+) create mode 100644 grub-core/tests/fuzz/jpeg.c diff

[PATCH 6/6] docs: document fuzzer support

2023-03-27 Thread Daniel Axtens
This is basic documentation. There are a few extra, super-hacky things we can do to get asan or afl++ going which are a bit too messy at the moment to commit to the docs. But, so as they are not lost to time, here's the invocations that currently work for me: libfuzzer + ASan: ./configure

[PATCH 0/6] Support fuzzing grub's image file parsers

2023-03-27 Thread Daniel Axtens
This is a cleaned up version of the fuzzers that I used to find CVE-2021-3695, CVE-2021-3696 and CVE-2021-3697. We're releasing this now because the techniques are not novel, the code is not hard to independently replicate, and it's hard to see what is gained by not releasing them. (I should add

[PATCH 1/6] configure.ac: detect if compiler supports -fsanitize=fuzzer

2023-03-27 Thread Daniel Axtens
If detected, COND_ENABLE_FUZZERS is set, which can be used in Makefile templates. This allows us to build libfuzzer fuzzers for parts of grub. --- configure.ac | 32 1 file changed, 32 insertions(+) diff --git a/configure.ac b/configure.ac index

[PATCH 5/6] tests: create a fuzzer for the tga image format

2023-03-27 Thread Daniel Axtens
TGA, the only parser where I didn't find any memory-corruption bugs. Yet. Signed-off-by: Daniel Axtens --- .gitignore | 1 + Makefile.util.def | 21 + grub-core/tests/fuzz/tga.c | 3 +++ 3 files changed, 25 insertions(+) create mode 100644 grub

[PATCH] f2fs: fix off-by-one error in nat journal entries check

2023-01-14 Thread Daniel Axtens
Oops. You're allowed to have up to n = NAT_JOURNAL_ENTRIES entries _inclusive_, because the loop below uses i < n, not i <= n. D'oh. Fixes: 4bd9877f6216 ("fs/f2fs: Do not read past the end of nat journal entries") Reported-by: программист нект Tested-by: программист нект Signe

Re: [programmer11...@programist.ru: Bug#1021846: grub-install is broken since 2.06-3: error: unknown filesystem]

2022-12-02 Thread Daniel Axtens
Steve McIntyre writes: > Hi all! > > программист некто (in CC) reported this bug a few weeks back in > Debian. Since I applied the bundle of filesystem bounds-checking fixes > a few months back, he can't run grub-install. He's done the work to > determine that the patch that breaks things for

Re: [PATCH 2/2] video/readers/jpeg: Check next_marker is within file size

2022-10-21 Thread Daniel Axtens
Alec Brown writes: > In grub-core/video/readers/jpeg.c, the function grub_jpeg_decode_huff_table() > has the variable next_marker which reads data from grub_jpeg_get_word() and > then uses it as an upper limit in a while loop. However, the function isn't > checking that next_marker is within the

[PATCH] diskfilter: don't make a RAID array with more than 1024 disks

2022-10-19 Thread Daniel Axtens
ons. 1024 is a bit arbitrary, yes, and I feel a bit like I'm tempting fate here, but I think 1024 disks in an array (that grub has to read to boot!) should be enough for anyone. Signed-off-by: Daniel Axtens --- v2: add a minimum of 1 disk as nmemb is a signed integer. Tested with `./grub-fs-tes

Re: [PATCH] efi: Increase default memory allocation to 32MB

2022-09-27 Thread Daniel Axtens
Patrick Steinhardt writes: > On Thu, Sep 22, 2022 at 05:59:34PM +0200, Daniel Kiper wrote: >> Adding some folks who may be interested in this thing too... >> >> On Tue, Sep 20, 2022 at 12:30:30AM +1000, Daniel Axtens wrote: >> > We have multiple reports of things b

[PATCH] efi: Increase default memory allocation to 32MB

2022-09-19 Thread Daniel Axtens
We have multiple reports of things being slower with a 1MB initial static allocation, and a report (more difficult to nail down) of a boot failure as a result of the smaller initial allocation. Make the initial memory allocation 32MB. Signed-off-by: Daniel Axtens --- grub-core/kern/efi/mm.c

Re: [PATCH] Remove HFS support

2022-09-01 Thread Daniel Axtens
"Vladimir 'phcoder' Serbinenko" writes: > Le ven. 26 août 2022, 15:47, Daniel Axtens a écrit : > >> Let me answer this out of order. >> >> > I understand the need to sometimes get rid of old code, but since the HFS >> > module can be blacklisted a

Re: [PATCH] Remove HFS support

2022-08-26 Thread Daniel Axtens
Let me answer this out of order. > I understand the need to sometimes get rid of old code, but since the HFS > module can be blacklisted as Vladimir explains, I don't really understand > the reasoning in this particular case. I want _all_ grub code to reach a minimum standard of not crashing or

Re: [PATCH] kern/efi/mm: Double the default heap size

2022-08-22 Thread Daniel Axtens
Hector Martin writes: > On 21/08/2022 21.35, Daniel Axtens wrote: >> Hi Hector, >> >> Thanks for your patch and for taking the trouble to put it together. >> >>> GRUB is already running out of memory on Apple M1 systems, causing >>> graphics init

Re: [PATCH 2/2] diskfilter: don't make a RAID array with more than 1024 disks

2022-08-22 Thread Daniel Axtens
Daniel Axtens writes: > This is 'belt and braces' with the last fix: we end up trying to use > too much memory in situations like corrupted Linux software raid setups > purporting to usew a huge number of disks. Simply refuse to permit such > configurations. > > 1024 is a

Re: [PATCH] kern/efi/mm: Double the default heap size

2022-08-21 Thread Daniel Axtens
Hi Hector, Thanks for your patch and for taking the trouble to put it together. > GRUB is already running out of memory on Apple M1 systems, causing > graphics init to fail, as of the latest Git changes. Since dynamic > growing of the heap isn't done yet, double the default heap size for > now.

[PATCH 2/2] diskfilter: don't make a RAID array with more than 1024 disks

2022-08-21 Thread Daniel Axtens
fate here, but I think 1024 disks in an array (that grub has to read to boot!) should be enough for anyone. Signed-off-by: Daniel Axtens --- grub-core/disk/diskfilter.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c index

[PATCH 1/2] diskfilter: check calloc() result for NULL

2022-08-21 Thread Daniel Axtens
-by: Daniel Axtens --- grub-core/disk/diskfilter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c index 2edcff6e8987..4ac50320ef4e 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -1163,6 +1163,9

Re: [PATCH] Remove HFS support

2022-08-20 Thread Daniel Axtens
"Vladimir 'phcoder' Serbinenko" writes: > No go from me either. Older macs may not be able to read HFS+ /boot. Also > HFS+ presents couple of problems the biggest one is that in case of sudden > reboot HFS+ often needs to be mounted by OSX or cleaning dirty flag > manually before it becomes

Re: [PATCH] Remove HFS support

2022-08-20 Thread Daniel Axtens
>> As Daniel Axtens has been finding out, the HFS code is terrible in >> terms of security. If you still need it for old/semi-dead machines, >> maybe you should fork an older grub release and stay with that? > > I don't know what should be the deal with the security of a bo

Re: [PATCH] Remove HFS support

2022-08-20 Thread Daniel Axtens
weeks I will >>> >>> merge this patch or a variant of it in the second half of September. >>> >> >>> >> We’re still formatting our /boot partitions for Debian PowerPC for >>> >> PowerMacs using HFS, so this change would be a breaking change for

Re: [PATCH] Remove HFS support

2022-08-20 Thread Daniel Axtens
John Paul Adrian Glaubitz writes: >> On Aug 19, 2022, at 3:59 PM, Daniel Kiper wrote: >> >> On Fri, Aug 19, 2022 at 11:38:26PM +1000, Daniel Axtens wrote: >>> HFS is so so very old now. According to Wikipedia, HFS was >>> introduced in 1985 and the success

[PATCH] Remove HFS support

2022-08-19 Thread Daniel Axtens
would have been part of the HFS->HFS+ transition, but I'm not really game to mess with either, in particular as macbless writes(!) to disk live. (I'm fairly sure the grub-macbless tool invokes code from the macbless module as well.) Signed-off-by: Daniel Axtens --- `make check` is unc

Re: [PATCH 6/6] ieee1275: implement vec5 for cas negotiation

2022-08-16 Thread Daniel Axtens
zeof(struct option_vector5) - 2, > +.vec5 = { > + 0, 0, 0, 0, 0, 0, 0, 0, 256 This maybe should be indented 6 spaces instead of 1 tab? But I wouldn't do a whole new revision just for this. Acked-by: Daniel Axtens Kind regards, Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

Re: [PATCH 0/2] powerpc-ieee1275: support larger core.elf images

2022-05-17 Thread Daniel Axtens
Hi, Sorry, I missed this as well - my otherwise lovely threaded email client doesn't sort on the basis of most recent message, but thread start date. > root@ibook-g4-14:/home/glaubitz/grub# grub-install -d ./grub-core > --macppc-directory=/boot/grub --no-nvram > Installing for powerpc-ieee1275

Re: [PATCH v3 15/19] appended signatures: parse PKCS#7 signedData and X.509 certificates

2022-05-17 Thread Daniel Axtens
Hi Michael, apologies for the delay, I've left IBM and am taking a while to get back on my feet. > On Thu, Apr 21, 2022 at 09:32:41PM +1000, Daniel Axtens wrote: >> Hi, >> >> >> This code allows us to parse: >> >> >> >> - PKCS#7 signedD

Re: [PATCH v3 15/19] appended signatures: parse PKCS#7 signedData and X.509 certificates

2022-04-21 Thread Daniel Axtens
^^ > This should be updated I suppose. So this is - surprisingly - still accurate! We still only support 1 _Extended_ Key Usage. The change that we made as a result of SUSE's bug report was to support additional regular, non-extended key usages. Here's the cha

[PATCH v3 18/19] appended signatures: documentation

2022-04-21 Thread Daniel Axtens
This explains how appended signatures can be used to form part of a secure boot chain, and documents the commands and variables introduced. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- v3: fix CR->LF, thanks Stefan Berger. v2: fix a grammar issue, thanks Stefan Berger. --- d

[PATCH v3 17/19] appended signatures: verification tests

2022-04-21 Thread Daniel Axtens
These tests are run through all_functional_test and test a range of commands and behaviours. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- v3: clean up error codes at the start, fix copyright headers. v2 changes: - add a test for EKU - add tests for files signed

[PATCH v3 14/19] appended signatures: import GNUTLS's ASN.1 description files

2022-04-21 Thread Daniel Axtens
/blob/857543cc24114431dd5dde0e83c2c44b9b7e6050/lib/gnutls_asn1_tab.c - https://github.com/gnutls/gnutls/blob/857543cc24114431dd5dde0e83c2c44b9b7e6050/lib/pkix_asn1_tab.c The GNUTLS license is LGPLv2.1+, which is GPLv3 compatible, allowing us to import it without issue. Signed-off-by: Daniel

[PATCH v3 04/19] dl: provide a fake grub_dl_set_persistent for the emu target

2022-04-21 Thread Daniel Axtens
Trying to start grub-emu with a module that calls grub_dl_set_persistent will crash because grub-emu fakes modules and passes NULL to the module init function. Provide an empty function for the emu case. Fixes: ee7808e2197c (dl: Add support for persistent modules) Signed-off-by: Daniel Axtens

[PATCH v3 09/19] libtasn1: disable code not needed in grub

2022-04-21 Thread Daniel Axtens
avoid the need for minmax.h, which is convenient because it means we don't have to import it from gnulib. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- grub-core/lib/libtasn1/lib/coding.c| 12 ++-- grub-core/lib/libtasn1/lib/decoding.c | 2 ++ grub-core/lib/libtasn1/lib

[PATCH v3 03/19] docs/grub: Document signing grub with an appended signature

2022-04-21 Thread Daniel Axtens
Signing grub for firmware that verifies an appended signature is a bit fiddly. I don't want people to have to figure it out from scratch so document it here. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- docs/grub.texi | 42 ++ 1 file

[PATCH v3 07/19] posix_wrap: tweaks in preparation for libtasn1

2022-04-21 Thread Daniel Axtens
also use that value. - Provide strto[u]l[l] preprocessor macros that resolve to grub_strto[u]l[l]. To avoid gcrypt redefining strtoul, we also define HAVE_STRTOUL here. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- grub-core/lib/posix_wrap/limits.h| 1 + grub-core/lib

[PATCH v3 02/19] docs/grub: Document signing grub under UEFI

2022-04-21 Thread Daniel Axtens
Before adding information about how grub is signed with an appended signature scheme, it's worth adding some information about how it can currently be signed for UEFI. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- docs/grub.texi | 22 +- 1 file changed, 21

[PATCH v3 05/19] pgp: factor out rsa_pad

2022-04-21 Thread Daniel Axtens
module. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- grub-core/Makefile.core.def | 8 + grub-core/commands/pgp.c| 28 ++ grub-core/lib/pkcs1_v15.c | 59 + include/grub/pkcs1_v15.h| 27 + 4 files changed

[PATCH v3 01/19] Add suport for signing grub with an appended signature

2022-04-21 Thread Daniel Axtens
e appended signature structure (not at the end) so that the final bytes of a signed ELF file are the appended signature magic. A subsequent patch documents how to create a grub core.img validly signed under this scheme. Signed-off-by: Daniel Axtens Signed-off-by: Rashmica Gupta --- You can exper

[PATCH v3 00/19] Appended signature secure boot support

2022-04-21 Thread Daniel Axtens
Daniel Axtens (17): docs/grub: Document signing grub under UEFI docs/grub: Document signing grub with an appended signature dl: provide a fake grub_dl_set_persistent for the emu target pgp: factor out rsa_pad crypto: move storage for grub_crypto_pk_* to crypto.c posix_wrap: tweaks

[PATCH v3 13/19] grub-install: support embedding x509 certificates

2022-04-21 Thread Daniel Axtens
. Signed-off-by: Alastair D'Silva Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- grub-core/commands/pgp.c| 2 +- include/grub/kernel.h | 3 ++- include/grub/util/install.h | 7 +-- util/grub-install-common.c | 22 +++- util/grub-mkimage.c | 15

[PATCH v3 11/19] libtasn1: compile into asn1 module

2022-04-21 Thread Daniel Axtens
Create a wrapper file that specifies the module license. Set up the makefile so it is built. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- v3: Proper copyright headers. --- grub-core/Makefile.core.def| 15 +++ grub-core/lib/libtasn1_wrap/wrap.c | 27

[PATCH v3 19/19] ieee1275: enter lockdown based on /ibm,secure-boot

2022-04-21 Thread Daniel Axtens
If the 'ibm,secure-boot' property of the root node is 2 or greater, enter lockdown. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- docs/grub.texi | 4 ++-- grub-core/Makefile.core.def| 1 + grub-core/kern/ieee1275/init.c | 27

[PATCH v3 06/19] crypto: move storage for grub_crypto_pk_* to crypto.c

2022-04-21 Thread Daniel Axtens
pher handle. That depends on grub_ciphers being populated by people calling grub_cipher_register. import_gcry.py ensures that the symmetric ciphers call it.] Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- grub-core/commands/pgp.c | 4 grub-core/lib/crypto.c | 4 2 f

[PATCH v3 15/19] appended signatures: parse PKCS#7 signedData and X.509 certificates

2022-04-21 Thread Daniel Axtens
Signed-off-by: Daniel Axtens --- v3 changes: - fix nits from Stefan - correct copyright headers - fixes for libtasn1-4.18.0 - Roll in a fix for a bug reported by Michal: Currently the x509 certificate parser for appended signature verification requires that the certificate have the Digitial

[PATCH v3 16/19] appended signatures: support verifying appended signatures

2022-04-21 Thread Daniel Axtens
, such as a password or lockdown, must be used to ensure that a user cannot drop to the grub shell and disable verification. Signed-off-by: Daniel Axtens --- v3: Correct copyright header, fix some nits from Stefan. v2 changes: - Improve x509 parser function name - Constify data parameters

[PATCH v3 10/19] libtasn1: changes for grub compatibility

2022-04-21 Thread Daniel Axtens
on 32 bit platforms. Signed-off-by: Daniel Axtens Reviewed-by: Stefan Berger --- v2: Clean up strcat handling, thanks Stefan Berger. --- grub-core/lib/libtasn1/lib/decoding.c | 11 +- grub-core/lib/libtasn1/lib/element.c| 3 ++- grub-core/lib/libtasn1/lib/gstr.c | 4 ++-- gru

Re: [PATCH v2 21/22] appended signatures: documentation

2022-04-21 Thread Daniel Axtens
le >> + >> +Refer to the section on password-protecting GRUB (@pxref{Authentication >> +and authorisation}) for more information on preventing this. >> + >> +Additionally, special care must be taken around the @command{loadenv} >> command, >> +which can be used to turn off @code{check_appended_signature}. >> + >> @node UEFI secure boot and shim >> @section UEFI secure boot and shim support >> > > > With this nit fixed: Reviewed-by: Stefan Berger Thanks! Kind regards, Daniel Axtens ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

Re: [PATCH v3 06/15] mm: Allow dynamically requesting additional memory regions

2022-04-21 Thread Daniel Axtens
); +#endif void grub_mm_init_region (void *addr, grub_size_t size); void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size); I've updated by GH branches. Daniel K, are you right to fold this in when you merge this? Kind regards, Daniel Daniel Axtens writes: > From: Patrick Steinha

Re: [PATCH v2 19/22] appended signatures: support verifying appended signatures

2022-04-21 Thread Daniel Axtens
>> +static enum >> +{ check_sigs_no = 0, > > > nit: newline after '{' > fixed > >> + check_sigs_enforce = 1, >> + check_sigs_forced = 2 >> +} check_sigs = check_sigs_no; > > > What does 'forced' mean? It means that it cannot be turned of with `set check_appended_signatures=0` at the grub

Re: [PATCH v2 18/22] appended signatures: parse PKCS#7 signedData and X.509 certificates

2022-04-21 Thread Daniel Axtens
Stefan Berger writes: > On 6/30/21 4:40 AM, Daniel Axtens wrote: > >> This code allows us to parse: >> >> - PKCS#7 signedData messages. Only a single signerInfo is supported, >> which is all that the Linux sign-file utility supports creating >> out-o

Re: [PATCH v2 13/22] libtasn1: changes for grub compatibility

2022-04-21 Thread Daniel Axtens
Stefan Berger writes: > On 6/30/21 4:40 AM, Daniel Axtens wrote: >> Do a few things to make libtasn1 compile as part of grub: >> >> - redefine _asn1_strcat. grub removed strcat so replace it with the >> appropriate calls to memcpy and strlen. Use this int

[PATCH v3 10/15] efi: mm: Implement runtime addition of pages

2022-04-20 Thread Daniel Axtens
there's not enough pages available in the current heap. Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/efi/mm.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core

[PATCH v3 13/15] ieee1275: support runtime memory claiming

2022-04-20 Thread Daniel Axtens
. Allow other space to be allocated at runtime. Tested-by: Stefan Berger Signed-off-by: Daniel Axtens --- v2: reformat, rework and explain better, add debug prints with grub_dprintf --- docs/grub-dev.texi | 7 +- grub-core/kern/ieee1275/init.c | 267

[PATCH v3 14/15] [RFC] Add memtool module with memory allocation stress-test

2022-04-20 Thread Daniel Axtens
large allocations: - how much memory can we allocate in one chunk? - how many 1MB chunks can we allocate? - check that gap-filling works with a 1MB aligned 900kB alloc + a 100kB alloc. Signed-off-by: Daniel Axtens --- I haven't addressed most of the change requests yet. This will need

[PATCH v3 07/15] efi: mm: Always request a fixed number of pages on init

2022-04-20 Thread Daniel Axtens
. Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/efi/mm.c | 35 +++ 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c index d8e4114541a4

[PATCH v3 12/15] ieee1275: drop len -= 1 quirk in heap_init

2022-04-20 Thread Daniel Axtens
or pseries) or under PFW for Power8. I don't have access to old Mac hardware, but if anyone feels especially strongly we can put it under some feature flag. I really want to disable it under pseries because it will mess with region merging. Signed-off-by: Daniel Axtens --- grub-core/kern/ieee1275/

[PATCH v3 11/15] ieee1275: request memory with ibm, client-architecture-support

2022-04-20 Thread Daniel Axtens
berately lower the amount of memory your partition has below 512MB.) Signed-off-by: Daniel Axtens --- v2: reformat v3: extend to option vectors 3 & 4 I wrongly assumed that the most compatible way to perform CAS negotiation was to only set the minimum number of vectors required to ask for m

[PATCH v3 05/15] mm: Drop unused unloading of modules on OOM

2022-04-20 Thread Daniel Axtens
with `grub_dl_unload_unneeded()` Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/dl.c | 20 grub-core/kern/mm.c | 8 include/grub/dl.h | 1 - 3 files changed, 29 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core

[PATCH v3 09/15] efi: mm: Pass up errors from `add_memory_regions ()`

2022-04-20 Thread Daniel Axtens
()` in case `grub_efi_mm_add_regions ()` returns an error. Signed-off-by: Patrick Steinhardt [dja: clarify error messages] Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- v2: Thank you Glenn and Daniel K for the feedback. This and all EFI changes were not tested on real hardware

[PATCH v3 08/15] efi: mm: Extract function to add memory regions

2022-04-20 Thread Daniel Axtens
From: Patrick Steinhardt In preparation of support for runtime-allocating additional memory region, this patch extracts the function to retrieve the EFI memory map and add a subset of it to GRUB's own memory regions. Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed

[PATCH v3 04/15] mm: debug support for region operations

2022-04-20 Thread Daniel Axtens
This is handy for debugging. Enable with `set debug=regions`. Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/mm.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 6e4e8f325a05

[PATCH v3 15/15] ibmvtpm: Add support for trusted boot using a vTPM 2.0

2022-04-20 Thread Daniel Axtens
message to be displayed in the Linux kernel log. Those users will have to update their machines to the firmware levels mentioned above. Cc: Eric Snowberg Signed-off-by: Stefan Berger Signed-off-by: Daniel Axtens --- docs/grub.texi| 3 +- grub-core/Makefile.core.def

[PATCH v3 02/15] mm: assert that we preserve header vs region alignment

2022-04-20 Thread Daniel Axtens
implicit here: rather than changing grub_mm_region_init() to ALIGN_UP(), require that the struct is explictly a multiple of the header size. Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- v2: Thanks Daniel K for feedback. --- include/grub/mm_private.h | 14 ++ 1 file

[PATCH v3 03/15] mm: when adding a region, merge with region after as well as before

2022-04-20 Thread Daniel Axtens
that are not multiples of GRUB_MM_ALIGN. * Allow merging of regions immediately _after_ existing regions, not just before. As with the other approach, we create an allocated block to represent the new space and the pass it to grub_free() to get the metadata right. Signed-off-by: Daniel Axtens Tested

[PATCH v3 06/15] mm: Allow dynamically requesting additional memory regions

2022-04-20 Thread Daniel Axtens
, in hopes that region merging means that we end up with enough memory for things to work out. Signed-off-by: Patrick Steinhardt [dja: add this to the documentation at the top of mm.c v2: fallback to non-contiguous] Signed-off-by: Daniel Axtens Tested-by: Stefan Berger Reviewed-by: Daniel

[PATCH v3 01/15] grub-shell: only pass SeaBIOS fw_opt in for x86 BIOS platforms

2022-04-20 Thread Daniel Axtens
This breaks the tests on pseries - just restrict it to x86 platforms that don't specify a BIOS. Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- v2: Thanks Daniel K and Glenn for feedback. --- tests/util/grub-shell.in | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff

[PATCH v3 00/15] Dynamic allocation of memory regions and IBM vTPM v2

2022-04-20 Thread Daniel Axtens
-specific patches only. Kind regards, Daniel Daniel Axtens (8): grub-shell: only pass SeaBIOS fw_opt in for x86 BIOS platforms mm: assert that we preserve header vs region alignment mm: when adding a region, merge with region after as well as before mm: debug support for region operations

[PATCH v2 10/15] efi: mm: Implement runtime addition of pages

2022-03-28 Thread Daniel Axtens
there's not enough pages available in the current heap. Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/efi/mm.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core

[PATCH v2 04/15] mm: debug support for region operations

2022-03-28 Thread Daniel Axtens
This is handy for debugging. Enable with `set debug=regions`. Signed-off-by: Daniel Axtens --- grub-core/kern/mm.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 94e78f9a910d..f36499865632 100644

[PATCH v2 14/15] [RFC] Add memtool module with memory allocation stress-test

2022-03-28 Thread Daniel Axtens
large allocations: - how much memory can we allocate in one chunk? - how many 1MB chunks can we allocate? - check that gap-filling works with a 1MB aligned 900kB alloc + a 100kB alloc. Signed-off-by: Daniel Axtens --- I haven't addressed most of the change requests yet. This will need

[PATCH v2 13/15] ieee1275: support runtime memory claiming

2022-03-28 Thread Daniel Axtens
. Allow other space to be allocated at runtime. Tested-by: Stefan Berger Signed-off-by: Daniel Axtens --- v2: reformat, rework and explain better, add debug prints with grub_dprintf --- docs/grub-dev.texi | 7 +- grub-core/kern/ieee1275/init.c | 267

[PATCH v2 15/15] ibmvtpm: Add support for trusted boot using a vTPM 2.0

2022-03-28 Thread Daniel Axtens
message to be displayed in the Linux kernel log. Those users will have to update their machines to the firmware levels mentioned above. Cc: Eric Snowberg Signed-off-by: Stefan Berger Signed-off-by: Daniel Axtens --- docs/grub.texi| 3 +- grub-core/Makefile.core.def

[PATCH v2 11/15] ieee1275: request memory with ibm, client-architecture-support

2022-03-28 Thread Daniel Axtens
ize - it persists even on cold boots. So if you've ever booted Linux in a partition, you'll probably never have grub call CAS. It'll only ever fire the first time a partition loads grub, or if you deliberately lower the amount of memory your partition has below 512MB.) Signed-off-by: Daniel Axtens

[PATCH v2 12/15] ieee1275: drop len -= 1 quirk in heap_init

2022-03-28 Thread Daniel Axtens
or pseries) or under PFW for Power8. I don't have access to old Mac hardware, but if anyone feels especially strongly we can put it under some feature flag. I really want to disable it under pseries because it will mess with region merging. Signed-off-by: Daniel Axtens --- grub-core/kern/ieee1275/

[PATCH v2 09/15] efi: mm: Pass up errors from `add_memory_regions ()`

2022-03-28 Thread Daniel Axtens
()` in case `grub_efi_mm_add_regions ()` returns an error. Signed-off-by: Patrick Steinhardt [dja: clarify error messages] Signed-off-by: Daniel Axtens --- v2: Thank you Glenn and Daniel K for the feedback. This and all EFI changes were not tested on real hardware. --- grub-core/kern/efi/mm.c | 22

[PATCH v2 08/15] efi: mm: Extract function to add memory regions

2022-03-28 Thread Daniel Axtens
From: Patrick Steinhardt In preparation of support for runtime-allocating additional memory region, this patch extracts the function to retrieve the EFI memory map and add a subset of it to GRUB's own memory regions. Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens --- grub

[PATCH v2 07/15] efi: mm: Always request a fixed number of pages on init

2022-03-28 Thread Daniel Axtens
. Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/efi/mm.c | 35 +++ 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c index d8e4114541a4

[PATCH v2 06/15] mm: Allow dynamically requesting additional memory regions

2022-03-28 Thread Daniel Axtens
, in hopes that region merging means that we end up with enough memory for things to work out. Tested-by: Stefan Berger Signed-off-by: Patrick Steinhardt [dja: add this to the documentation at the top of mm.c v2: fallback to non-contiguous] Signed-off-by: Daniel Axtens --- Daniel K: you

[PATCH v2 05/15] mm: Drop unused unloading of modules on OOM

2022-03-28 Thread Daniel Axtens
with `grub_dl_unload_unneeded()` Signed-off-by: Patrick Steinhardt Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- grub-core/kern/dl.c | 20 grub-core/kern/mm.c | 8 include/grub/dl.h | 1 - 3 files changed, 29 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core

[PATCH v2 01/15] grub-shell: only pass SeaBIOS fw_opt in for x86 BIOS platforms

2022-03-28 Thread Daniel Axtens
This breaks the tests on pseries - just restrict it to x86 platforms that don't specify a BIOS. Signed-off-by: Daniel Axtens --- v2: Thanks Daniel K and Glenn for feedback. --- tests/util/grub-shell.in | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/util/grub

[PATCH v2 03/15] mm: when adding a region, merge with region after as well as before

2022-03-28 Thread Daniel Axtens
-by: Daniel Axtens --- v2: Thanks Daniel K for feedback. --- grub-core/kern/mm.c | 123 +++--- include/grub/mm_private.h | 9 +++ 2 files changed, 85 insertions(+), 47 deletions(-) diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 079c28da7cdf

[PATCH v2 02/15] mm: assert that we preserve header vs region alignment

2022-03-28 Thread Daniel Axtens
implicit here: rather than changing grub_mm_region_init() to ALIGN_UP(), require that the struct is explictly a multiple of the header size. Signed-off-by: Daniel Axtens --- v2: Thanks Daniel K for feedback. --- include/grub/mm_private.h | 14 ++ 1 file changed, 14 insertions(+) diff

[PATCH v2 00/15] Dynamic allocation of memory regions and IBM vTPM v2

2022-03-28 Thread Daniel Axtens
in the patch. I've also included Stefan's vTPM patch - Stefan kindly tested that his patch worked with my memory rework series. I have added his tested-by to relevant Power-specific patches only. Kind regards, Daniel Daniel Axtens (8): grub-shell: pseries: don't pass fw_opt to qemu mm: assert

Re: [PATCH 11/19] efi: mm: Extract function to add memory regions

2022-03-24 Thread Daniel Axtens
>>/* Prepare a memory region to store two memory maps. */ >>memory_map = grub_efi_allocate_any_pages (2 * BYTES_TO_PAGES >> (MEMORY_MAP_SIZE)); >>if (! memory_map) >> -grub_fatal ("cannot allocate memory"); >> +return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate

Re: [PATCH 04/19] mm: assert that we preserve header vs region alignment

2022-03-22 Thread Daniel Axtens
> s/struct grub_mm_region/grub_mm_region_t/ > s/struct grub_mm_header/grub_mm_header_t/ The problem is that grub_mm_{region,header}_t is a pointer type, not a struct type. So sizeof (grub_mm_region_t) == sizeof(void *). You also can't do sizeof (*grub_mm_region_t), because you can't dereference

[PATCH] net: check against nb->tail in grub_netbuff_pull

2022-03-04 Thread Daniel Axtens
nb->data > nb->tail, which should not be. Make grub_netbuff_pull check against both nb->tail and nb->end. In theory just checking against ->tail should be sufficient but the extra check should be cheap and seems like good defensive practice. Signed-off-by: Daniel Axtens

Re: [PATCH] net: fix null pointer dereference when parsing ICMP6_ROUTER_ADVERTISE messages

2022-02-17 Thread Daniel Axtens
Hi, I tested this against grub-emu and it fixed the crash I had observed. net_ls_addr reports an address as expected now also. Reviewed-by: Daniel Axtens Kind regards, Daniel Qiumiao Zhang via Grub-devel writes: > During UEFI PXE boot in IPv6 network, if the DHCP server adopts state

Re: [PATCH] Revert "iee1275/datetime: Fix off-by-1 error."

2022-02-10 Thread Daniel Axtens
dja@sauce ~]$ date -u >> Tue Feb 8 04:46:40 UTC 2022 >> >> After applying the patch, grub printed: >> >> grub> date >> 2022-02-08 04:51:27 Tuesday >> >> It seems the patch makes things better. > > Great thanks Daniel for confirming this.

Re: [PATCH] Revert "iee1275/datetime: Fix off-by-1 error."

2022-02-07 Thread Daniel Axtens
se, before the patch, grub printed: grub> date 2022-02-09 04:31:10 Wednesday whereas on booting: [dja@sauce ~]$ date -u Tue Feb 8 04:46:40 UTC 2022 After applying the patch, grub printed: grub> date 2022-02-08 04:51:27 Tuesday It seems the patch makes things better. Tested-by: Dani

Re: [PATCH 5/6] mm: document grub_mm_init_region

2021-12-13 Thread Daniel Axtens
Daniel Kiper writes: > On Thu, Nov 25, 2021 at 02:22:49AM +1100, Daniel Axtens wrote: >> grub_mm_init_region does some things that seem magical, especially >> around region merging. Make it a bit clearer. >> >> Signed-off-by: Daniel Axtens >>

[PATCH 3/6] mm: grub_real_malloc: make small allocs comment match code

2021-11-24 Thread Daniel Axtens
/mm.c (grub_real_malloc): Decrease cut-off of moving the") Signed-off-by: Daniel Axtens --- grub-core/kern/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 6efabe92df0e..ac41cf4aab15 100644 --- a/grub-core/kern/mm.c +++ b/grub-core

[PATCH 2/6] mm: clarify grub_real_malloc

2021-11-24 Thread Daniel Axtens
Document that. Signed-off-by: Daniel Axtens --- grub-core/kern/mm.c | 76 - 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index c070afc621f8..6efabe92df0e 100644 --- a/grub-core/kern/mm.c +++ b/

  1   2   3   >