Page MenuHomeFreeBSD

uefisign: Separate file verdicts from failures
Needs ReviewPublic

Authored by quentin.thebault_defenso.fr on Sep 11 2026, 1:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 18, 1:42 AM
Unknown Object (File)
Sat, Oct 17, 4:33 PM
Unknown Object (File)
Tue, Oct 13, 2:46 PM
Unknown Object (File)
Mon, Oct 12, 7:26 AM
Unknown Object (File)
Mon, Oct 12, 2:12 AM
Unknown Object (File)
Wed, Oct 7, 11:42 PM
Unknown Object (File)
Tue, Oct 6, 6:56 PM
Unknown Object (File)
Tue, Oct 6, 6:56 PM
Subscribers

Details

Summary
uefisign: Separate file verdicts from failures

uefisign(8) exited 1 for everything, so a caller (e.g. a signing script
or a CI check) could not tell an unsigned or malformed file from a
program failure.  Split the status into four values:

    0  success (file was signed or with -V, contains a signature)
    1  program or library failure
    2  no signature found (with -V)
    3  invalid file format (input is not a conforming PE image)

PR:             298383
Sponsored by:   Defenso

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77401
Build 74284: arc lint + arc unit

Event Timeline

sysexits(3) states

This interface has been deprecated and is retained only for compatibility. Its use is discouraged.

I agree it's useful to be able to distinguish the different failure cases though.

I hate to request a bunch of rework on this, but IMO a lot of this is churn that isn't really needed.

grep(1) has a similar need for more than just a binary success/failure exit and is succinct:

The grep utility exits with one of the following values:

0     One or more lines were selected.
1     No lines were selected.
>1    An error occurred.

Can we similarly have three or four exit values to use here?

The sysexit parts of this are too churny. Can't we exit 2 or 3 or whatever to indicate signing issues instead?

quentin.thebault_defenso.fr edited the summary of this revision. (Show Details)

Simplify return codes to 4 values:

0  success (file was signed or with -V, contains a signature)
1  program or library failure
2  no signature found (with -V)
3  invalid file format (input is not a conforming PE image)
quentin.thebault_defenso.fr retitled this revision from uefisign: separate file verdicts from failures to uefisign: Separate file verdicts from failures.Mon, Sep 28, 4:59 AM
quentin.thebault_defenso.fr edited the summary of this revision. (Show Details)