Commit Graph

508 Commits

Author SHA1 Message Date
David Vossel
d5b762e441 LOG: Invoke custom log filter function if tag changes 2012-07-19 17:18:46 -05:00
Jim Meyering
c60f5012ea ipcs: avoid use-after-free for size-0 || disconnect-request
Hi,

Glancing through coverity-reported issues,
I saw that this one required attention:

From 70f1f689022321710405f16dc45b3df30c22bc59 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 18 Jul 2012 17:34:17 +0200
Subject: [PATCH] ipcs: avoid use-after-free for size-0 || disconnect-request

spotted by coverity:
http://libqb.org/html/0.14.1/coverity/1/265ipcs.c.html#error

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-19 08:19:22 +10:00
The Quarterback Library Release Team
5470bf5625 Bump the version to 0.14.1
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-07-17 22:03:31 +10:00
Angus Salkeld
e5be0396a7 RB: set the new read pointer after clearing the header.
This is to prevent a situation where a fast writer will
write their new chunk between setting the new read pointer
and clearing the header.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 21:18:47 +10:00
Angus Salkeld
3feb3b6b8f RB: improve the debug print outs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 20:45:29 +10:00
Angus Salkeld
b9a992a5d3 RB: be more explicit about the word alignment
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 19:37:52 +10:00
Angus Salkeld
15d0291a8a RB: cleanup the macros for wrapping the index
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:38:22 +10:00
Angus Salkeld
6e1d9054c3 RB: use sem_getvalue as a tie breaker when read_pt == write_pt
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:38:22 +10:00
Angus Salkeld
bdc63cdf1a RB: if read or peek don't get the message then re-post to the semaphore
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:38:22 +10:00
Angus Salkeld
deddaea86c RB: convert the rb_peek() status into a recv like status.
peek returns 0 on no data, so convert that to -EAGAIN.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:22:31 +10:00
Angus Salkeld
121abe3dbe RB: use internal reclaim function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:22:26 +10:00
Angus Salkeld
3b31023d84 IPC: use calloc instead of malloc to fix valgrind warnings
This is to cleanup some valgrind warnings.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-17 12:22:17 +10:00
Angus Salkeld
740f9df7ac Fix a valgrind error.
just use the receive buffer, as it will be big enough.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-07-14 22:29:25 +10:00
The Quarterback Library Release Team
1c2b77f005 Bump the version to 0.14.0
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-06-22 16:29:32 +10:00
Angus Salkeld
b9f8ec34df LOG: fix threaded logging.
This has been broken for a year - yikes!
Thanks to Voznesensky Vladimir for spotting it.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-14 11:01:52 +10:00
Angus Salkeld
22569f51ba Add user control of the permissions that are set on the shared mem files
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-13 08:21:09 +10:00
Andrew Beekhof
e70e7908f0 LOG: Restrict string trucation during serialization to when a precision is specified 2012-06-07 15:02:06 +10:00
Andrew Beekhof
bb2e307241 LOG: Gracefully fail when the caller exceeds QB_LOG_MAX_LEN 2012-06-07 14:41:03 +10:00
Andrew Beekhof
9b0bb4e80e LOG: Observe field widths when serializing string arguments 2012-06-07 14:40:34 +10:00
Angus Salkeld
3369581066 RB: use the same mechanism in reclaim as read/peek to detect end-of-ring
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-07 12:02:32 +10:00
Angus Salkeld
9520fc4501 RB: fix wrong sem_flg IPC_NOWAIT option
The #ifdef was the wrong way around causing
the sem to return early with EAGAIN.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 16:22:58 +10:00
Angus Salkeld
194b93678f Open shared mem file in /dev/shm only for linux
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 15:31:51 +10:00
Angus Salkeld
c0f52fb5c2 Don't use msg_flags on solaris (recvmsg).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 15:29:10 +10:00
Angus Salkeld
73731f0643 IPC: if the server returns EAGAIN or ETIMEOUT the check the connection
Mainly useful for shm, as the ringbuffer doesn't know the state
of the connection.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-06 13:46:58 +10:00
Angus Salkeld
b52f2e37b3 LOG: make it possible to fsync() on each file log.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-05 12:07:35 +10:00
Angus Salkeld
460cc70a8b IPC: make sure that the created callback happens before dispatches
This only happened on the socket ipc type.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-04 21:45:28 +10:00
Angus Salkeld
9956fe29ff LOG: fix the printing of %p in the blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-04 14:54:39 +10:00
Angus Salkeld
1e81530332 IPC: On bsd's use the notifier for responses
The point of this is to catch connection failures
more reliably.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-01 11:12:44 +10:00
Angus Salkeld
44f61b23bb IPC: interpret ECONNRESET and EPIPE as ENOTCONN
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-01 10:15:36 +10:00
Angus Salkeld
35a4421d23 cleanup some warnings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-31 22:18:04 +10:00
Angus Salkeld
9f90b16d06 blackbox: fix %p formatting
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 23:16:49 +10:00
Angus Salkeld
d280ddd6e4 LOG: put all fields in the blackbox (added priority and tags)
Fixes #36

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 22:23:22 +10:00
Angus Salkeld
85b39906a9 RB: fix compiler warning.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 19:10:13 +10:00
Angus Salkeld
4208a4b88b Add replacement function stpcpy
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 19:10:13 +10:00
Angus Salkeld
fe8014b379 Use AC_FUNC_STRERROR_R and STRERROR_R_CHAR_P
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 14:41:43 +10:00
Angus Salkeld
2b49dc7030 Move some conditional defines into code (from the configure script)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 14:33:03 +10:00
Angus Salkeld
70a9623a48 Remove message queues
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:41:04 +10:00
Angus Salkeld
aaae0a3c31 Check for union semun properly
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:35:48 +10:00
Angus Salkeld
531f7cdb7a Blackbox: provide more space for log messages when reading from the blackbox.
This is to allow for the header (16bytes and variable length function).
so if someone has a function name > 400 chars it will break. I
recon that will do:)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 13:34:15 +10:00
Andrew Beekhof
77fa3650dd RB: Read the file size into an initialized variable of the correct size 2012-05-28 12:25:10 +10:00
Angus Salkeld
e0bc3a15ce RB: to be safer save the read and write pointers at the top of the blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-25 14:01:19 +10:00
Jim Meyering
32abe38ffd avoid unwarranted use of strncpy: use memcpy instead
* lib/log_format.c (qb_vsnprintf_deserialize): We know that there are
len or more non-NUL bytes in the source string, so it's clearer to
use memcpy.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 20:47:57 +10:00
Angus Salkeld
a8405ab06d blackbox: fix the print_from_file()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 19:22:55 +10:00
Angus Salkeld
4fdabe5bed RB: add an option to not use any semaphores
(brought over from the "speed" branch)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 19:16:59 +10:00
Angus Salkeld
0327b6aa86 LOG: tweak the blackbox format string
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 14:37:05 +10:00
Angus Salkeld
c56427e19e LOG: accept NULL strings into the blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 14:16:54 +10:00
Angus Salkeld
072e224331 LOG: protect close and reload from calling log
Logging during these operations is temporarly disabled.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 13:06:51 +10:00
Angus Salkeld
0458c5ccd2 IPC: log the connection description in all logs
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-16 13:59:12 +10:00
Angus Salkeld
78374c2ed3 IPC: only modify the dispatch if we get EAGAIN
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-16 13:19:41 +10:00
Jan Friesse
a4411105a7 Correctly display timestamp in blackbox
On little endian architectures where time_t is 64-bit long integer could
happen, that instead of displaying correct timestamp, random data was
used, because of memcpy.

Solution is to memcpy to real 32-bit variable and then assing this value
to timestamp. This will let compiler decide endianity and store number
correctly.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-12 22:04:59 +10:00