Commit Graph

536 Commits

Author SHA1 Message Date
Angus Salkeld
79059bcae3 Solaris based operating systems don't define MSG_NOSIGNAL and SO_NOSIGPIPE.
They return SIGPIPE when send is used with a closed socket. A SIGPIPE handler
must be used or SIGPIPE should be set ignored with SIG_IGN. In this case send
returns -1 instead of a SIGPIPE. The setting to ignore SIGPIPE is global and
should be used only where it is absolutely necessary.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-22 11:15:05 +11:00
Angus Salkeld
bcba4a2983 Fix a crash in ptrie if you iterate over the map in the deleted notifier.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-12 10:39:17 +10:00
Angus Salkeld
aedcb97690 Make sure atomic's are initialized (for non-gcc atomic).
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-11 14:42:04 +10:00
The Quarterback Library Release Team
74b7c6e990 Bump the version to 0.14.2
Signed-off-by: The Quarterback Library Release Team <quarterback-devel@fedorahosted.org>
2012-09-10 10:58:14 +10:00
Виноградов Василий
f44efc4529 Get libqb building on cygwin.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-07 09:14:07 +10:00
Jeremy Fitzhardinge
20a7075862 ipc_us: slightly more robust cmsg handling
Cope with multiple cmsg structures in the received msg.
2012-09-05 17:57:23 -07:00
Jeremy Fitzhardinge
6d75ccba6f ipc_us: on Linux, set SO_PASSCRED on the sending socket too
Linux doesn't pass credential information by default, only when it has
been specifically requested with SO_PASSCRED.  This means there's a
race between when the ipc server side has set up and is listening on the
socket, and when the client may connect; if the client connects and sends
its first message before the server has set SO_PASSCRED on the socket,
then there will be no ucred information associated with the message.

The fix is to set SO_PASSCRED on the client socket as well, so that
the message will always have a ucred associated with it when the server
reads it.

Without this change, around 1% of cpg_model_initialize() calls fail
with CS_ERR_ACCESS.

(This Linux behaviour was introduced just on a year ago in
16e5726269611b71c930054ffe9b858c1cea88eb "af_unix: dont send
SCM_CREDENTIALS by default".)
2012-09-05 17:51:49 -07:00
Jeremy Fitzhardinge
b79f8ceb1e ipc_us: clear request unused fields
Clear unused request fields and padding so that valgrind doesn't complain
about undefined data being sent over the socket.
2012-09-05 17:01:55 -07:00
Angus Salkeld
9d33e1f40d LOG: fix qb_vsnprintf_deserialize()
the strlcat was not call correctly, it needs the
original string to find the end and return the
correct length.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-05 18:35:19 +10:00
Jeremy Fitzhardinge
30139366ed blackbox: fix 64-bit big-endian issues
Two issues:
1. when writing out the function name length, don't just write the 4 MSB
   of the size
2. when reading the time, don't just use the 4 MSB of the time as the
   timestamp; the log contains a full time_t, so we may as well use it.
2012-08-31 13:21:00 -07:00
Angus Salkeld
c7810b38b1 Remove IPC_NEEDS_RESPONSE_ACK and turn off shm ipc on solaris
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-31 14:53:38 +10:00
Angus Salkeld
ffcb11f93d Some improvements to kqueue usage.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-31 13:32:11 +10:00
Angus Salkeld
b6e0b5b431 kqueue: drop log message to trace.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-30 23:12:36 +10:00
Angus Salkeld
988c1e259c Fix splint warning
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 23:29:05 +10:00
Angus Salkeld
cceb4e2e5f Avoid strcpy() use strlcpy() instead.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:31:57 +10:00
Angus Salkeld
95840eb3aa Fix kqueue complile warnings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:31:29 +10:00
Angus Salkeld
d92bfa2b0e openbsd doesn't have EBADMSG
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 22:30:58 +10:00
Angus Salkeld
a55554efb1 LOG: change qb_vsprintf_serialize() into qb_vsnprintf_serialize()
This is to prevent overwriting the ringbuffer.
Also remove stpcpy() as it is not used anymore.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 21:40:40 +10:00
Angus Salkeld
10045dd561 Some missing pshared semaphore checks
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 12:26:47 +10:00
Angus Salkeld
873e467cf8 Cleanup the checks for pshared semaphores
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 10:22:56 +10:00
Angus Salkeld
fb76492880 RB: change the #error to ENOTSUP if no usable shared process sem
This is mainly on mac.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-28 21:30:43 +10:00
Angus Salkeld
b6839bacfe LOOP-KQUEUE: fix reference before assignment.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-28 14:39:28 +10:00
Fabio M. Di Nitto
5e16bcd004 build: fix libqb.pc creation and make maintainer-clean
LIB_RT is unnecessary around. AC_CHECK_LIBS will do the right thing

similar for the other libs that are all exported via LIBS

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
2012-08-27 15:07:36 +02:00
Angus Salkeld
248259f12b LOG: Make sure the semaphores are initialized.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-27 19:16:04 +10:00
Angus Salkeld
50632154ed Catch disconnected sockets on Solaris
It seems like poll() was not producing a POLLHUP
so we rely on qb_ipc_us_recv() returning -ENOTCONN.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-24 11:49:07 +10:00
Jeremy Fitzhardinge
4a1e24ee3e Don't free rb->shared_hdr in qb_rb_create_from_file()
Since qb_rb_close() frees it by munmapping it.
2012-08-23 10:14:11 -07:00
Jeremy Fitzhardinge
069f4e3190 Check error return of qb_ipcs_uc_recv_and_auth()
If it fails, then &ugp isn't initialized.
2012-08-23 10:12:09 -07:00
Angus Salkeld
70c8df9a19 Work around debian not setting the arch path in splint.
So just adding both i386 and x86_64 to the path.
Ref: http://lists.gnu.org/archive/html/gpsd-dev/2012-05/msg00221.html

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-22 10:58:29 +10:00
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