~ubuntu-branches/ubuntu/natty/libvirt/natty-security

« back to all changes in this revision

Viewing changes to gnulib/tests/test-sigaction.c

  • Committer: Bazaar Package Importer
  • Author(s): Serge Hallyn
  • Date: 2011-02-23 09:05:46 UTC
  • mfrom: (1.2.8 upstream) (3.4.25 sid)
  • Revision ID: james.westby@ubuntu.com-20110223090546-4pwmrrt7h51hr3l3
Tags: 0.8.8-1ubuntu1
* Resynchronize and merge from Debian unstable. Remaining changes:
  - debian/patches:
    * 9000-delayed_iff_up_bridge.patch
    * 9001-dont_clobber_existing_bridges.patch
    * 9002-better_default_uri_virsh.patch
    * 9003-better-default-arch.patch
    * 9004-libvirtd-group-name.patch
    * 9005-increase-unix-socket-timeout.patch
    * 9006-default-config-test-case.patch
    * 9007-fix-daemon-conf-ftbfs.patch
    * 9011-move-ebtables-script.patch
    * 9014-skip-nodeinfotest.patch
    * 9020-lp545795.patch
    * 9021-fix-uint64_t.patch
  - debian/patches/series:
    * Disable qemu-disable-network.diff.patch
  - debian/control:
    * set ubuntu maintainer
    * Build-Depends:
      - swap libxen to libxen3, qemu to qemu-kvm, and open-iscsi to
        open-iscsi-utils in Build-Depends
      - remove virtualbox Build-Depends
      - add libxml2 and libapparmor-dev Build-Depends
    * convert Vcs-Git to Xs-Debian-Vcs-Git
    * libvirt-bin Depends: move netcat-openbsd, bridge-utils, dnsmasq-base
      (>= 2.46-1), and iptables from Recommends to Depends
    * libvirt-bin Recommends: move qemu to Suggests
    * libvirt-bin Suggests: add apparmor
    * libvirt0 Recommands: move lvm2 to Suggests
  - keep debian/libvirt-bin.apport
  - keep debian/libvirt-bin.cron.daily
  - debian/libvirt-bin.dirs:
    * add apparmor, cron.daily, and apport dirs
  - debian/libvirt-bin.examples:
    * add debian/libvirt-suspendonreboot
  - debian/libvirt-bin.install:
    * add /etc/apparmor.d files
    * add apport hook
  - debian/libvirt-bin.manpages:
    * add debian/libvirt-migrate-qemu-disks.1
  - debian/libvirt-bin.postinst:
    * replace libvirt groupname with libvirtd
    * add each admin user to libvirtd group
    * call apparmor_parser on usr.sbin.libvirtd and
      usr.lib.libvirt.virt-aa-helper
    * call 'libvirt-migrate-qemu-disks -a' after
      libvirt-bin has started if migrating from
      older than 0.8.3-1ubuntu1
  - debian/libvirt-bin.postrm:
    * replace libvirt groupname with libvirtd
    * remove usr.sbin.libvirtd and
      usr.lib.libvirt.virt-aa-helper
  - keep added files under debian/:
    * libvirt-bin.upstart
    * libvirt-migrate-qemu-disks
    * libvirt-migrate-qemu-disks.1
    * libvirt-suspendonreboot
    * apparmor profiles
  - debian/README.Debian:
    * add 'Apparmor Profile' section
    * add 'Disk migration' section
  - debian/rules:
    * don't build with vbox since virtualbox-ose is in universe
    * add --with-apparmor to DEB_CONFIGURE_EXTRA_FLAGS
    * set DEB_DH_INSTALLINIT_ARGS to '--upstart-only'
    * set DEB_MAKE_CHECK_TARGET to 'check'
    * remove unneeded binary-install/libvirt-bin:: and clean::
      sections (they only deal with sysvinit stuff)
    * add build/libvirt-bin:: section to install
      - apparmor files
      - apport hooks
      - libvirt-migrate-qemu-disks
* The following Ubuntu packaging changes occurred during the divergence
  between Debian and Ubuntu. These changes are not new, but included here
  for completeness: (0.8.5-0ubuntu1 - 0.8.5-0ubuntu5):
  - Have upstart job source /etc/default/libvirt-bin.  This is only a
    temporary fix until upstart provides proper default override support
    through /etc/init/libvirt-bin.override (or any other mechanism).
    (LP: 708172)
  - debian/apparmor/usr.sbin.libvirtd: use PUx instead of Ux for executables
    (LP: 573315)
  - Rebuild with python 2.7 as the python default.
  - debian/libvirt-bin.cron.daily: use shell globbing to enumerate xml files.
    Based on patch thanks to Henryk Plötz (LP: 655176)
* Dropped the following patches included/fixed upstream:
  - 9010-dont-disable-ipv6.patch
  - 9022-build-cleanup-declaration-of-xen-tests.patch
  - 9023-vah-require-uuid.patch
  - 9009-autodetect-nc-params.patch
    * rolled into Debian's
      Autodetect-if-the-remote-nc-command-supports-the-q-o.patch
* Updated the following patches:
  - 9011-move-ebtables-script.patch:
    * LOCALSTATEDIR is defined in configmake.h
  - 9000-9006: added DEP-3 tags
  - 9002-better_default_uri_virsh.patch: updated (context changed)
