Project

General

Profile

Actions

Bug #14136

open

acctadm *SOMETIMES* triggers smatch error

Added by Dan McDonald 22 days ago. Updated 21 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

It's been more frequent of late in our Jenkins builds. We're seeing:

/root/data/jenkins/workspace/smartos-master-debug/projects/illumos/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: main.c:377 main() warn: passing freed memory 'buf'
/root/data/jenkins/workspace/smartos-master-debug/projects/illumos/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/smatch: main.c:388 main() warn: passing freed memory 'buf'

Even though the ONLY way "buf" is freed before hitting those two lines are via free() calls before die(), which exits the program. Is it a bug in the program? Or in smatch?

Actions #1

Updated by Jason King 22 days ago

What happens if you label die() as __NORETURN in utils.h?

Actions #2

Updated by Dan McDonald 21 days ago

Jason King wrote in #note-1:

What happens if you label die() as __NORETURN in utils.h?

Like this?

diff --git a/usr/src/cmd/acctadm/utils.h b/usr/src/cmd/acctadm/utils.h
index e40fa53f01..7a58cbf855 100644
--- a/usr/src/cmd/acctadm/utils.h
+++ b/usr/src/cmd/acctadm/utils.h
@@ -41,7 +41,7 @@ extern "C" {
 extern dladm_handle_t dld_handle;

 extern void warn(const char *, ...);
-extern void die(char *, ...);
+extern void die(char *, ...) __NORETURN;
 extern char *setpname(char *);
 extern const char *ac_type_name(int);
 extern int open_exacct_file(const char *, int);

Seems to build okay. The BIG test would be to put it in and see if we still see that sort of failure in our Jenkins runs, but it's highly random, so it may take several tries. Plus we also see jenkins failures thanks to #14132 .

Actions

Also available in: Atom PDF