]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
3 years agoutil: add unit tests for CIDRFromMask() 7449/head
Sascha Steinbiss [Wed, 27 Apr 2022 21:12:26 +0000 (23:12 +0200)] 
util: add unit tests for CIDRFromMask()

(cherry picked from commit 5ec6f3ba51c449f7588afac0820ad57b1cea5de9)

3 years agodetect: make int CIDRFromMask() work on big endian platforms
Sascha Steinbiss [Wed, 27 Apr 2022 18:09:50 +0000 (20:09 +0200)] 
detect: make int CIDRFromMask() work on big endian platforms

(cherry picked from commit 394356f73c026879672843fbb20b4de68a09d0ac)

3 years agomemcmp: no-simd no case loop can scan forward
Victor Julien [Fri, 6 May 2022 21:52:00 +0000 (23:52 +0200)] 
memcmp: no-simd no case loop can scan forward

(cherry picked from commit f0479987ff6f5321613395a8bf1a5eb38530b977)

3 years agomemcmp: use SCMEMCMP_BYTES everywhere; general cleanups
Victor Julien [Fri, 6 May 2022 16:20:40 +0000 (18:20 +0200)] 
memcmp: use SCMEMCMP_BYTES everywhere; general cleanups

(cherry picked from commit 0fc7ba45aa6c494bdedd5276e7ec7e4e9012facb)

3 years agomemcmp: remove unreachable code from memcmp simd
Victor Julien [Thu, 5 May 2022 05:16:53 +0000 (07:16 +0200)] 
memcmp: remove unreachable code from memcmp simd

cppcheck:

