Bug 255594 - efirt: add ESRT table support
Summary: efirt: add ESRT table support
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-04 15:14 UTC by Pavel Balaev
Modified: 2024-08-28 17:35 UTC (History)
3 users (show)

See Also:


Attachments
ESRT table patch (7.12 KB, patch)
2021-05-04 15:14 UTC, Pavel Balaev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Balaev 2021-05-04 15:14:09 UTC
Created attachment 224662 [details]
ESRT table patch

This patch enables publishing ESRT table to user space.
This is usefull for firmware update tools such as fwupd.

ESRT table represent via read-only sysctl variables.
User can disable ESRT representing via variable
"efi.esrt.disable=1" in loader.conf.
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2021-05-04 15:42:43 UTC
Can you put the patch on https://reviews.freebsd.org?
Comment 2 Pavel Balaev 2021-05-04 17:27:56 UTC
(In reply to Konstantin Belousov from comment #1)
OK, waiting for account approval
Comment 3 Pavel Balaev 2021-05-04 17:57:42 UTC
(In reply to Konstantin Belousov from comment #1)
done: https://reviews.freebsd.org/differential/diff/88606/
Comment 4 Pavel Balaev 2021-05-04 18:02:22 UTC
(In reply to Konstantin Belousov from comment #1)
Sorry, correct link: https://reviews.freebsd.org/D30104
Comment 5 Pavel Balaev 2021-05-04 18:08:19 UTC
(In reply to Konstantin Belousov from comment #1)
I don't know who to appoint as reviewers, can you help me?
Comment 6 Ed Maste freebsd_committer freebsd_triage 2024-08-28 17:35:29 UTC
Is this resolved with:

commit 24f398e7a153a05a7e94ae8dd623e2b6d28d94eb
Author: Pavel Balaev <pavel.balaev@3mdeb.com>
Date:   Thu Jul 1 19:29:36 2021 +0300

    Add efitable(8), a userspace tool to fetch and parse EFI tables
    
    Only ESRT and PROP tables are handled at the moment.
    
    Submitted by:   Pavel Balaev <pavel.balaev@3mdeb.com>
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D30104

commit d12d651f8692cfcaf6fd0a6e8264c29547f644c9
Author: Pavel Balaev <pavel.balaev@3mdeb.com>
Date:   Thu Jul 1 19:27:25 2021 +0300

    EFI RT: resurrect EFIIOC_GET_TABLE
    
    Make it work, but change the interface to be safe for non-root users. In
    particular, right now interface only works for the tables which can be
    minimally parsed by kernel to determine the table size. Then, userspace can
    query the table size, after that it provides a buffer of needed size
    and kernel copies out just table to userspace.
    
    Main advantage is that user no longer need to be able to read /dev/mem,
    the disadvantage is the need to have minimal parsers aware of the table
    types.  Right now the parsers are implemented for ESRT and PROP tables.
    
    Future extension of the present interface might be a return of only
    the table physical address, in case kernel does not have suitable
    parser yet. Then, a privileged user could read the table from /dev/mem.
    This extension, which logically equivalent to the old (non-worked)
    EFIIOC_GET_TABLE variant, is not implemented until needed.
    
    Submitted by:   Pavel Balaev <pavel.balaev@3mdeb.com>
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D30104