Open Bug 818870 Opened 12 years ago Updated 5 months ago

NSS should be compiled with -fno-strict-aliasing

Categories

(NSS :: Build, defect, P4)

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: stef, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11

Steps to reproduce:

NSS code does not try to respect GCC's (strange, ornerous) strict aliasing rules. This results in warnings and risk of undefined behavior. It is possible to make GCC compile an abort() equivalent into the program through if ane doesn't abide by its strict aliasing rules.

See:

 * http://thiemonagel.de/2010/01/no-strict-aliasing/
 * http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html
 * 

The solution (other than rewriting lots of code) is to tell GCC to not use strict aliasing. NSS already does this in the freebl library.


Actual results:

Warnings like this. They're dangerous, because GCC often changes what it does in response to undefined behavior from version to version. NSS could start crashing when this code is run when compiled on certain (future) versions of GCC.

sslsnce.c: In function ‘InitCache’:
sslsnce.c:1234:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1235:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1236:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1237:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1238:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1239:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1240:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1241:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1242:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1243:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1244:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1245:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1246:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c: In function ‘SSL_InheritMPServerSIDCacheInstance’:
sslsnce.c:1586:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
cd pkcs12; make libs
sslsnce.c:1587:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1588:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1589:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
cd pkcs7; make libs
sslsnce.c:1590:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1591:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1592:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
cd smime; make libs
sslsnce.c:1593:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1594:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1595:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1596:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1597:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
sslsnce.c:1598:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]


Expected results:

We should tell GCC to stop thinking it can make strict aliasing assumptions on NSS code.
Severity: normal → S3
Severity: S3 → S4
Priority: -- → P4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: