Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1510538

Summary: Fix Covscan detected programming errors
Product: Red Hat Enterprise Linux 7 Reporter: Phil Sutter <psutter>
Component: libnftnlAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Tomas Dolezal <todoleza>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: atragler, jmaxwell, rkhan, sbrivio, todoleza
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libnftnl-1.0.8-2.el7 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 19:40:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1723958    
Attachments:
Description Flags
added issues
none
scan-results.err none

Description Phil Sutter 2017-11-07 15:58:25 UTC
Created attachment 1349039 [details]
added issues

Coverity tool found a number of potential issues in rebased libnftnl code base, see attachment for details.

Comment 2 Phil Sutter 2017-12-14 13:06:52 UTC
Created attachment 1367976 [details]
scan-results.err

Comment 3 Phil Sutter 2017-12-14 19:43:30 UTC
All warnings about potential NULL pointer dereference in nftnl_chain_set_data() are invalid: Covscan missed that initial call to nftnl_assert_validate() will lead to calling exit() if 'data' is NULL.

Possibly negative return of time(NULL) in nftnl_batch_is_supported() was deemed unproblematic by upstream maintainer: https://www.spinics.net/lists/netfilter-devel/msg43429.html

Potential NULL pointer deref in nftnl_gen_set_data() is invalid for the same reason as in nftnl_chain_set_data().

Potential NULL pointer deref in nftnl_obj_set_data() is invalid as well, since the function calls nftnl_assert_validate(), too.

Potential NULL pointer deref in nftnl_rule_set_data() is invalid for the same reason as above.

Warning about uninitialized variable 'attr' in nftnl_rule_parse_expr() is invalid: mnl_attr_for_each_nested() initializes it.

Potential NULL pointer deref in nftnl_set_set_data() falls into the same category as those above, the function protects access to 'data' by a call to nftnl_assert_validate().

Warning about uninitialized variable 'attr' in nftnl_set_elems_parse() is invalid as well since it is passed to mnl_attr_for_each_nested().

Remaining issues addressed in a series of patches for upstream: https://marc.info/?l=netfilter-devel&m=151328044511316&w=2

Comment 4 Phil Sutter 2018-02-26 10:48:15 UTC
Upstream accepted. The list of patches to backport is:

4177002b26f02 ("data_reg: Add a missing break in nftnl_data_reg_snprintf")
fd9ab5c922cd8 ("gen: Remove a pointless call to mnl_nlmsg_get_payload()")
8f228f6842494 ("object: Avoid returning garbage in nftnl_obj_do_parse()")
dbaf6ea8f6a1a ("ruleset: Avoid reading garbage in nftnl_ruleset_cb()")
8bcf10b504c69 ("set_elem: Don't return garbage in nftnl_set_elems_parse()")
57f85977ed72e ("trace: Check return value of mnl_attr_parse_nested()")

Comment 6 Phil Sutter 2018-03-28 11:43:58 UTC
*** Bug 1451368 has been marked as a duplicate of this bug. ***

Comment 8 Phil Sutter 2019-06-26 10:41:40 UTC
Missed 7.7, aiming for 7.8.

Comment 17 errata-xmlrpc 2020-03-31 19:40:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1027