Re: [Rpm-maint] [rpm-software-management/rpm] A header with count zero has length zero (#1496)

2021-01-13 Thread Demi Marie Obenour
@DemiMarie pushed 1 commit. e02bf8213191e53ddde98171ab2ba8900c33833b A header with count zero has length zero -- You are receiving this because you are subscribed to this thread. View it on GitHub:

[Rpm-maint] [rpm-software-management/rpm] Avoid negating an attacker-controlled signed integer (#1502)

2021-01-13 Thread Demi Marie Obenour
Negating INT32_MIN is undefined behavior, so we must prevent it. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1502 -- Commit Summary -- * Avoid negating an attacker-controlled signed integer -- File Changes -- M

Re: [Rpm-maint] [rpm-software-management/rpm] Check that type and length are not out of range (#1491)

2021-01-13 Thread lgtm-com[bot]
This pull request **introduces 1 alert** when merging 9e7b746b1d419135b0f175b875a9023762dce87a into 5ce2b5e3121aa07eb1ccf2bc24443c1536bf94d5 - [view on LGTM.com](https://lgtm.com/projects/g/rpm-software-management/rpm/rev/pr-af2eb5afc56e75f307e29688f00cf48eb1ddb722) **new alerts:** * 1 for

[Rpm-maint] [rpm-software-management/rpm] Enable hardening flags where available (#1501)

2021-01-13 Thread Demi Marie Obenour
We want to remove as many forms of undefined behavior as we can. This adds flags to make integer and pointer overflows well-defined. Furthermore, it turns on strong stack protection. You can view, comment on, or merge this pull request online at:

[Rpm-maint] [rpm-software-management/rpm] Verify that data does not overlap region trailer (#1498)

2021-01-13 Thread Demi Marie Obenour
This is already checked for other headers. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1498 -- Commit Summary -- * Verify that data does not overlap region trailer -- File Changes -- M lib/header.c (5) -- Patch

[Rpm-maint] [rpm-software-management/rpm] Re-check header in hdrblobInit() (#1500)

2021-01-13 Thread Demi Marie Obenour
Functions in the public RPM API use hdrblobInit() to import an RPM header from memory, but that skips critical checks. Fix this by not skipping these checks. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1500 -- Commit

[Rpm-maint] [rpm-software-management/rpm] Check that len is in range before using it (#1497)

2021-01-13 Thread Demi Marie Obenour
This prevents integer overflows. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1497 -- Commit Summary -- * Check that len is in range before using it -- File Changes -- M lib/header.c (8) -- Patch Links --

[Rpm-maint] [rpm-software-management/rpm] ‘hdrblobInit’: check pointer is 8-byte aligned (#1499)

2021-01-13 Thread Demi Marie Obenour
Otherwise, we will dereference a misaligned pointer, which is undefined behavior. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1499 -- Commit Summary -- * ‘hdrblobInit’: check pointer is 8-byte aligned -- File Changes

[Rpm-maint] [rpm-software-management/rpm] Forbid headers with only a region (#1495)

2021-01-13 Thread Demi Marie Obenour
Such headers are useless and might cause problems elsewhere. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1495 -- Commit Summary -- * Forbid headers with only a region -- File Changes -- M lib/header.c (6) --

[Rpm-maint] [rpm-software-management/rpm] A header with count zero has length zero (#1496)

2021-01-13 Thread Demi Marie Obenour
Previously we would suffer an integer underflow in this case. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1496 -- Commit Summary -- * A header with count zero has length zero -- File Changes -- M lib/header.c (3)

[Rpm-maint] [rpm-software-management/rpm] Check that count won't overflow (#1493)

2021-01-13 Thread Demi Marie Obenour
This is already checked in regionSwab() but it is better to check it earlier, in case someone uses hdrblobInit() without hdrblobImport(). You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1493 -- Commit Summary -- * Check

[Rpm-maint] [rpm-software-management/rpm] Check that ‘einfo.offset’ is reasonable (#1494)

2021-01-13 Thread Demi Marie Obenour
This ensures adding ‘REGION_TAG_COUNT’ to it will not overflow. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1494 -- Commit Summary -- * Check that ‘einfo.offset’ is reasonable -- File Changes -- M lib/header.c (3)

[Rpm-maint] [rpm-software-management/rpm] Clean up rdl calculation (#1488)

2021-01-13 Thread Demi Marie Obenour
You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1488 -- Commit Summary -- * Clean up rdl calculation -- File Changes -- M lib/header.c (4) -- Patch Links --

[Rpm-maint] [rpm-software-management/rpm] Fuzz headerimport (#1490)

2021-01-13 Thread Demi Marie Obenour
You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1490 -- Commit Summary -- * Add a fuzz target for ‘headerImport’ * Fuzz headerExport() too -- File Changes -- M lib/header.c (50) -- Patch Links --

[Rpm-maint] [rpm-software-management/rpm] Avoid incrementing a pointer past the end (#1489)

2021-01-13 Thread Demi Marie Obenour
The ‘end’ parameter to ‘strtaglen’ might point past the end of an allocation. Therefore, if ‘start’ becomes equal to ‘end’, return an error without calling ‘memchr’ on that pointer. You can view, comment on, or merge this pull request online at:

[Rpm-maint] [rpm-software-management/rpm] Check that count and data length are reasonable (#1492)

2021-01-13 Thread Demi Marie Obenour
This avoids any possible integer overflows. You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1492 -- Commit Summary -- * Check that count and data length are reasonable -- File Changes -- M lib/header.c (3) -- Patch

[Rpm-maint] [rpm-software-management/rpm] Check that type and length are not out of range (#1491)

2021-01-13 Thread Demi Marie Obenour
This avoids a potential out-of-bounds read in dataLength(). You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1491 -- Commit Summary -- * Check that type and length are not out of range -- File Changes -- M lib/header.c

Re: [Rpm-maint] [rpm-software-management/rpm] Harden against crafted inputs (#1471)

2021-01-13 Thread Demi Marie Obenour
> Please split off the commits with actual reproducer to a separate PR, and > make the reproducers available someplace. That allows us to prioritize, > properly reviewing this kind of stuff is a lot of work. Will do. I only have reproducers for a small subset of these, though. > Second, split

[Rpm-maint] [rpm-software-management/rpm] Also check DT_RUNPATH when looking for rpath issues (#1487)

2021-01-13 Thread Siddhesh Poyarekar
DT_RPATH has been deprecated in favour of DT_RUNPATH for some time now and both have similar functionality. RUNPATH is less infectious, i.e. it does not affect search paths for dependency resolution of dependencies, but that only limits the issues insecure paths may cause and does not eliminate

Re: [Rpm-maint] [rpm-software-management/rpm] Harden against crafted inputs (#1471)

2021-01-13 Thread Panu Matilainen
@pmatilai requested changes on this pull request. Please split off the commits with actual reproducer to a separate PR, and make the reproducers available someplace. Second, split this further into smaller PRs, this kind of pile-up is impossible to meaningfully review in GH. Stick to just a

Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-13 Thread Panu Matilainen
@pmatilai requested changes on this pull request. See above, bunch of mostly minor issues and some questions to address. > +return RPMRC_OK; +} + +if (stat(state->fifo_path, ) == -1) { +rpmlog(RPMLOG_DEBUG, "Stat: %s -> %s\n", state->fifo_path, strerror(errno)); +

Re: [Rpm-maint] [rpm-software-management/rpm] file trigger quirks (#1370)

2021-01-13 Thread Michael Schroeder
Speaking of file trigger issues: what's the deal with the %transfiletriggerpostun triggers? Why are they not fed a list of matching files so they can check if there is really something to do? And why is the implementation so weird? I don't see any reason for that

Re: [Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

2021-01-13 Thread Panu Matilainen
@pmatilai commented on this pull request. > @@ -845,6 +845,14 @@ > AC_CHECK_HEADERS([linux/fsverity.h],[FSVERITY_IOCTL="yes"]) ]) AM_CONDITIONAL(FSVERITY_IOCTL,[test "x$FSVERITY_IOCTL" = xyes]) +#= +# Check for fapolicyd support +AC_ARG_WITH(fapolicyd,

Re: [Rpm-maint] [rpm-software-management/rpm] Dynamic Spec generation (#1485)

2021-01-13 Thread Panu Matilainen
A couple of random thoughts: - I think we'd want the generated specs parse occur before `%check` because you want to get possible packaging errors as soon as possible, and test-suites can take significant amount of time. And actually, I don't think we should allow `%check` to affect the actual