History log of /netbsd-current/common/lib/libprop/prop_stack.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.3 08-May-2019 thorpej

Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
header.
- Make sure libprop's source file include prop_object_impl.h before
anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-20171202 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 netbsd-5-2-RELEASE netbsd-5-2-RC1 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE yamt-nfs-mp-base11 netbsd-5-1-RC4 matt-nb5-mips64-k15 yamt-nfs-mp-base10 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 rmind-uvmplock-base yamt-nfs-mp-base9 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-base matt-armv6-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base reinoud-bufcleanup-nbase reinoud-bufcleanup-base hpcarm-cleanup-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-armv6-base
# 1.2 30-Aug-2007 joerg

branches: 1.2.2; 1.2.4;
Avoid using unbound amount of stack frames in prop_object_equal
by using a dynamic stack as well. Reorder arguments for the internalizer
as the iteration is always present and should go before possibly
NULL arguments.

Reviewed by mjf@ and adrianp@


# 1.1 16-Aug-2007 joerg

branches: 1.1.2;
libprop is currently using a recursive parser. While this is fine for
userland, deeply nested arrays and dictionaries can easily overflow
the kernel stack and thereby force a panic.

Fix the internalizer and prop_object_release to use a separate call
stack and alter the dictionary and array handling to not recurse on
the C stack. The default stack has an inline depth of 16 elements,
which should keep the overhead reasonable.

This issue was found by Pavel Cahyna and Jachym Holecek.

Additionally add a limit for prop_object_copyin_ioctl to prevent user
programs from temporary allocating unbound amount of kernel memory.
Allow malloc to fail so that tight loops of userland processes can't
force panics by exhausting the kernel map.

Tested with the sample exploit of Jachym, his test suite and reviewed
by himself (initial patch), Christos Zoulas and Jason Thorpe.


# 1.2 30-Aug-2007 joerg

branches: 1.2.2; 1.2.4;
Avoid using unbound amount of stack frames in prop_object_equal
by using a dynamic stack as well. Reorder arguments for the internalizer
as the iteration is always present and should go before possibly
NULL arguments.

Reviewed by mjf@ and adrianp@


# 1.1 16-Aug-2007 joerg

branches: 1.1.2;
libprop is currently using a recursive parser. While this is fine for
userland, deeply nested arrays and dictionaries can easily overflow
the kernel stack and thereby force a panic.

Fix the internalizer and prop_object_release to use a separate call
stack and alter the dictionary and array handling to not recurse on
the C stack. The default stack has an inline depth of 16 elements,
which should keep the overhead reasonable.

This issue was found by Pavel Cahyna and Jachym Holecek.

Additionally add a limit for prop_object_copyin_ioctl to prevent user
programs from temporary allocating unbound amount of kernel memory.
Allow malloc to fail so that tight loops of userland processes can't
force panics by exhausting the kernel map.

Tested with the sample exploit of Jachym, his test suite and reviewed
by himself (initial patch), Christos Zoulas and Jason Thorpe.


# 1.1.2.1 06-Nov-2007 matt

sync with HEAD


# 1.2.4.2 29-Sep-2007 wrstuden

Catch up on netbsd-4 as of a few days ago.


# 1.2.4.1 30-Aug-2007 wrstuden

file prop_stack.c was added on branch wrstuden-fixsa on 2007-09-30 03:38:49 +0000


# 1.2.2.2 26-Sep-2007 xtraeme

