7 Commits

Author SHA1 Message Date
Yossi Gottlieb
0b5312a4a6 Fix setproctitle related crashes. (#8150)
Makes spt_init more careful with assumptions about what memory regions
may be overwritten. It will now only consider a contiguous block of argv
and envp elements and mind any gaps.

(cherry picked from commit 9f272197ea0d8e59f565782a6a1b420b9b94266d)
2021-01-12 16:25:37 +02:00
Yossi Gottlieb
e2f6b95926 Fix use-after-free issue in spt_copyenv. (#8088)
Seems to have gone unnoticed for a long time, because at least with
glibc it will only be triggered if setenv() was called before spt_init,
which Redis doesn't.

Fixes #8064.

(cherry picked from commit 87f59674b4f24fab3e98d3cb029ad85be5e68266)
2021-01-12 16:25:37 +02:00
David Carlier
81180ee56b DragonFlyBSD little build fix 2018-11-11 18:49:55 +00:00
David Carlier
b65d8172ae Fix undefined behavior constant defined. 2017-11-19 16:23:42 +00:00
Stam He
2fabb412ca Set proctitle: avoid the use of __attribute__((constructor)).
This cased a segfault in some Linux system and was GCC-specific.

Commit modified by @antirez:

1) Stripped away the part to set the proc title via config for now.
2) Handle initialization of setproctitle only when the replacement
   is used.
3) Don't require GCC now that the attribute constructor is no
   longer used.
2013-02-27 11:50:35 +01:00
antirez
ac7f6bac6f setproctitle.c: declar tmp as static so valgrind will not detect a leak. 2013-02-26 15:51:33 +01:00
antirez
6386d8ffc3 Set process name in ps output to make operations safer.
This commit allows Redis to set a process name that includes the binding
address and the port number in order to make operations simpler.

Redis children processes doing AOF rewrites or RDB saving change the
name into redis-aof-rewrite and redis-rdb-bgsave respectively.

This in general makes harder to kill the wrong process because of an
error and makes simpler to identify saving children.

This feature was suggested by Arnaud GRANAL in the Redis Google Group,
Arnaud also pointed me to the setproctitle.c implementation includeed in
this commit.

This feature should work on all the Linux, OSX, and all the three major
BSD systems.
2013-02-26 11:52:12 +01:00