diff options
author | mdf <mdf@FreeBSD.org> | 2010-09-13 18:48:23 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2010-09-13 18:48:23 +0000 |
commit | 3ed6eac561ccce2958e668867ea38fd005bc635b (patch) | |
tree | b0bd953f5f99c28abddea5f8c7bb39d837607940 /sys/kern/subr_witness.c | |
parent | 9a10f7c4328c6763a33844ed9635ef3c2a7f1e84 (diff) | |
download | FreeBSD-src-3ed6eac561ccce2958e668867ea38fd005bc635b.zip FreeBSD-src-3ed6eac561ccce2958e668867ea38fd005bc635b.tar.gz |
Revert r212370, as it causes a LOR on powerpc. powerpc does a few
unexpected things in copyout(9) and so wiring the user buffer is not
sufficient to perform a copyout(9) while holding a random mutex.
Requested by: nwhitehorn
Diffstat (limited to 'sys/kern/subr_witness.c')
-rw-r--r-- | sys/kern/subr_witness.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 3fec4c4..e5aa8dca 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -154,7 +154,8 @@ __FBSDID("$FreeBSD$"); #define MAX_W_NAME 64 #define BADSTACK_SBUF_SIZE (256 * WITNESS_COUNT) -#define FULLGRAPH_SBUF_SIZE 512 +#define CYCLEGRAPH_SBUF_SIZE 8192 +#define FULLGRAPH_SBUF_SIZE 32768 /* * These flags go in the witness relationship matrix and describe the @@ -2544,7 +2545,7 @@ sysctl_debug_witness_fullgraph(SYSCTL_HANDLER_ARGS) return (error); } error = 0; - sb = sbuf_new_for_sysctl(NULL, NULL, FULLGRAPH_SBUF_SIZE, req); + sb = sbuf_new(NULL, NULL, FULLGRAPH_SBUF_SIZE, SBUF_FIXEDLEN); if (sb == NULL) return (ENOMEM); sbuf_printf(sb, "\n"); @@ -2557,9 +2558,19 @@ sysctl_debug_witness_fullgraph(SYSCTL_HANDLER_ARGS) mtx_unlock_spin(&w_mtx); /* + * While using SBUF_FIXEDLEN, check if the sbuf overflowed. + */ + if (sbuf_error(sb) != 0) { + sbuf_delete(sb); + panic("%s: sbuf overflowed, bump FULLGRAPH_SBUF_SIZE value\n", + __func__); + } + + /* * Close the sbuf and return to userland. */ - error = sbuf_finish(sb); + sbuf_finish(sb); + error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); sbuf_delete(sb); return (error); |