[acassen/keepalived] 2f8165: Fix new --mem-check-log option

Alexandre Cassen <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <57720f3927f86_451b3fafd0c572bc10601c@hookshot-fe4-cp1-prd.iad.github.net.mail>
  Branch: refs/heads/master
  Home:   https://github.com/acassen/keepalived
  Commit: 2f81655862cdce4f930fd8d2b2f18804b51388a8
      https://github.com/acassen/keepalived/commit/2f81655862cdce4f930fd8d2b2f18804b51388a8
  Author: Quentin Armitage <[email protected]>
  Date:   2016-06-27 (Mon, 27 Jun 2016)

  Changed paths:
    M keepalived/core/main.c

  Log Message:
  -----------
  Fix new --mem-check-log option

Signed-off-by: Quentin Armitage <[email protected]>


  Commit: 5d536cef9c9c26ea6df549643c6721799ed99a84
      https://github.com/acassen/keepalived/commit/5d536cef9c9c26ea6df549643c6721799ed99a84
  Author: Quentin Armitage <[email protected]>
  Date:   2016-06-27 (Mon, 27 Jun 2016)

  Changed paths:
    M lib/memory.c

  Log Message:
  -----------
  Don't write parent's memory logging into children's log file

When running with mem-check output to files, the buffer from the
parent process was also being written into the children's log
files. The commit sets the CLOEXEC flag on the log files, and
also sets the log files to be line buffered.

Signed-off-by: Quentin Armitage <[email protected]>


  Commit: dcfb7b7335b335def9a0e15e984e30df09f27b41
      https://github.com/acassen/keepalived/commit/dcfb7b7335b335def9a0e15e984e30df09f27b41
  Author: Quentin Armitage <[email protected]>
  Date:   2016-06-27 (Mon, 27 Jun 2016)

  Changed paths:
    M keepalived/check/check_daemon.c
    M keepalived/vrrp/vrrp_daemon.c
    M lib/scheduler.c
    M lib/scheduler.h

  Log Message:
  -----------
  Fix segfault or infinite loop in thread_child_handler() after reloading

When the checker and vrrp child processes start up, memory for a
thread_master_t is malloc'd and saved in master. Subsequently,
launch_scheduler() is called, and that sets the parameter to be passed
to the SIGCHLD handler - thread_child_handler() to the value of master,
pointing to a thread_master_t.

If keepalived is signalled to reload, the child processes free all
malloc'd memory, and a new thread_master_t is malloc'd and saved in
master. If this is not the same address as the previous thread_master_t,
then the value being passed to the SIGCHLD handler is a pointer to the
old thread_master_t, whereas everything else is using the new thread_master_t.
If the memory used for the old thread_master_t is then returned in a subsequent
malloc() call, a subsequent SIGCHLD will invoke thread_child_handler() with
a pointer to memory that has now been overwritten for some other purpose, hence
causing either a segfault or an infinite loop.

A further consequence is that new child processes will be added to the new
thread_master_t, but when thread_child_hander() is called after a child
terminates, it won't find the child since it is still looking at the old
thread_master_t.

This commit modifies the behaviour of a reload by not releasing the old
thread_master_t and then malloc'ing a new one, but rather it just reinitialises
the original thread_master_t and continues using it.

Signed-off-by: Quentin Armitage <[email protected]>


  Commit: b0a7473b7d23e34562b34879bd80d1c2089c698d
      https://github.com/acassen/keepalived/commit/b0a7473b7d23e34562b34879bd80d1c2089c698d
  Author: Quentin Armitage <[email protected]>
  Date:   2016-06-27 (Mon, 27 Jun 2016)

  Changed paths:
    M keepalived/include/vrrp.h

  Log Message:
  -----------
  Remove base_iface from struct _vrrp_ - it wasn't used

Signed-off-by: Quentin Armitage <[email protected]>


  Commit: bde660ec3671dd5e3aafc8fb09fa2f71cd381514
      https://github.com/acassen/keepalived/commit/bde660ec3671dd5e3aafc8fb09fa2f71cd381514
  Author: Alexandre Cassen <[email protected]>
  Date:   2016-06-28 (Tue, 28 Jun 2016)

  Changed paths:
    M keepalived/check/check_daemon.c
    M keepalived/core/main.c
    M keepalived/include/vrrp.h
    M keepalived/vrrp/vrrp_daemon.c
    M lib/memory.c
    M lib/scheduler.c
    M lib/scheduler.h

  Log Message:
  -----------
  Merge pull request #371 from pqarmitage/segv

Resolve a segfault when reloading keepalived


Compare: https://github.com/acassen/keepalived/compare/e320d5cfe429...bde660ec3671

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.