* New patches:
  - 9022-drop-booton-when-kernel-specified.patch (LP: #720426)
  - 9023-fix-lxc-console-hangup.patch (LP: #668369)
  - 9024-skip-broken-commandtest.patch
* debian/patches/series:
  - don't apply Disable-CHECKSUM-rule.patch: our iptables can do this
  - don't apply Debian-specific Debianize-libvirt-guests.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- buffer-read-only: t -*- vi: set ro: */
 
2
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
 
3
/* Test of sigaction() function.
 
4
   Copyright (C) 2008-2011 Free Software Foundation, Inc.
 
5
 
 
6
   This program is free software: you can redistribute it and/or modify
 
7
   it under the terms of the GNU General Public License as published by
 
8
   the Free Software Foundation; either version 3 of the License, or
 
9
   (at your option) any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
   GNU General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU General Public License
 
17
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
18
 
 
19
/* Written by Eric Blake <ebb9@byu.net>, 2008.  */
 
20
 
 
21
#include <config.h>
 
22
 
 
23
#include <signal.h>
 
24
 
 
25
#include "signature.h"
 
26
SIGNATURE_CHECK (sigaction, int, (int, struct sigaction const *,
 
27
                                  struct sigaction *));
 
28
 
 
29
#include <stddef.h>
 
30
 
 
31
#include "macros.h"
 
32
 
 
33
#ifndef SA_NOCLDSTOP
 
34
# define SA_NOCLDSTOP 0
 
35
#endif
 
36
#ifndef SA_ONSTACK
 
37
# define SA_ONSTACK 0
 
38
#endif
 
39
#ifndef SA_RESETHAND
 
40
# define SA_RESETHAND 0
 
41
#endif
 
42
#ifndef SA_RESTART
 
43
# define SA_RESTART 0
 
44
#endif
 
45
#ifndef SA_SIGINFO
 
46
# define SA_SIGINFO 0
 
47
#endif
 
48
#ifndef SA_NOCLDWAIT
 
49
# define SA_NOCLDWAIT 0
 
50
#endif
 
51
 
 
52
/* Define a mask of flags required by POSIX.  Some implementations
 
53
   provide other flags as extensions, such as SA_RESTORER, that we
 
54
   must ignore in this test.  */
 
55
#define MASK_SA_FLAGS (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART \
 
56
                       | SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER)
 
57
 
 
58
/* This test is unsafe in the presence of an asynchronous SIGABRT,
 
59
   because we install a signal-handler that is intentionally not
 
60
   async-safe.  Hopefully, this does not lead to too many reports of
 
61
   false failures, since people don't generally use 'kill -s SIGABRT'
 
62
   to end a runaway program.  */
 
63
 
 
64
static void
 
65
handler (int sig)
 
66
{
 
67
  static int entry_count;
 
68
  struct sigaction sa;
 
69
  ASSERT (sig == SIGABRT);
 
70
  ASSERT (sigaction (SIGABRT, NULL, &sa) == 0);
 
71
  ASSERT ((sa.sa_flags & SA_SIGINFO) == 0);
 
72
  switch (entry_count++)
 
73
    {
 
74
    case 0:
 
75
      ASSERT ((sa.sa_flags & SA_RESETHAND) == 0);
 
76
      ASSERT (sa.sa_handler == handler);
 
77
      break;
 
78
    case 1:
 
79
      /* This assertion fails on glibc-2.3.6 systems with LinuxThreads,
 
80
         when this program is linked with -lpthread, due to the sigaction()
 
81
         override in libpthread.so.  */
 
82
#if !(defined __GLIBC__ || defined __UCLIBC__)
 
83
      ASSERT (sa.sa_handler == SIG_DFL);
 
84
#endif
 
85
      break;
 
86
    default:
 
87
      ASSERT (0);
 
88
    }
 
89
}
 
90
 
 
91
int
 
92
main (void)
 
93
{
 
94
  struct sigaction sa;
 
95
  struct sigaction old_sa;
 
96
  sa.sa_handler = handler;
 
97
 
 
98
  sa.sa_flags = 0;
 
99
  ASSERT (sigemptyset (&sa.sa_mask) == 0);
 
100
  ASSERT (sigaction (SIGABRT, &sa, NULL) == 0);
 
101
  ASSERT (raise (SIGABRT) == 0);
 
102
 
 
103
  sa.sa_flags = SA_RESETHAND | SA_NODEFER;
 
104
  ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
 
105
  ASSERT ((old_sa.sa_flags & MASK_SA_FLAGS) == 0);
 
106
  ASSERT (old_sa.sa_handler == handler);
 
107
  ASSERT (raise (SIGABRT) == 0);
 
108
 
 
109
  sa.sa_handler = SIG_DFL;
 
110
  ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
 
111
  ASSERT ((old_sa.sa_flags & SA_SIGINFO) == 0);
 
112
#if !(defined __GLIBC__ || defined __UCLIBC__) /* see above */
 
113
  ASSERT (old_sa.sa_handler == SIG_DFL);
 
114
#endif
 
115
 
 
116
  sa.sa_handler = SIG_IGN;
 
117
  ASSERT (sigaction (SIGABRT, &sa, NULL) == 0);
 
118
  ASSERT (raise (SIGABRT) == 0);
 
119
  ASSERT (sigaction (SIGABRT, NULL, &old_sa) == 0);
 
120
  ASSERT (old_sa.sa_handler == SIG_IGN);
 
121
  ASSERT (raise (SIGABRT) == 0);
 
122
 
 
123
  return 0;
 
124
}