Pull up following revision(s) (requested by joerg in ticket #904):
sbin/veriexecctl/veriexecctl.c: revision 1.29 (via patch)
common/lib/libprop/prop_string.c: revision 1.9 (via patch)
distrib/sets/lists/comp/mi: revision 1.1063 (via patch)
common/lib/libprop/prop_kern.c: revision 1.8 (via patch)
common/include/prop/prop_string.h: revision 1.2 (via patch)
common/include/prop/prop_ingest.h: revision 1.2 (via patch)
usr.sbin/btdevctl/btdevctl.c: revision 1.5 (via patch)
common/lib/libprop/prop_object_impl.h: revision 1.14 (via patch)
common/lib/libprop/prop_rb.c: revision 1.7 (via patch)
common/include/prop/prop_array.h: revision 1.5 (via patch)
common/lib/libprop/prop_stack.h: revision 1.1 (via patch)
common/lib/libprop/prop_object_impl.h: revision 1.16 (via patch)
common/lib/libprop/prop_number.3: revision 1.7 (via patch)
common/lib/libprop/prop_stack.h: revision 1.2 (via patch)
common/lib/libprop/prop_stack.c: revision 1.1 (via patch)
common/lib/libprop/prop_object_impl.h: revision 1.17 (via patch)
common/lib/libprop/prop_dictionary_util.c: revision 1.2 (via patch)
common/lib/libprop/prop_dictionary_util.3: revision 1.2 (via patch)
common/lib/libprop/prop_dictionary.c: revision 1.18 (via patch)
common/lib/libprop/prop_stack.c: revision 1.2 (via patch)
common/lib/libprop/prop_object_impl.h: revision 1.18 (via patch)
common/lib/libprop/prop_dictionary.c: revision 1.19 (via patch)
common/include/prop/prop_bool.h: revision 1.3 (via patch)
common/include/prop/prop_dictionary.h: revision 1.7 (via patch)
common/include/prop/prop_data.h: revision 1.2 (via patch)
sys/sys/dkio.h: revision 1.14 (via patch)
usr.sbin/btdevctl/sdp.c: revision 1.4 (via patch)
common/include/prop/Makefile: revision 1.3 (via patch)
common/include/prop/prop_number.h: revision 1.5 (via patch)
common/lib/libprop/prop_object.c: revision 1.14 (via patch)
common/lib/libprop/prop_object.c: revision 1.15 (via patch)
common/lib/libprop/prop_object.c: revision 1.16 (via patch)
common/lib/libprop/prop_bool.3: revision 1.3 (via patch)
common/lib/libprop/prop_data.3: revision 1.4 (via patch)
common/lib/libprop/prop_object.3: revision 1.6 (via patch)
common/lib/libprop/prop_data.c: revision 1.7 (via patch)
common/lib/libprop/prop_data.c: revision 1.8 (via patch)
common/lib/libprop/prop_data.c: revision 1.9 (via patch)
common/lib/libprop/prop_dictionary.c: revision 1.20 (via patch)
usr.sbin/btdevctl/print.c: revision 1.9 (via patch)
sbin/veriexecctl/veriexecctl_parse.y: revision 1.22 (via patch)
common/lib/libprop/prop_number.c: revision 1.12 (via patch)
common/include/prop/proplib.h: revision 1.5 (via patch)
common/lib/libprop/prop_number.c: revision 1.13 (via patch)
common/lib/libprop/prop_number.c: revision 1.14 (via patch)
common/include/prop/prop_object.h: revision 1.5 (via patch)
common/lib/libprop/prop_array.3: revision 1.5 (via patch)
common/include/prop/prop_object.h: revision 1.6 (via patch)
common/lib/libprop/prop_string.3: revision 1.4 (via patch)
common/lib/libprop/prop_bool.c: revision 1.10 (via patch)
common/lib/libprop/Makefile.inc: revision 1.6 (via patch)
common/lib/libprop/prop_ingest.c: revision 1.2 (via patch)
common/lib/libprop/prop_bool.c: revision 1.11 (via patch)
common/lib/libprop/prop_array.c: revision 1.10 (via patch)
common/lib/libprop/prop_ingest.3: revision 1.3 (via patch)
common/lib/libprop/prop_bool.c: revision 1.12 (via patch)
common/lib/libprop/prop_array.c: revision 1.11 (via patch)
common/lib/libprop/prop_string.c: revision 1.7 (via patch)
common/lib/libprop/prop_dictionary.3: revision 1.8 (via patch)
common/lib/libprop/prop_array.c: revision 1.9 (via patch)
usr.sbin/btdevctl/db.c: revision 1.4 (via patch)
common/lib/libprop/prop_string.c: revision 1.8 (via patch)
common/include/prop/plistref.h: revision 1.1 (via patch)
Consider '\r' to be white space. Discussed with and also kept as local
change by freza. With this change, DOS style line endings work.

boolean_t -> bool
TRUE -> true
FALSE -> false

libprop is currently using a recursive parser. While this is fine for
userland, deeply nested arrays and dictionaries can easily overflow
the kernel stack and thereby force a panic.

Fix the internalizer and prop_object_release to use a separate call
stack and alter the dictionary and array handling to not recurse on
the C stack. The default stack has an inline depth of 16 elements,
which should keep the overhead reasonable.

This issue was found by Pavel Cahyna and Jachym Holecek.

Additionally add a limit for prop_object_copyin_ioctl to prevent user
programs from temporary allocating unbound amount of kernel memory.

Allow malloc to fail so that tight loops of userland processes can't
force panics by exhausting the kernel map.

Tested with the sample exploit of Jachym, his test suite and reviewed
by himself (initial patch), Christos Zoulas and Jason Thorpe.
struct plistref does not reference other proplib data types, so split it
in its own header file to be included by dkio.h. Fixes breakage due to
pollution from proplib.h in programs which include ioctl.h. Tested and OK
by dogcow@.

Attempt at fixing build failures after proplib was converted to bool:
FALSE -> false, TRUE -> true, boolean_t -> bool, int -> bool when
appropriate, include stdbool.h . proplib.h no longer provides boolean_t,
so it is necessary to change to bool.
From Tom Spindler (dogcow@).

Avoid using unbound amount of stack frames in prop_object_equal
by using a dynamic stack as well. Reorder arguments for the internalizer
as the iteration is always present and should go before possibly
NULL arguments.
Reviewed by mjf@ and adrianp@


# 1.2.2.1 30-Aug-2007 xtraeme

file prop_stack.c was added on branch netbsd-4 on 2007-09-27 16:16:26 +0000