Project

General

Profile

Actions

Bug #8126

open

-funsigned-char makes int8_t unsigned on Solaris

Added by Martin Rehak 2 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Affected Versions:
Effort:
Difficulty:
Label:
Needs backport to 7.0

Description

Hello,

hundreds of unit tests are failing on Solaris. This is the first one:

Test StreamTcpReassembleTest39 -- app proto test : STREAM MEMORY IN USE 38912 STREAM REASSEMBLY MEMORY IN USE 118784 FAILED Test StreamTcpReassembleTest40 -- app proto test : Assertion failed: !(postsize > presize), file ./suricata-8.0.2/src/stream-tcp-reassemble.c, line 143, function StreamTcpReassembleDecrMemuse make[2]: *** [Makefile:4964: check-am] Abort (core dumped)

https://github.com/OISF/suricata/blob/626027a456401fc20f9706dce8783e24764c8a8a/src/stream-tcp-reassemble.c#L2783C1-L2783C83

I have found that the root cause is that 'char' is forced to be unsigned by this compiler option:

https://github.com/OISF/suricata/blob/626027a456401fc20f9706dce8783e24764c8a8a/src/Makefile.am#L1455

On Solaris system headers expect 'char' to be signed (as usually is to be portable) and 'sys/types.h' defines some types like 'int8_t' as 'char'. That makes 'int8_t' unsigned and some (at least unary arithmetics) gives different result from what is expected.

Linux probably does some tests to guess whether compiler treats 'char' as signed or unsigned.

Once I remove '-funsigned-char' from Makefile.am all Suricata unit tests passes.

Could I ask you to help me find the reason why the compiler option is there so I can find a way how to make it work on Solaris without patching Makefile.am, please?

Thank you,
Martin

No data to display

Actions

Also available in: Atom PDF