Deleted Added
full compact
audit_worker.c (179176) audit_worker.c (179178)
1/*
2 * Copyright (c) 1999-2005 Apple Computer, Inc.
3 * Copyright (c) 2006-2008 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1999-2005 Apple Computer, Inc.
3 * Copyright (c) 2006-2008 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/security/audit/audit_worker.c 179176 2008-05-21 13:05:06Z rwatson $");
32__FBSDID("$FreeBSD: head/sys/security/audit/audit_worker.c 179178 2008-05-21 13:59:05Z rwatson $");
33
34#include <sys/param.h>
35#include <sys/condvar.h>
36#include <sys/conf.h>
37#include <sys/file.h>
38#include <sys/filedesc.h>
39#include <sys/fcntl.h>
40#include <sys/ipc.h>

--- 213 unchanged lines hidden (view full) ---

254
255fail_enospc:
256 /*
257 * ENOSPC is considered a special case with respect to failures, as
258 * this can reflect either our preemptive detection of insufficient
259 * space, or ENOSPC returned by the vnode write call.
260 */
261 if (audit_fail_stop) {
33
34#include <sys/param.h>
35#include <sys/condvar.h>
36#include <sys/conf.h>
37#include <sys/file.h>
38#include <sys/filedesc.h>
39#include <sys/fcntl.h>
40#include <sys/ipc.h>

--- 213 unchanged lines hidden (view full) ---

254
255fail_enospc:
256 /*
257 * ENOSPC is considered a special case with respect to failures, as
258 * this can reflect either our preemptive detection of insufficient
259 * space, or ENOSPC returned by the vnode write call.
260 */
261 if (audit_fail_stop) {
262 VOP_LOCK(vp, LK_DRAIN | LK_INTERLOCK);
262 VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY);
263 (void)VOP_FSYNC(vp, MNT_WAIT, curthread);
264 VOP_UNLOCK(vp, 0);
265 panic("Audit log space exhausted and fail-stop set.");
266 }
267 (void)audit_send_trigger(AUDIT_TRIGGER_NO_SPACE);
268 audit_suspended = 1;
269
270 /* FALLTHROUGH */
271fail:
272 /*
273 * We have failed to write to the file, so the current record is
274 * lost, which may require an immediate system halt.
275 */
276 if (audit_panic_on_write_fail) {
263 (void)VOP_FSYNC(vp, MNT_WAIT, curthread);
264 VOP_UNLOCK(vp, 0);
265 panic("Audit log space exhausted and fail-stop set.");
266 }
267 (void)audit_send_trigger(AUDIT_TRIGGER_NO_SPACE);
268 audit_suspended = 1;
269
270 /* FALLTHROUGH */
271fail:
272 /*
273 * We have failed to write to the file, so the current record is
274 * lost, which may require an immediate system halt.
275 */
276 if (audit_panic_on_write_fail) {
277 VOP_LOCK(vp, LK_DRAIN | LK_INTERLOCK);
277 VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY);
278 (void)VOP_FSYNC(vp, MNT_WAIT, curthread);
279 VOP_UNLOCK(vp, 0);
280 panic("audit_worker: write error %d\n", error);
281 } else if (ppsratecheck(&last_fail, &cur_fail, 1))
282 printf("audit_worker: write error %d\n", error);
283 VFS_UNLOCK_GIANT(vfslocked);
284}
285

--- 200 unchanged lines hidden ---
278 (void)VOP_FSYNC(vp, MNT_WAIT, curthread);
279 VOP_UNLOCK(vp, 0);
280 panic("audit_worker: write error %d\n", error);
281 } else if (ppsratecheck(&last_fail, &cur_fail, 1))
282 printf("audit_worker: write error %d\n", error);
283 VFS_UNLOCK_GIANT(vfslocked);
284}
285

--- 200 unchanged lines hidden ---