src/util-memcmp.h:281:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:280:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:269:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:281:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^
src/util-memcmp.h:344:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:343:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:318:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:344:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^
src/util-memcmp.h:171:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:170:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:159:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:171:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^
src/util-memcmp.h:233:18: warning: Identical condition 'len-offset<16', second condition is always false [identicalConditionAfterEarlyExit]
        if (diff < 16) {
                 ^
src/util-memcmp.h:232:24: note: 'diff' is assigned value 'len-offset' here.
        int diff = len - offset;
                       ^
src/util-memcmp.h:208:33: note: If condition 'len-offset<16' is true, the function will return/exit
        if (likely(len - offset < 16)) {
                                ^
src/util-memcmp.h:233:18: note: Testing identical condition 'len-offset<16'
        if (diff < 16) {
                 ^

(cherry picked from commit ca97ed44361fe84cae72fad1807825f149f983eb)

3 years agomemcmp: work around GCC 12+ 'blend' issues
Victor Julien [Fri, 6 May 2022 15:46:40 +0000 (17:46 +0200)] 
memcmp: work around GCC 12+ 'blend' issues

Since GCC 12 the memcmp code using `_mm_blendv_epi8` failed to work.
Inspection of the disassembled objects suggests that it simply omits
the instruction on systems that are not AVX512 capable. On AVX512
it does replace it with VPCMPB logic that appears to work.

Luckily our use of blend is actually uncessary. A simple AND is sufficient.

Bug: #5312.
(cherry picked from commit 87c5d6943709de225d946f5eab8f1d24cdefa491)

3 years agoftp: truncate first segment if over max length 7377/head
Jason Ish [Fri, 22 Apr 2022 18:04:37 +0000 (12:04 -0600)] 
ftp: truncate first segment if over max length

The first segment was not limited to the configured maximum line length
allowing it to be up to 65k. This could result in the next input length
being negative, which while handled properly by the code, did trigger a
debug validation assertion.

The fix is to be consistent and apply the limit to the first segment as
well, which does ensure the input_len could never be less than 0.

Ticket #5281

(cherry picked from commit 9645285dff9eb8313db573d8603162a708736236)

3 years agoja3: fix minor format string warning
Victor Julien [Wed, 27 Apr 2022 09:38:37 +0000 (11:38 +0200)] 
ja3: fix minor format string warning

cppcheck:

src/util-ja3.c:197:28: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
        (*buffer)->used += snprintf((*buffer)->data, (*buffer)->size, "%d",
                           ^
src/util-ja3.c:201:28: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
        (*buffer)->used += snprintf((*buffer)->data + (*buffer)->used,
                           ^

Bug: #5291.
(cherry picked from commit 1e13f7278585555623ff0be2d3a98476617b1219)

3 years agoaf-packet/v2: use proper type for ring
Victor Julien [Wed, 27 Apr 2022 09:32:22 +0000 (11:32 +0200)] 
af-packet/v2: use proper type for ring

cppcheck:

src/source-af-packet.c:1762:19: warning: Size of pointer 'v2' used instead of size of its data. This is likely to lead to a buffer overflow. You probably intend to write 'sizeof(*v2)'. [pointerSize]
        ptv->ring.v2 = SCMalloc(ptv->req.v2.tp_frame_nr * sizeof (union thdr *));
                  ^
src/source-af-packet.c:1767:26: warning: Size of pointer 'v2' used instead of size of its data. This is likely to lead to a buffer overflow. You probably intend to write 'sizeof(*v2)'. [pointerSize]
        memset(ptv->ring.v2, 0, ptv->req.v2.tp_frame_nr * sizeof (union thdr *));
                         ^

scan-build:

CC       source-af-packet.o
source-af-packet.c:1762:24: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'union thdr *' [unix.MallocSizeof]
        ptv->ring.v2 = SCMalloc(ptv->req.v2.tp_frame_nr * sizeof (union thdr *));
                       ^~~~~~~~                           ~~~~~~~~~~~~~~~~~~~~~
./util-mem.h:35:18: note: expanded from macro 'SCMalloc'
                 ^~~~~~
1 warning generated.

Bug: #5291.
(cherry picked from commit fedced209dc25443ec5eee22bfab6c99f9f652ab)

3 years agodetect/pcre: assist code analyzer around pointer logic
Victor Julien [Tue, 26 Apr 2022 19:47:37 +0000 (21:47 +0200)] 
detect/pcre: assist code analyzer around pointer logic

cppcheck:

src/detect-pcre.c:381:27: warning: Either the condition 'pcap' is redundant or there is overflow in pointer subtraction. [nullPointerArithmeticRedundantCheck]
            cut_capture = MIN((pcap - regexstr), (fcap - regexstr));
                          ^
src/detect-pcre.c:378:18: note: Assuming that condition 'pcap' is not redundant
        else if (pcap && !fcap)
                 ^
src/detect-pcre.c:381:27: note: Null pointer subtraction
            cut_capture = MIN((pcap - regexstr), (fcap - regexstr));
                          ^

Bug: #5291.
(cherry picked from commit 69b8b48b9422279943c083a24e5baf64e1c4aa94)

3 years agodevice: avoid uninit var warning
Victor Julien [Tue, 26 Apr 2022 19:35:29 +0000 (21:35 +0200)] 
device: avoid uninit var warning

cppcheck:

src/util-device.c:455:17: error: Uninitialized variables: *ndev.dev, *ndev.tenant_id_set, *ndev.id, *ndev.next, *ndev.tenant_id, *ndev.offload_orig [uninitvar]
        *ldev = *ndev;
                ^
src/util-device.c:618:36: note: Calling function 'LiveDeviceForEach', 2nd argument '&ndev' value is <Uninit>
    while(LiveDeviceForEach(&ldev, &ndev)) {
                                   ^
src/util-device.c:455:17: note: Uninitialized variables: *ndev.dev, *ndev.tenant_id_set, *ndev.id, *ndev.next, *ndev.tenant_id, *ndev.offload_orig
        *ldev = *ndev;
                ^

Bug: #5291.
(cherry picked from commit 3bc50df9c3397b9ab06376657c5e8c3467fbc7c5)

3 years agotime: fix warning in timestring creation
Victor Julien [Tue, 26 Apr 2022 19:03:42 +0000 (21:03 +0200)] 
time: fix warning in timestring creation

cppcheck:

src/util-time.c:255:18: warning: Either the condition 'str!=NULL' is redundant or there is possible null pointer dereference: str. [nullPointerRedundantCheck]
        snprintf(str, size, "ts-error");
                 ^
src/util-time.c:252:48: note: Assuming that condition 'str!=NULL' is not redundant
    if (likely(t != NULL && fmt != NULL && str != NULL)) {
                                               ^
src/util-time.c:255:18: note: Null pointer dereference
        snprintf(str, size, "ts-error");
                 ^

Only `t` could possibly be NULL if `localtime_r` fails elsewhere.

Bug: #5291.
(cherry picked from commit 2f48e432cd4465bbb1f42fe7778fee44a5d0aa47)

3 years agodetect/multi-tentancy: minor format string fixes
Victor Julien [Tue, 26 Apr 2022 18:36:36 +0000 (20:36 +0200)] 
detect/multi-tentancy: minor format string fixes

cppcheck:

src/detect-engine.c:3643:5: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
    snprintf(prefix, sizeof(prefix), "multi-detect.%d", tenant_id);
    ^
src/detect-engine.c:3707:5: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
    snprintf(prefix, sizeof(prefix), "multi-detect.%d.reload.%d", tenant_id, reload_cnt);
    ^
src/detect-engine.c:4086:17: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
                snprintf(prefix, sizeof(prefix), "multi-detect.%d", tenant_id);
                ^

Bug: #5291.
(cherry picked from commit 4fcb8740e7b98eee1b5e65bd66045c9440cef8b6)

3 years agoreference: remove useless var reset
Victor Julien [Tue, 26 Apr 2022 18:18:28 +0000 (20:18 +0200)] 
reference: remove useless var reset

cppcheck:

src/util-reference-config.c:179:9: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
        fd = NULL;
        ^

Bug: #5291.
(cherry picked from commit 5a0bbb5289cd0fbf4ef50294127cb1018baf82a2)

3 years agompm/ac-ks: address int handling issues
Victor Julien [Tue, 26 Apr 2022 18:14:39 +0000 (20:14 +0200)] 
mpm/ac-ks: address int handling issues

cppcheck:

src/util-mpm-ac-ks.c:1452:5: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
    printf("Total states in the state table:    %d\n", ctx->state_count);
    ^
src/util-mpm-ac-ks.c:606:34: error: Signed integer overflow for expression '1<<31'. [integerOverflow]
        encoded_next_state |= (1 << 31);
                                 ^

Bug: #5291.
(cherry picked from commit a8d3cd6eb4f181000256986ea7cf83074a0d2b59)

3 years agoclassification: remove useless clear
Victor Julien [Tue, 26 Apr 2022 18:12:20 +0000 (20:12 +0200)] 
classification: remove useless clear

cppcheck:

src/util-classification-config.c:189:9: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
        fd = NULL;
        ^

Bug: #5291.
(cherry picked from commit 9c672a805fe1fe78591ec0f06da56e23c99d0751)

3 years agodetect/content-inspect: code cleanup
Victor Julien [Tue, 26 Apr 2022 18:06:43 +0000 (20:06 +0200)] 
detect/content-inspect: code cleanup

Rearrange code slightly to make it more clear that `found` cannot
be NULL further down the loop.

cppcheck:

src/detect-engine-content-inspection.c:316:50: warning: Either the condition 'found!=NULL' is redundant or there is overflow in pointer subtraction. [nullPointerArithmeticRedundantCheck]
                match_offset = (uint32_t)((found - buffer) + cd->content_len);
                                                 ^
src/detect-engine-content-inspection.c:308:30: note: Assuming that condition 'found!=NULL' is not redundant
            } else if (found != NULL && (cd->flags & DETECT_CONTENT_NEGATED)) {
                             ^
src/detect-engine-content-inspection.c:316:50: note: Null pointer subtraction
                match_offset = (uint32_t)((found - buffer) + cd->content_len);
                                                 ^

Bug: #5291.
(cherry picked from commit 27e9a871d0f7feeafb8fff266b2bb4d97abd39f3)

3 years agodetect/analyzer: minor format string fixes
Victor Julien [Tue, 26 Apr 2022 18:05:51 +0000 (20:05 +0200)] 
detect/analyzer: minor format string fixes

cppcheck flagged this as:

src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
            fprintf(rule_engine_analysis_FD, "    Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http);
            ^
src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
            fprintf(rule_engine_analysis_FD, "    Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http);
            ^
src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
            fprintf(rule_engine_analysis_FD, "    Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http);
            ^
src/detect-engine-analyzer.c:1359:13: warning: %d in format string (no. 4) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
            fprintf(rule_engine_analysis_FD, "    Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http);
            ^

Bug: #5291.
(cherry picked from commit a0847e6c697055b127343cc338029bc69bbc0791)

3 years agodetect/address: remove useless checks
Victor Julien [Tue, 26 Apr 2022 18:04:28 +0000 (20:04 +0200)] 
detect/address: remove useless checks

Cppcheck flagged this:

src/detect-engine-address.c:1035:48: warning: Either the condition 'ghn!=NULL' is redundant or there is possible null pointer dereference: gh. [nullPointerRedundantCheck]
    int r = DetectAddressIsCompleteIPSpaceIPv4(gh->ipv4_head);
                                               ^
src/detect-engine-address.c:1297:17: note: Assuming that condition 'ghn!=NULL' is not redundant
        if (ghn != NULL) {
                ^
src/detect-engine-address.c:1283:44: note: Calling function 'DetectAddressIsCompleteIPSpace', 1st argument 'ghn' value is 0
        if (DetectAddressIsCompleteIPSpace(ghn)) {
                                           ^
src/detect-engine-address.c:1035:48: note: Null pointer dereference
    int r = DetectAddressIsCompleteIPSpaceIPv4(gh->ipv4_head);
                                               ^

Cleanup code could only be reached with non-NULL pointers, so simplify checks.

Bug: #5291.
(cherry picked from commit f8a0f3d9b9f4e1aa758a493e00d38e98a552a0d6)

3 years agodetect/ipv6: remove useless code
Victor Julien [Tue, 26 Apr 2022 18:02:19 +0000 (20:02 +0200)] 
detect/ipv6: remove useless code

Remove useless allocation and free.

Found by cppcheck as a potential issue:

src/detect-engine-address-ipv6.c:385:12: warning: Either the condition 'tmp!=NULL' is redundant or there is possible null pointer dereference: tmp. [nullPointerRedundantCheck]
    memset(tmp,0,sizeof(DetectAddress));
           ^
src/detect-engine-address-ipv6.c:525:13: note: Assuming that condition 'tmp!=NULL' is not redundant
    if (tmp != NULL)
            ^
src/detect-engine-address-ipv6.c:385:12: note: Null pointer dereference
    memset(tmp,0,sizeof(DetectAddress));
           ^

But code turned out not to do anything, so removed.

Bug: #5291.
(cherry picked from commit bad900516133a81afb0a6d3982fa3de5871e6ba7)

3 years agodatasets: fix cppcheck warning
Victor Julien [Tue, 26 Apr 2022 18:01:19 +0000 (20:01 +0200)] 
datasets: fix cppcheck warning

src/datasets.c:107:17: error: Uninitialized variable: hash [uninitvar]
    memcpy(out, hash, outs);
                ^
src/datasets.c:93:26: note: Assuming condition is false
    for (x = 0, i = 0; i < ins; i+=2, x++) {
                         ^
src/datasets.c:107:17: note: Uninitialized variable: hash
    memcpy(out, hash, outs);
                ^

Bug: #5291.
(cherry picked from commit ea2d0ecf08842d52f77d1a88a184a85960999e1e)

3 years agoftp: fix direction of expectation for STOR command
Xiaofan Wang [Thu, 19 Mar 2020 15:50:48 +0000 (23:50 +0800)] 
ftp: fix direction of expectation for STOR command

Fix direction in active mode.

(cherry picked from commit 071f55dcd7892924d193cc1e747bcfa01498202a)

3 years agoftp-data: fix direction for active mode commands
Victor Julien [Sat, 30 Apr 2022 14:54:07 +0000 (16:54 +0200)] 
ftp-data: fix direction for active mode commands

Set correct direction for PORT mode, where the server connects
to the client.

The direction is not also strictly enforced. No data in the wrong
direction will be accepted to setup the file or to be added to the
file after setup.

This also fixes files getting closed twice.

Adds some general cleanups.

Bug: #3542.
(cherry picked from commit 07bf9214513e54e04508c055bb8ed29aa3bce60f)

3 years agodetect: fix rule inspection order 7325/head
Victor Julien [Mon, 25 Apr 2022 16:00:24 +0000 (18:00 +0200)] 
detect: fix rule inspection order

Fix rules from the 'match' list getting added to the tx candidates list
unsorted. In some cases this could lead to the same sid getting inspected
twice leading to a DEBUG_VALIDATION_BUG_ON trigger.

Bug: #5144.
(cherry picked from commit 4bb00964ac22f0f96704cf5befca76d056763142)

3 years agostream: improve flow end payload logging
Victor Julien [Sat, 23 Apr 2022 11:59:34 +0000 (13:59 +0200)] 
stream: improve flow end payload logging

Use all available data, including un-ACK'd, when in flow timeout
mode.

Bug: #5276.
(cherry picked from commit c40df43609becc467e86d756098829b3174c80c7)

3 years agosuricata/init: Remove stack-on-signal code
Jeff Lucovsky [Tue, 26 Apr 2022 19:04:48 +0000 (15:04 -0400)] 
suricata/init: Remove stack-on-signal code

Issue: 5229

This commit removes functionality never intended for the 5.0.x
maintenance branch: stack-on-signal logging

3 years agouserguide: dynamically determine copyright date
Juliana Fajardini [Wed, 9 Feb 2022 19:46:24 +0000 (19:46 +0000)] 
userguide: dynamically determine copyright date

This uses the date of doc generation to determine the copyright date
for the trailing date. Based on Jeff Lucovsky solution.

(cherry picked from commit e0c8dba7ac6eaa757daf80245688f9f2b2496eff)

3 years agoflow-manager: fix off-by-one in flow_hash row allocation
Arne Welzel [Sat, 12 Feb 2022 16:49:07 +0000 (17:49 +0100)] 
flow-manager: fix off-by-one in flow_hash row allocation

The current code doesn't cover all rows when more than one flow manager is
used. It leaves a single row between ftd->max and ftd->min of the next
manager orphaned. As an example:

    hash_size=1000
    flowmgr_number=3
    range=333

    instance  ftd->min  ftd->max
    0         0         333
    1         334       666
    2         667       1000

    Rows not covered: 333, 666

(cherry picked from commit 8ef066318d7c4dd9b6686dbebd621c790828c384)

3 years agoutil/atomic: Fetch and add interface
Jeff Lucovsky [Mon, 25 Apr 2022 12:39:06 +0000 (08:39 -0400)] 
util/atomic: Fetch and add interface

This commit adds an API for an atomic fetch and add function to be
consistent with later branches where SC_ATOMIC_ADD has that
functionality.

3 years agodetect/dataset: fix space condition in rule lang
Shivani Bhardwaj [Fri, 28 Jan 2022 20:17:17 +0000 (01:47 +0530)] 
detect/dataset: fix space condition in rule lang

If there is a space following a keyword that does not expect a value,
the rule fails to load due to improper value evaluation.
e.g. Space after "set" command
alert http any any -> any any (http.user_agent; dataset:set  ,ua-seen,type string,save datasets.csv; sid:1;)

gives error
[ERRCODE: SC_ERR_UNKNOWN_VALUE(129)] - dataset action "" is not supported.

Fix this by handling values correctly for such cases.

(cherry picked from commit 6d2a2a073120906304f70c0e120565eae96e36b8)

3 years agodetect/dataset: cleanup dead code
Shivani Bhardwaj [Fri, 28 Jan 2022 13:43:04 +0000 (19:13 +0530)] 
detect/dataset: cleanup dead code

(cherry picked from commit 7366396011227b5e51ca810d86ebf7d310e98f34)

3 years agostream/unittests: fix failures after last_ack fix
Victor Julien [Fri, 22 Apr 2022 17:33:13 +0000 (19:33 +0200)] 
stream/unittests: fix failures after last_ack fix

Work around many tests not setting up stream completely or correctly.

(cherry picked from commit 3d6e733aa7297f64fe87cc3b59fbbd9a527513fa)

3 years agostream: improve last_ack validation check
Victor Julien [Fri, 22 Apr 2022 16:27:15 +0000 (18:27 +0200)] 
stream: improve last_ack validation check

If a packet after the initialization would come with ACK flag set
but a ACK value of 0, the last_ack tracking could get confused. Fix
this by not checking for 0 but instead checking if the ACK flag
has been seen.

Bug: #4549.
(cherry picked from commit 1f43e1477f3c5781381e75f4bed918cbc6c18dfd)

3 years agoversion: start development towards 5.0.10
Victor Julien [Wed, 27 Apr 2022 09:13:52 +0000 (11:13 +0200)] 
version: start development towards 5.0.10

3 years agorelease: 5.0.9; update changelog; require htp 0.5.40 suricata-5.0.9
Victor Julien [Thu, 21 Apr 2022 08:52:23 +0000 (10:52 +0200)] 
release: 5.0.9; update changelog; require htp 0.5.40

3 years agossl: cert parsing hardening
Jeff Lucovsky [Thu, 10 Mar 2022 14:09:57 +0000 (15:09 +0100)] 
ssl: cert parsing hardening

Limit initial memory allocated for certificates. General parsing
hardening and checking improvements.

Based on commits:
862e84877ff262cd4b8c4b191a8710f94f63fcf7
3ed188e0bcb6f4ae5b6c5eafdd75ce1f8e3d7246

Bug: #5193.

3 years agossl: validation macros
Jeff Lucovsky [Mon, 18 Apr 2022 15:20:58 +0000 (11:20 -0400)] 
ssl: validation macros

Include valiation macros from 3ed188e0bc

3 years agossl: copy data using a safe memcpy wrapper
Victor Julien [Fri, 3 Apr 2020 14:31:00 +0000 (16:31 +0200)] 
ssl: copy data using a safe memcpy wrapper

To avoid future memcpy issues introduce a wrapper and check the
result of it.

When compiled with --enable-debug-validation the wrapper will abort if
the input is wrong.

(cherry picked from commit d1ada2e13c207e0937f8a4818d5731d319f5fa07)

3 years agodoc/userguide: document ftp max-line-length
Jason Ish [Thu, 7 Apr 2022 21:58:58 +0000 (15:58 -0600)] 
doc/userguide: document ftp max-line-length

(cherry picked from commit 7d6bc60abb6eefce3f0d20222b2a843de9ea5a6e)

3 years agoftp: truncate command data that is too long
Jason Ish [Wed, 6 Apr 2022 21:38:35 +0000 (15:38 -0600)] 
ftp: truncate command data that is too long

FTP control commands will be buffered forever until a new line is seen,
this can lead to memory exhaustion in Suricata.

To fix, set an upper bound, 4096 bytes on the size of the command that
is saved in the transaction. The input continues to be parsed to find
the end of the command so the parser can continue to move onto the next
command.

The result is that the command data in the transaction is truncated,
which also shows up in the ftp transaction logs.

This value is configurable with the max-line-length field in the ftp
app-layer.protocols section.

As FTP doesn't have events at this time, add a new fields to eve-log
that specificy if the request, or the response has been truncated.

Ticket #5024

(cherry-picked from commit 433a0b8e3b0bf206069ebb94bc4cb71044572791)

3 years agosmtp: don't pass partial boundary on to mime parser
Victor Julien [Fri, 15 Apr 2022 13:51:10 +0000 (15:51 +0200)] 
smtp: don't pass partial boundary on to mime parser

If the start of a line looks like it might be a mime boundary we
yield to the get line logic if we don't have enough data to be
conclusive.

(cherry picked from commit e7417a8e96fcd23fa9e3b529d7c2bbd7b3efb928)

3 years agomime: allow partial lines as input
Victor Julien [Fri, 15 Apr 2022 13:49:09 +0000 (15:49 +0200)] 
mime: allow partial lines as input

If we get a zero length delim we assume its a partial line and we
won't append CRLF just yet.

(cherry picked from commit 6e800a8548d9d2699589cac6afca3c0fa7613202)

3 years agosmtp: pre process DATA and BDAT commands
Shivani Bhardwaj [Tue, 19 Apr 2022 15:33:24 +0000 (21:03 +0530)] 
smtp: pre process DATA and BDAT commands

The input data received in DATA and BDAT command modes can be huge and
could have important data, like a legit huge email. Therefore, exempt
these from the line buffering limits which were introduced to regulate
the size of lines that we buffer at any point in time.

As a part of this patch, anything that comes under DATA or BDAT is
processed early without buffering as and when it arrives. The ways of
processing remain the same as before.

(cherry picked from commit cf749fd450ca41dc001c2a1c10d8d17500dcedce)

3 years agosmtp: fix indefinite buffering if no LF in line
Shivani Bhardwaj [Tue, 19 Apr 2022 12:05:06 +0000 (17:35 +0530)] 
smtp: fix indefinite buffering if no LF in line

Issue
-----
So far, with the SMTP parser, we would buffer data up until an LF char
was found indicating the end of one line. This would happen in case of
fragmented data where a line might come broken into multiple chunks.
This was problematic if there was a really long line without any LF
character. It would mean that we'd keep buffering data up until we
encounter one such LF char which may be many many bytes of data later.

Fix
---
Fix this issue by setting an upper limit of 4KB on the buffering of
lines. If the limit is reached then we save the data into current line
and process it as if it were a regular request/response up until 4KB
only. Any data after 4KB is discarded up until there is a new LF char in
the received input.

Cases
-----
1. Fragmentation
The limit is enforced for any cases where a line of >= 4KB comes as diff
fragments that are each/some < 4KB.
2. Single too long line
The limit is also enforced for any cases where a single line exceeds the
limit of buffer.

Reported by Victor Julien.
Ticket 5028

3 years agodns: don't parse a full request during probe if not enough data
Jason Ish [Mon, 28 Feb 2022 22:48:34 +0000 (16:48 -0600)] 
dns: don't parse a full request during probe if not enough data

If there is more data than a header, but not enough for a complete DNS
message, the hostname parser could return an error causing the probe to
fail on valid DNS messages.

So only parse the complete message if we have enough input data. This is
reliable for TCP as DNS messages are prefixed, but for UDP its just
going to be the size of the input buffer presented to the parser, so
incomplete could still happen.

Ticket #5034

(cherry picked from commit 27679a12aa4e03e960112f387640419d29780e5a)

3 years agodns: improve probing parser
Philippe Antoine [Tue, 9 Mar 2021 20:00:36 +0000 (21:00 +0100)] 
dns: improve probing parser

Checks opcode is valid
Checks additional_rr do not exceed message length
Better logic for incomplete cases

(cherry picked from commit 9e7ea631b2a067609c500539cd3a7a139f39c3e4)

3 years agodns: better error handling when parsing names
Jason Ish [Tue, 1 Feb 2022 21:44:43 +0000 (15:44 -0600)] 
dns: better error handling when parsing names

The DNS name parser will error out with an error even if the
error is incomplete. Instead of manually generating errors,
use '?' to let the nom error ripple up the error handling chain.

The reason this wasn't done in the first place is this code
predates the ? operator, or we were not aware of it at the time.

This prevents the case where probing fails when there is enough data to
parse the header, but not enough to complete name parser. In such a case
a parse error is returned (instead of incomplete) resulting in the
payload not being detected as DNS.

Ticket #5034

(cherry picked from commit 0623ada24df1da99c72bb8cd4959b2cb0e64ccc2)

3 years agotftp: use destate
Philippe Antoine [Mon, 22 Nov 2021 09:37:33 +0000 (10:37 +0100)] 
tftp: use destate

And avoids memory leaks on it

3 years agodnp3: check Base64Encode return value for logging
Philippe Antoine [Mon, 29 Nov 2021 12:24:12 +0000 (13:24 +0100)] 
dnp3: check Base64Encode return value for logging

So that NULL pointers do not get logged

Ticket: 4849

3 years agodnp3: sync actual code with generated code
Jason Ish [Fri, 1 Apr 2022 18:22:41 +0000 (12:22 -0600)] 
dnp3: sync actual code with generated code

3 years agoutil: right parenthesises for base64 macro
Philippe Antoine [Mon, 29 Nov 2021 12:20:40 +0000 (13:20 +0100)] 
util: right parenthesises for base64 macro

So that BASE64_BUFFER_SIZE(3) == 5 instead of 7

3 years agoutil/crypt: Add macro for max base64encode len
Shivani Bhardwaj [Thu, 3 Dec 2020 11:25:39 +0000 (16:55 +0530)] 
util/crypt: Add macro for max base64encode len

Maximum length of a base64 encoded string can be 33% over the actual
length of the input string. The formula to best cover all the edge cases
is mathematically
(4 * (input_length + 2) / 3) + 1

Add a macro to calculate this for a given input length.

(cherry picked from commit 02942a123a525bb1ed97bba9242f1e08d54f0fb8)

3 years agosmb: protocol detection on pattern without midstream
Jason Ish [Thu, 31 Mar 2022 18:45:07 +0000 (12:45 -0600)] 
smb: protocol detection on pattern without midstream

To recognize a protocol, Suricata first looks for
patterns, which can be confirmed by a probing parser.
If this does not work, Suricata can try to run
some probing parsers on some ports.

This is the case for SMB.

This commit makes handling the confirming and the probing
paser differently even if they share much code.

The confirmation parser knows that a pattern has been found.
So, it must not do the midstream case of looking for this
pattern in the whole buffer, but only check it at the beginning.
But it must reverse direction if needed.

Ticket #4849

Backported manually by jason.ish@oisf.net.

3 years agosmb/events: fix limit exceeded events and rules 7280/head
Victor Julien [Wed, 20 Apr 2022 19:42:28 +0000 (21:42 +0200)] 
smb/events: fix limit exceeded events and rules

3 years agosmb: log max read/write sizes
Victor Julien [Mon, 18 Apr 2022 20:14:36 +0000 (22:14 +0200)] 
smb: log max read/write sizes

(cherry picked from commit 90d4b8e43804d4a03190ad06b6863c808c8b4acd)

3 years agosmb/rules: add rules for new events
Victor Julien [Tue, 19 Apr 2022 10:35:52 +0000 (12:35 +0200)] 
smb/rules: add rules for new events

(cherry picked from commit b0354437d5064e6843ab05b881929859b0009435)

3 years agodoc/smb: add resource limits section
Victor Julien [Tue, 19 Apr 2022 10:17:31 +0000 (12:17 +0200)] 
doc/smb: add resource limits section

(cherry picked from commit 976748b777fbbbba41491401c73c83e05e0a7c8a)

3 years agosmb2: validate negotiate read/write max sizes
Victor Julien [Tue, 19 Apr 2022 06:13:48 +0000 (08:13 +0200)] 
smb2: validate negotiate read/write max sizes

Raise event if they exceed the configured limit.

(cherry picked from commit fc9b65d8d3188c57016635aef8d7cdfe4552324e)

3 years agosmb2: allow limiting in-flight data size/cnt
Victor Julien [Sat, 16 Apr 2022 04:58:20 +0000 (06:58 +0200)] 
smb2: allow limiting in-flight data size/cnt

Allow limiting in-flight out or order data chunks per size or count.

Implemented for read and writes separately:

app-layer.protocols.smb.max-write-queue-size
app-layer.protocols.smb.max-write-queue-cnt
app-layer.protocols.smb.max-read-queue-size
app-layer.protocols.smb.max-read-queue-cnt

Backport note: Modified to support Rust 1.33 -- Jason Ish

(cherry picked from commit 4be8334c9e95cc520c9c6a63a98d6b160915d07f)

3 years agofiletracker: track total queued data (in_flight)
Victor Julien [Sat, 16 Apr 2022 04:57:56 +0000 (06:57 +0200)] 
filetracker: track total queued data (in_flight)

As well as expose number of chunks.

Backport note: Modified to support Rust 1.33 -- Jason Ish

(cherry picked from commit 2c5ad8858e38fce20155044a06969693fe472d4c)

3 years agosmb2: add options for max read/write size
Victor Julien [Mon, 18 Apr 2022 19:47:39 +0000 (21:47 +0200)] 
smb2: add options for max read/write size

Add options for the max read/write size accepted by the parser.

(cherry picked from commit 5bcc4162f7051194d228ba6c58a665d71c0c047c)

3 years agosmb2: track max read/write size and enforce its values
Victor Julien [Mon, 18 Apr 2022 15:49:58 +0000 (17:49 +0200)] 
smb2: track max read/write size and enforce its values

(cherry picked from commit f28888513ac3be18715f522db253c5753adb94ed)

3 years agosmb: minor function cleanup
Victor Julien [Fri, 15 Apr 2022 18:52:48 +0000 (20:52 +0200)] 
smb: minor function cleanup

Remove used argument from `filetracker_newchunk()`. We're not
using fill_bytes with smb.

(cherry picked from commit 594acec5dc88540dddc18b3ee0ad89af0948ee33)

3 years agofiletracker: make FileChunk private
Victor Julien [Fri, 15 Apr 2022 18:00:55 +0000 (20:00 +0200)] 
filetracker: make FileChunk private

(cherry picked from commit c7a474c7253233ce1117ae4af5a5c1fcc4b4e7f4)

3 years agodetect/mpm: improve transforms handling 7274/head
Victor Julien [Mon, 26 Oct 2020 20:14:43 +0000 (21:14 +0100)] 
detect/mpm: improve transforms handling

Make sure keywords with transforms get their own mpm ctx, instead of
sharing it with the 'pure' version of the keyword.

(cherry picked from commit 82d7f6463053e2180883decaef9987b6caea277d)

3 years agosmb/ntlmssp: add stricter len/offset validation 7272/head
Victor Julien [Mon, 11 Apr 2022 10:33:43 +0000 (12:33 +0200)] 
smb/ntlmssp: add stricter len/offset validation

(cherry picked from commit 053a9d2e685abe7639e23b1c7fad5ae7d68630e3)

3 years agosmb: ntlmssp domain_blob_offset underflow check
Philippe Antoine [Mon, 4 Apr 2022 20:51:01 +0000 (22:51 +0200)] 
smb: ntlmssp domain_blob_offset underflow check

Ticket: 5246
(cherry picked from commit e72036f12f577fb37b985147c2c847d147e49db2)

3 years agosmb: check on param parsing
Philippe Antoine [Mon, 4 Apr 2022 20:45:56 +0000 (22:45 +0200)] 
smb: check on param parsing

Ticket: 5246

so as not to overflow u16

(cherry picked from commit 817a5001a50a90800547e66fef067c0443eb9f72)

3 years agogithub-ci: pin checkout action plus other fixes
Jason Ish [Mon, 18 Apr 2022 17:21:22 +0000 (11:21 -0600)] 
github-ci: pin checkout action plus other fixes

Fixes to get CI to pass with updates to checkout action.

3 years agosmb: rules for messages in the wrong direction
Jason Ish [Mon, 28 Feb 2022 21:12:37 +0000 (15:12 -0600)] 
smb: rules for messages in the wrong direction

(cherry picked from commit 1e653249400ec6217af6d3f153f774ec133d5357)

3 years agosmb: handle records in the wrong direction
Jason Ish [Fri, 18 Feb 2022 04:57:30 +0000 (22:57 -0600)] 
smb: handle records in the wrong direction

If an SMB record is seen in the wrong direction, set an event on the PDU
frame and don't process the record in the state.

No error is returned, so the next record will be processed.

(cherry picked from commit 2341f47755c616f9ee3249cd28372eab45889e0d)

3 years agosmb: expose smb1 request/reply flags with a method
Jason Ish [Fri, 18 Feb 2022 17:43:17 +0000 (11:43 -0600)] 
smb: expose smb1 request/reply flags with a method

Adds `.is_request()` and `.is_reply()` to check if a SMB record flags
say the message is a request or a reply.

(cherry picked from commit 09e2d3b216218eaed471b3ddb496873223744cf8)

3 years agosmb: fix smb2 header flag parsing
Jason Ish [Mon, 18 Apr 2022 16:32:25 +0000 (10:32 -0600)] 
smb: fix smb2 header flag parsing

The bits were being parsed in the order they're displayed in Wireshark,
rather than the order they were being seen on the wire, resulting in
direction and async being 0 more often than they should be.

Instead of bits, take the 4 bytes as an le_u32 and just use bit masks to
extract what we need into a struct, I think its easier to reason about
this way when comparing to the Microsoft documentation.

(cherry picked from commit 7b659489c85eaed4921ed9c4b97ecf827560376e)

3 years agooutput: fix integer warnings
Philippe Antoine [Tue, 18 Jan 2022 09:56:48 +0000 (10:56 +0100)] 
output: fix integer warnings

Ticket: 4516
(cherry picked from commit e3180e3248e38311ad56a080233ad1a8d31a623b)

3 years agodetect-content: error on single char hex pairs
Jason Ish [Tue, 22 Mar 2022 15:46:45 +0000 (09:46 -0600)] 
detect-content: error on single char hex pairs

Fix parsing of content like "|aa b cc|" which was parsed as "|aa bc|"
without error or warning. This will now fail out, requiring all hex
values to be 2 chars.

Ticket #5201

(cherry picked from commit 8d1e4a1d0b481b289bcbae619693c4c442e937e1)

3 years agopppoe: fix protocol field length variation
Steven Ottenhoff [Thu, 13 Jan 2022 13:05:58 +0000 (13:05 +0000)] 
pppoe: fix protocol field length variation

Detect when protocol field is not a 16 bit field.
Added tests to prove logic

Ticket: 4810
(cherry picked from commit 6bf2117056e8c2e9448a02d2198384935b1d5b70)

3 years agonss: use 'atexit()' to cleanup 7214/head
Victor Julien [Thu, 7 Apr 2022 12:44:26 +0000 (14:44 +0200)] 
nss: use 'atexit()' to cleanup

This avoids ASAN to report leaks in case of fatal errors in tests.

3 years agosmtp: check if there is a transaction to close 7213/head
Philippe Antoine [Tue, 22 Feb 2022 12:10:59 +0000 (13:10 +0100)] 
smtp: check if there is a transaction to close

Ticket: 4948

When parsing the response for starttls

(cherry picked from commit 99b3443369703ba69d962019edeca8f1c7c7896e)

3 years agosmtp: check if we have a current transaction
Philippe Antoine [Tue, 25 Jan 2022 20:10:37 +0000 (21:10 +0100)] 
smtp: check if we have a current transaction

Ticket: 4948

This is not the perfect solution, but it prevents to trigger
the assert, and keep the assert.
A better solution would need to create transaction from
the reponse parsing, in case a later command was buffered and
not answered. But this would not be enough as NoNewTx prevents
the creation of a new transaction for RSET...

(cherry picked from commit 4247605d874113ef13003816007e0575219d065e)

3 years agodetect/iponly: add tests for 5168 7153/head
Victor Julien [Tue, 1 Mar 2022 11:44:01 +0000 (12:44 +0100)] 
detect/iponly: add tests for 5168

(cherry picked from commit 935ea745f5e38b49713ae77d86b57ce7260917a4)

3 years agodetect/address: minor unittest cleanup
Victor Julien [Tue, 1 Mar 2022 11:43:25 +0000 (12:43 +0100)] 
detect/address: minor unittest cleanup

(cherry picked from commit 053b2b3b5b1197064bba5d59d4731c5789ff7239)

3 years agodetect/iponly: validate netmask
Victor Julien [Tue, 1 Mar 2022 11:42:49 +0000 (12:42 +0100)] 
detect/iponly: validate netmask

Only accept netmask in dotted quad notation if they can be turned
into a CIDR.

According to rfc 4632, CIDR (compat) netmasks are all that should be
used.

Bug: #5168.
(cherry picked from commit 79b7b7a0ddfdcd7664ca328a41d24fbca75e3e54)

3 years agodetect/address: validate netmasks
Victor Julien [Tue, 1 Mar 2022 11:41:04 +0000 (12:41 +0100)] 
detect/address: validate netmasks

Only accept netmask in dotted quad notation if they can be turned
into a CIDR.

According to rfc 4632, CIDR (compat) netmasks are all that should be
used.

Bug: #5168.
(cherry picked from commit 259bd8aa92c7bc8ca8c74b3f429f321935493828)

3 years agodetect/iponly: break out range insert code
Victor Julien [Mon, 28 Feb 2022 21:31:58 +0000 (22:31 +0100)] 
detect/iponly: break out range insert code

So we can reuse it.

(cherry picked from commit 4020e2faa7ee93dfed663b4b0795644572ddfd79)

3 years agoutil/cidr: add util to convert netmask to cidr
Victor Julien [Tue, 1 Mar 2022 11:41:49 +0000 (12:41 +0100)] 
util/cidr: add util to convert netmask to cidr

(cherry picked from commit a67b97e14c08f46f50c1acd989f0dc049a8e4cba)

3 years agogeneral: Fix typo
Jeff Lucovsky [Thu, 27 Jan 2022 17:30:14 +0000 (12:30 -0500)] 
general: Fix typo

(cherry picked from commit b53fced45254ca267e75ea7e8c60afab82ea1e08)

3 years agoconfig/ref: Raise errors for ref.config parsing
Jeff Lucovsky [Wed, 26 Jan 2022 21:35:12 +0000 (16:35 -0500)] 
config/ref: Raise errors for ref.config parsing

This commit raises an error in configuration test mode if there was an
error parsing reference.config.

Issue: 4659
(cherry picked from commit be2155b4edb712913166cb5e8c10b36fb4362f2a)

3 years agosmb: check correct buffer for overflow
Jason Ish [Tue, 15 Feb 2022 21:18:49 +0000 (15:18 -0600)] 
smb: check correct buffer for overflow

Fix an error in the checking of an overflow condition.

The first overflow check is only checking the size of the new data, not
the new data + the size of the buffered data. This is due to the buffer
on the state being emptied into a local variable just before the check.

This results in overflows not being caught, but being caught a few lines
down after the copy resulting in increased CPU usage for data that is
just going to be thrown away.

Ticket #4945

3 years agonfs/rpc: update full record parsers to be more exact 7151/head
Victor Julien [Fri, 18 Mar 2022 21:33:27 +0000 (15:33 -0600)] 
nfs/rpc: update full record parsers to be more exact

Instead of 'take'ing all data for the RPC prog_data and then
letting the higher level parsers figure out which part to use
take the exact amount.

Note: Differs a bit from the original commit as this series of commits
was not backported in the same order.

(cherry picked from commit 64d8a1e16e07148a8b5839452be3f7481e4e3623)

3 years agonfs3: improve read validation; fix partial handling
Victor Julien [Fri, 18 Mar 2022 21:29:29 +0000 (15:29 -0600)] 
nfs3: improve read validation; fix partial handling

Note: Some parsers converted to a more functional style to faciliate
additonal arguments being provided -- Jason Ish

(cherry picked from commit d85b77cad064bd88c921b2f3d520fe526ad8ff82)

3 years agonfs3: fix partial write record handling
Victor Julien [Fri, 18 Mar 2022 18:02:45 +0000 (12:02 -0600)] 
nfs3: fix partial write record handling

Note: This was more of a manual cherry-pick converting some parsers from
named macros into functions in order to handle more arguments than just
the input data -- Jason Ish

(cherry picked from commit 4418fc1b02f47533439fe00789d9c850a24271b2)

3 years agonfs3: enforce more values 7140/head
Victor Julien [Sun, 20 Feb 2022 22:02:13 +0000 (23:02 +0100)] 
nfs3: enforce more values

Enforce values of a number of u32's that are used as bools or for
really low values.

(cherry picked from commit 5baf94e40ddeb3deab97a897b9da2e93ece4c654)

3 years agorpc: enforce various field values
Victor Julien [Mon, 21 Feb 2022 09:08:41 +0000 (10:08 +0100)] 
rpc: enforce various field values

Minimal frag_len. Correct msgtype and others.

(cherry picked from commit 1c57e3c18d746743bc2cbcaba35f78b5f9b15675)

3 years agonfs/rpc: enforce length field limits
Victor Julien [Sat, 19 Feb 2022 07:42:35 +0000 (08:42 +0100)] 
nfs/rpc: enforce length field limits

Limits based on the Linux kernel limits. Then multiplied a few times
to allow for other implementations to have higher limits.

(cherry picked from commit fe76ab1803bea02f47f691b5944ba319a3bc0300)

3 years agonfs4: verify bool fields
Victor Julien [Mon, 21 Feb 2022 11:20:13 +0000 (12:20 +0100)] 
nfs4: verify bool fields

(cherry picked from commit 5ecb626e50048cfa43ad67cdd80307377e90926c)

3 years agothreads: Honor per-thread stack size setting 7134/head
Jeff Lucovsky [Fri, 11 Feb 2022 14:02:39 +0000 (09:02 -0500)] 
threads: Honor per-thread stack size setting

Issue: 4550

This commit adjusts the per-thread stack size if a size has been
configured. If the setting has not been configured, the default
per-thread stack size provided by the runtime mechanisms are used.

(cherry picked from commit 6232c94235a60f2f89d444dfd5a9e20efc0a5a60)

3 years agoconfig/thread: Use config'd per-thread stack size
Jeff Lucovsky [Fri, 11 Feb 2022 13:36:28 +0000 (08:36 -0500)] 
config/thread: Use config'd per-thread stack size

Issue: 4550

This commit checks if there's a config setting for threading.stack-size
and assigns the value to a global variable for use during thread
creation.

(cherry picked from commit e4d60f451b8a226e32a3df8e232efe437b11e2e3)

3 years agosuricata.yaml: Add per-thread stack size setting
Jeff Lucovsky [Fri, 11 Feb 2022 13:35:36 +0000 (08:35 -0500)] 
suricata.yaml: Add per-thread stack size setting

Issue: 4550
(cherry picked from commit d79a317cea900e60166068c4d6703caab7218509)

3 years agoconfig/debug: Debug probe for getattr_np
Jeff Lucovsky [Tue, 15 Feb 2022 15:50:33 +0000 (10:50 -0500)] 
config/debug: Debug probe for getattr_np

This commit adds a probe for a non-portable function to be used in
diagnostic debug display of a thread's stack size.

(cherry picked from commit deb49862cd6734ccb15c1cc91e430c8ee01292aa)

3 years agodoc: Describe per-thread stack size config setting
Jeff Lucovsky [Fri, 11 Feb 2022 13:34:12 +0000 (08:34 -0500)] 
doc: Describe per-thread stack size config setting

Issue: 4550

This commit documents the new per-thread stack-size setting. Some
systems have a small default value that is not suitable for Suricata's
multi-threaded architecture and adjustment may be required.

(cherry picked from commit 117e11b0ae0c64d8c8b61d3d343957be3b9eb128)