Skip to content

Commit

Permalink
Bug 1313123 - Merge UBSan runs back with ASan and fix remaining test …
Browse files Browse the repository at this point in the history
…suites r=franziskus

Differential Revision: https://nss-dev.phacility.com/D125

--HG--
extra : amend_source : 5e9395472515cccd88316bbcf065f867a8d673e6
  • Loading branch information
Tim Taubert committed Oct 26, 2016
1 parent bb4cc45 commit 96d63cf
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 42 deletions.
30 changes: 3 additions & 27 deletions automation/taskcluster/graph/src/extend.js
Expand Up @@ -14,14 +14,10 @@ const WINDOWS_CHECKOUT_CMD =

/*****************************************************************************/

function isSanitizer(task) {
return task.collection == "asan" || task.collection == "ubsan";
}

queue.filter(task => {
if (task.group == "Builds") {
// Remove extra builds on {A,UB}San and ARM.
if (isSanitizer(task) || task.collection == "arm-debug") {
if (task.collection == "asan" || task.collection == "arm-debug") {
return false;
}

Expand All @@ -44,17 +40,11 @@ queue.filter(task => {
}
}

// Filter test suites that currently fail with UBSan.
if (task.collection == "ubsan" &&
["crmf", "cipher", "fips", "merge", "smime"].includes(task.tests)) {
return false;
}

return true;
});

queue.map(task => {
if (isSanitizer(task)) {
if (task.collection == "asan") {
// CRMF and FIPS tests still leak, unfortunately.
if (task.tests == "crmf" || task.tests == "fips") {
task.env.ASAN_OPTIONS = "detect_leaks=0";
Expand Down Expand Up @@ -121,20 +111,6 @@ export default async function main() {
});

await scheduleLinux("Linux 64 (ASan, debug)", {
env: {
NSS_DISABLE_ARENA_FREE_LIST: "1",
NSS_DISABLE_UNLOAD: "1",
CC: "clang",
CCC: "clang++",
USE_ASAN: "1",
USE_64: "1"
},
platform: "linux64",
collection: "asan",
image: LINUX_IMAGE
});

await scheduleLinux("Linux 64 (ASan+UBSan, debug)", {
env: {
UBSAN_OPTIONS: "print_stacktrace=1",
NSS_DISABLE_ARENA_FREE_LIST: "1",
Expand All @@ -146,7 +122,7 @@ export default async function main() {
USE_64: "1"
},
platform: "linux64",
collection: "ubsan",
collection: "asan",
image: LINUX_IMAGE
});

Expand Down
6 changes: 3 additions & 3 deletions automation/taskcluster/graph/src/try_syntax.js
Expand Up @@ -113,7 +113,7 @@ function filter(opts) {

// Additional checks.
if (platform == "linux64-asan") {
keep &= coll("asan") || coll("ubsan");
keep &= coll("asan");
} else if (platform == "arm") {
keep &= coll("arm-opt") || coll("arm-debug");
} else if (platform == "linux64-gyp") {
Expand All @@ -132,8 +132,8 @@ function filter(opts) {
}

// Finally, filter by build type.
let isDebug = coll("debug") || coll("asan") || coll("ubsan") ||
coll("arm-debug") || coll("gyp") || coll("fuzz");
let isDebug = coll("debug") || coll("asan") || coll("arm-debug") ||
coll("gyp") || coll("fuzz");
return (isDebug && opts.builds.includes("d")) ||
(!isDebug && opts.builds.includes("o"));
}
Expand Down
4 changes: 3 additions & 1 deletion lib/crmf/crmfpop.c
Expand Up @@ -125,7 +125,9 @@ crmf_generic_encoder_callback(void *arg, const char *buf, unsigned long len,
encoderArg->allocatedLen = newSize;
}
cursor = &(encoderArg->buffer->data[encoderArg->buffer->len]);
PORT_Memcpy(cursor, buf, len);
if (len) {
PORT_Memcpy(cursor, buf, len);
}
encoderArg->buffer->len += len;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/freebl/alg2268.c
Expand Up @@ -364,7 +364,7 @@ rc2_Decrypt1Block(RC2Context *cx, RC2Block *output, RC2Block *input)
output->s[3] = R3;
}

static SECStatus
static SECStatus NO_SANITIZE_ALIGNMENT
rc2_EncryptECB(RC2Context *cx, unsigned char *output,
const unsigned char *input, unsigned int inputLen)
{
Expand All @@ -381,7 +381,7 @@ rc2_EncryptECB(RC2Context *cx, unsigned char *output,
return SECSuccess;
}

static SECStatus
static SECStatus NO_SANITIZE_ALIGNMENT
rc2_DecryptECB(RC2Context *cx, unsigned char *output,
const unsigned char *input, unsigned int inputLen)
{
Expand All @@ -398,7 +398,7 @@ rc2_DecryptECB(RC2Context *cx, unsigned char *output,
return SECSuccess;
}

static SECStatus
static SECStatus NO_SANITIZE_ALIGNMENT
rc2_EncryptCBC(RC2Context *cx, unsigned char *output,
const unsigned char *input, unsigned int inputLen)
{
Expand Down
8 changes: 4 additions & 4 deletions lib/freebl/camellia.c
Expand Up @@ -1078,7 +1078,7 @@ camellia_setup192(const unsigned char *key, PRUint32 *subkey)
* Stuff related to camellia encryption/decryption
*
*/
SECStatus
SECStatus NO_SANITIZE_ALIGNMENT
camellia_encrypt128(const PRUint32 *subkey,
unsigned char *output,
const unsigned char *input)
Expand Down Expand Up @@ -1185,7 +1185,7 @@ camellia_encrypt128(const PRUint32 *subkey,
return SECSuccess;
}

SECStatus
SECStatus NO_SANITIZE_ALIGNMENT
camellia_decrypt128(const PRUint32 *subkey,
unsigned char *output,
const unsigned char *input)
Expand Down Expand Up @@ -1295,7 +1295,7 @@ camellia_decrypt128(const PRUint32 *subkey,
/**
* stuff for 192 and 256bit encryption/decryption
*/
SECStatus
SECStatus NO_SANITIZE_ALIGNMENT
camellia_encrypt256(const PRUint32 *subkey,
unsigned char *output,
const unsigned char *input)
Expand Down Expand Up @@ -1426,7 +1426,7 @@ camellia_encrypt256(const PRUint32 *subkey,
return SECSuccess;
}

SECStatus
SECStatus NO_SANITIZE_ALIGNMENT
camellia_decrypt256(const PRUint32 *subkey,
unsigned char *output,
const unsigned char *input)
Expand Down
2 changes: 1 addition & 1 deletion lib/freebl/sha_fast.c
Expand Up @@ -140,7 +140,7 @@ SHA1_Update(SHA1Context *ctx, const unsigned char *dataIn, unsigned int len)
/*
* SHA: Generate hash value from context
*/
void
void NO_SANITIZE_ALIGNMENT
SHA1_End(SHA1Context *ctx, unsigned char *hashout,
unsigned int *pDigestLen, unsigned int maxDigestLen)
{
Expand Down
4 changes: 3 additions & 1 deletion lib/smime/cmsencode.c
Expand Up @@ -105,7 +105,9 @@ nss_cms_encoder_out(void *arg, const char *buf, unsigned long len,
output->dest->len += len;

/* copy it in */
PORT_Memcpy(output->dest->data + offset, buf, len);
if (len) {
PORT_Memcpy(output->dest->data + offset, buf, len);
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/softoken/legacydb/lgutil.c
Expand Up @@ -67,7 +67,9 @@ lg_Attribute2SecItem(PLArenaPool *arena, CK_ATTRIBUTE_TYPE type,
return CKR_HOST_MEMORY;
}
item->len = len;
PORT_Memcpy(item->data, attribute->pValue, len);
if (item->len) {
PORT_Memcpy(item->data, attribute->pValue, len);
}
return CKR_OK;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/softoken/pkcs11.c
Expand Up @@ -4006,7 +4006,9 @@ NSC_Login(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType,
return CKR_PIN_LEN_RANGE;

/* convert to null terminated string */
PORT_Memcpy(pinStr, pPin, ulPinLen);
if (ulPinLen) {
PORT_Memcpy(pinStr, pPin, ulPinLen);
}
pinStr[ulPinLen] = 0;

handle = sftk_getKeyDB(slot);
Expand Down

0 comments on commit 96d63cf

Please sign in to comment.