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 1820684

Summary: nftables segfault on working with non-empty interval sets using rhel-8.1 kernel
Product: Red Hat Enterprise Linux 8 Reporter: Tomas Dolezal <todoleza>
Component: nftablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Tomas Dolezal <todoleza>
Severity: high Docs Contact:
Priority: high    
Version: 8.2CC: egarver, sbrivio, todoleza, yiche
Target Milestone: rcKeywords: ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nftables-0.9.3-16.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1847553 1854532 (view as bug list) Environment:
Last Closed: 2020-11-04 01:58:24 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: 1847553    
Bug Blocks: 1802014, 1854532    

Description Tomas Dolezal 2020-04-03 15:25:54 UTC
Description of problem:
userspace packages nftables and kernel can now work with intervals in sets. If nftables package operates on such sets on older kernel, segfaults occur when:
 * adding elements to the set with interval flag
 * listing entities that contain such sets (e.g. nft list tables)
A fix other than RPM version requirement is needed to be compatible with containers.

Version-Release number of selected component (if applicable):
nftables-0.9.3-12.el8.x86_64
libnftnl-1.1.5-4.el8.x86_64
kernel-4.18.0-147.3.1.el8_1.x86_64 (rhel-8.1 kernel)

How reproducible:
always

Steps to Reproduce:
cat > rules.nft <<EOF
flush ruleset
table inet filter {
        set test {
                type ipv4_addr . ipv4_addr . inet_service
                flags interval,timeout
                elements = { 1.1.1.1 . 2.2.2.2 . 30 ,
                             2.2.2.2 . 3.3.3.3 . 40 ,
                             3.3.3.3 . 4.4.4.4 . 50 }
        }

        chain output {
                type filter hook output priority 0; policy accept;
                ip saddr . ip daddr . tcp dport @test counter
        }
}
EOF

# nft -f rules.nft
# nft list tables
Segmentation fault (core dumped)
# nft list ruleset
Segmentation fault (core dumped)
# nft flush set inet filter test
# nft list tables
table inet filter

Actual results:
when there are interval elements in the set, segfault occurs with older kernel

Expected results:
compatibility layer for older kernels and proper package requirements in place to counter the issue


Additional info:
see thread in upstream for more information:
 https://lore.kernel.org/netfilter-devel/20200403120351.cxhcdcwfpylven4k@salvia/

following set without interval works correctly
{ type ipv4_addr . inet_service
  flags timeout
  elements = { 2.2.2.2 . 30 }
}

Comment 1 Phil Sutter 2020-06-16 15:31:33 UTC
Upstream solved this by re-introducing NFT_SET_CONCAT flag. Backporting this is a combined approach in user space:

commit 09441b5e92ceea60198a35cd657904fa7a10ee54
Author: Stefano Brivio <sbrivio>
Date:   Mon Apr 13 21:48:03 2020 +0200

    src: Set NFT_SET_CONCAT flag for sets with concatenated ranges
    
    Pablo reports that nft, after commit 8ac2f3b2fca3 ("src: Add support
    for concatenated set ranges"), crashes with older kernels (< 5.6)
    without support for concatenated set ranges: those sets will be sent
    to the kernel, which adds them without notion of the fact that
    different concatenated fields are actually included, and nft crashes
    while trying to list this kind of malformed concatenation.
    
    Use the NFT_SET_CONCAT flag introduced by kernel commit ef516e8625dd
    ("netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag") when
    sets including concatenated ranges are sent to the kernel, so that
    older kernels (with no knowledge of this flag itself) will refuse set
    creation.
    
    Note that, in expr_evaluate_set(), we have to check for the presence
    of the flag, also on empty sets that might carry it in context data,
    and actually set it in the actual set flags.
    
    Reported-by: Pablo Neira Ayuso <pablo>
    Signed-off-by: Stefano Brivio <sbrivio>
    Signed-off-by: Pablo Neira Ayuso <pablo>

and kernel space:

commit ef516e8625ddea90b3a0313f3a0b0baa83db7ac2
Author: Pablo Neira Ayuso <pablo>
Date:   Tue Apr 7 14:10:38 2020 +0200

    netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag
    
    Stefano originally proposed to introduce this flag, users hit EOPNOTSUPP
    in new binaries with old kernels when defining a set with ranges in
    a concatenation.
    
    Fixes: f3a2181e16f1 ("netfilter: nf_tables: Support for sets with multiple ranged fields")
    Reviewed-by: Stefano Brivio <sbrivio>
    Signed-off-by: Pablo Neira Ayuso <pablo>

I'll therefore clone this ticket for kernel component to get both into RHEL8.3.

Comment 15 errata-xmlrpc 2020-11-04 01:58:24 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 (nftables bug fix and enhancement update), 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/RHEA-2020:4535