diff --git a/backport-assign-freed-pointers-to-NULL-pointer.patch b/backport-assign-freed-pointers-to-NULL-pointer.patch deleted file mode 100644 index 676b7097cdaf312c09a9f6f647802d5cdd421e60..0000000000000000000000000000000000000000 --- a/backport-assign-freed-pointers-to-NULL-pointer.patch +++ /dev/null @@ -1,587 +0,0 @@ -From 283fe6b239b140093bc142a9ff2c947dd54c754c Mon Sep 17 00:00:00 2001 -From: Hui Li -Date: Sat, 23 Dec 2023 21:13:29 -0500 -Subject: [PATCH] assign freed pointers to NULL pointer - ---- - bus.c | 13 ++++++++++--- - cache.c | 3 +++ - config.c | 10 ++++++++++ - dimm.c | 1 + - dmi.c | 1 + - mcelog.c | 7 ++++++- - memdb.c | 11 ++++++++++- - msg.c | 2 ++ - msr.c | 1 + - page.c | 15 +++++++++++++-- - server.c | 6 +++++- - sysfs.c | 7 +++++++ - trigger.c | 7 +++++-- - tsc.c | 4 ++++ - unknown.c | 6 +++++- - yellow.c | 6 +++++- - 16 files changed, 88 insertions(+), 12 deletions(-) - -diff --git a/bus.c b/bus.c -index 20b4741..2bf2d9a 100644 ---- a/bus.c -+++ b/bus.c -@@ -69,6 +69,7 @@ void run_bus_trigger(int socket, int cpu, char *level, char *pp, char *rrrr, - location, ii); - xasprintf(&env[ei++], "LOCATION=%s", location); - free(location); -+ location = NULL; - - if (socket >= 0) - xasprintf(&env[ei++], "SOCKETID=%d", socket); -@@ -83,9 +84,12 @@ void run_bus_trigger(int socket, int cpu, char *level, char *pp, char *rrrr, - assert(ei < MAX_ENV); - - run_trigger(bus_trigger, NULL, env, false, "bus"); -- for (i = 0; i < ei; i++) -+ for (i = 0; i < ei; i++) { - free(env[i]); -+ env[i] = NULL; -+ } - free(msg); -+ msg = NULL; - } - - void run_iomca_trigger(int socket, int cpu, int seg, int bus, int dev, int fn) -@@ -107,6 +111,7 @@ void run_iomca_trigger(int socket, int cpu, int seg, int bus, int dev, int fn) - location, seg, bus, dev, fn); - xasprintf(&env[ei++], "LOCATION=%s", location); - free(location); -+ location = NULL; - - if (socket >= 0) - xasprintf(&env[ei++], "SOCKETID=%d", socket); -@@ -120,8 +125,10 @@ void run_iomca_trigger(int socket, int cpu, int seg, int bus, int dev, int fn) - assert(ei < MAX_ENV); - - run_trigger(iomca_trigger, NULL, env, false, "iomca"); -- for (i = 0; i < ei; i++) -+ for (i = 0; i < ei; i++) { - free(env[i]); -+ env[i] = NULL; -+ } - free(msg); -- -+ msg = NULL; - } -diff --git a/cache.c b/cache.c -index 8b64b43..74c0d31 100644 ---- a/cache.c -+++ b/cache.c -@@ -108,6 +108,7 @@ static void read_cpu_map(struct cache *c, char *cfn) - parse_cpumap(map, c->cpumap, c->cpumaplen); - out: - free(map); -+ map = NULL; - } - - static int read_caches(void) -@@ -144,9 +145,11 @@ static int read_caches(void) - c->level = read_field_num(cfn, "level"); - read_cpu_map(c, cfn); - free(cfn); -+ cfn = NULL; - } - } - free(fn); -+ fn = NULL; - } - } - closedir(cpus); -diff --git a/config.c b/config.c -index cefc220..df94594 100644 ---- a/config.c -+++ b/config.c -@@ -110,6 +110,7 @@ static void unparseable(char *desc, const char *header, const char *name) - } - Eprintf("%s config option `%s' unparseable\n", desc, field); - free(field); -+ field = NULL; - exit(1); - } - -@@ -180,6 +181,7 @@ int parse_config_file(const char *fn) - } - fclose(f); - free(line); -+ line = NULL; - return 0; - } - -@@ -302,6 +304,7 @@ int config_trigger(const char *header, const char *base, struct bucket_conf *bc) - } - } - free(name); -+ name = NULL; - - xasprintf(&name, "%s-trigger", base); - s = config_string(header, name); -@@ -314,6 +317,7 @@ int config_trigger(const char *header, const char *base, struct bucket_conf *bc) - bc->trigger = s; - } - free(name); -+ name = NULL; - - bc->log = 0; - xasprintf(&name, "%s-log", base); -@@ -321,6 +325,7 @@ int config_trigger(const char *header, const char *base, struct bucket_conf *bc) - if (n >= 0) - bc->log = n; - free(name); -+ name = NULL; - - return 0; - } -@@ -342,6 +347,7 @@ void config_cred(char *header, char *base, struct config_cred *cred) - cred->uid = pw->pw_uid; - } - free(name); -+ name = NULL; - xasprintf(&name, "%s-group", base); - if ((s = config_string(header, name)) != NULL) { - struct group *gr; -@@ -354,6 +360,7 @@ void config_cred(char *header, char *base, struct config_cred *cred) - cred->gid = gr->gr_gid; - } - free(name); -+ name = NULL; - } - - #ifdef TEST -@@ -386,8 +393,11 @@ int main(int ac, char **av) - break; - } - free(type); -+ type = NULL; - free(header); -+ header = NULL; - free(name); -+ name = NULL; - } - return 0; - } -diff --git a/dimm.c b/dimm.c -index 7edb6b3..22ada68 100644 ---- a/dimm.c -+++ b/dimm.c -@@ -378,6 +378,7 @@ void new_error(unsigned long long addr, unsigned long max_error, char *trigger) - } - } - free(devs); -+ devs = NULL; - } - - void reset_dimm(char *locator) -diff --git a/dmi.c b/dmi.c -index 2970e77..a6ace3b 100644 ---- a/dmi.c -+++ b/dmi.c -@@ -667,6 +667,7 @@ void dmi_decodeaddr(unsigned long long addr) - Wprintf("No DIMM found for %llx in SMBIOS\n", addr); - } - free(devs); -+ devs = NULL; - } - - void dmi_set_verbosity(int v) -diff --git a/mcelog.c b/mcelog.c -index 2948ea7..a0230b7 100644 ---- a/mcelog.c -+++ b/mcelog.c -@@ -165,6 +165,7 @@ static void print_tsc(int cpunum, __u64 tsc, unsigned long time) - ret = decode_tsc_current(&buf, cpunum, cputype, cpumhz, tsc); - Wprintf("TSC %llx %s", tsc, ret >= 0 && buf ? buf : ""); - free(buf); -+ buf = NULL; - } - - struct cpuid1 { -@@ -477,6 +478,7 @@ int is_cpu_supported(void) - } - fclose(f); - free(line); -+ line = NULL; - } else - Eprintf("warning: Cannot open /proc/cpuinfo\n"); - -@@ -805,6 +807,7 @@ restart: - data = 1; - } - free(line); -+ line = NULL; - if (data) - dump_mce_final(&m, symbol, missing, recordlen, disclaimer_seen); - } -@@ -812,8 +815,10 @@ restart: - static void remove_pidfile(void) - { - unlink(pidfile); -- if (pidfile != pidfile_default) -+ if (pidfile != pidfile_default) { - free(pidfile); -+ pidfile = NULL; -+ } - } - - static void signal_exit(int sig) -diff --git a/memdb.c b/memdb.c -index 8dfe15d..956704f 100644 ---- a/memdb.c -+++ b/memdb.c -@@ -174,12 +174,17 @@ void memdb_trigger(char *msg, struct memdimm *md, time_t t, - env[ei] = NULL; - assert(ei < MAX_ENV); - run_trigger(bc->trigger, args, env, sync, reporter); -- for (i = 0; i < ei; i++) -+ for (i = 0; i < ei; i++) { - free(env[i]); -+ env[i] = NULL; -+ } - out: - free(location); -+ location = NULL; - free(out); -+ out = NULL; - free(thresh); -+ thresh = NULL; - } - - /* -@@ -197,6 +202,7 @@ account_over(struct err_triggers *t, struct memdimm *md, struct mce *m, unsigned - t->type, corr_err_cnt); - memdb_trigger(msg, md, 0, &md->ce, &t->ce_bucket_conf, NULL, false, reporter); - free(msg); -+ msg = NULL; - } - } - } -@@ -219,6 +225,7 @@ account_memdb(struct err_triggers *t, struct memdimm *md, struct mce *m, const c - memdb_trigger(msg, md, m->time, &md->ce, &t->ce_bucket_conf, NULL, false, reporter); - } - free(msg); -+ msg = NULL; - } - - /* -@@ -281,6 +288,7 @@ static void dump_errtype(char *name, struct err_type *e, FILE *f, enum printflag - s = bucket_output(bc, &e->bucket); - fprintf(f, "\t%s\n", s); - free(s); -+ s = NULL; - } - } - -@@ -343,6 +351,7 @@ void dump_memory_errors(FILE *f, enum printflags flags) - dump_dimm(da[i], f, flags); - } - free(da); -+ da = NULL; - } - - void memdb_config(void) -diff --git a/msg.c b/msg.c -index fd54f20..e564a3d 100644 ---- a/msg.c -+++ b/msg.c -@@ -26,6 +26,7 @@ int open_logfile(char *fn) - char *old = output_fn; - output_fn = xstrdup(fn); - free(old); -+ old = NULL; - return 0; - } - return -1; -@@ -100,6 +101,7 @@ void SYSERRprintf(char *fmt, ...) - xasprintf(&fmt2, "%s: %s\n", fmt, err); - vsyslog(LOG_ERR, fmt2, ap); - free(fmt2); -+ fmt2 = NULL; - va_end(ap); - } - } -diff --git a/msr.c b/msr.c -index a5bba8a..54cddc5 100644 ---- a/msr.c -+++ b/msr.c -@@ -56,6 +56,7 @@ static bool in_lockdown(void) - if (!strstr(lockdown, "[none]")) - ret = true; - free(lockdown); -+ lockdown = NULL; - return ret; - } - -diff --git a/page.c b/page.c -index 3a0dfb7..eff42b0 100644 ---- a/page.c -+++ b/page.c -@@ -265,11 +265,15 @@ static void counter_trigger(char *msg, time_t t, struct mempage_replacement *mr, - - run_trigger(bc->trigger, NULL, env, sync, "page-error-counter"); - -- for (i = 0; i < ei; i++) -+ for (i = 0; i < ei; i++) { - free(env[i]); -+ env[i] = NULL; -+ } - out: - free(out); -+ out = NULL; - free(thresh); -+ thresh = NULL; - } - - void account_page_error(struct mce *m, int channel, int dimm) -@@ -323,9 +327,11 @@ void account_page_error(struct mce *m, int channel, int dimm) - thresh = bucket_output(&mp_replacement_trigger_conf, &mp_repalcement.bucket); - xasprintf(&msg, "Replacements of page correctable error counter exceed threshold %s", thresh); - free(thresh); -+ thresh = NULL; - - counter_trigger(msg, t, &mp_repalcement, &mp_replacement_trigger_conf, false); - free(msg); -+ msg = NULL; - } - } else { - mempage_cluster_lru_list_update(to_cluster(mp)); -@@ -342,8 +348,10 @@ void account_page_error(struct mce *m, int channel, int dimm) - xasprintf(&msg, "Corrected memory errors on page %llx exceed threshold %s", - addr, thresh); - free(thresh); -+ thresh = NULL; - memdb_trigger(msg, md, t, &mp->ce, &page_trigger_conf, NULL, false, "page"); - free(msg); -+ msg = NULL; - mp->triggered = 1; - - if (offline == OFFLINE_SOFT || offline == OFFLINE_SOFT_THEN_HARD) { -@@ -365,6 +373,7 @@ void account_page_error(struct mce *m, int channel, int dimm) - asprintf(&msg, "pre soft trigger run for page %lld", addr); - memdb_trigger(msg, md, t, &mp->ce, &page_soft_trigger_conf, argv, true, "page_pre_soft"); - free(msg); -+ msg = NULL; - - offline_action(mp, addr); - -@@ -375,8 +384,9 @@ void account_page_error(struct mce *m, int channel, int dimm) - asprintf(&msg, "post soft trigger run for page %lld", addr); - memdb_trigger(msg, md, t, &mp->ce, &page_soft_trigger_conf, argv, true, "page_post_soft"); - free(msg); -+ msg = NULL; - free(args); -- -+ args = NULL; - } else - offline_action(mp, addr); - } -@@ -402,6 +412,7 @@ void dump_page_errors(FILE *f) - page_state[(unsigned)p->offlined], - p->triggered ? " triggered" : ""); - free(msg); -+ msg = NULL; - fputc('\n', f); - } - } -diff --git a/server.c b/server.c -index 86029c5..54c7d57 100644 ---- a/server.c -+++ b/server.c -@@ -70,8 +70,11 @@ static void free_inbuf(struct clientcon *cc) - static void free_cc(struct clientcon *cc) - { - free(cc->outbuf); -+ cc->outbuf = NULL; - free(cc->inbuf); -- free(cc); -+ cc->inbuf = NULL; -+ free(cc); -+ cc = NULL; - } - - static void sendstring(int fd, char *str) -@@ -264,6 +267,7 @@ static void client_accept(struct pollfd *pfd, void *data) - - cleanup: - free(cc); -+ cc = NULL; - close(nfd); - } - -diff --git a/sysfs.c b/sysfs.c -index cd0f7c7..618d2bf 100644 ---- a/sysfs.c -+++ b/sysfs.c -@@ -37,6 +37,7 @@ char *read_field(char *base, char *name) - xasprintf(&fn, "%s/%s", base, name); - fd = open(fn, O_RDONLY); - free(fn); -+ fn = NULL; - if (fd < 0) - goto bad_buf; - n = read(fd, buf, 4096); -@@ -47,6 +48,7 @@ char *read_field(char *base, char *name) - memcpy(val, buf, n); - val[n] = 0; - free(buf); -+ buf = NULL; - s = memchr(val, '\n', n); - if (s) - *s = 0; -@@ -54,6 +56,7 @@ char *read_field(char *base, char *name) - - bad_buf: - free(buf); -+ buf = NULL; - SYSERRprintf("Cannot read sysfs field %s/%s", base, name); - return xstrdup(""); - } -@@ -64,6 +67,7 @@ unsigned read_field_num(char *base, char *name) - char *val = read_field(base, name); - int n = sscanf(val, "%u", &num); - free(val); -+ val = NULL; - if (n != 1) { - Eprintf("Cannot parse number in sysfs field %s/%s\n", base,name); - return 0; -@@ -81,10 +85,12 @@ unsigned read_field_map(char *base, char *name, struct map *map) - } - if (map->name) { - free(val); -+ val = NULL; - return map->value; - } - Eprintf("sysfs field %s/%s has unknown string value `%s'\n", base, name, val); - free(val); -+ val = NULL; - return -1; - } - -@@ -104,6 +110,7 @@ int sysfs_write(const char *name, const char *fmt, ...) - e = errno; - close(fd); - free(buf); -+ buf = NULL; - errno = e; - return n; - } -diff --git a/trigger.c b/trigger.c -index 6480c58..4886680 100644 ---- a/trigger.c -+++ b/trigger.c -@@ -108,7 +108,8 @@ static void finish_child(pid_t child, int status) - c->name, strsignal(WTERMSIG(status))); - } - list_del(&c->nd); -- free(c); -+ free(c); -+ c = NULL; - num_children--; - return; - } -@@ -175,8 +176,10 @@ int trigger_check(char *s) - - rc = access(name, R_OK|X_OK); - -- if (trigger_dir) -+ if (trigger_dir) { - free(name); -+ name = NULL; -+ } - - return rc; - } -diff --git a/tsc.c b/tsc.c -index f79aaf0..db2b152 100644 ---- a/tsc.c -+++ b/tsc.c -@@ -55,6 +55,7 @@ static double cpufreq_mhz(int cpu, double infomhz) - xasprintf(&fn, "/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", cpu); - f = fopen(fn, "r"); - free(fn); -+ fn = NULL; - if (!f) { - /* /sys exists, but no cpufreq -- use value from cpuinfo */ - if (access("/sys/devices", F_OK) == 0) -@@ -87,12 +88,14 @@ static int deep_sleep_states(int cpu) - xasprintf(&fn, "/sys/devices/system/cpu/cpu%d/cpuidle", cpu); - ret = access(fn, X_OK); - free(fn); -+ fn = NULL; - if (ret == 0) - return 1; - - xasprintf(&fn, "/proc/acpi/processor/CPU%d/power", cpu); - f = fopen(fn, "r"); - free(fn); -+ fn = NULL; - if (!f) - return 0; - -@@ -107,6 +110,7 @@ static int deep_sleep_states(int cpu) - } - } - free(line); -+ line = NULL; - fclose(f); - return 0; - } -diff --git a/unknown.c b/unknown.c -index 12feac8..f9d57a3 100644 ---- a/unknown.c -+++ b/unknown.c -@@ -60,6 +60,7 @@ void run_unknown_trigger(int socket, int cpu, struct mce *log) - xasprintf(&msg, "%s received unknown error", location); - xasprintf(&env[ei++], "LOCATION=%s", location); - free(location); -+ location = NULL; - - if (socket >= 0) - xasprintf(&env[ei++], "SOCKETID=%d", socket); -@@ -74,8 +75,11 @@ void run_unknown_trigger(int socket, int cpu, struct mce *log) - assert(ei < MAX_ENV); - - run_trigger(unknown_trigger, NULL, env, false, "unknown"); -- for (i = 0; i < ei; i++) -+ for (i = 0; i < ei; i++) { - free(env[i]); -+ env[i] = NULL; -+ } - free(msg); -+ msg = NULL; - } - -diff --git a/yellow.c b/yellow.c -index 3616a8b..d73ab70 100644 ---- a/yellow.c -+++ b/yellow.c -@@ -75,6 +75,7 @@ void run_yellow_trigger(int cpu, int tnum, int lnum, char *ts, char *ls, int soc - xasprintf(&msg, "%s has large number of corrected cache errors in %s %s", - location, ls, ts); - free(location); -+ location = NULL; - if (yellow_log) { - Lprintf("%s\n", msg); - Lprintf("System operating correctly, but might lead to uncorrected cache errors soon\n"); -@@ -96,10 +97,13 @@ void run_yellow_trigger(int cpu, int tnum, int lnum, char *ts, char *ls, int soc - assert(ei < MAX_ENV); - - run_trigger(yellow_trigger, NULL, env, false, "yellow"); -- for (i = 0; i < ei; i++) -+ for (i = 0; i < ei; i++) { - free(env[i]); -+ env[i] = NULL; -+ } - out: - free(msg); -+ msg = NULL; - } - - void yellow_setup(void) --- -2.33.0 - diff --git a/mcelog-196.tar.gz b/mcelog-196.tar.gz deleted file mode 100644 index 35d38ad96d51409034a5b3db55a450c2e8a83583..0000000000000000000000000000000000000000 Binary files a/mcelog-196.tar.gz and /dev/null differ diff --git a/mcelog-198.tar.gz b/mcelog-198.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..9402532cd73806b0668b210a3f9238cbaada8595 Binary files /dev/null and b/mcelog-198.tar.gz differ diff --git a/mcelog.spec b/mcelog.spec index 56d01578f3f8199953e66c8913b3368c1e87f103..5adc4c1dfc66fc87878d7068a3ab271fb43f564b 100644 --- a/mcelog.spec +++ b/mcelog.spec @@ -1,11 +1,11 @@ #needsrootforbuild -%define last_tar_version 196 +%define last_tar_version 198 %define mce_inject_ver 2013.01.19 %define aer_inject_ver 2010.03.10 Name: mcelog -Version: 196 -Release: 2 +Version: 198 +Release: 1 Epoch: 3 Summary: Linux kernel machine check handling middleware License: GPLv2 @@ -15,8 +15,6 @@ Source1: mce-inject-%{mce_inject_ver}.tar.bz2 Source2: aer-inject-%{aer_inject_ver}.tar.bz2 Source3: mcelog.conf -Patch0: backport-assign-freed-pointers-to-NULL-pointer.patch - ExclusiveArch: i686 x86_64 BuildRequires: bison flex systemd gcc psmisc Requires(post): systemd @@ -35,7 +33,6 @@ driver error recovery handler and PCIE AER core handler. %prep %setup -q -n %{name}-%{last_tar_version} -a 1 -a 2 -%patch0 -p1 %build make CFLAGS="$RPM_OPT_FLAGS -Wl,-z,relro,-z,now -fpie" LDFLAGS="-Wl,-z,relro,-z,now -fpie -pie" @@ -86,6 +83,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/*/* %changelog +* Wed Aug 7 2024 dillon chen - 3:198-1 +- upgrade to 3:198-1 + * Mon Mar 25 2024 zhangruifang - 3:196-2 - backport patches from upstream - enable check only during obs build