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 1436402 - nc from nmap ncat crash if ipv6 disabled
Summary: nc from nmap ncat crash if ipv6 disabled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nmap
Version: 7.3
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Pavel Zhukov
QA Contact: Jaroslav Aster
URL:
Whiteboard:
Depends On: 1460249
Blocks: 1420851 1465887 1465928
TreeView+ depends on / blocked
 
Reported: 2017-03-27 20:52 UTC by Paulo Andrade
Modified: 2021-06-10 12:06 UTC (History)
5 users (show)

Fixed In Version: nmap-6.40-13.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 08:36:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0661 0 None None None 2018-04-10 08:37:09 UTC

Description Paulo Andrade 2017-03-27 20:52:50 UTC
The crash always happen due to to nmap-6.40-allresolve.patch
but can be made to crash without the patch by passing "-6" in
the command line, so the patch is not really wrong, just exposes
the issue.

  Steps to reproduce:
1. Boot with "ipv6.disable=1" as kernel parameter
2. Run "nc -6 localhost"

Adding -6 just for it to not try ipv4 before.

  Expectd output would be the same as:

$ nc -4 localhost
Ncat: Connection refused.

but what happens is:

$ nc -6 localhost
Socket troubles: Address family not supported by protocol
nc: engine_select.c:353: get_evmask: Assertion `sd >= 0' failed.
Aborted (core dumped)

  The fix probably should involve not adding to the event list
in nsock/src/nsock_connect.c:nsp_add_event() if it failed to
connect, or, nsock/src/engine_select.c:iterate_through_event_lists()
check the event and not call process_event() if the (connect_event)
event has event_done set, but would need to check too many states
for that.

  Likely fix would be in pseudo patch:

       if (!nse->event_done) {
         assert(nse->iod->sd >= 0);
         socket_count_read_inc(nse->iod);
         socket_count_write_inc(nse->iod);
         update_events(nse->iod, nsp, EV_READ|EV_WRITE|EV_EXCEPT, EV_NONE);
       }
+      else if (nse->iod->sd < 0) {
+          /* do something else, update logs, etc */
+          msevent_delete(nsp, nse);
+          /* do something else, update logs, etc */
+      }
+      else
       iod_add_event(nse->iod, nse);

Comment 11 Jaroslav Aster 2017-11-08 16:49:22 UTC
Hi Pavel,

I'm not sure, is this output ok? I see the same output in the old/new version, abort without crash.


# rpm -q nmap
nmap-ncat-6.40-12.el7.x86_64

# ncat -6 localhost
Socket troubles: Address family not supported by protocol
ncat: engine_select.c:353: get_evmask: Assertion `sd >= 0' failed.
Aborted



# rpm -q nmap-ncat
nmap-ncat-6.40-7.el7.x86_64

# ncat -6 localhost
Socket troubles: Address family not supported by protocol
ncat: engine_select.c:353: get_evmask: Assertion `sd >= 0' failed.
Aborted

Comment 18 errata-xmlrpc 2018-04-10 08:36:10 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-2018:0661


Note You need to log in before you can comment on or make changes to this bug.