svn commit: r252541 - stable/9/sys/kern
Author: lstewart Date: Wed Jul 3 05:58:51 2013 New Revision: 252541 URL: http://svnweb.freebsd.org/changeset/base/252541 Log: MFC r251778: Cleanup and simplification in khelp_{register|deregister}_helper(). No functional changes. Modified: stable/9/sys/kern/kern_khelp.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_khelp.c == --- stable/9/sys/kern/kern_khelp.c Wed Jul 3 05:54:23 2013 (r252540) +++ stable/9/sys/kern/kern_khelp.c Wed Jul 3 05:58:51 2013 (r252541) @@ -72,34 +72,32 @@ khelp_register_helper(struct helper *h) struct helper *tmph; int error, i, inserted; - error = 0; - inserted = 0; + error = inserted = 0; refcount_init(h-h_refcount, 0); h-h_id = osd_register(OSD_KHELP, NULL, NULL); /* It's only safe to add the hooks after osd_register(). */ - if (h-h_nhooks 0) { - for (i = 0; i h-h_nhooks !error; i++) { - /* We don't require the module to assign hook_helper. */ - h-h_hooks[i].hook_helper = h; - error = hhook_add_hook_lookup(h-h_hooks[i], - HHOOK_WAITOK); - } - - if (error) { - for (i--; i = 0; i--) - hhook_remove_hook_lookup(h-h_hooks[i]); - - osd_deregister(OSD_KHELP, h-h_id); - } + for (i = 0; i h-h_nhooks !error; i++) { + /* We don't require the module to assign hook_helper. */ + h-h_hooks[i].hook_helper = h; + error = hhook_add_hook_lookup(h-h_hooks[i], HHOOK_WAITOK); + if (error) + printf(%s: \%s\ khelp module unable to + hook type %d id %d due to error %d\n, __func__, + h-h_name, h-h_hooks[i].hook_type, + h-h_hooks[i].hook_id, error); } - if (!error) { + if (error) { + for (i--; i = 0; i--) + hhook_remove_hook_lookup(h-h_hooks[i]); + osd_deregister(OSD_KHELP, h-h_id); + } else { KHELP_LIST_WLOCK(); /* * Keep list of helpers sorted in descending h_id order. Due to * the way osd_set() works, a sorted list ensures -* init_helper_osd() will operate with improved efficiency. +* khelp_init_osd() will operate with improved efficiency. */ TAILQ_FOREACH(tmph, helpers, h_next) { if (tmph-h_id h-h_id) { @@ -123,8 +121,6 @@ khelp_deregister_helper(struct helper *h struct helper *tmph; int error, i; - error = 0; - KHELP_LIST_WLOCK(); if (h-h_refcount 0) error = EBUSY; @@ -141,10 +137,8 @@ khelp_deregister_helper(struct helper *h KHELP_LIST_WUNLOCK(); if (!error) { - if (h-h_nhooks 0) { - for (i = 0; i h-h_nhooks; i++) - hhook_remove_hook_lookup(h-h_hooks[i]); - } + for (i = 0; i h-h_nhooks; i++) + hhook_remove_hook_lookup(h-h_hooks[i]); osd_deregister(OSD_KHELP, h-h_id); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252542 - stable/8/sys/kern
Author: lstewart Date: Wed Jul 3 05:59:48 2013 New Revision: 252542 URL: http://svnweb.freebsd.org/changeset/base/252542 Log: MFC r251778: Cleanup and simplification in khelp_{register|deregister}_helper(). No functional changes. Modified: stable/8/sys/kern/kern_khelp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_khelp.c == --- stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:58:51 2013 (r252541) +++ stable/8/sys/kern/kern_khelp.c Wed Jul 3 05:59:48 2013 (r252542) @@ -72,34 +72,32 @@ khelp_register_helper(struct helper *h) struct helper *tmph; int error, i, inserted; - error = 0; - inserted = 0; + error = inserted = 0; refcount_init(h-h_refcount, 0); h-h_id = osd_register(OSD_KHELP, NULL, NULL); /* It's only safe to add the hooks after osd_register(). */ - if (h-h_nhooks 0) { - for (i = 0; i h-h_nhooks !error; i++) { - /* We don't require the module to assign hook_helper. */ - h-h_hooks[i].hook_helper = h; - error = hhook_add_hook_lookup(h-h_hooks[i], - HHOOK_WAITOK); - } - - if (error) { - for (i--; i = 0; i--) - hhook_remove_hook_lookup(h-h_hooks[i]); - - osd_deregister(OSD_KHELP, h-h_id); - } + for (i = 0; i h-h_nhooks !error; i++) { + /* We don't require the module to assign hook_helper. */ + h-h_hooks[i].hook_helper = h; + error = hhook_add_hook_lookup(h-h_hooks[i], HHOOK_WAITOK); + if (error) + printf(%s: \%s\ khelp module unable to + hook type %d id %d due to error %d\n, __func__, + h-h_name, h-h_hooks[i].hook_type, + h-h_hooks[i].hook_id, error); } - if (!error) { + if (error) { + for (i--; i = 0; i--) + hhook_remove_hook_lookup(h-h_hooks[i]); + osd_deregister(OSD_KHELP, h-h_id); + } else { KHELP_LIST_WLOCK(); /* * Keep list of helpers sorted in descending h_id order. Due to * the way osd_set() works, a sorted list ensures -* init_helper_osd() will operate with improved efficiency. +* khelp_init_osd() will operate with improved efficiency. */ TAILQ_FOREACH(tmph, helpers, h_next) { if (tmph-h_id h-h_id) { @@ -123,8 +121,6 @@ khelp_deregister_helper(struct helper *h struct helper *tmph; int error, i; - error = 0; - KHELP_LIST_WLOCK(); if (h-h_refcount 0) error = EBUSY; @@ -141,10 +137,8 @@ khelp_deregister_helper(struct helper *h KHELP_LIST_WUNLOCK(); if (!error) { - if (h-h_nhooks 0) { - for (i = 0; i h-h_nhooks; i++) - hhook_remove_hook_lookup(h-h_hooks[i]); - } + for (i = 0; i h-h_nhooks; i++) + hhook_remove_hook_lookup(h-h_hooks[i]); osd_deregister(OSD_KHELP, h-h_id); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r252514 - head/sbin/swapon
On Tue, Jul 02, 2013 at 05:34:35PM +, Xin LI wrote: New Revision: 252514 URL: http://svnweb.freebsd.org/changeset/base/252514 Log: Plug a memory leak. Is MFC to stable/[89] applicable? If yes, can it be scheduled? ;-) ./danfe ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252543 - stable/9/sys/kern
Author: lstewart Date: Wed Jul 3 06:20:47 2013 New Revision: 252543 URL: http://svnweb.freebsd.org/changeset/base/252543 Log: MFC r251787: Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to ensure all per-vnet related hhook initialisation is completed prior to any virtualised hhook points attempting registration. vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be chosen. There are no per-vnet initialisors in the source tree at this time which run earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs indicates there are no subsystems pre SI_SUB_MBUF that would likely be interested in registering a virtualised hhook point. Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the first overtly network-related initilisation stage to run after SI_SUB_VNET. If a subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to register virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which runs immediately after SI_SUB_VNET. Modified: stable/9/sys/kern/kern_hhook.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_hhook.c == --- stable/9/sys/kern/kern_hhook.c Wed Jul 3 05:59:48 2013 (r252542) +++ stable/9/sys/kern/kern_hhook.c Wed Jul 3 06:20:47 2013 (r252543) @@ -509,7 +509,7 @@ hhook_vnet_uninit(const void *unused __u /* * When a vnet is created and being initialised, init the V_hhook_vhead_list. */ -VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, +VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST, hhook_vnet_init, NULL); /* @@ -517,5 +517,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PRO * points to clean up on vnet tear down, but in case the KPI is misused, * provide a function to clean up and free memory for a vnet being destroyed. */ -VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, +VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY, hhook_vnet_uninit, NULL); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252544 - stable/8/sys/kern
Author: lstewart Date: Wed Jul 3 06:23:46 2013 New Revision: 252544 URL: http://svnweb.freebsd.org/changeset/base/252544 Log: MFC r251787: Move hhook's per-vnet initialisation to an earlier SYSINIT SI_SUB stage to ensure all per-vnet related hhook initialisation is completed prior to any virtualised hhook points attempting registration. vnet_register_sysinit() requires that a stage later than SI_SUB_VNET be chosen. There are no per-vnet initialisors in the source tree at this time which run earlier than SI_SUB_INIT_IF. A quick audit of non-virtualised SYSINITs indicates there are no subsystems pre SI_SUB_MBUF that would likely be interested in registering a virtualised hhook point. Settle on SI_SUB_MBUF as hhook's per-vnet initialisation stage as it's the first overtly network-related initilisation stage to run after SI_SUB_VNET. If a subsystem that initialises earlier than SI_SUB_MBUF ends up wanting to register virtualised hhook points in future, hhook's use of SI_SUB_MBUF will need to be revisited and would probably warrant creating a dedicated SI_SUB_HHOOK which runs immediately after SI_SUB_VNET. Modified: stable/8/sys/kern/kern_hhook.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c == --- stable/8/sys/kern/kern_hhook.c Wed Jul 3 06:20:47 2013 (r252543) +++ stable/8/sys/kern/kern_hhook.c Wed Jul 3 06:23:46 2013 (r252544) @@ -509,7 +509,7 @@ hhook_vnet_uninit(const void *unused __u /* * When a vnet is created and being initialised, init the V_hhook_vhead_list. */ -VNET_SYSINIT(hhook_vnet_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, +VNET_SYSINIT(hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST, hhook_vnet_init, NULL); /* @@ -517,5 +517,5 @@ VNET_SYSINIT(hhook_vnet_init, SI_SUB_PRO * points to clean up on vnet tear down, but in case the KPI is misused, * provide a function to clean up and free memory for a vnet being destroyed. */ -VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, +VNET_SYSUNINIT(hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY, hhook_vnet_uninit, NULL); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252547 - in head: include lib/libc/iconv lib/libc/locale
Author: peter Date: Wed Jul 3 07:03:19 2013 New Revision: 252547 URL: http://svnweb.freebsd.org/changeset/base/252547 Log: Replace the #define for iconv so it is for the function name instead of a macro with parameters. Remove a __DECONST hack and add consts instead for gnu libiconv API compatability. This makes it work with things like devel/boost-libs that expects to use iconv as though it were a pointer. Modified: head/include/iconv.h head/lib/libc/iconv/citrus_iconv.h head/lib/libc/iconv/citrus_iconv_local.h head/lib/libc/iconv/iconv.c head/lib/libc/locale/cXXrtomb_iconv.h head/lib/libc/locale/mbrtocXX_iconv.h Modified: head/include/iconv.h == --- head/include/iconv.hWed Jul 3 06:43:49 2013(r252546) +++ head/include/iconv.hWed Jul 3 07:03:19 2013(r252547) @@ -43,7 +43,7 @@ #define iconv_open libiconv_open #define iconv_closelibiconv_close -#define iconv(cd, in, insize, out, outsize)libiconv(cd, __DECONST(char **, in), insize, out, outsize) +#define iconv libiconv #define iconv_tlibiconv_t struct __tag_iconv_t; @@ -51,7 +51,7 @@ typedef struct __tag_iconv_t*iconv_t; __BEGIN_DECLS iconv_tlibiconv_open(const char *, const char *); -size_t libiconv(iconv_t, char ** __restrict, +size_t libiconv(iconv_t, const char ** __restrict, size_t * __restrict, char ** __restrict, size_t * __restrict); intlibiconv_close(iconv_t); @@ -60,7 +60,7 @@ int libiconv_close(iconv_t); */ int__iconv_get_list(char ***, size_t *, bool); void __iconv_free_list(char **, size_t); -size_t __iconv(iconv_t, char **, size_t *, char **, +size_t __iconv(iconv_t, const char **, size_t *, char **, size_t *, __uint32_t, size_t *); #define __ICONV_F_HIDE_INVALID 0x0001 Modified: head/lib/libc/iconv/citrus_iconv.h == --- head/lib/libc/iconv/citrus_iconv.h Wed Jul 3 06:43:49 2013 (r252546) +++ head/lib/libc/iconv/citrus_iconv.h Wed Jul 3 07:03:19 2013 (r252547) @@ -52,7 +52,7 @@ __END_DECLS */ static __inline int _citrus_iconv_convert(struct _citrus_iconv * __restrict cv, -char * __restrict * __restrict in, size_t * __restrict inbytes, +const char * __restrict * __restrict in, size_t * __restrict inbytes, char * __restrict * __restrict out, size_t * __restrict outbytes, uint32_t flags, size_t * __restrict nresults) { Modified: head/lib/libc/iconv/citrus_iconv_local.h == --- head/lib/libc/iconv/citrus_iconv_local.hWed Jul 3 06:43:49 2013 (r252546) +++ head/lib/libc/iconv/citrus_iconv_local.hWed Jul 3 07:03:19 2013 (r252547) @@ -45,7 +45,7 @@ static void_citrus_##_m_##_iconv_unini (struct _citrus_iconv_shared *);\ static int _citrus_##_m_##_iconv_convert \ (struct _citrus_iconv * __restrict, \ - char * __restrict * __restrict, \ + const char * __restrict * __restrict, \ size_t * __restrict,\ char * __restrict * __restrict, \ size_t * __restrict outbytes, \ @@ -74,7 +74,7 @@ typedef void (*_citrus_iconv_uninit_shar (struct _citrus_iconv_shared *); typedef int (*_citrus_iconv_convert_t) (struct _citrus_iconv * __restrict, -char *__restrict* __restrict, size_t * __restrict, +const char *__restrict* __restrict, size_t * __restrict, char * __restrict * __restrict, size_t * __restrict, uint32_t, size_t * __restrict); typedef int (*_citrus_iconv_init_context_t)(struct _citrus_iconv *); Modified: head/lib/libc/iconv/iconv.c == --- head/lib/libc/iconv/iconv.c Wed Jul 3 06:43:49 2013(r252546) +++ head/lib/libc/iconv/iconv.c Wed Jul 3 07:03:19 2013(r252547) @@ -130,7 +130,7 @@ libiconv_close(iconv_t handle) } size_t -libiconv(iconv_t handle, char **in, size_t *szin, char **out, size_t *szout) +libiconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout) { size_t ret; int err; @@ -151,7 +151,7 @@ libiconv(iconv_t handle, char **in, size } size_t -__iconv(iconv_t handle, char **in, size_t *szin, char **out, +__iconv(iconv_t handle, const char **in, size_t *szin, char **out, size_t *szout, uint32_t flags, size_t *invalids) { size_t ret; Modified: head/lib/libc/locale/cXXrtomb_iconv.h
svn commit: r252548 - head/sys/net
Author: hrs Date: Wed Jul 3 07:31:07 2013 New Revision: 252548 URL: http://svnweb.freebsd.org/changeset/base/252548 Log: Fix a compiler warning. MFC after:1 week Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c == --- head/sys/net/if_bridge.cWed Jul 3 07:03:19 2013(r252547) +++ head/sys/net/if_bridge.cWed Jul 3 07:31:07 2013(r252548) @@ -1100,6 +1100,7 @@ bridge_ioctl_add(struct bridge_softc *sc * interfaces have inet6 address. If any, remove * inet6 addresses on the interface to be added. */ + ia6_m = NULL; BRIDGE_XLOCK(sc); LIST_FOREACH(bif, sc-sc_iflist, bif_next) { ia6_m = in6ifa_llaonifp(bif-bif_ifp); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252549 - stable/9/sys/sys
Author: lstewart Date: Wed Jul 3 07:57:22 2013 New Revision: 252549 URL: http://svnweb.freebsd.org/changeset/base/252549 Log: MFC r251789: Now that the necessary infrastructure is in place to ensure hhook points which register after a khelp module will get hooked, move khelp module initialisation to the earlier SI_SUB_KLD stage. Modified: stable/9/sys/sys/module_khelp.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/sys/module_khelp.h == --- stable/9/sys/sys/module_khelp.h Wed Jul 3 07:31:07 2013 (r252548) +++ stable/9/sys/sys/module_khelp.h Wed Jul 3 07:57:22 2013 (r252549) @@ -85,8 +85,7 @@ struct khelp_modevent_data { .evhand = khelp_modevent, \ .priv = kmd_##hname\ }; \ - DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY); \ + DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \ MODULE_VERSION(hname, version) #defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252550 - stable/8/sys/sys
Author: lstewart Date: Wed Jul 3 07:58:14 2013 New Revision: 252550 URL: http://svnweb.freebsd.org/changeset/base/252550 Log: MFC r251789: Now that the necessary infrastructure is in place to ensure hhook points which register after a khelp module will get hooked, move khelp module initialisation to the earlier SI_SUB_KLD stage. Modified: stable/8/sys/sys/module_khelp.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/sys/module_khelp.h == --- stable/8/sys/sys/module_khelp.h Wed Jul 3 07:57:22 2013 (r252549) +++ stable/8/sys/sys/module_khelp.h Wed Jul 3 07:58:14 2013 (r252550) @@ -85,8 +85,7 @@ struct khelp_modevent_data { .evhand = khelp_modevent, \ .priv = kmd_##hname\ }; \ - DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY); \ + DECLARE_MODULE(hname, h_##hname, SI_SUB_KLD, SI_ORDER_ANY); \ MODULE_VERSION(hname, version) #defineKHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252551 - stable/9/share/man/man9
Author: lstewart Date: Wed Jul 3 08:20:40 2013 New Revision: 252551 URL: http://svnweb.freebsd.org/changeset/base/252551 Log: MFC r252052: Non-virtualised hhook points are supported as of r251732. Modified: stable/9/share/man/man9/hhook.9 Directory Properties: stable/9/share/man/ (props changed) stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/hhook.9 == --- stable/9/share/man/man9/hhook.9 Wed Jul 3 07:58:14 2013 (r252550) +++ stable/9/share/man/man9/hhook.9 Wed Jul 3 08:20:40 2013 (r252551) @@ -30,7 +30,7 @@ .\ .\ $FreeBSD$ .\ -.Dd February 15, 2011 +.Dd June 21, 2013 .Dt HHOOK 9 .Os .Sh NAME @@ -380,9 +380,3 @@ This manual page was written by .An David Hayes Aq david.ha...@ieee.org and .An Lawrence Stewart Aq lstew...@freebsd.org . -.Sh BUGS -The framework does not currently support registering hook points in subsystems -which have not been virtualised with VIMAGE. -Fairly minimal internal changes to the -.Nm -implementation are required to address this. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252552 - stable/8/share/man/man9
Author: lstewart Date: Wed Jul 3 08:21:05 2013 New Revision: 252552 URL: http://svnweb.freebsd.org/changeset/base/252552 Log: MFC r252052: Non-virtualised hhook points are supported as of r251732. Modified: stable/8/share/man/man9/hhook.9 Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/hhook.9 == --- stable/8/share/man/man9/hhook.9 Wed Jul 3 08:20:40 2013 (r252551) +++ stable/8/share/man/man9/hhook.9 Wed Jul 3 08:21:05 2013 (r252552) @@ -30,7 +30,7 @@ .\ .\ $FreeBSD$ .\ -.Dd February 15, 2011 +.Dd June 21, 2013 .Dt HHOOK 9 .Os .Sh NAME @@ -380,9 +380,3 @@ This manual page was written by .An David Hayes Aq david.ha...@ieee.org and .An Lawrence Stewart Aq lstew...@freebsd.org . -.Sh BUGS -The framework does not currently support registering hook points in subsystems -which have not been virtualised with VIMAGE. -Fairly minimal internal changes to the -.Nm -implementation are required to address this. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: should_yield problem [Was: svn commit: r251322 - head/sys/kern]
on 03/07/2013 07:40 Bruce Evans said the following: On Tue, 2 Jul 2013, Andriy Gapon wrote: distance = (signed)( i1 - i2 ) With 2's complement and benign overflow, this is no different from 'distance = i1 - i2'. Given the particular context I'd say that there is a difference. But signed counters are not wanted here. A negative distance, or equivalently with 32-bit unsigned ints, an unsigned difference of = 0x8000 means overflow or an initialization error. Your bug is an initialization error. Right. But I'd rather produce a positive (unsigned) number than a negative number when such an error happens (and is detectable). Again, I am speaking about the concrete context. -- Andriy Gapon ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252553 - stable/8/sys/dev/mfi
Author: smh Date: Wed Jul 3 08:35:14 2013 New Revision: 252553 URL: http://svnweb.freebsd.org/changeset/base/252553 Log: MFC r252471: Remove forced timeout of in-flight commands from mfi_timeout. While this prevents commands getting stuck forever there is no way to guarantee that data from the command hasn't been committed to the device. In addition older mfi firmware has a bug that would cause the controller to frequently stall IO for over our timeout value, which when combined with a forced timeout often resulted in panics in UFS; which would otherwise be avoided when the command eventually completed if left alone. For reference this timeout issue is resolved in Dell FW package 21.2.1-. Fixed FW package version for none Dell controller will likely vary. Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c == --- stable/8/sys/dev/mfi/mfi.c Wed Jul 3 08:21:05 2013(r252552) +++ stable/8/sys/dev/mfi/mfi.c Wed Jul 3 08:35:14 2013(r252553) @@ -3762,12 +3762,15 @@ mfi_timeout(void *data) MFI_PRINT_CMD(cm); MFI_VALIDATE_CMD(sc, cm); /* -* Fail the command instead of leaving it on -* the queue where it could remain stuck forever +* While commands can get stuck forever we do +* not fail them as there is no way to tell if +* the controller has actually processed them +* or not. +* +* In addition its very likely that force +* failing a command here would cause a panic +* e.g. in UFS. */ - mfi_remove_busy(cm); - cm-cm_error = ETIMEDOUT; - mfi_complete(sc, cm); timedout++; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252554 - stable/9/sys/dev/mfi
Author: smh Date: Wed Jul 3 08:39:18 2013 New Revision: 252554 URL: http://svnweb.freebsd.org/changeset/base/252554 Log: MFC r252471: Remove forced timeout of in-flight commands from mfi_timeout. While this prevents commands getting stuck forever there is no way to guarantee that data from the command hasn't been committed to the device. In addition older mfi firmware has a bug that would cause the controller to frequently stall IO for over our timeout value, which when combined with a forced timeout often resulted in panics in UFS; which would otherwise be avoided when the command eventually completed if left alone. For reference this timeout issue is resolved in Dell FW package 21.2.1-. Fixed FW package version for none Dell controller will likely vary. Modified: stable/9/sys/dev/mfi/mfi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c == --- stable/9/sys/dev/mfi/mfi.c Wed Jul 3 08:35:14 2013(r252553) +++ stable/9/sys/dev/mfi/mfi.c Wed Jul 3 08:39:18 2013(r252554) @@ -3768,12 +3768,15 @@ mfi_timeout(void *data) MFI_PRINT_CMD(cm); MFI_VALIDATE_CMD(sc, cm); /* -* Fail the command instead of leaving it on -* the queue where it could remain stuck forever +* While commands can get stuck forever we do +* not fail them as there is no way to tell if +* the controller has actually processed them +* or not. +* +* In addition its very likely that force +* failing a command here would cause a panic +* e.g. in UFS. */ - mfi_remove_busy(cm); - cm-cm_error = ETIMEDOUT; - mfi_complete(sc, cm); timedout++; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r252408 - head/sbin/ifconfig
On Sun, 2013-06-30 at 07:37:32 +, Hiroki Sato wrote: Author: hrs Date: Sun Jun 30 07:37:31 2013 New Revision: 252408 URL: http://svnweb.freebsd.org/changeset/base/252408 Log: Do not display a warning message in a jail without AF_INET6 support. MFC after: 3 days Modified: head/sbin/ifconfig/af_nd6.c Modified: head/sbin/ifconfig/af_nd6.c == --- head/sbin/ifconfig/af_nd6.c Sun Jun 30 06:44:31 2013 (r252407) +++ head/sbin/ifconfig/af_nd6.c Sun Jun 30 07:37:31 2013 (r252408) @@ -148,7 +148,7 @@ nd6_status(int s) memset(nd, 0, sizeof(nd)); strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) 0) { - if (errno != EAFNOSUPPORT) + if (errno != EAFNOSUPPORT error != EPROTONOSUPPORT) warn(socket(AF_INET6, SOCK_DGRAM)); return; } This gives undefined behavior, error is uninitialized at this point. Found by: Coverity Scan, CID 1042128 Cheers, Uli ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252555 - in stable/9: sbin/ifconfig sys/amd64/conf sys/conf sys/contrib/rdma sys/contrib/rdma/krping sys/dev/cxgb/ulp/tom sys/i386/conf sys/modules sys/modules/rdma/krping sys/modules/...
Author: np Date: Wed Jul 3 09:25:29 2013 New Revision: 252555 URL: http://svnweb.freebsd.org/changeset/base/252555 Log: MFC/backport core kernel and userspace parts of r237263 (TCP_OFFLOAD rework). MFC r237563, r239511, r243603, r245915, r245916, r245919, r245921, r245922, r245924, r245925, r245932, r245934 too. Build tested with make universe. r237263: - Updated TOE support in the kernel. ... r237563: Fix clang warning when compiling iw_cxgb. r239511: Correctly handle the case where an inp has already been dropped by the time the TOE driver reports that an active open failed. toe_connect_failed is supposed to handle this but it should be provided the inpcb instead of the tcpcb which may no longer be around. r243603: Make sure that tcp_timer_activate() correctly sees TCP_OFFLOAD (or not). r245915: Heed SO_NO_OFFLOAD. r245916: Teach toe_4tuple_check() to deal with IPv6 4-tuples too. r245919: Add TCP_OFFLOAD hook in syncache_respond for IPv6 too, just like the one that exists for IPv4. r245921: There is no need to call into the TOE driver twice in pru_rcvd (tod_rcvd and then tod_output right after that). r245922: Avoid NULL dereference in nd6_storelladdr when no mbuf is provided. It is called this way from a couple of places in the OFED code. (toecore calls it too but that's going to change shortly). r245924: Move lle_event to if_llatbl.h lle_event replaced arp_update_event after the ARP rewrite and ended up in if_ether.h simply because arp_update_event used to be there too. IPv6 neighbor discovery is going to grow lle_event support and this is a good time to move it to if_llatbl.h. The two in-tree consumers of this event - OFED and toecore - are not affected. r245925: Generate lle_event in the IPv6 neighbor discovery code too. r245932: Teach toe_l2_resolve to resolve IPv6 destinations too. r245934: Add checks for SO_NO_OFFLOAD in a couple of places that I missed earlier in r245915. Added: stable/9/sys/modules/toecore/ - copied from r237263, head/sys/modules/toecore/ stable/9/sys/netinet/toecore.c - copied, changed from r237263, head/sys/netinet/toecore.c stable/9/sys/netinet/toecore.h - copied, changed from r237263, head/sys/netinet/toecore.h Deleted: stable/9/sys/netinet/toedev.h Modified: stable/9/sbin/ifconfig/ifconfig.c stable/9/sys/amd64/conf/GENERIC stable/9/sys/conf/NOTES stable/9/sys/conf/files stable/9/sys/conf/options stable/9/sys/contrib/rdma/krping/krping.c stable/9/sys/contrib/rdma/krping/krping.h stable/9/sys/contrib/rdma/krping/krping_dev.c stable/9/sys/contrib/rdma/rdma_addr.c stable/9/sys/contrib/rdma/rdma_cache.c stable/9/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c stable/9/sys/i386/conf/GENERIC stable/9/sys/i386/conf/XEN stable/9/sys/modules/Makefile stable/9/sys/modules/rdma/krping/Makefile stable/9/sys/net/if_llatbl.h stable/9/sys/net/if_var.h stable/9/sys/net/if_vlan.c stable/9/sys/netinet/if_ether.c stable/9/sys/netinet/if_ether.h stable/9/sys/netinet/in.c stable/9/sys/netinet/tcp_input.c stable/9/sys/netinet/tcp_offload.c stable/9/sys/netinet/tcp_offload.h stable/9/sys/netinet/tcp_output.c stable/9/sys/netinet/tcp_subr.c stable/9/sys/netinet/tcp_syncache.c stable/9/sys/netinet/tcp_syncache.h stable/9/sys/netinet/tcp_timer.c stable/9/sys/netinet/tcp_usrreq.c stable/9/sys/netinet/tcp_var.h stable/9/sys/netinet6/nd6.c stable/9/sys/netinet6/nd6_nbr.c stable/9/sys/ofed/drivers/infiniband/core/cma.c stable/9/sys/ofed/drivers/infiniband/core/iwcm.c stable/9/sys/ofed/include/linux/net.h stable/9/sys/ofed/include/linux/workqueue.h stable/9/sys/ofed/include/net/netevent.h stable/9/sys/ofed/include/rdma/iw_cm.h stable/9/usr.bin/netstat/inet.c stable/9/usr.bin/sockstat/sockstat.c Directory Properties: stable/9/sbin/ifconfig/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/net/ (props changed) stable/9/usr.bin/netstat/ (props changed) stable/9/usr.bin/sockstat/ (props changed) Modified: stable/9/sbin/ifconfig/ifconfig.c == --- stable/9/sbin/ifconfig/ifconfig.c Wed Jul 3 08:39:18 2013 (r252554) +++ stable/9/sbin/ifconfig/ifconfig.c Wed Jul 3 09:25:29 2013 (r252555) @@ -910,7 +910,7 @@ unsetifdescr(const char *val, int value, #defineIFCAPBITS \ \020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING \ \10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC \ -\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP \ +\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP \ \26RXCSUM_IPV6\27TXCSUM_IPV6 /* @@ -1189,6 +1189,8 @@ static struct cmd basic_cmds[] = { DEF_CMD(-tso4,-IFCAP_TSO4,setifcap), DEF_CMD(tso,
Re: svn commit: r252356 - in head: contrib/smbfs/mount_smbfs etc/defaults etc/mtree include lib lib/libprocstat rescue/rescue sbin/mount share/examples share/examples/etc share/mk sys/conf sys/kern sy
On Fri, 2013-06-28 at 21:00:08 +, Davide Italiano wrote: Author: davide Date: Fri Jun 28 21:00:08 2013 New Revision: 252356 URL: http://svnweb.freebsd.org/changeset/base/252356 Log: - Trim an unused and bogus Makefile for mount_smbfs. - Reconnect with some minor modifications, in particular now selsocket() internals are adapted to use sbintime units after recent'ish calloutng switch. yay, for reconnecting this to the build. Now Coverity Scan is seeing this code and there are dozens of double frees in the form: smb_rq_done(rqp); free(rqp, M_SMBFSDATA); But smb_rq_done() is already calling free(rqp). This seems easy to audit and fix. (sometimes the order is swapped, so it's a USE_AFTER_FREE instead) This is CIDs 1042109 -- 1042126, all in smbfs_smb.c. Thanks for looking into this Uli ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252556 - head/usr.sbin/pw
Author: des Date: Wed Jul 3 09:48:24 2013 New Revision: 252556 URL: http://svnweb.freebsd.org/changeset/base/252556 Log: There is no reason to disallow setting the password or account expiry date to the current date. MFC after:3 days Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c == --- head/usr.sbin/pw/pw_user.c Wed Jul 3 09:25:29 2013(r252555) +++ head/usr.sbin/pw/pw_user.c Wed Jul 3 09:48:24 2013(r252556) @@ -513,8 +513,6 @@ pw_user(struct userconf * cnf, int mode, time_t now = time(NULL); time_t expire = parse_date(now, arg-val); - if (now == expire) - errx(EX_DATAERR, invalid password change date `%s', arg-val); if (pwd-pw_change != expire) { pwd-pw_change = expire; edited = 1; @@ -533,8 +531,6 @@ pw_user(struct userconf * cnf, int mode, time_t now = time(NULL); time_t expire = parse_date(now, arg-val); - if (now == expire) - errx(EX_DATAERR, invalid account expiry date `%s', arg-val); if (pwd-pw_expire != expire) { pwd-pw_expire = expire; edited = 1; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252557 - head/sbin/ifconfig
Author: hrs Date: Wed Jul 3 09:50:59 2013 New Revision: 252557 URL: http://svnweb.freebsd.org/changeset/base/252557 Log: Fix a typo (s/error/errno/). Modified: head/sbin/ifconfig/af_nd6.c Modified: head/sbin/ifconfig/af_nd6.c == --- head/sbin/ifconfig/af_nd6.c Wed Jul 3 09:48:24 2013(r252556) +++ head/sbin/ifconfig/af_nd6.c Wed Jul 3 09:50:59 2013(r252557) @@ -148,7 +148,7 @@ nd6_status(int s) memset(nd, 0, sizeof(nd)); strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname)); if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) 0) { - if (errno != EAFNOSUPPORT error != EPROTONOSUPPORT) + if (errno != EAFNOSUPPORT errno != EPROTONOSUPPORT) warn(socket(AF_INET6, SOCK_DGRAM)); return; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252558 - head/sys/fs/smbfs
Author: davide Date: Wed Jul 3 10:31:45 2013 New Revision: 252558 URL: http://svnweb.freebsd.org/changeset/base/252558 Log: - Fix double frees/user after free. - Allocate using smb_rq_alloc() instead of inlining it. Reported by: uqs Found with: Coverity Scan Modified: head/sys/fs/smbfs/smbfs_smb.c Modified: head/sys/fs/smbfs/smbfs_smb.c == --- head/sys/fs/smbfs/smbfs_smb.c Wed Jul 3 09:50:59 2013 (r252557) +++ head/sys/fs/smbfs/smbfs_smb.c Wed Jul 3 10:31:45 2013 (r252558) @@ -94,12 +94,10 @@ smbfs_smb_lockandx(struct smbnode *np, i if (op == SMB_LOCK_SHARED) ltype |= SMB_LOCKING_ANDX_SHARED_LOCK; - rqp = malloc(sizeof(struct smb_rq), M_SMBFSDATA, M_WAITOK); - error = smb_rq_init(rqp, SSTOCP(ssp), SMB_COM_LOCKING_ANDX, scred); - if (error) { - free(rqp, M_SMBFSDATA); - return error; - } + + error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_LOCKING_ANDX, scred, rqp); + if (error) + return (error); smb_rq_getrequest(rqp, mbp); smb_rq_wstart(rqp); mb_put_uint8(mbp, 0xff);/* secondary command */ @@ -119,7 +117,6 @@ smbfs_smb_lockandx(struct smbnode *np, i smb_rq_bend(rqp); error = smb_rq_simple(rqp); smb_rq_done(rqp); - free(rqp, M_SMBFSDATA); return error; } @@ -188,19 +185,16 @@ smbfs_smb_statfs(struct smb_share *ssp, u_int16_t units, bpu, bsize, funits; int error; - rqp = malloc(sizeof(struct smb_rq), M_SMBFSDATA, M_WAITOK); - error = smb_rq_init(rqp, SSTOCP(ssp), SMB_COM_QUERY_INFORMATION_DISK, scred); - if (error) { - free(rqp, M_SMBFSDATA); - return error; - } + error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_QUERY_INFORMATION_DISK, + scred, rqp); + if (error) + return (error); smb_rq_wstart(rqp); smb_rq_wend(rqp); smb_rq_bstart(rqp); smb_rq_bend(rqp); error = smb_rq_simple(rqp); if (error) { - free(rqp, M_SMBFSDATA); smb_rq_done(rqp); return error; } @@ -216,7 +210,6 @@ smbfs_smb_statfs(struct smb_share *ssp, sbp-f_files = 0x; /* total file nodes in filesystem */ sbp-f_ffree = 0x; /* free file nodes in fs */ smb_rq_done(rqp); - free(rqp, M_SMBFSDATA); return 0; } @@ -260,12 +253,9 @@ smb_smb_flush(struct smbnode *np, struct if ((np-n_flag NOPEN) == 0 || !SMBTOV(np) || SMBTOV(np)-v_type != VREG) return 0; /* not a regular open file */ - rqp = malloc(sizeof(struct smb_rq), M_SMBFSDATA, M_WAITOK); - error = smb_rq_init(rqp, SSTOCP(ssp), SMB_COM_FLUSH, scred); - if (error) { - free(rqp, M_SMBFSDATA); + error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_FLUSH, scred, rqp); + if (error) return (error); - } smb_rq_getrequest(rqp, mbp); smb_rq_wstart(rqp); mb_put_mem(mbp, (caddr_t)np-n_fid, 2, MB_MSYSTEM); @@ -274,7 +264,6 @@ smb_smb_flush(struct smbnode *np, struct smb_rq_bend(rqp); error = smb_rq_simple(rqp); smb_rq_done(rqp); - free(rqp, M_SMBFSDATA); if (!error) np-n_flag = ~NFLUSHWIRE; return (error); @@ -301,12 +290,9 @@ smbfs_smb_setfsize(struct smbnode *np, i return (0); } - rqp = malloc(sizeof(struct smb_rq), M_SMBFSDATA, M_WAITOK); - error = smb_rq_init(rqp, SSTOCP(ssp), SMB_COM_WRITE, scred); - if (error) { - free(rqp, M_SMBFSDATA); - return error; - } + error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_WRITE, scred, rqp); + if (error) + return (error); smb_rq_getrequest(rqp, mbp); smb_rq_wstart(rqp); mb_put_mem(mbp, (caddr_t)np-n_fid, 2, MB_MSYSTEM); @@ -320,7 +306,6 @@ smbfs_smb_setfsize(struct smbnode *np, i smb_rq_bend(rqp); error = smb_rq_simple(rqp); smb_rq_done(rqp); - free(rqp, M_SMBFSDATA); return error; } @@ -337,12 +322,10 @@ smbfs_smb_query_info(struct smbnode *np, u_int16_t wattr; u_int32_t lint; - rqp = malloc(sizeof(struct smb_rq), M_SMBFSDATA, M_WAITOK); - error = smb_rq_init(rqp, SSTOCP(ssp), SMB_COM_QUERY_INFORMATION, scred); - if (error) { - free(rqp, M_SMBFSDATA); - return error; - } + error = smb_rq_alloc(SSTOCP(ssp), SMB_COM_QUERY_INFORMATION, scred, + rqp); + if (error) + return (error); smb_rq_getrequest(rqp, mbp); smb_rq_wstart(rqp); smb_rq_wend(rqp); @@ -377,7 +360,6 @@ smbfs_smb_query_info(struct smbnode *np, fap-fa_size = lint; }
Re: svn commit: r252356 - in head: contrib/smbfs/mount_smbfs etc/defaults etc/mtree include lib lib/libprocstat rescue/rescue sbin/mount share/examples share/examples/etc share/mk sys/conf sys/kern sy
On Wed, Jul 3, 2013 at 11:28 AM, Ulrich Spörlein u...@freebsd.org wrote: On Fri, 2013-06-28 at 21:00:08 +, Davide Italiano wrote: Author: davide Date: Fri Jun 28 21:00:08 2013 New Revision: 252356 URL: http://svnweb.freebsd.org/changeset/base/252356 Log: - Trim an unused and bogus Makefile for mount_smbfs. - Reconnect with some minor modifications, in particular now selsocket() internals are adapted to use sbintime units after recent'ish calloutng switch. yay, for reconnecting this to the build. Now Coverity Scan is seeing this code and there are dozens of double frees in the form: smb_rq_done(rqp); free(rqp, M_SMBFSDATA); But smb_rq_done() is already calling free(rqp). This seems easy to audit and fix. (sometimes the order is swapped, so it's a USE_AFTER_FREE instead) This is CIDs 1042109 -- 1042126, all in smbfs_smb.c. Thanks for looking into this Uli I've just committed a fix. If there's something I missed don't hesitate to poke me privately. Thanks, -- Davide There are no solved problems; there are only problems that are more or less solved -- Henri Poincare ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r252408 - head/sbin/ifconfig
Ulrich Spörlein u...@freebsd.org wrote in 20130703092307.ga2...@acme.spoerlein.net: uqif ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) 0) { uq - if (errno != EAFNOSUPPORT) uq + if (errno != EAFNOSUPPORT error != EPROTONOSUPPORT) uqwarn(socket(AF_INET6, SOCK_DGRAM)); uqreturn; uq} uq uq This gives undefined behavior, error is uninitialized at this point. uq uq Found by: Coverity Scan, CID 1042128 Gr, fixed just now. Thank you for the report! -- Hiroki pgp7w1rEUQSSz.pgp Description: PGP signature
svn commit: r252561 - head/tools/build/options
Author: zeising (doc,ports committer) Date: Wed Jul 3 12:36:47 2013 New Revision: 252561 URL: http://svnweb.freebsd.org/changeset/base/252561 Log: Document WITHOUT_SVNLITE and WITH_SVN. PR: docs/180025 Submitted by: Garrett Cooper yaneurab...@gmail.com Added: head/tools/build/options/WITHOUT_SVNLITE (contents, props changed) head/tools/build/options/WITH_SVN (contents, props changed) Added: head/tools/build/options/WITHOUT_SVNLITE == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_SVNLITEWed Jul 3 12:36:47 2013 (r252561) @@ -0,0 +1,4 @@ +.\ $FreeBSD$ +Set to not build +.Xr svnlite 1 +and related programs. Added: head/tools/build/options/WITH_SVN == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_SVN Wed Jul 3 12:36:47 2013 (r252561) @@ -0,0 +1,5 @@ +.\ $FreeBSD$ +Set to install +.Xr svnlite 1 +as +.Xr svn 1 . ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: should_yield problem [Was: svn commit: r251322 - head/sys/kern]
on 02/07/2013 21:11 Andriy Gapon said the following: on 02/07/2013 20:59 Ed Maste said the following: What about just initializing td_swvoltick to ticks at td creation? I like this idea. What would be the best place(s) to do the initialization? Or, perhaps, td_swvoltick should be moved to td_startcopy-td_endcopy section? -- Andriy Gapon ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252562 - head/share/man/man5
Author: zeising (doc,ports committer) Date: Wed Jul 3 12:53:06 2013 New Revision: 252562 URL: http://svnweb.freebsd.org/changeset/base/252562 Log: Regenerate after r252561 PR: docs/180025 Submitted by: Garrett Cooper yaneurab...@gmail.com Modified: head/share/man/man5/rc.conf.5 head/share/man/man5/src.conf.5 Modified: head/share/man/man5/rc.conf.5 == --- head/share/man/man5/rc.conf.5 Wed Jul 3 12:36:47 2013 (r252561) +++ head/share/man/man5/rc.conf.5 Wed Jul 3 12:53:06 2013 (r252562) @@ -3449,6 +3449,40 @@ For example, will set the .Xr syscons 4 scrollback (history) buffer to 200 lines. +.It Va auditd_enable +.Pq Vt bool +If set to +.Dq Li YES , +run the +.Xr auditd 8 +daemon at system boot time. +.It Va auditd_program +.Pq Vt str +Path to +.Xr autitd 8 +(default +.Pa /usr/sbin/auditd ) . +.It Va auditd_flags +.Pq Vt str +Flags to pass to +.Xr audtid 8 . +.It Va auditdistd_enable +.Pq Vt bool +If set to +.Dq Li YES , +run the +.Xr auditdistd 8 +daemon at system boot time. +.It Va auditdistd_program +.Pq Vt str +Path to +.Xr auditdistd 8 +(default +.Pa /usr/sbin/auditdistd ) . +.It Va auditdistd_flags +.Pq Vt str +Flags to pass to +.Xr auditdistd 8 . .It Va cron_enable .Pq Vt bool If set to Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Wed Jul 3 12:36:47 2013 (r252561) +++ head/share/man/man5/src.conf.5 Wed Jul 3 12:53:06 2013 (r252562) @@ -1,7 +1,7 @@ .\ DO NOT EDIT-- this file is automatically generated. .\ from FreeBSD: head/tools/build/options/makeman 251685 2013-06-13 13:05:08Z emaste .\ $FreeBSD$ -.Dd June 16, 2013 +.Dd July 3, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1055,6 +1055,17 @@ Set to not build kernel modules that inc .It Va WITHOUT_SSP .\ from FreeBSD: head/tools/build/options/WITHOUT_SSP 180012 2008-06-25 21:33:28Z ru Set to not build world with propolice stack smashing protection. +.It Va WITH_SVN +.\ from FreeBSD: head/tools/build/options/WITH_SVN 252561 2013-07-03 12:36:47Z zeising +Set to install +.Xr svnlite 1 +as +.Xr svn 1 . +.It Va WITHOUT_SVNLITE +.\ from FreeBSD: head/tools/build/options/WITHOUT_SVNLITE 252561 2013-07-03 12:36:47Z zeising +Set to not build +.Xr svnlite 1 +and related programs. .It Va WITHOUT_SYMVER .\ from FreeBSD: head/tools/build/options/WITHOUT_SYMVER 169649 2007-05-17 05:03:24Z deischen Set to disable symbol versioning when building shared libraries. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252563 - stable/9/sys/netinet6
Author: ae Date: Wed Jul 3 12:58:17 2013 New Revision: 252563 URL: http://svnweb.freebsd.org/changeset/base/252563 Log: MFC r251995: Use ICMP6STAT_INC() macro for ICMPv6 errors accounting. Modified: stable/9/sys/netinet6/icmp6.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/icmp6.c == --- stable/9/sys/netinet6/icmp6.c Wed Jul 3 12:53:06 2013 (r252562) +++ stable/9/sys/netinet6/icmp6.c Wed Jul 3 12:58:17 2013 (r252563) @@ -130,7 +130,7 @@ VNET_DECLARE(int, icmp6_nodeinfo); #defineV_icmp6errppslim_last VNET(icmp6errppslim_last) #defineV_icmp6_nodeinfoVNET(icmp6_nodeinfo) -static void icmp6_errcount(struct icmp6errstat *, int, int); +static void icmp6_errcount(int, int); static int icmp6_rip6_input(struct mbuf **, int); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); static const char *icmp6_redirect_diag(struct in6_addr *, @@ -159,59 +159,59 @@ kmod_icmp6stat_inc(int statnum) } static void -icmp6_errcount(struct icmp6errstat *stat, int type, int code) +icmp6_errcount(int type, int code) { switch (type) { case ICMP6_DST_UNREACH: switch (code) { case ICMP6_DST_UNREACH_NOROUTE: - stat-icp6errs_dst_unreach_noroute++; + ICMP6STAT_INC(icp6s_odst_unreach_noroute); return; case ICMP6_DST_UNREACH_ADMIN: - stat-icp6errs_dst_unreach_admin++; + ICMP6STAT_INC(icp6s_odst_unreach_admin); return; case ICMP6_DST_UNREACH_BEYONDSCOPE: - stat-icp6errs_dst_unreach_beyondscope++; + ICMP6STAT_INC(icp6s_odst_unreach_beyondscope); return; case ICMP6_DST_UNREACH_ADDR: - stat-icp6errs_dst_unreach_addr++; + ICMP6STAT_INC(icp6s_odst_unreach_addr); return; case ICMP6_DST_UNREACH_NOPORT: - stat-icp6errs_dst_unreach_noport++; + ICMP6STAT_INC(icp6s_odst_unreach_noport); return; } break; case ICMP6_PACKET_TOO_BIG: - stat-icp6errs_packet_too_big++; + ICMP6STAT_INC(icp6s_opacket_too_big); return; case ICMP6_TIME_EXCEEDED: switch (code) { case ICMP6_TIME_EXCEED_TRANSIT: - stat-icp6errs_time_exceed_transit++; + ICMP6STAT_INC(icp6s_otime_exceed_transit); return; case ICMP6_TIME_EXCEED_REASSEMBLY: - stat-icp6errs_time_exceed_reassembly++; + ICMP6STAT_INC(icp6s_otime_exceed_reassembly); return; } break; case ICMP6_PARAM_PROB: switch (code) { case ICMP6_PARAMPROB_HEADER: - stat-icp6errs_paramprob_header++; + ICMP6STAT_INC(icp6s_oparamprob_header); return; case ICMP6_PARAMPROB_NEXTHEADER: - stat-icp6errs_paramprob_nextheader++; + ICMP6STAT_INC(icp6s_oparamprob_nextheader); return; case ICMP6_PARAMPROB_OPTION: - stat-icp6errs_paramprob_option++; + ICMP6STAT_INC(icp6s_oparamprob_option); return; } break; case ND_REDIRECT: - stat-icp6errs_redirect++; + ICMP6STAT_INC(icp6s_oredirect); return; } - stat-icp6errs_unknown++; + ICMP6STAT_INC(icp6s_ounknown); } /* @@ -262,7 +262,7 @@ icmp6_error(struct mbuf *m, int type, in ICMP6STAT_INC(icp6s_error); /* count per-type-code statistics */ - icmp6_errcount(V_icmp6stat.icp6s_outerrhist, type, code); + icmp6_errcount(type, code); #ifdef M_DECRYPTED /*not openbsd*/ if (m-m_flags M_DECRYPTED) { @@ -2558,7 +2558,7 @@ icmp6_redirect_output(struct mbuf *m0, s struct ifnet *outif = NULL; struct sockaddr_in6 src_sa; - icmp6_errcount(V_icmp6stat.icp6s_outerrhist, ND_REDIRECT, 0); + icmp6_errcount(ND_REDIRECT, 0); /* if we are not router, we don't send icmp6 redirect */ if (!V_ip6_forwarding) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252564 - head/share/man/man5
Author: zeising (doc,ports committer) Date: Wed Jul 3 12:58:53 2013 New Revision: 252564 URL: http://svnweb.freebsd.org/changeset/base/252564 Log: Revert previous revision, local change that accidentally snuck in. Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 == --- head/share/man/man5/rc.conf.5 Wed Jul 3 12:58:17 2013 (r252563) +++ head/share/man/man5/rc.conf.5 Wed Jul 3 12:58:53 2013 (r252564) @@ -3449,40 +3449,6 @@ For example, will set the .Xr syscons 4 scrollback (history) buffer to 200 lines. -.It Va auditd_enable -.Pq Vt bool -If set to -.Dq Li YES , -run the -.Xr auditd 8 -daemon at system boot time. -.It Va auditd_program -.Pq Vt str -Path to -.Xr autitd 8 -(default -.Pa /usr/sbin/auditd ) . -.It Va auditd_flags -.Pq Vt str -Flags to pass to -.Xr audtid 8 . -.It Va auditdistd_enable -.Pq Vt bool -If set to -.Dq Li YES , -run the -.Xr auditdistd 8 -daemon at system boot time. -.It Va auditdistd_program -.Pq Vt str -Path to -.Xr auditdistd 8 -(default -.Pa /usr/sbin/auditdistd ) . -.It Va auditdistd_flags -.Pq Vt str -Flags to pass to -.Xr auditdistd 8 . .It Va cron_enable .Pq Vt bool If set to ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252565 - stable/9/sys/netinet6
Author: ae Date: Wed Jul 3 13:00:35 2013 New Revision: 252565 URL: http://svnweb.freebsd.org/changeset/base/252565 Log: MFC r252007: Use RIP6STAT_INC() macro for raw ip6 statistics accounting. Modified: stable/9/sys/netinet6/raw_ip6.c stable/9/sys/netinet6/raw_ip6.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/raw_ip6.c == --- stable/9/sys/netinet6/raw_ip6.c Wed Jul 3 12:58:53 2013 (r252564) +++ stable/9/sys/netinet6/raw_ip6.c Wed Jul 3 13:00:35 2013 (r252565) @@ -160,7 +160,7 @@ rip6_input(struct mbuf **mp, int *offp, struct mbuf *opts = NULL; struct sockaddr_in6 fromsa; - V_rip6stat.rip6s_ipackets++; + RIP6STAT_INC(rip6s_ipackets); if (faithprefix_p != NULL (*faithprefix_p)(ip6-ip6_dst)) { /* XXX Send icmp6 host/port unreach? */ @@ -199,11 +199,11 @@ rip6_input(struct mbuf **mp, int *offp, } INP_RLOCK(in6p); if (in6p-in6p_cksum != -1) { - V_rip6stat.rip6s_isum++; + RIP6STAT_INC(rip6s_isum); if (in6_cksum(m, proto, *offp, m-m_pkthdr.len - *offp)) { INP_RUNLOCK(in6p); - V_rip6stat.rip6s_badsum++; + RIP6STAT_INC(rip6s_badsum); continue; } } @@ -279,7 +279,7 @@ rip6_input(struct mbuf **mp, int *offp, m_freem(n); if (opts) m_freem(opts); - V_rip6stat.rip6s_fullsock++; + RIP6STAT_INC(rip6s_fullsock); } else sorwakeup(last-inp_socket); opts = NULL; @@ -312,14 +312,14 @@ rip6_input(struct mbuf **mp, int *offp, m_freem(m); if (opts) m_freem(opts); - V_rip6stat.rip6s_fullsock++; + RIP6STAT_INC(rip6s_fullsock); } else sorwakeup(last-inp_socket); INP_RUNLOCK(last); } else { - V_rip6stat.rip6s_nosock++; + RIP6STAT_INC(rip6s_nosock); if (m-m_flags M_MCAST) - V_rip6stat.rip6s_nosockmcast++; + RIP6STAT_INC(rip6s_nosockmcast); if (proto == IPPROTO_NONE) m_freem(m); else { @@ -559,7 +559,7 @@ rip6_output(m, va_alist) icmp6_ifoutstat_inc(oifp, type, code); ICMP6STAT_INC(icp6s_outhist[type]); } else - V_rip6stat.rip6s_opackets++; + RIP6STAT_INC(rip6s_opackets); goto freectl; Modified: stable/9/sys/netinet6/raw_ip6.h == --- stable/9/sys/netinet6/raw_ip6.h Wed Jul 3 12:58:53 2013 (r252564) +++ stable/9/sys/netinet6/raw_ip6.h Wed Jul 3 13:00:35 2013 (r252565) @@ -48,6 +48,8 @@ struct rip6stat { }; #ifdef _KERNEL +#defineRIP6STAT_ADD(name, val) V_rip6stat.name += (val) +#defineRIP6STAT_INC(name) RIP6STAT_ADD(name, 1) VNET_DECLARE(struct rip6stat, rip6stat); #defineV_rip6stat VNET(rip6stat) #endif ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252566 - stable/9/sys/netinet6
Author: ae Date: Wed Jul 3 13:03:09 2013 New Revision: 252566 URL: http://svnweb.freebsd.org/changeset/base/252566 Log: MFC r252009: Use PIM6STAT_INC() and MRT6STAT_INC() macros for IPv6 multicast statistics accounting. Modified: stable/9/sys/netinet6/ip6_mroute.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet6/ip6_mroute.c == --- stable/9/sys/netinet6/ip6_mroute.c Wed Jul 3 13:00:35 2013 (r252565) +++ stable/9/sys/netinet6/ip6_mroute.c Wed Jul 3 13:03:09 2013 (r252566) @@ -162,6 +162,7 @@ SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, mrt6stat, mrt6stat, Multicast Routing Statistics (struct mrt6stat, netinet6/ip6_mroute.h)); +#defineMRT6STAT_INC(name) mrt6stat.name += 1 #define NO_RTE_FOUND 0x1 #define RTE_FOUND 0x2 @@ -251,8 +252,9 @@ static mifi_t reg_mif_num = (mifi_t)-1; static struct pim6stat pim6stat; SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RW, pim6stat, pim6stat, -PIM Statistics (struct pim6stat, netinet6/pim_var.h)); +PIM Statistics (struct pim6stat, netinet6/pim6_var.h)); +#definePIM6STAT_INC(name) pim6stat.name += 1 static VNET_DEFINE(int, pim6); #defineV_pim6 VNET(pim6) @@ -270,7 +272,7 @@ static VNET_DEFINE(int, pim6); #define MF6CFIND(o, g, rt) do { \ struct mf6c *_rt = mf6ctable[MF6CHASH(o,g)]; \ rt = NULL; \ - mrt6stat.mrt6s_mfc_lookups++; \ + MRT6STAT_INC(mrt6s_mfc_lookups); \ while (_rt) { \ if (IN6_ARE_ADDR_EQUAL(_rt-mf6c_origin.sin6_addr, (o)) \ IN6_ARE_ADDR_EQUAL(_rt-mf6c_mcastgrp.sin6_addr, (g)) \ @@ -281,7 +283,7 @@ static VNET_DEFINE(int, pim6); _rt = _rt-mf6c_next; \ } \ if (rt == NULL) { \ - mrt6stat.mrt6s_mfc_misses++; \ + MRT6STAT_INC(mrt6s_mfc_misses); \ } \ } while (/*CONSTCOND*/ 0) @@ -1142,7 +1144,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru GET_TIME(tp); #endif /* UPCALL_TIMING */ - mrt6stat.mrt6s_no_route++; + MRT6STAT_INC(mrt6s_no_route); #ifdef MRT6DEBUG if (V_mrt6debug (DEBUG_FORWARD | DEBUG_MFC)) log(LOG_DEBUG, ip6_mforward: no rte s %s g %s\n, @@ -1269,7 +1271,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru if (socket_send(V_ip6_mrouter, mm, sin6) 0) { log(LOG_WARNING, ip6_mforward: ip6_mrouter socket queue full\n); - mrt6stat.mrt6s_upq_sockfull++; + MRT6STAT_INC(mrt6s_upq_sockfull); free(rte, M_MRTABLE6); m_freem(mb0); free(rt, M_MRTABLE6); @@ -1277,7 +1279,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru return (ENOBUFS); } - mrt6stat.mrt6s_upcalls++; + MRT6STAT_INC(mrt6s_upcalls); /* insert new entry at head of hash chain */ bzero(rt, sizeof(*rt)); @@ -1303,7 +1305,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru for (p = rt-mf6c_stall; *p != NULL; p = (*p)-next) if (++npkts MAX_UPQ6) { - mrt6stat.mrt6s_upq_ovflw++; + MRT6STAT_INC(mrt6s_upq_ovflw); free(rte, M_MRTABLE6); m_freem(mb0); MFC6_UNLOCK(); @@ -1372,7 +1374,7 @@ expire_upcalls(void *unused) free(rte, M_MRTABLE6); rte = n; } while (rte != NULL); - mrt6stat.mrt6s_cache_cleanups++; + MRT6STAT_INC(mrt6s_cache_cleanups); n6expire[i]--; *nptr = mfc-mf6c_next; @@ -1428,7 +1430,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *if ifp-if_index, mifi, mif6table[mifi].m6_ifp-if_index); #endif - mrt6stat.mrt6s_wrong_if++; + MRT6STAT_INC(mrt6s_wrong_if); rt-mf6c_wrong_if++; /* * If we are doing PIM processing, and we are forwarding @@ -1501,14 +1503,14 @@ ip6_mdq(struct mbuf *m, struct ifnet *if break; } - mrt6stat.mrt6s_upcalls++; + MRT6STAT_INC(mrt6s_upcalls); if
svn commit: r252567 - svnadmin/conf
Author: adrian Date: Wed Jul 3 13:16:58 2013 New Revision: 252567 URL: http://svnweb.freebsd.org/changeset/base/252567 Log: Add loos into the committers list, mentored by yours truely. Approved by: core (implicit) Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access == --- svnadmin/conf/accessWed Jul 3 13:03:09 2013(r252566) +++ svnadmin/conf/accessWed Jul 3 13:16:58 2013(r252567) @@ -130,6 +130,7 @@ kevlo kib kientzle kuriyama +loos lstewart luigi marcel Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Wed Jul 3 13:03:09 2013(r252566) +++ svnadmin/conf/mentors Wed Jul 3 13:16:58 2013(r252567) @@ -23,6 +23,7 @@ jceel wkoszek Co-mentor: cognet jinmei gnn jonathan rwatson jwdrmacklem +loos adrian miwi rwatson monthadar adrian peterj jhb Co-mentor: grog ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252569 - head/sys/cam/ctl
Author: mav Date: Wed Jul 3 14:58:11 2013 New Revision: 252569 URL: http://svnweb.freebsd.org/changeset/base/252569 Log: Fix NULL-deference kernel panic on attempt of destroying non-existing ramdisk-backed CTL LUN. Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c == --- head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Jul 3 13:57:36 2013 (r252568) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Jul 3 14:58:11 2013 (r252569) @@ -441,6 +441,9 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram snprintf(req-error_str, sizeof(req-error_str), %s: error %d returned from ctl_invalidate_lun() for LUN %d, __func__, retval, params-lun_id); + mtx_lock(softc-lock); + be_lun-flags = ~CTL_BE_RAMDISK_LUN_WAITING; + mtx_unlock(softc-lock); goto bailout_error; } @@ -475,14 +478,6 @@ ctl_backend_ramdisk_rm(struct ctl_be_ram return (retval); bailout_error: - - /* -* Don't leave the waiting flag set. -*/ - mtx_lock(softc-lock); - be_lun-flags = ~CTL_BE_RAMDISK_LUN_WAITING; - mtx_unlock(softc-lock); - req-status = CTL_LUN_ERROR; return (0); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252577 - head/sys/netinet
Author: np Date: Wed Jul 3 17:27:32 2013 New Revision: 252577 URL: http://svnweb.freebsd.org/changeset/base/252577 Log: Catch up with r238990. LLE_DELETED does not clobber everything else in la_flags since said revision. Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c == --- head/sys/netinet/if_ether.c Wed Jul 3 17:26:05 2013(r252576) +++ head/sys/netinet/if_ether.c Wed Jul 3 17:27:32 2013(r252577) @@ -174,7 +174,7 @@ arptimer(void *arg) ifp = lle-lle_tbl-llt_ifp; CURVNET_SET(ifp-if_vnet); - if (lle-la_flags != LLE_DELETED) { + if ((lle-la_flags LLE_DELETED) == 0) { int evt; if (lle-la_flags LLE_VALID) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r250953 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
This creates another panic on module unload when WITNESS is enabled, because the module exits while holding the fasttrap_cleanup_mtx. This patch fixes the problem. I'm not sure if the mtx_destroy() is necessary, but I would feel dirty to leave it out. Does this patch look good to you? Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c === --- sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c (revision 252490) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c (working copy) @@ -2434,6 +2434,7 @@ wakeup(fasttrap_cleanup_cv); mtx_sleep(fasttrap_cleanup_drain, fasttrap_cleanup_mtx, 0, ftcld, 0); + mtx_unlock(fasttrap_cleanup_mtx); fasttrap_cleanup_proc = NULL; #ifdef DEBUG @@ -2473,6 +2474,7 @@ #if !defined(sun) destroy_dev(fasttrap_cdev); mutex_destroy(fasttrap_count_mtx); + mtx_destroy(fasttrap_cleanup_mtx); CPU_FOREACH(i) { mutex_destroy(fasttrap_cpuc_pid_lock[i]); } On Thu, May 23, 2013 at 9:29 PM, Mark Johnston ma...@freebsd.org wrote: Author: markj Date: Fri May 24 03:29:32 2013 New Revision: 250953 URL: http://svnweb.freebsd.org/changeset/base/250953 Log: The fasttrap provider cleans up probes asynchronously when a process with USDT probes exits. This was previously done with a callout; however, it is possible to sleep while holding the DTrace mutexes, so a panic will occur on INVARIANTS kernels if the callout handler can't immediately acquire one of these mutexes. This panic will be frequently triggered on systems where a USDT-enabled program (perl, for instance) is often run. This revision changes the fasttrap cleanup mechanism so that a dedicated thread is used instead of a callout. The old behaviour is otherwise preserved. Reviewed by: rpaulo MFC after:1 month Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri May 24 02:18:37 2013(r250952) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Fri May 24 03:29:32 2013(r250953) @@ -155,9 +155,9 @@ static struct cdevsw fasttrap_cdevsw = { static struct cdev *fasttrap_cdev; static dtrace_meta_provider_id_t fasttrap_meta_id; -static struct callout fasttrap_timeout; +static struct proc *fasttrap_cleanup_proc; static struct mtx fasttrap_cleanup_mtx; -static uint_t fasttrap_cleanup_work; +static uint_t fasttrap_cleanup_work, fasttrap_cleanup_drain, fasttrap_cleanup_cv; /* * Generation count on modifications to the global tracepoint lookup table. @@ -310,8 +310,11 @@ fasttrap_mod_barrier(uint64_t gen) } /* - * This is the timeout's callback for cleaning up the providers and their - * probes. + * This function performs asynchronous cleanup of fasttrap providers. The + * Solaris implementation of this mechanism use a timeout that's activated in + * fasttrap_pid_cleanup(), but this doesn't work in FreeBSD: one may sleep while + * holding the DTrace mutexes, but it is unsafe to sleep in a callout handler. + * Thus we use a dedicated process to perform the cleanup when requested. */ /*ARGSUSED*/ static void @@ -322,11 +325,8 @@ fasttrap_pid_cleanup_cb(void *data) dtrace_provider_id_t provid; int i, later = 0, rval; - static volatile int in = 0; - ASSERT(in == 0); - in = 1; - - while (fasttrap_cleanup_work) { + mtx_lock(fasttrap_cleanup_mtx); + while (!fasttrap_cleanup_drain || later 0) { fasttrap_cleanup_work = 0; mtx_unlock(fasttrap_cleanup_mtx); @@ -397,39 +397,32 @@ fasttrap_pid_cleanup_cb(void *data) } mutex_exit(bucket-ftb_mtx); } - mtx_lock(fasttrap_cleanup_mtx); - } -#if 0 - ASSERT(fasttrap_timeout != 0); -#endif + /* +* If we were unable to retire a provider, try again after a +* second. This situation can occur in certain circumstances +* where providers cannot be unregistered even though they have +* no probes enabled because of an execution of dtrace -l or +* something similar. +*/ + if (later 0 || fasttrap_cleanup_work || + fasttrap_cleanup_drain) { + mtx_unlock(fasttrap_cleanup_mtx); + pause(ftclean, hz); + mtx_lock(fasttrap_cleanup_mtx); + } else + mtx_sleep(fasttrap_cleanup_cv, fasttrap_cleanup_mtx, +
svn commit: r252576 - head/sys/dev/acpica
Author: jhb Date: Wed Jul 3 17:26:05 2013 New Revision: 252576 URL: http://svnweb.freebsd.org/changeset/base/252576 Log: Don't perform the acpi_DeviceIsPresent() check for PCI-PCI bridges. If we are probing a PCI-PCI bridge it is because we found one by enumerating the devices on a PCI bus, so the bridge is definitely present. A few BIOSes report incorrect status (_STA) for some bridges that claimed they were not present when in fact they were. While here, move this check earlier for Host-PCI bridges so attach fails before doing any work that needs to be torn down. PR: kern/91594 Tested by:Jack Vogel @ Intel MFC after:1 week Modified: head/sys/dev/acpica/acpi_pcib.c head/sys/dev/acpica/acpi_pcib_acpi.c Modified: head/sys/dev/acpica/acpi_pcib.c == --- head/sys/dev/acpica/acpi_pcib.c Wed Jul 3 17:23:51 2013 (r252575) +++ head/sys/dev/acpica/acpi_pcib.c Wed Jul 3 17:26:05 2013 (r252576) @@ -135,15 +135,6 @@ acpi_pcib_attach(device_t dev, ACPI_BUFF ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); /* - * Don't attach if we're not really there. - * - * XXX: This isn't entirely correct since we may be a PCI bus - * on a hot-plug docking station, etc. - */ -if (!acpi_DeviceIsPresent(dev)) - return_VALUE(ENXIO); - -/* * Get the PCI interrupt routing table for this bus. If we can't * get it, this is not an error but may reduce functionality. There * are several valid bridges in the field that do not have a _PRT, so Modified: head/sys/dev/acpica/acpi_pcib_acpi.c == --- head/sys/dev/acpica/acpi_pcib_acpi.cWed Jul 3 17:23:51 2013 (r252575) +++ head/sys/dev/acpica/acpi_pcib_acpi.cWed Jul 3 17:26:05 2013 (r252576) @@ -287,6 +287,12 @@ acpi_pcib_acpi_attach(device_t dev) sc-ap_handle = acpi_get_handle(dev); /* + * Don't attach if we're not really there. + */ +if (!acpi_DeviceIsPresent(dev)) + return (ENXIO); + +/* * Get our segment number by evaluating _SEG. * It's OK for this to not exist. */ @@ -353,7 +359,7 @@ acpi_pcib_acpi_attach(device_t dev) if (status != AE_NOT_FOUND) { device_printf(dev, could not evaluate _BBN - %s\n, AcpiFormatException(status)); - return_VALUE (ENXIO); + return (ENXIO); } else { /* If it's not found, assume 0. */ sc-ap_bus = 0; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r250953 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
On Wed, Jul 3, 2013 at 1:28 PM, Alan Somers asom...@freebsd.org wrote: This creates another panic on module unload when WITNESS is enabled, because the module exits while holding the fasttrap_cleanup_mtx. This patch fixes the problem. I'm not sure if the mtx_destroy() is necessary, but I would feel dirty to leave it out. Does this patch look good to you? Hi Alan, Sorry about that - I noticed this mistake recently and fixed it in r252493: http://svnweb.freebsd.org/base?view=revisionrevision=252493 DTrace module unloading is now working properly for me with WITNESS enabled. Thanks, -Mark Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c === --- sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c (revision 252490) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c (working copy) @@ -2434,6 +2434,7 @@ wakeup(fasttrap_cleanup_cv); mtx_sleep(fasttrap_cleanup_drain, fasttrap_cleanup_mtx, 0, ftcld, 0); + mtx_unlock(fasttrap_cleanup_mtx); fasttrap_cleanup_proc = NULL; #ifdef DEBUG @@ -2473,6 +2474,7 @@ #if !defined(sun) destroy_dev(fasttrap_cdev); mutex_destroy(fasttrap_count_mtx); + mtx_destroy(fasttrap_cleanup_mtx); CPU_FOREACH(i) { mutex_destroy(fasttrap_cpuc_pid_lock[i]); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r250953 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Great timing. I think that's only a few hours more recent than my latest src checkout. On Wed, Jul 3, 2013 at 11:35 AM, Mark Johnston ma...@freebsd.org wrote: On Wed, Jul 3, 2013 at 1:28 PM, Alan Somers asom...@freebsd.org wrote: This creates another panic on module unload when WITNESS is enabled, because the module exits while holding the fasttrap_cleanup_mtx. This patch fixes the problem. I'm not sure if the mtx_destroy() is necessary, but I would feel dirty to leave it out. Does this patch look good to you? Hi Alan, Sorry about that - I noticed this mistake recently and fixed it in r252493: http://svnweb.freebsd.org/base?view=revisionrevision=252493 DTrace module unloading is now working properly for me with WITNESS enabled. Thanks, -Mark Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c === --- sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c (revision 252490) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c (working copy) @@ -2434,6 +2434,7 @@ wakeup(fasttrap_cleanup_cv); mtx_sleep(fasttrap_cleanup_drain, fasttrap_cleanup_mtx, 0, ftcld, 0); + mtx_unlock(fasttrap_cleanup_mtx); fasttrap_cleanup_proc = NULL; #ifdef DEBUG @@ -2473,6 +2474,7 @@ #if !defined(sun) destroy_dev(fasttrap_cdev); mutex_destroy(fasttrap_count_mtx); + mtx_destroy(fasttrap_cleanup_mtx); CPU_FOREACH(i) { mutex_destroy(fasttrap_cpuc_pid_lock[i]); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252580 - head/sys/dev/qlxgbe
Author: davidcs Date: Wed Jul 3 17:57:35 2013 New Revision: 252580 URL: http://svnweb.freebsd.org/changeset/base/252580 Log: Port 0 needs to wait for ACK only if it issued the RESET. Modified: head/sys/dev/qlxgbe/ql_os.c Modified: head/sys/dev/qlxgbe/ql_os.c == --- head/sys/dev/qlxgbe/ql_os.c Wed Jul 3 17:47:48 2013(r252579) +++ head/sys/dev/qlxgbe/ql_os.c Wed Jul 3 17:57:35 2013(r252580) @@ -1646,11 +1646,13 @@ qla_error_recovery(void *context, int pe if ((ha-pci_func 0x1) == 0) { - if (!ha-msg_from_peer) + if (!ha-msg_from_peer) { qla_send_msg_to_peer(ha, QL_PEER_MSG_RESET); - while ((ha-msg_from_peer != QL_PEER_MSG_ACK) msecs_100--) - qla_mdelay(__func__, 100); + while ((ha-msg_from_peer != QL_PEER_MSG_ACK) + msecs_100--) + qla_mdelay(__func__, 100); + } ha-msg_from_peer = 0; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252581 - svnadmin/conf
Author: gavin Date: Wed Jul 3 18:04:46 2013 New Revision: 252581 URL: http://svnweb.freebsd.org/changeset/base/252581 Log: Remove jinmei, as he handed his commit bit back for safekeeping. This should have been committed as part of r252465. Approved by: core Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Wed Jul 3 17:57:35 2013(r252580) +++ svnadmin/conf/mentors Wed Jul 3 18:04:46 2013(r252581) @@ -20,7 +20,6 @@ erwin delphij gjbkib hiren sbruno jceel wkoszek Co-mentor: cognet -jinmei gnn jonathan rwatson jwdrmacklem loos adrian ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252582 - in head/usr.bin: mkcsmapper mkesdb
Author: peter Date: Wed Jul 3 18:25:27 2013 New Revision: 252582 URL: http://svnweb.freebsd.org/changeset/base/252582 Log: Attempt to deal with a compile failure that shows up with gcc, which has -Werror on. Without this, yylex() is inconsistently or redundantly defined. Modified: head/usr.bin/mkcsmapper/lex.l head/usr.bin/mkesdb/lex.l Modified: head/usr.bin/mkcsmapper/lex.l == --- head/usr.bin/mkcsmapper/lex.l Wed Jul 3 18:04:46 2013 (r252581) +++ head/usr.bin/mkcsmapper/lex.l Wed Jul 3 18:25:27 2013 (r252582) @@ -41,6 +41,8 @@ #include ldef.h #include yacc.h +#define YY_DECL int yylex(void) + int linenumber = 1; %} %optionnoinput Modified: head/usr.bin/mkesdb/lex.l == --- head/usr.bin/mkesdb/lex.l Wed Jul 3 18:04:46 2013(r252581) +++ head/usr.bin/mkesdb/lex.l Wed Jul 3 18:25:27 2013(r252582) @@ -43,6 +43,8 @@ #include ldef.h #include yacc.h +#define YY_DECL int yylex(void) + int linenumber = 1; %} %optionnoinput ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252583 - in head: lib/libc/iconv lib/libiconv_modules/BIG5 lib/libiconv_modules/DECHanyu lib/libiconv_modules/EUC lib/libiconv_modules/EUCTW lib/libiconv_modules/GBK2K lib/libiconv_mod...
Author: peter Date: Wed Jul 3 18:27:45 2013 New Revision: 252583 URL: http://svnweb.freebsd.org/changeset/base/252583 Log: As a followup to r252547, propate const down the call stack. Modified: head/lib/libc/iconv/citrus_none.c head/lib/libc/iconv/citrus_stdenc.h head/lib/libc/iconv/citrus_stdenc_local.h head/lib/libc/iconv/citrus_stdenc_template.h head/lib/libiconv_modules/BIG5/citrus_big5.c head/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c head/lib/libiconv_modules/EUC/citrus_euc.c head/lib/libiconv_modules/EUCTW/citrus_euctw.c head/lib/libiconv_modules/GBK2K/citrus_gbk2k.c head/lib/libiconv_modules/HZ/citrus_hz.c head/lib/libiconv_modules/ISO2022/citrus_iso2022.c head/lib/libiconv_modules/JOHAB/citrus_johab.c head/lib/libiconv_modules/MSKanji/citrus_mskanji.c head/lib/libiconv_modules/UES/citrus_ues.c head/lib/libiconv_modules/UTF1632/citrus_utf1632.c head/lib/libiconv_modules/UTF7/citrus_utf7.c head/lib/libiconv_modules/UTF8/citrus_utf8.c head/lib/libiconv_modules/VIQR/citrus_viqr.c head/lib/libiconv_modules/ZW/citrus_zw.c head/lib/libiconv_modules/iconv_none/citrus_iconv_none.c head/lib/libiconv_modules/iconv_std/citrus_iconv_std.c head/usr.bin/iconv/iconv.c Modified: head/lib/libc/iconv/citrus_none.c == --- head/lib/libc/iconv/citrus_none.c Wed Jul 3 18:25:27 2013 (r252582) +++ head/lib/libc/iconv/citrus_none.c Wed Jul 3 18:27:45 2013 (r252583) @@ -83,7 +83,7 @@ _citrus_NONE_stdenc_init_state(struct _c static int _citrus_NONE_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce __unused, -_csid_t *csid, _index_t *idx, char **s, size_t n, +_csid_t *csid, _index_t *idx, const char **s, size_t n, void *ps __unused, size_t *nresult, struct iconv_hooks *hooks) { @@ -159,7 +159,7 @@ _citrus_NONE_stdenc_cstomb(struct _citru static int _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused, -_wc_t * __restrict pwc, char ** __restrict s, size_t n, +_wc_t * __restrict pwc, const char ** __restrict s, size_t n, void * __restrict pspriv __unused, size_t * __restrict nresult, struct iconv_hooks *hooks) { Modified: head/lib/libc/iconv/citrus_stdenc.h == --- head/lib/libc/iconv/citrus_stdenc.h Wed Jul 3 18:25:27 2013 (r252582) +++ head/lib/libc/iconv/citrus_stdenc.h Wed Jul 3 18:27:45 2013 (r252583) @@ -69,7 +69,7 @@ _citrus_stdenc_init_state(struct _citrus static __inline int _citrus_stdenc_mbtocs(struct _citrus_stdenc * __restrict ce, _citrus_csid_t * __restrict csid, _citrus_index_t * __restrict idx, -char ** __restrict s, size_t n, void * __restrict ps, +const char ** __restrict s, size_t n, void * __restrict ps, size_t * __restrict nresult, struct iconv_hooks *hooks) { Modified: head/lib/libc/iconv/citrus_stdenc_local.h == --- head/lib/libc/iconv/citrus_stdenc_local.h Wed Jul 3 18:25:27 2013 (r252582) +++ head/lib/libc/iconv/citrus_stdenc_local.h Wed Jul 3 18:27:45 2013 (r252583) @@ -55,7 +55,7 @@ static int _citrus_##_e_##_stdenc_mbtoc (struct _citrus_stdenc * __restrict,\ _citrus_csid_t * __restrict,\ _citrus_index_t * __restrict, \ - char ** __restrict, size_t, \ + const char ** __restrict, size_t, \ void * __restrict, size_t * __restrict, \ struct iconv_hooks *); \ static int _citrus_##_e_##_stdenc_cstomb \ @@ -66,7 +66,7 @@ static int _citrus_##_e_##_stdenc_cstom static int _citrus_##_e_##_stdenc_mbtowc \ (struct _citrus_stdenc * __restrict,\ _citrus_wc_t * __restrict, \ - char ** __restrict, size_t, \ + const char ** __restrict, size_t, \ void * __restrict, size_t * __restrict, \ struct iconv_hooks *); \ static int _citrus_##_e_##_stdenc_wctomb \ @@ -106,7 +106,7 @@ typedef int (*_citrus_stdenc_init_state_ typedef int (*_citrus_stdenc_mbtocs_t) (struct _citrus_stdenc * __restrict, _citrus_csid_t * __restrict, _citrus_index_t * __restrict, -char ** __restrict, size_t, +const char ** __restrict, size_t, void * __restrict, size_t * __restrict, struct iconv_hooks *); typedef int (*_citrus_stdenc_cstomb_t) @@ -116,7 +116,7 @@ typedef int
svn commit: r252584 - head/lib/libc/iconv
Author: peter Date: Wed Jul 3 18:35:21 2013 New Revision: 252584 URL: http://svnweb.freebsd.org/changeset/base/252584 Log: Make it clear that there are three separate internal locks. Modified: head/lib/libc/iconv/citrus_csmapper.c head/lib/libc/iconv/citrus_iconv.c head/lib/libc/iconv/citrus_lock.h head/lib/libc/iconv/citrus_mapper.c Modified: head/lib/libc/iconv/citrus_csmapper.c == --- head/lib/libc/iconv/citrus_csmapper.c Wed Jul 3 18:27:45 2013 (r252583) +++ head/lib/libc/iconv/citrus_csmapper.c Wed Jul 3 18:35:21 2013 (r252584) @@ -58,6 +58,8 @@ static struct _citrus_mapper_area *maparea = NULL; +static pthread_rwlock_tma_lock = PTHREAD_RWLOCK_INITIALIZER; + #define CS_ALIAS _PATH_CSMAPPER /charset.alias #define CS_PIVOT _PATH_CSMAPPER /charset.pivot @@ -314,7 +316,7 @@ get_none(struct _citrus_mapper_area *__r { int ret; - WLOCK; + WLOCK(ma_lock); if (csm_none) { *rcsm = csm_none; ret = 0; @@ -329,7 +331,7 @@ get_none(struct _citrus_mapper_area *__r *rcsm = csm_none; ret = 0; quit: - UNLOCK; + UNLOCK(ma_lock); return (ret); } Modified: head/lib/libc/iconv/citrus_iconv.c == --- head/lib/libc/iconv/citrus_iconv.c Wed Jul 3 18:27:45 2013 (r252583) +++ head/lib/libc/iconv/citrus_iconv.c Wed Jul 3 18:35:21 2013 (r252584) @@ -68,11 +68,13 @@ static int shared_max_reuse, shared_n static _CITRUS_HASH_HEAD(, _citrus_iconv_shared, CI_HASH_SIZE) shared_pool; static TAILQ_HEAD(, _citrus_iconv_shared) shared_unused; +static pthread_rwlock_t ci_lock = PTHREAD_RWLOCK_INITIALIZER; + static __inline void init_cache(void) { - WLOCK; + WLOCK(ci_lock); if (!isinit) { _CITRUS_HASH_INIT(shared_pool, CI_HASH_SIZE); TAILQ_INIT(shared_unused); @@ -83,7 +85,7 @@ init_cache(void) shared_max_reuse = CI_INITIAL_MAX_REUSE; isinit = true; } - UNLOCK; + UNLOCK(ci_lock); } static __inline void @@ -195,7 +197,7 @@ get_shared(struct _citrus_iconv_shared * snprintf(convname, sizeof(convname), %s/%s, src, dst); - WLOCK; + WLOCK(ci_lock); /* lookup alread existing entry */ hashval = hash_func(convname); @@ -222,7 +224,7 @@ get_shared(struct _citrus_iconv_shared * *rci = ci; quit: - UNLOCK; + UNLOCK(ci_lock); return (ret); } @@ -231,7 +233,7 @@ static void release_shared(struct _citrus_iconv_shared * __restrict ci) { - WLOCK; + WLOCK(ci_lock); ci-ci_used_count--; if (ci-ci_used_count == 0) { /* put it into unused list */ @@ -247,7 +249,7 @@ release_shared(struct _citrus_iconv_shar } } - UNLOCK; + UNLOCK(ci_lock); } /* Modified: head/lib/libc/iconv/citrus_lock.h == --- head/lib/libc/iconv/citrus_lock.h Wed Jul 3 18:27:45 2013 (r252583) +++ head/lib/libc/iconv/citrus_lock.h Wed Jul 3 18:35:21 2013 (r252584) @@ -27,10 +27,7 @@ #include pthread.h -/* XXX Yes, the original code has three separate file-local lock instances */ -static pthread_rwlock_tlock = PTHREAD_RWLOCK_INITIALIZER; - -#define WLOCK if (__isthreaded) \ - pthread_rwlock_wrlock(lock); -#define UNLOCK if (__isthreaded) \ - pthread_rwlock_unlock(lock); +#define WLOCK(lock)if (__isthreaded) \ + pthread_rwlock_wrlock(lock); +#define UNLOCK(lock) if (__isthreaded) \ + pthread_rwlock_unlock(lock); Modified: head/lib/libc/iconv/citrus_mapper.c == --- head/lib/libc/iconv/citrus_mapper.c Wed Jul 3 18:27:45 2013 (r252583) +++ head/lib/libc/iconv/citrus_mapper.c Wed Jul 3 18:35:21 2013 (r252584) @@ -55,6 +55,8 @@ #define CM_HASH_SIZE 101 #define REFCOUNT_PERSISTENT-1 +static pthread_rwlock_tcm_lock = PTHREAD_RWLOCK_INITIALIZER; + struct _citrus_mapper_area { _CITRUS_HASH_HEAD(, _citrus_mapper, CM_HASH_SIZE)ma_cache; char*ma_dir; @@ -75,7 +77,7 @@ _citrus_mapper_create_area( char path[PATH_MAX]; int ret; - WLOCK; + WLOCK(cm_lock); if (*rma != NULL) { ret = 0; @@ -104,7 +106,7 @@ _citrus_mapper_create_area( *rma = ma; ret = 0; quit: - UNLOCK; + UNLOCK(cm_lock);
svn commit: r252585 - head/sys/netinet
Author: tuexen Date: Wed Jul 3 18:48:43 2013 New Revision: 252585 URL: http://svnweb.freebsd.org/changeset/base/252585 Log: Code cleanups. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Wed Jul 3 18:35:21 2013 (r252584) +++ head/sys/netinet/sctp_indata.c Wed Jul 3 18:48:43 2013 (r252585) @@ -1729,7 +1729,6 @@ sctp_process_a_data_chunk(struct sctp_tc sctp_alloc_a_readq(stcb, control); sctp_build_readq_entry_mac(control, stcb, asoc-context, net, tsn, protocol_id, - stcb-asoc.context, strmno, strmseq, chunk_flags, dmbuf); @@ -1857,7 +1856,6 @@ failed_pdapi_express_del: sctp_alloc_a_readq(stcb, control); sctp_build_readq_entry_mac(control, stcb, asoc-context, net, tsn, protocol_id, - stcb-asoc.context, strmno, strmseq, chunk_flags, dmbuf); Modified: head/sys/netinet/sctp_indata.h == --- head/sys/netinet/sctp_indata.h Wed Jul 3 18:35:21 2013 (r252584) +++ head/sys/netinet/sctp_indata.h Wed Jul 3 18:48:43 2013 (r252585) @@ -47,14 +47,14 @@ sctp_build_readq_entry(struct sctp_tcb * struct mbuf *dm); -#define sctp_build_readq_entry_mac(_ctl, in_it, a, net, tsn, ppid, context, stream_no, stream_seq, flags, dm) do { \ +#define sctp_build_readq_entry_mac(_ctl, in_it, context, net, tsn, ppid, stream_no, stream_seq, flags, dm) do { \ if (_ctl) { \ atomic_add_int(((net)-ref_count), 1); \ (_ctl)-sinfo_stream = stream_no; \ (_ctl)-sinfo_ssn = stream_seq; \ (_ctl)-sinfo_flags = (flags 8); \ (_ctl)-sinfo_ppid = ppid; \ - (_ctl)-sinfo_context = a; \ + (_ctl)-sinfo_context = context; \ (_ctl)-sinfo_timetolive = 0; \ (_ctl)-sinfo_tsn = tsn; \ (_ctl)-sinfo_cumtsn = tsn; \ Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Wed Jul 3 18:35:21 2013 (r252584) +++ head/sys/netinet/sctp_input.c Wed Jul 3 18:48:43 2013 (r252585) @@ -1028,12 +1028,13 @@ sctp_handle_shutdown_ack(struct sctp_shu SCTP_SOCKET_UNLOCK(so, 1); #endif } - /* are the queues empty? */ +#ifdef INVARIANTS if (!TAILQ_EMPTY(asoc-send_queue) || !TAILQ_EMPTY(asoc-sent_queue) || !stcb-asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) { - sctp_report_all_outbound(stcb, 0, 0, SCTP_SO_NOT_LOCKED); + panic(Queues are not empty when handling SHUTDOWN-ACK); } +#endif /* stop the timer */ sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb-sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_9); /* send SHUTDOWN-COMPLETE */ @@ -1875,9 +1876,14 @@ sctp_process_cookie_existing(struct mbuf cookie-tie_tag_peer_vtag != 0) { struct sctpasochead *head; +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + struct socket *so; + +#endif + if (asoc-peer_supports_nat) { /* -* This is a gross gross hack. just call the +* This is a gross gross hack. Just call the * cookie_new code since we are allowing a duplicate * association. I hope this works... */ @@ -1939,6 +1945,10 @@ sctp_process_cookie_existing(struct mbuf asoc-mapping_array_size); } SCTP_TCB_UNLOCK(stcb); +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + so = SCTP_INP_SO(stcb-sctp_ep); + SCTP_SOCKET_LOCK(so, 1); +#endif SCTP_INP_INFO_WLOCK(); SCTP_INP_WLOCK(stcb-sctp_ep); SCTP_TCB_LOCK(stcb); @@ -1946,7 +1956,7 @@ sctp_process_cookie_existing(struct mbuf /* send up all the data */ SCTP_TCB_SEND_LOCK(stcb); - sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_NOT_LOCKED); + sctp_report_all_outbound(stcb, 0, 1, SCTP_SO_LOCKED); for (i = 0; i stcb-asoc.streamoutcnt; i++) { stcb-asoc.strmout[i].chunks_on_queues = 0; stcb-asoc.strmout[i].stream_no = i; @@ -1968,11 +1978,15 @@
svn commit: r252586 - head/sys/boot/i386/gptboot
Author: wblock (doc committer) Date: Wed Jul 3 18:53:36 2013 New Revision: 252586 URL: http://svnweb.freebsd.org/changeset/base/252586 Log: Add descriptions to the FILES list, fix some mdoc complaints, move the neither entry out of the table in BOOTING. Submitted by: joeld Reviewed by: joeld MFC after:1 week Modified: head/sys/boot/i386/gptboot/gptboot.8 Modified: head/sys/boot/i386/gptboot/gptboot.8 == --- head/sys/boot/i386/gptboot/gptboot.8Wed Jul 3 18:48:43 2013 (r252585) +++ head/sys/boot/i386/gptboot/gptboot.8Wed Jul 3 18:53:36 2013 (r252586) @@ -24,7 +24,7 @@ .\ .\ $FreeBSD$ .\ -.Dd July 1, 2013 +.Dd July 3, 2013 .Dt GPTBOOT 8 .Os .Sh NAME @@ -147,7 +147,8 @@ Middle priority: booting is attempted fr partitions with the .Cm bootme attribute. -.It neither +.El +.Pp If neither .Cm bootonce nor @@ -156,7 +157,6 @@ attributes are found on any partitions, first .Cm freebsd-ufs partition on the disk. -.El .Sh POST-BOOT ACTIONS The startup script .Pa /etc/rc.d/gptboot @@ -181,9 +181,12 @@ The attribute is cleared from the partition that successfully booted. There is normally only one of these. .Sh FILES -.Bl -tag -width /boot/loader -compact +.Bl -tag -width /boot/gptboot -compact .It Pa /boot/gptboot +bootcode binary .It Pa /boot.config +parameters for the boot blocks +.Pq optional .El .Sh EXAMPLES .Nm @@ -223,7 +226,6 @@ attribute: .Bd -literal -offset indent gpart set -a bootonce -i 2 ada0 .Ed -.Pp .Sh SEE ALSO .Xr boot.config 5 , .Xr rc.conf 5 , ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252587 - head/contrib/llvm/tools/clang/lib/Sema
Author: dim Date: Wed Jul 3 19:08:10 2013 New Revision: 252587 URL: http://svnweb.freebsd.org/changeset/base/252587 Log: Pull in r185446 from clang trunk: Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout. Reported by: glebius Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp == --- head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp Wed Jul 3 18:53:36 2013(r252586) +++ head/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp Wed Jul 3 19:08:10 2013(r252587) @@ -10296,7 +10296,8 @@ void Sema::ActOnTagFinishDefinition(Scop Tag-setTopLevelDeclInObjCContainer(); // Notify the consumer that we've defined a tag. - Consumer.HandleTagDeclDefinition(Tag); + if (!Tag-isInvalidDecl()) +Consumer.HandleTagDeclDefinition(Tag); } void Sema::ActOnObjCContainerFinishDefinition() { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252588 - stable/9
Author: obrien Date: Wed Jul 3 19:12:35 2013 New Revision: 252588 URL: http://svnweb.freebsd.org/changeset/base/252588 Log: MFC: r238051: Add hier as an alternate spelling of hierarchy to match hier(9). Modified: stable/9/Makefile (contents, props changed) stable/9/Makefile.inc1 (contents, props changed) Directory Properties: stable/9/ (props changed) Modified: stable/9/Makefile == --- stable/9/Makefile Wed Jul 3 19:08:10 2013(r252587) +++ stable/9/Makefile Wed Jul 3 19:12:35 2013(r252588) @@ -91,7 +91,7 @@ TGTS= all all-man buildenv buildenvvars delete-old delete-old-dirs delete-old-files delete-old-libs \ depend distribute distributekernel distributekernel.debug \ distributeworld distrib-dirs distribution doxygen \ - everything hierarchy install installcheck installkernel \ + everything hier hierarchy install installcheck installkernel \ installkernel.debug packagekernel packageworld \ reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries lint maninstall \ Modified: stable/9/Makefile.inc1 == --- stable/9/Makefile.inc1 Wed Jul 3 19:08:10 2013(r252587) +++ stable/9/Makefile.inc1 Wed Jul 3 19:12:35 2013(r252588) @@ -1272,7 +1272,7 @@ cross-tools: # # hierarchy - ensure that all the needed directories are present # -hierarchy: +hierarchy hier: .if defined(NO_ROOT) cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \ -DNO_ROOT METALOG=${METALOG} distrib-dirs ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252590 - vendor/v4l/dist
Author: netchild Date: Wed Jul 3 19:56:39 2013 New Revision: 252590 URL: http://svnweb.freebsd.org/changeset/base/252590 Log: Update videodev2.h to the version from linux kernel 2.6.34.14. This version is dual-licensed: 3 clause BSD license and GPL v2+. Modified: vendor/v4l/dist/videodev2.h Modified: vendor/v4l/dist/videodev2.h == --- vendor/v4l/dist/videodev2.h Wed Jul 3 19:55:24 2013(r252589) +++ vendor/v4l/dist/videodev2.h Wed Jul 3 19:56:39 2013(r252590) @@ -1,37 +1,81 @@ -#ifndef __LINUX_VIDEODEV2_H -#define __LINUX_VIDEODEV2_H /* - * Video for Linux Two + * Video for Linux Two header file + * + * Copyright (C) 1999-2007 the contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Header file for v4l or V4L2 drivers and applications, for - * Linux kernels 2.2.x or 2.4.x. + * Alternatively you can redistribute this file under the terms of the + * BSD license as stated below: * - * See http://bytesex.org/v4l/ for API specs and other - * v4l2 documentation. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of its contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. * - * Author: Bill Dirks bdi...@pacbell.net + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Header file for v4l or V4L2 drivers and applications + * with public API. + * All kernel-specific stuff were moved to media/v4l2-dev.h, so + * no #if __KERNEL tests are allowed here + * + * See http://linuxtv.org for more info + * + * Author: Bill Dirks b...@thedirks.org * Justin Schoeman + * Hans Verkuil hverk...@xs4all.nl * et al. */ +#ifndef __LINUX_VIDEODEV2_H +#define __LINUX_VIDEODEV2_H + #ifdef __KERNEL__ -#include linux/time.h /* need struct timeval */ -#include linux/poll.h -#include linux/device.h -#include linux/mutex.h +#include linux/time.h /* need struct timeval */ +#else +#include sys/time.h #endif -#include linux/compiler.h /* need __user */ - - -#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */ -#define HAVE_V4L2 1 +#include linux/compiler.h +#include linux/ioctl.h +#include linux/types.h /* * Common stuff for both V4L1 and V4L2 * Moved from videodev.h */ - #define VIDEO_MAX_FRAME 32 +#ifndef __KERNEL__ + +/* These defines are V4L1 specific and should not be used with the V4L2 API! + They will be removed from this header in the future. */ + #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ #define VID_TYPE_TELETEXT 4 /* Does teletext */ @@ -46,70 +90,6 @@ #define VID_TYPE_MPEG_ENCODER 2048/* Can encode MPEG streams */ #define VID_TYPE_MJPEG_DECODER 4096/* Can decode MJPEG streams */ #define VID_TYPE_MJPEG_ENCODER 8192/* Can encode MJPEG streams */ - -#ifdef __KERNEL__ - -/* Minor device allocation */ -#define MINOR_VFL_TYPE_GRABBER_MIN 0 -#define MINOR_VFL_TYPE_GRABBER_MAX 63 -#define MINOR_VFL_TYPE_RADIO_MIN64 -#define MINOR_VFL_TYPE_RADIO_MAX 127 -#define MINOR_VFL_TYPE_VTX_MIN 192
svn commit: r252591 - vendor/v4l/2.6.34.14
Author: netchild Date: Wed Jul 3 20:08:22 2013 New Revision: 252591 URL: http://svnweb.freebsd.org/changeset/base/252591 Log: Tag 2.6.34.14. Added: vendor/v4l/2.6.34.14/ - copied from r252372, vendor/v4l/dist/ Replaced: vendor/v4l/2.6.34.14/videodev2.h - copied unchanged from r252590, vendor/v4l/dist/videodev2.h Copied: vendor/v4l/2.6.34.14/videodev2.h (from r252590, vendor/v4l/dist/videodev2.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/v4l/2.6.34.14/videodev2.hWed Jul 3 20:08:22 2013 (r252591, copy of r252590, vendor/v4l/dist/videodev2.h) @@ -0,0 +1,1761 @@ +/* + * Video for Linux Two header file + * + * Copyright (C) 1999-2007 the contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Alternatively you can redistribute this file under the terms of the + * BSD license as stated below: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of its contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Header file for v4l or V4L2 drivers and applications + * with public API. + * All kernel-specific stuff were moved to media/v4l2-dev.h, so + * no #if __KERNEL tests are allowed here + * + * See http://linuxtv.org for more info + * + * Author: Bill Dirks b...@thedirks.org + * Justin Schoeman + * Hans Verkuil hverk...@xs4all.nl + * et al. + */ +#ifndef __LINUX_VIDEODEV2_H +#define __LINUX_VIDEODEV2_H + +#ifdef __KERNEL__ +#include linux/time.h /* need struct timeval */ +#else +#include sys/time.h +#endif +#include linux/compiler.h +#include linux/ioctl.h +#include linux/types.h + +/* + * Common stuff for both V4L1 and V4L2 + * Moved from videodev.h + */ +#define VIDEO_MAX_FRAME 32 + +#ifndef __KERNEL__ + +/* These defines are V4L1 specific and should not be used with the V4L2 API! + They will be removed from this header in the future. */ + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES128 /* Scalable */ +#define VID_TYPE_MONOCHROME256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024/* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048/* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096/* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192/* Can encode MJPEG streams */ +#endif + +/* + * M I S C E L L A N E O U S + */ + +/* Four-character-code (FOURCC) */ +#define v4l2_fourcc(a, b, c, d)\ + ((__u32)(a) | ((__u32)(b) 8) | ((__u32)(c)
svn commit: r252592 - head/sys/dev/cpuctl
Author: rpaulo Date: Wed Jul 3 20:19:23 2013 New Revision: 252592 URL: http://svnweb.freebsd.org/changeset/base/252592 Log: Typos in comments. Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cWed Jul 3 20:08:22 2013 (r252591) +++ head/sys/dev/cpuctl/cpuctl.cWed Jul 3 20:19:23 2013 (r252592) @@ -326,7 +326,7 @@ update_intel(int cpu, cpuctl_update_args is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); critical_enter(); - rdmsr_safe(MSR_BIOS_SIGN, rev0); /* Get current micorcode revision. */ + rdmsr_safe(MSR_BIOS_SIGN, rev0); /* Get current microcode revision. */ /* * Perform update. @@ -339,7 +339,7 @@ update_intel(int cpu, cpuctl_update_args */ do_cpuid(0, tmp); critical_exit(); - rdmsr_safe(MSR_BIOS_SIGN, rev1); /* Get new micorcode revision. */ + rdmsr_safe(MSR_BIOS_SIGN, rev1); /* Get new microcode revision. */ restore_cpu(oldcpu, is_bound, td); if (rev1 rev0) ret = 0; @@ -440,7 +440,7 @@ update_via(int cpu, cpuctl_update_args_t is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); critical_enter(); - rdmsr_safe(MSR_BIOS_SIGN, rev0); /* Get current micorcode revision. */ + rdmsr_safe(MSR_BIOS_SIGN, rev0); /* Get current microcode revision. */ /* * Perform update. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252593 - head/sys/conf
Author: peter Date: Wed Jul 3 20:21:39 2013 New Revision: 252593 URL: http://svnweb.freebsd.org/changeset/base/252593 Log: Move static ZFS compile option to the other static file system options. Modified: head/sys/conf/options Modified: head/sys/conf/options == --- head/sys/conf/options Wed Jul 3 20:19:23 2013(r252592) +++ head/sys/conf/options Wed Jul 3 20:21:39 2013(r252593) @@ -226,6 +226,7 @@ SMBFS opt_dontuse.h TMPFS opt_dontuse.h UDFopt_dontuse.h UNIONFSopt_dontuse.h +ZFSopt_dontuse.h # Pseudofs debugging PSEUDOFS_TRACE opt_pseudofs.h @@ -840,8 +841,6 @@ HWPMC_MIPS_BACKTRACEopt_hwpmc_hooks.h # XBOX options for FreeBSD/i386, but some files are MI XBOX opt_xbox.h -ZFSopt_dontuse.h - # Interrupt filtering INTR_FILTER ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252594 - head/sys/conf
Author: peter Date: Wed Jul 3 20:22:12 2013 New Revision: 252594 URL: http://svnweb.freebsd.org/changeset/base/252594 Log: Add an entry for filemon. Modified: head/sys/conf/files head/sys/conf/options Modified: head/sys/conf/files == --- head/sys/conf/files Wed Jul 3 20:21:39 2013(r252593) +++ head/sys/conf/files Wed Jul 3 20:22:12 2013(r252594) @@ -1369,6 +1369,7 @@ dev/fdt/fdtbus.c optional fdt dev/fdt/simplebus.coptional fdt dev/fe/if_fe.c optional fe dev/fe/if_fe_pccard.c optional fe pccard +dev/filemon/filemon.c optional filemon dev/firewire/firewire.coptional firewire dev/firewire/fwcrom.c optional firewire dev/firewire/fwdev.c optional firewire Modified: head/sys/conf/options == --- head/sys/conf/options Wed Jul 3 20:21:39 2013(r252593) +++ head/sys/conf/options Wed Jul 3 20:22:12 2013(r252594) @@ -85,6 +85,7 @@ COMPRESS_USER_CORES opt_core.h CY_PCI_FASTINTR DEADLKRES opt_watchdog.h DIRECTIO +FILEMONopt_dontuse.h FFCLOCK FULL_PREEMPTIONopt_sched.h IPI_PREEMPTION opt_sched.h ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252595 - stable/9/usr.bin/truss
Author: mjg Date: Wed Jul 3 20:24:37 2013 New Revision: 252595 URL: http://svnweb.freebsd.org/changeset/base/252595 Log: MFC r252414: truss: recognize O_DIRECTORY, O_EXEC, O_TTY_INIT and O_CLOEXEC Modified: stable/9/usr.bin/truss/syscalls.c Directory Properties: stable/9/usr.bin/truss/ (props changed) Modified: stable/9/usr.bin/truss/syscalls.c == --- stable/9/usr.bin/truss/syscalls.c Wed Jul 3 20:22:12 2013 (r252594) +++ stable/9/usr.bin/truss/syscalls.c Wed Jul 3 20:24:37 2013 (r252595) @@ -343,7 +343,7 @@ static struct xlat open_flags[] = { X(O_RDONLY) X(O_WRONLY) X(O_RDWR) X(O_ACCMODE) X(O_NONBLOCK) X(O_APPEND) X(O_SHLOCK) X(O_EXLOCK) X(O_ASYNC) X(O_FSYNC) X(O_NOFOLLOW) X(O_CREAT) X(O_TRUNC) X(O_EXCL) X(O_NOCTTY) - X(O_DIRECT) XEND + X(O_DIRECT) X(O_DIRECTORY) X(O_EXEC) X(O_TTY_INIT) X(O_CLOEXEC) XEND }; static struct xlat shutdown_arg[] = { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252596 - head/usr.bin/rwho
Author: pjd Date: Wed Jul 3 20:28:33 2013 New Revision: 252596 URL: http://svnweb.freebsd.org/changeset/base/252596 Log: Style cleanups. Submitted by: Mariusz Zaborski osho...@freebsd.org Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after:1 month Modified: head/usr.bin/rwho/rwho.c Modified: head/usr.bin/rwho/rwho.c == --- head/usr.bin/rwho/rwho.cWed Jul 3 20:24:37 2013(r252595) +++ head/usr.bin/rwho/rwho.cWed Jul 3 20:28:33 2013(r252596) @@ -1,6 +1,6 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. +/*- + * Copyright (c) 1983, 1993 The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,22 +58,21 @@ __FBSDID($FreeBSD$); #include timeconv.h #include unistd.h -static DIR *dirp; +#defineNUSERS 1000 +#defineWHDRSIZE(ssize_t)(sizeof (wd) - sizeof (wd.wd_we)) +/* + * this macro should be shared with ruptime. + */ +#definedown(w,now) ((now) - (w)-wd_recvtime 11 * 60) +static DIR *dirp; static struct whod wd; -#defineNUSERS 1000 +static int nusers; static struct myutmp { charmyhost[sizeof(wd.wd_hostname)]; int myidle; struct outmp myutmp; } myutmp[NUSERS]; -static int nusers; - -#defineWHDRSIZE(ssize_t)(sizeof (wd) - sizeof (wd.wd_we)) -/* - * this macro should be shared with ruptime. - */ -#definedown(w,now) ((now) - (w)-wd_recvtime 11 * 60) static time_t now; static int aflg; @@ -88,17 +87,18 @@ main(int argc, char *argv[]) struct dirent *dp; int width; ssize_t cc; - register struct whod *w = wd; - register struct whoent *we; - register struct myutmp *mp; + struct whod *w; + struct whoent *we; + struct myutmp *mp; int f, n, i; int d_first; + w = wd; (void) setlocale(LC_TIME, ); d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); - while ((ch = getopt(argc, argv, a)) != -1) - switch((char)ch) { + while ((ch = getopt(argc, argv, a)) != -1) { + switch ((char)ch) { case 'a': aflg = 1; break; @@ -106,6 +106,7 @@ main(int argc, char *argv[]) default: usage(); } + } argc -= optind; argv += optind; @@ -115,9 +116,9 @@ main(int argc, char *argv[]) if (chdir(_PATH_RWHODIR) || (dirp = opendir(.)) == NULL) err(1, %s, _PATH_RWHODIR); mp = myutmp; - (void)time(now); - while ((dp = readdir(dirp))) { - if (dp-d_ino == 0 || strncmp(dp-d_name, whod., 5)) + (void) time(now); + while ((dp = readdir(dirp)) != NULL) { + if (dp-d_ino == 0 || strncmp(dp-d_name, whod., 5) != 0) continue; f = open(dp-d_name, O_RDONLY); if (f 0) @@ -127,22 +128,25 @@ main(int argc, char *argv[]) (void) close(f); continue; } - if (down(w,now)) { + if (down(w,now) != 0) { (void) close(f); continue; } cc -= WHDRSIZE; we = w-wd_we; for (n = cc / sizeof (struct whoent); n 0; n--) { - if (aflg == 0 we-we_idle = 60*60) { + if (aflg == 0 we-we_idle = 60 * 60) { we++; continue; } if (nusers = NUSERS) errx(1, too many users); - mp-myutmp = we-we_utmp; mp-myidle = we-we_idle; + mp-myutmp = we-we_utmp; + mp-myidle = we-we_idle; (void) strcpy(mp-myhost, w-wd_hostname); - nusers++; we++; mp++; + nusers++; + we++; + mp++; } (void) close(f); } @@ -151,7 +155,9 @@ main(int argc, char *argv[]) width = 0; for (i = 0; i nusers; i++) { /* append one for the blank and use 8 for the out_line */ - int j = strlen(mp-myhost) + 1 + sizeof(mp-myutmp.out_line); + int j; + + j = strlen(mp-myhost) + 1 + sizeof(mp-myutmp.out_line); if (j width) width = j; mp++; @@ -159,31 +165,33 @@ main(int argc, char *argv[]) mp =
svn commit: r252597 - head/sys/dev/cpuctl
Author: rpaulo Date: Wed Jul 3 20:29:15 2013 New Revision: 252597 URL: http://svnweb.freebsd.org/changeset/base/252597 Log: Increase the microcode max size to 16K to accomodate more recent Intel firmware. Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cWed Jul 3 20:28:33 2013 (r252596) +++ head/sys/dev/cpuctl/cpuctl.cWed Jul 3 20:29:15 2013 (r252597) @@ -63,7 +63,7 @@ static d_ioctl_t cpuctl_ioctl; # define DPRINTF(...) #endif -#defineUCODE_SIZE_MAX (10 * 1024) +#defineUCODE_SIZE_MAX (16 * 1024) static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data, u_long cmd, struct thread *td); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252598 - head/usr.bin/rwho
Author: pjd Date: Wed Jul 3 20:42:10 2013 New Revision: 252598 URL: http://svnweb.freebsd.org/changeset/base/252598 Log: Sandbox rwho(1) using capability mode and Capsicum capabilities. rwho(1) gets only read-only access to /var/rwho/ directory. Submitted by: Mariusz Zaborski osho...@freebsd.org Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after:1 month Modified: head/usr.bin/rwho/rwho.c Modified: head/usr.bin/rwho/rwho.c == --- head/usr.bin/rwho/rwho.cWed Jul 3 20:29:15 2013(r252597) +++ head/usr.bin/rwho/rwho.cWed Jul 3 20:42:10 2013(r252598) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1983, 1993 The Regents of the University of California. + * Copyright (c) 2013 Mariusz Zaborski osho...@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,6 +43,7 @@ static char sccsid[] = @(#)rwho.c8.1 ( #include sys/cdefs.h __FBSDID($FreeBSD$); +#include sys/capability.h #include sys/param.h #include sys/file.h @@ -49,6 +51,7 @@ __FBSDID($FreeBSD$); #include dirent.h #include err.h +#include errno.h #include langinfo.h #include locale.h #include stdio.h @@ -92,6 +95,8 @@ main(int argc, char *argv[]) struct myutmp *mp; int f, n, i; int d_first; + int dfd; + time_t ct; w = wd; (void) setlocale(LC_TIME, ); @@ -113,16 +118,31 @@ main(int argc, char *argv[]) if (argc != 0) usage(); - if (chdir(_PATH_RWHODIR) || (dirp = opendir(.)) == NULL) - err(1, %s, _PATH_RWHODIR); + if (chdir(_PATH_RWHODIR) 0) + err(1, chdir(%s), _PATH_RWHODIR); + if ((dirp = opendir(.)) == NULL) + err(1, opendir(%s), _PATH_RWHODIR); + dfd = dirfd(dirp); mp = myutmp; + if (cap_rights_limit(dfd, CAP_READ | CAP_LOOKUP) 0 errno != ENOSYS) + err(1, cap_rights_limit failed: %s, _PATH_RWHODIR); + /* +* Cache files required for time(3) and localtime(3) before entering +* capability mode. +*/ + (void) time(ct); + (void) localtime(ct); + if (cap_enter() 0 errno != ENOSYS) + err(1, cap_enter); (void) time(now); while ((dp = readdir(dirp)) != NULL) { if (dp-d_ino == 0 || strncmp(dp-d_name, whod., 5) != 0) continue; - f = open(dp-d_name, O_RDONLY); + f = openat(dfd, dp-d_name, O_RDONLY); if (f 0) continue; + if (cap_rights_limit(f, CAP_READ) 0 errno != ENOSYS) + err(1, cap_rights_limit failed: %s, dp-d_name); cc = read(f, (char *)wd, sizeof (struct whod)); if (cc WHDRSIZE) { (void) close(f); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252599 - head/usr.bin/rwho
Author: pjd Date: Wed Jul 3 20:44:47 2013 New Revision: 252599 URL: http://svnweb.freebsd.org/changeset/base/252599 Log: Few more style nits. MFC after:1 month Modified: head/usr.bin/rwho/rwho.c Modified: head/usr.bin/rwho/rwho.c == --- head/usr.bin/rwho/rwho.cWed Jul 3 20:42:10 2013(r252598) +++ head/usr.bin/rwho/rwho.cWed Jul 3 20:44:47 2013(r252599) @@ -62,7 +62,7 @@ __FBSDID($FreeBSD$); #include unistd.h #defineNUSERS 1000 -#defineWHDRSIZE(ssize_t)(sizeof (wd) - sizeof (wd.wd_we)) +#defineWHDRSIZE(ssize_t)(sizeof(wd) - sizeof(wd.wd_we)) /* * this macro should be shared with ruptime. */ @@ -143,18 +143,18 @@ main(int argc, char *argv[]) continue; if (cap_rights_limit(f, CAP_READ) 0 errno != ENOSYS) err(1, cap_rights_limit failed: %s, dp-d_name); - cc = read(f, (char *)wd, sizeof (struct whod)); + cc = read(f, (char *)wd, sizeof(struct whod)); if (cc WHDRSIZE) { (void) close(f); continue; } - if (down(w,now) != 0) { + if (down(w, now) != 0) { (void) close(f); continue; } cc -= WHDRSIZE; we = w-wd_we; - for (n = cc / sizeof (struct whoent); n 0; n--) { + for (n = cc / sizeof(struct whoent); n 0; n--) { if (aflg == 0 we-we_idle = 60 * 60) { we++; continue; @@ -170,7 +170,7 @@ main(int argc, char *argv[]) } (void) close(f); } - qsort((char *)myutmp, nusers, sizeof (struct myutmp), utmpcmp); + qsort((char *)myutmp, nusers, sizeof(struct myutmp), utmpcmp); mp = myutmp; width = 0; for (i = 0; i nusers; i++) { @@ -188,18 +188,14 @@ main(int argc, char *argv[]) time_t t; t = _int_to_time(mp-myutmp.out_time); - strftime(cbuf, sizeof(cbuf), - d_first ? %e %b %R : %b %e %R, + strftime(cbuf, sizeof(cbuf), d_first ? %e %b %R : %b %e %R, localtime(t)); (void) sprintf(buf, %s:%-.*s, mp-myhost, (int)sizeof(mp-myutmp.out_line), mp-myutmp.out_line); printf(%-*.*s %-*s %s, (int)sizeof(mp-myutmp.out_name), (int)sizeof(mp-myutmp.out_name), - mp-myutmp.out_name, - width, - buf, - cbuf); + mp-myutmp.out_name, width, buf, cbuf); mp-myidle /= 60; if (mp-myidle != 0) { if (aflg != 0) { @@ -224,6 +220,7 @@ main(int argc, char *argv[]) static void usage(void) { + fprintf(stderr, usage: rwho [-a]\n); exit(1); } @@ -242,6 +239,6 @@ utmpcmp(const void *u1, const void *u2) rc = strcmp(MYUTMP(u1)-myhost, MYUTMP(u2)-myhost); if (rc != 0) return (rc); - return (strncmp(MYUTMP(u1)-myutmp.out_line, MYUTMP(u2)-myutmp.out_line, - sizeof(MYUTMP(u2)-myutmp.out_line))); + return (strncmp(MYUTMP(u1)-myutmp.out_line, + MYUTMP(u2)-myutmp.out_line, sizeof(MYUTMP(u2)-myutmp.out_line))); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252600 - stable/9/usr.sbin/sysinstall
Author: dteske Date: Wed Jul 3 20:54:25 2013 New Revision: 252600 URL: http://svnweb.freebsd.org/changeset/base/252600 Log: Fix grammar in a comment. Modified: stable/9/usr.sbin/sysinstall/package.c Modified: stable/9/usr.sbin/sysinstall/package.c == --- stable/9/usr.sbin/sysinstall/package.c Wed Jul 3 20:44:47 2013 (r252599) +++ stable/9/usr.sbin/sysinstall/package.c Wed Jul 3 20:54:25 2013 (r252600) @@ -106,7 +106,7 @@ package_installed(char *name) /* XXX KLUDGE ALERT! This makes evil assumptions about how XXX * packages register themselves and should *really be done with - * `pkg_info -e name' except that this it's too slow for an + * `pkg_info -e name' except that this is too slow for an * item check routine.. :-( */ snprintf(fname, FILENAME_MAX, /var/db/pkg/%s, name); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252601 - stable/8/usr.sbin/sysinstall
Author: dteske Date: Wed Jul 3 20:55:49 2013 New Revision: 252601 URL: http://svnweb.freebsd.org/changeset/base/252601 Log: MFC r252600: Fix grammar in a comment. Modified: stable/8/usr.sbin/sysinstall/package.c Modified: stable/8/usr.sbin/sysinstall/package.c == --- stable/8/usr.sbin/sysinstall/package.c Wed Jul 3 20:54:25 2013 (r252600) +++ stable/8/usr.sbin/sysinstall/package.c Wed Jul 3 20:55:49 2013 (r252601) @@ -106,7 +106,7 @@ package_installed(char *name) /* XXX KLUDGE ALERT! This makes evil assumptions about how XXX * packages register themselves and should *really be done with - * `pkg_info -e name' except that this it's too slow for an + * `pkg_info -e name' except that this is too slow for an * item check routine.. :-( */ snprintf(fname, FILENAME_MAX, /var/db/pkg/%s, name); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252602 - head/usr.sbin/rwhod
Author: pjd Date: Wed Jul 3 20:58:58 2013 New Revision: 252602 URL: http://svnweb.freebsd.org/changeset/base/252602 Log: Style cleanups. Submitted by: Mariusz Zaborski osho...@freebsd.org Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after:1 month Modified: head/usr.sbin/rwhod/rwhod.c Modified: head/usr.sbin/rwhod/rwhod.c == --- head/usr.sbin/rwhod/rwhod.c Wed Jul 3 20:55:49 2013(r252601) +++ head/usr.sbin/rwhod/rwhod.c Wed Jul 3 20:58:58 2013(r252602) @@ -1,6 +1,6 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. +/*- + * Copyright (c) 1983, 1993 The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -60,47 +60,17 @@ __FBSDID($FreeBSD$); #include err.h #include errno.h #include fcntl.h +#include grp.h #include netdb.h #include paths.h +#include pwd.h #include stdio.h #include stdlib.h #include string.h #include syslog.h #include timeconv.h -#include unistd.h #include utmpx.h -#include pwd.h -#include grp.h - -/* - * This version of Berkeley's rwhod has been modified to use IP multicast - * datagrams, under control of a new command-line option: - * - * rwhod -mcauses rwhod to use IP multicast (instead of - * broadcast or unicast) on all interfaces that have - * the IFF_MULTICAST flag set in their ifnet structs - * (excluding the loopback interface). The multicast - * reports are sent with a time-to-live of 1, to prevent - * forwarding beyond the directly-connected subnet(s). - * - * rwhod -m ttl causes rwhod to send IP multicast datagrams with a - * time-to-live of ttl, via a SINGLE interface rather - * than all interfaces. ttl must be between 0 and - * MAX_MULTICAST_SCOPE, defined below. Note that -m 1 - * is different than -m, in that -m 1 specifies - * transmission on one interface only. - * - * When -m is used without a ttl argument, the program accepts multicast - * rwhod reports from all multicast-capable interfaces. If a ttl argument - * is given, it accepts multicast reports from only one interface, the one - * on which reports are sent (which may be controlled via the host's routing - * table). Regardless of the -m option, the program accepts broadcast or - * unicast reports from all interfaces. Thus, this program will hear the - * reports of old, non-multicasting rwhods, but, if multicasting is used, - * those old rwhods won't hear the reports generated by this program. - * - * -- Steve Deering, Stanford University, February 1989 - */ +#include unistd.h #defineUNPRIV_USER daemon #defineUNPRIV_GROUPdaemon @@ -112,15 +82,15 @@ __FBSDID($FreeBSD$); #define MAX_MULTICAST_SCOPE32/* site-wide, by convention */ #define INADDR_WHOD_GROUP (u_long)0xe103 /* 224.0.1.3 */ - /* (belongs in protocols/rwhod.h) */ + /* (belongs in protocols/rwhod.h) */ -intinsecure_mode; -intquiet_mode; -intiff_flag = IFF_POINTOPOINT; -intmulticast_mode = NO_MULTICAST; -intmulticast_scope; -struct sockaddr_in multicast_addr = - { sizeof multicast_addr, AF_INET, 0, { 0 }, { 0 } }; +intinsecure_mode; +intquiet_mode; +intiff_flag = IFF_POINTOPOINT; +intmulticast_mode = NO_MULTICAST; +intmulticast_scope; +struct sockaddr_in multicast_addr = + { sizeof(multicast_addr), AF_INET, 0, { 0 }, { 0 } }; /* * Alarm interval. Don't forget to change the down time check in ruptime @@ -137,72 +107,109 @@ char myname[MAXHOSTNAMELEN]; */ struct neighbor { struct neighbor *n_next; - char*n_name;/* interface name */ + char *n_name; /* interface name */ struct sockaddr *n_addr; /* who to send to */ - int n_addrlen; /* size of address */ - int n_flags;/* should forward?, interface flags */ + int n_addrlen;/* size of address */ + int n_flags; /* should forward?, interface flags */ }; struct neighbor *neighbors; struct whod mywd; -struct servent *sp; +struct servent *sp; ints; #defineWHDRSIZE(int)(sizeof(mywd) - sizeof(mywd.wd_we)) -voidrun_as(uid_t *, gid_t *); -int configure(int); -voidgetboottime(int);
svn commit: r252606 - stable/9/bin/sleep
Author: jilles Date: Wed Jul 3 21:11:56 2013 New Revision: 252606 URL: http://svnweb.freebsd.org/changeset/base/252606 Log: MFC r251078,r251433: sleep: Improve nanosleep() error handling: * Work around kernel bugs that cause a spurious [EINTR] return if a debugger (such as truss(1)) is attached. * Write an error message if an error other than [EINTR] occurs. PR: bin/178664 Modified: stable/9/bin/sleep/sleep.c Directory Properties: stable/9/bin/sleep/ (props changed) Modified: stable/9/bin/sleep/sleep.c == --- stable/9/bin/sleep/sleep.c Wed Jul 3 21:07:02 2013(r252605) +++ stable/9/bin/sleep/sleep.c Wed Jul 3 21:11:56 2013(r252606) @@ -43,6 +43,7 @@ __FBSDID($FreeBSD$); #include ctype.h #include err.h +#include errno.h #include limits.h #include signal.h #include stdint.h @@ -81,14 +82,20 @@ main(int argc, char *argv[]) time_to_sleep.tv_nsec = 1e9 * (d - time_to_sleep.tv_sec); signal(SIGINFO, report_request); + + /* +* Note: [EINTR] is supposed to happen only when a signal was handled +* but the kernel also returns it when a ptrace-based debugger +* attaches. This is a bug but it is hard to fix. +*/ while (nanosleep(time_to_sleep, time_to_sleep) != 0) { if (report_requested) { /* Reporting does not bother with nanoseconds. */ warnx(about %d second(s) left out of the original %d, (int)time_to_sleep.tv_sec, (int)original); report_requested = 0; - } else - break; + } else if (errno != EINTR) + err(1, nanosleep); } return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252604 - stable/9/lib/libc/sys
Author: jilles Date: Wed Jul 3 21:05:35 2013 New Revision: 252604 URL: http://svnweb.freebsd.org/changeset/base/252604 Log: MFC r250982: sigreturn(2): Remove ancient compatibility warning about 4.2BSD The HISTORY subsection still says that sigreturn() was added in 4.3BSD. Modified: stable/9/lib/libc/sys/sigreturn.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/sigreturn.2 == --- stable/9/lib/libc/sys/sigreturn.2 Wed Jul 3 21:04:20 2013 (r252603) +++ stable/9/lib/libc/sys/sigreturn.2 Wed Jul 3 21:05:35 2013 (r252604) @@ -56,10 +56,6 @@ Execution resumes at the specified pc. This system call is used by the trampoline code and .Xr longjmp 3 when returning from a signal to the previously executing program. -.Sh NOTES -This system call is not available in -.Bx 4.2 -hence it should not be used if backward compatibility is needed. .Sh RETURN VALUES If successful, the system call does not return. Otherwise, a value of -1 is returned and ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252603 - head/usr.sbin/rwhod
Author: pjd Date: Wed Jul 3 21:04:20 2013 New Revision: 252603 URL: http://svnweb.freebsd.org/changeset/base/252603 Log: The whole sending functionality was implemented within signal handler, which is very bad idea. Split sending and receiving in two processes, which fixes this problem and will help to sandbox rwhod. Submitted by: Mariusz Zaborski osho...@freebsd.org Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after:1 month Modified: head/usr.sbin/rwhod/rwhod.c Modified: head/usr.sbin/rwhod/rwhod.c == --- head/usr.sbin/rwhod/rwhod.c Wed Jul 3 20:58:58 2013(r252602) +++ head/usr.sbin/rwhod/rwhod.c Wed Jul 3 21:04:20 2013(r252603) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1983, 1993 The Regents of the University of California. + * Copyright (c) 2013 Mariusz Zaborski osho...@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,6 +49,8 @@ __FBSDID($FreeBSD$); #include sys/signal.h #include sys/ioctl.h #include sys/sysctl.h +#include sys/procdesc.h +#include sys/wait.h #include net/if.h #include net/if_dl.h @@ -93,10 +96,10 @@ struct sockaddr_in multicast_addr = { sizeof(multicast_addr), AF_INET, 0, { 0 }, { 0 } }; /* - * Alarm interval. Don't forget to change the down time check in ruptime + * Sleep interval. Don't forget to change the down time check in ruptime * if this is changed. */ -#define AL_INTERVAL (3 * 60) +#define SL_INTERVAL (3 * 60) char myname[MAXHOSTNAMELEN]; @@ -117,15 +120,18 @@ structneighbor *neighbors; struct whod mywd; struct servent *sp; ints; +intfdp; +pid_t pid_child_receiver; #defineWHDRSIZE(int)(sizeof(mywd) - sizeof(mywd.wd_we)) intconfigure(int so); void getboottime(int signo __unused); -void onalrm(int signo __unused); +void receiver_process(void); void rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo); void run_as(uid_t *uid, gid_t *gid); void quit(const char *msg); +void sender_process(void); intverify(char *name, int maxlen); static void usage(void); @@ -168,9 +174,6 @@ voidSendto(int s, const void *buf, size int main(int argc, char *argv[]) { - struct sockaddr_in from; - struct stat st; - char path[64]; int on; char *cp; struct sockaddr_in soin; @@ -269,16 +272,83 @@ main(int argc, char *argv[]) if (!configure(s)) exit(1); if (!quiet_mode) { - signal(SIGALRM, onalrm); - onalrm(0); + pid_child_receiver = pdfork(fdp, 0); + if (pid_child_receiver == 0) { + receiver_process(); + } else if (pid_child_receiver 0) { + sender_process(); + } else if (pid_child_receiver == -1) { + syslog(LOG_ERR, pdfork: %m); + exit(1); + } + } else { + receiver_process(); } - for (;;) { - struct whod wd; - socklen_t len; - int cc, whod; - time_t t; +} + +static void +usage(void) +{ + + fprintf(stderr, usage: rwhod [-i] [-p] [-l] [-m [ttl]]\n); + exit(1); +} + +void +run_as(uid_t *uid, gid_t *gid) +{ + struct passwd *pw; + struct group *gr; + + pw = getpwnam(UNPRIV_USER); + if (pw == NULL) { + syslog(LOG_ERR, getpwnam(%s): %m, UNPRIV_USER); + exit(1); + } + *uid = pw-pw_uid; + + gr = getgrnam(UNPRIV_GROUP); + if (gr == NULL) { + syslog(LOG_ERR, getgrnam(%s): %m, UNPRIV_GROUP); + exit(1); + } + *gid = gr-gr_gid; +} + +/* + * Check out host name for unprintables + * and other funnies before allowing a file + * to be created. Sorry, but blanks aren't allowed. + */ +int +verify(char *name, int maxlen) +{ + int size; + + size = 0; + while (*name != '\0' size maxlen - 1) { + if (!isascii(*name) || !isalnum(*name) || ispunct(*name)) + return (0); + name++; + size++; + } + *name = '\0'; + return (size 0); +} + +void +receiver_process(void) +{ + struct sockaddr_in from; + struct stat st; + char path[64]; + struct whod wd; + socklen_t len; + int cc, whod; + time_t t; - len = sizeof(from); + len = sizeof(from); + for (;;) { cc = recvfrom(s, wd, sizeof(wd), 0, (struct sockaddr *)from, len); if (cc = 0) { @@ -344,139 +414,97 @@ main(int argc, char *argv[]) } } -static void -usage(void) -{ - - fprintf(stderr, usage: rwhod [-i] [-p] [-l] [-m [ttl]]\n); - exit(1); -} - -void
svn commit: r252605 - head/usr.sbin/rwhod
Author: pjd Date: Wed Jul 3 21:07:02 2013 New Revision: 252605 URL: http://svnweb.freebsd.org/changeset/base/252605 Log: Sandbox rwhod(8) receiver process using capability mode and Capsicum capabilities. rwhod(8) receiver can now only receive packages, write to /var/rwho/ directory and log to syslog. Submitted by: Mariusz Zaborski osho...@freebsd.org Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after:1 month Modified: head/usr.sbin/rwhod/rwhod.c Modified: head/usr.sbin/rwhod/rwhod.c == --- head/usr.sbin/rwhod/rwhod.c Wed Jul 3 21:05:35 2013(r252604) +++ head/usr.sbin/rwhod/rwhod.c Wed Jul 3 21:07:02 2013(r252605) @@ -43,6 +43,7 @@ static char sccsid[] = @(#)rwhod.c 8.1 #include sys/cdefs.h __FBSDID($FreeBSD$); +#include sys/capability.h #include sys/param.h #include sys/socket.h #include sys/stat.h @@ -220,7 +221,7 @@ main(int argc, char *argv[]) daemon(1, 0); #endif (void) signal(SIGHUP, getboottime); - openlog(rwhod, LOG_PID, LOG_DAEMON); + openlog(rwhod, LOG_PID | LOG_NDELAY, LOG_DAEMON); sp = getservbyname(who, udp); if (sp == NULL) { syslog(LOG_ERR, who/udp: unknown service); @@ -342,12 +343,27 @@ receiver_process(void) struct sockaddr_in from; struct stat st; char path[64]; + int dirfd; struct whod wd; socklen_t len; int cc, whod; time_t t; len = sizeof(from); + dirfd = open(., O_RDONLY | O_DIRECTORY); + if (dirfd 0) { + syslog(LOG_WARNING, %s: %m, _PATH_RWHODIR); + exit(1); + } + if (cap_rights_limit(dirfd, CAP_CREATE | CAP_WRITE | CAP_FTRUNCATE | + CAP_SEEK | CAP_LOOKUP | CAP_FSTAT) 0 errno != ENOSYS) { + syslog(LOG_WARNING, cap_rights_limit: %m); + exit(1); + } + if (cap_enter() 0 errno != ENOSYS) { + syslog(LOG_ERR, cap_enter: %m); + exit(1); + } for (;;) { cc = recvfrom(s, wd, sizeof(wd), 0, (struct sockaddr *)from, len); @@ -380,11 +396,16 @@ receiver_process(void) * Rather than truncating and growing the file each time, * use ftruncate if size is less than previous size. */ - whod = open(path, O_WRONLY | O_CREAT, 0644); + whod = openat(dirfd, path, O_WRONLY | O_CREAT, 0644); if (whod 0) { syslog(LOG_WARNING, %s: %m, path); continue; } + if (cap_rights_limit(whod, CAP_WRITE | CAP_FTRUNCATE | + CAP_FSTAT) 0 errno != ENOSYS) { + syslog(LOG_WARNING, cap_rights_limit: %m); + exit(1); + } #if ENDIAN != BIG_ENDIAN { struct whoent *we; @@ -412,6 +433,7 @@ receiver_process(void) ftruncate(whod, cc); (void) close(whod); } + (void) close(dirfd); } void ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252607 - stable/9/bin/test
Author: jilles Date: Wed Jul 3 21:14:57 2013 New Revision: 252607 URL: http://svnweb.freebsd.org/changeset/base/252607 Log: MFC r251209: test(1): List non-standard primaries. Modified: stable/9/bin/test/test.1 Directory Properties: stable/9/bin/test/ (props changed) Modified: stable/9/bin/test/test.1 == --- stable/9/bin/test/test.1Wed Jul 3 21:11:56 2013(r252606) +++ stable/9/bin/test/test.1Wed Jul 3 21:14:57 2013(r252607) @@ -32,7 +32,7 @@ .\ @(#)test.1 8.1 (Berkeley) 5/31/93 .\ $FreeBSD$ .\ -.Dd December 27, 2012 +.Dd June 1, 2013 .Dt TEST 1 .Os .Sh NAME @@ -349,6 +349,17 @@ The utility implements a superset of the .St -p1003.2 specification. +The primaries +.Cm , +.Cm == , +.Cm , +.Fl ef , +.Fl nt , +.Fl ot , +.Fl G , +and +.Fl O +are extensions. .Sh BUGS Both sides are always evaluated in .Fl a ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252608 - in head: include lib/libc/stdlib
Author: ache Date: Wed Jul 3 21:21:54 2013 New Revision: 252608 URL: http://svnweb.freebsd.org/changeset/base/252608 Log: 1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range, but ACM formula we use have internal state (and return value) in the [1, 0x7ffe] range, so our RAND_MAX (0x7fff) is never reached because it is off by one, zero is not reached too. Correct both RAND_MAX and rand(3) return value, shifting last one to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffd(=new RAND_MAX)] range. 2) Add a checks for not overflowing on too big seeds. It may happens on the machines, where sizeof(unsigned int) 32 bits. Reviewed by:bde [1] MFC after: 2 weeks Modified: head/include/stdlib.h head/lib/libc/stdlib/rand.c Modified: head/include/stdlib.h == --- head/include/stdlib.h Wed Jul 3 21:14:57 2013(r252607) +++ head/include/stdlib.h Wed Jul 3 21:21:54 2013(r252608) @@ -69,7 +69,7 @@ typedef struct { #defineEXIT_FAILURE1 #defineEXIT_SUCCESS0 -#defineRAND_MAX0x7fff +#defineRAND_MAX0x7ffd __BEGIN_DECLS #ifdef _XLOCALE_H_ Modified: head/lib/libc/stdlib/rand.c == --- head/lib/libc/stdlib/rand.c Wed Jul 3 21:14:57 2013(r252607) +++ head/lib/libc/stdlib/rand.c Wed Jul 3 21:21:54 2013(r252608) @@ -67,15 +67,15 @@ do_rand(unsigned long *ctx) */ long hi, lo, x; - /* Can't be initialized with 0, so use another value. */ - if (*ctx == 0) - *ctx = 123459876; + /* Must be in [1, 0x7ffe] range at this point. */ hi = *ctx / 127773; lo = *ctx % 127773; x = 16807 * lo - 2836 * hi; if (x 0) x += 0x7fff; - return ((*ctx = x) % ((u_long)RAND_MAX + 1)); + *ctx = x; + /* Transform to [0, 0x7ffd] range. */ + return (x - 1); #endif /* !USE_WEAK_SEEDING */ } @@ -84,6 +84,10 @@ int rand_r(unsigned int *ctx) { u_long val = (u_long) *ctx; +#ifndef USE_WEAK_SEEDING + /* Transform to [1, 0x7ffe] range. */ + val = (val % 0x7ffe) + 1; +#endif int r = do_rand(val); *ctx = (unsigned int) val; @@ -104,6 +108,10 @@ srand(seed) u_int seed; { next = seed; +#ifndef USE_WEAK_SEEDING + /* Transform to [1, 0x7ffe] range. */ + next = (next % 0x7ffe) + 1; +#endif } @@ -125,6 +133,10 @@ sranddev() mib[0] = CTL_KERN; mib[1] = KERN_ARND; sysctl(mib, 2, (void *)next, len, NULL, 0); +#ifndef USE_WEAK_SEEDING + /* Transform to [1, 0x7ffe] range. */ + next = (next % 0x7ffe) + 1; +#endif } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252609 - stable/9/bin/sh
Author: jilles Date: Wed Jul 3 21:22:47 2013 New Revision: 252609 URL: http://svnweb.freebsd.org/changeset/base/252609 Log: MFC r248692: sh(1): Mention possible ambiguities with $(( and ((. In some other shells, things like $((a);(b)) are command substitutions. Also, there are shells that have an extension ((ARITH)) that evaluates an arithmetic expression and returns status 1 if the result is zero, 0 otherwise. This extension may lead to ambiguity with two subshells starting in sequence. Modified: stable/9/bin/sh/sh.1 Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/sh.1 == --- stable/9/bin/sh/sh.1Wed Jul 3 21:21:54 2013(r252608) +++ stable/9/bin/sh/sh.1Wed Jul 3 21:22:47 2013(r252609) @@ -32,7 +32,7 @@ .\from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\ $FreeBSD$ .\ -.Dd November 5, 2011 +.Dd March 24, 2013 .Dt SH 1 .Os .Sh NAME @@ -1061,6 +1061,9 @@ A subshell environment may be implemente If job control is enabled in an interactive shell, commands grouped in parentheses can be suspended and continued as a unit. .Pp +For compatibility with other shells, +two open parentheses in sequence should be separated by whitespace. +.Pp The second form never forks another shell, so it is slightly more efficient. Grouping commands together this way allows the user to @@ -1604,6 +1607,16 @@ and .Ic times returns information about the same process if they are the only command in a command substitution. +.Pp +If a command substitution of the +.Li $( +form begins with a subshell, +the +.Li $( +and +.Li ( +must be separated by whitespace +to avoid ambiguity with arithmetic expansion. .Ss Arithmetic Expansion Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its value. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252610 - stable/9/bin/sh
Author: jilles Date: Wed Jul 3 21:25:46 2013 New Revision: 252610 URL: http://svnweb.freebsd.org/changeset/base/252610 Log: MFC r248870 by joel: Minor mdoc fix in previous commit. Modified: stable/9/bin/sh/sh.1 Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/sh.1 == --- stable/9/bin/sh/sh.1Wed Jul 3 21:22:47 2013(r252609) +++ stable/9/bin/sh/sh.1Wed Jul 3 21:25:46 2013(r252610) @@ -1614,7 +1614,7 @@ form begins with a subshell, the .Li $( and -.Li ( +.Li (\ must be separated by whitespace to avoid ambiguity with arithmetic expansion. .Ss Arithmetic Expansion ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252611 - stable/9/bin/sh
Author: jilles Date: Wed Jul 3 21:31:13 2013 New Revision: 252611 URL: http://svnweb.freebsd.org/changeset/base/252611 Log: MFC r251763: sh(1): A subshell environment has its own rlimits (ulimit). This has always been the case and is intended (just like cd). This matches Austin group issue #706. Modified: stable/9/bin/sh/sh.1 Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/sh.1 == --- stable/9/bin/sh/sh.1Wed Jul 3 21:25:46 2013(r252610) +++ stable/9/bin/sh/sh.1Wed Jul 3 21:31:13 2013(r252611) @@ -32,7 +32,7 @@ .\from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\ $FreeBSD$ .\ -.Dd March 24, 2013 +.Dd June 14, 2013 .Dt SH 1 .Os .Sh NAME @@ -1036,6 +1036,9 @@ The current working directory as set by The file creation mask as set by .Ic umask . .It +Resource limits as set by +.Ic ulimit . +.It References to open files. .It Traps as set by ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252612 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 21:41:35 2013 New Revision: 252612 URL: http://svnweb.freebsd.org/changeset/base/252612 Log: MFp4: @229469: Garbage-collect dead prototypes. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhcpd.h head/sbin/dhclient/packet.c Modified: head/sbin/dhclient/dhcpd.h == --- head/sbin/dhclient/dhcpd.h Wed Jul 3 21:31:13 2013(r252611) +++ head/sbin/dhclient/dhcpd.h Wed Jul 3 21:41:35 2013(r252612) @@ -413,12 +413,6 @@ ssize_t decode_hw_header(unsigned char * ssize_t decode_udp_ip_header(unsigned char *, int, struct sockaddr_in *, unsigned char *, int); -/* ethernet.c */ -void assemble_ethernet_header(struct interface_info *, unsigned char *, -int *, struct hardware *); -ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, -int, struct hardware *); - /* clparse.c */ int read_client_conf(void); void read_client_leases(void); Modified: head/sbin/dhclient/packet.c == --- head/sbin/dhclient/packet.c Wed Jul 3 21:31:13 2013(r252611) +++ head/sbin/dhclient/packet.c Wed Jul 3 21:41:35 2013(r252612) @@ -55,11 +55,6 @@ __FBSDID($FreeBSD$); u_int32_t checksum(unsigned char *, unsigned, u_int32_t); u_int32_t wrapsum(u_int32_t); -void assemble_ethernet_header(struct interface_info *, unsigned char *, - int *, struct hardware *); -ssize_tdecode_ethernet_header(struct interface_info *, unsigned char *, - int bufix, struct hardware *); - u_int32_t checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252613 - in stable/9/tools/regression/bin/sh: builtins execution expansion
Author: jilles Date: Wed Jul 3 21:43:41 2013 New Revision: 252613 URL: http://svnweb.freebsd.org/changeset/base/252613 Log: MFC r245383,245392,247190,249220,251180,251797: New sh testcases. These already work on stable/9. Added: stable/9/tools/regression/bin/sh/builtins/break4.4 - copied unchanged from r251180, head/tools/regression/bin/sh/builtins/break4.4 stable/9/tools/regression/bin/sh/builtins/break5.4 - copied unchanged from r251180, head/tools/regression/bin/sh/builtins/break5.4 stable/9/tools/regression/bin/sh/builtins/eval6.0 - copied unchanged from r249220, head/tools/regression/bin/sh/builtins/eval6.0 stable/9/tools/regression/bin/sh/builtins/local2.0 - copied unchanged from r251797, head/tools/regression/bin/sh/builtins/local2.0 stable/9/tools/regression/bin/sh/builtins/local3.0 - copied unchanged from r251797, head/tools/regression/bin/sh/builtins/local3.0 stable/9/tools/regression/bin/sh/builtins/read6.0 - copied unchanged from r247190, head/tools/regression/bin/sh/builtins/read6.0 stable/9/tools/regression/bin/sh/execution/subshell1.0 - copied unchanged from r245383, head/tools/regression/bin/sh/execution/subshell1.0 stable/9/tools/regression/bin/sh/execution/subshell1.0.stdout - copied unchanged from r245383, head/tools/regression/bin/sh/execution/subshell1.0.stdout stable/9/tools/regression/bin/sh/execution/subshell2.0 - copied unchanged from r245383, head/tools/regression/bin/sh/execution/subshell2.0 stable/9/tools/regression/bin/sh/execution/subshell3.0 - copied unchanged from r245383, head/tools/regression/bin/sh/execution/subshell3.0 stable/9/tools/regression/bin/sh/execution/subshell4.0 - copied unchanged from r245383, head/tools/regression/bin/sh/execution/subshell4.0 stable/9/tools/regression/bin/sh/expansion/cmdsubst16.0 - copied unchanged from r245392, head/tools/regression/bin/sh/expansion/cmdsubst16.0 Modified: Directory Properties: stable/9/tools/regression/bin/sh/ (props changed) Copied: stable/9/tools/regression/bin/sh/builtins/break4.4 (from r251180, head/tools/regression/bin/sh/builtins/break4.4) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/break4.4 Wed Jul 3 21:43:41 2013(r252613, copy of r251180, head/tools/regression/bin/sh/builtins/break4.4) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +# Although this is not specified by POSIX, some configure scripts (gawk 4.1.0) +# appear to depend on it. + +break +exit 4 Copied: stable/9/tools/regression/bin/sh/builtins/break5.4 (from r251180, head/tools/regression/bin/sh/builtins/break5.4) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/break5.4 Wed Jul 3 21:43:41 2013(r252613, copy of r251180, head/tools/regression/bin/sh/builtins/break5.4) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +# Although this is not specified by POSIX, some configure scripts (gawk 4.1.0) +# appear to depend on it. +# In some uncommitted code, the subshell environment corrupted the outer +# shell environment's state. + +(for i in a b c; do + exit 3 +done) +break +exit 4 Copied: stable/9/tools/regression/bin/sh/builtins/eval6.0 (from r249220, head/tools/regression/bin/sh/builtins/eval6.0) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/eval6.0 Wed Jul 3 21:43:41 2013(r252613, copy of r249220, head/tools/regression/bin/sh/builtins/eval6.0) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# eval should preserve $? from command substitutions when starting +# the parsed command. +[ $(false; eval 'echo $?' $(:)) = 0 ] Copied: stable/9/tools/regression/bin/sh/builtins/local2.0 (from r251797, head/tools/regression/bin/sh/builtins/local2.0) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/local2.0 Wed Jul 3 21:43:41 2013(r252613, copy of r251797, head/tools/regression/bin/sh/builtins/local2.0) @@ -0,0 +1,17 @@ +# $FreeBSD$ + +f() { + local - + set -a + case $- in + *a*) : ;; + *) echo In-function \$- bad + esac +} +case $- in +*a*) echo Initial \$- bad +esac +f +case $- in +*a*) echo Final \$- bad +esac Copied: stable/9/tools/regression/bin/sh/builtins/local3.0 (from r251797, head/tools/regression/bin/sh/builtins/local3.0) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/local3.0 Wed
svn commit: r252614 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 21:45:29 2013 New Revision: 252614 URL: http://svnweb.freebsd.org/changeset/base/252614 Log: MFp4 @229470: Remove unused argument from send_packet(). Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcpd.h Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 21:43:41 2013(r252613) +++ head/sbin/dhclient/bpf.cWed Jul 3 21:45:29 2013(r252614) @@ -251,8 +251,7 @@ if_register_receive(struct interface_inf ssize_t send_packet(struct interface_info *interface, struct dhcp_packet *raw, -size_t len, struct in_addr from, struct sockaddr_in *to, -struct hardware *hto) +size_t len, struct in_addr from, struct sockaddr_in *to) { unsigned char buf[256]; struct iovec iov[2]; @@ -261,7 +260,7 @@ send_packet(struct interface_info *inter /* Assemble the headers... */ if (to-sin_addr.s_addr == INADDR_BROADCAST) - assemble_hw_header(interface, buf, bufp, hto); + assemble_hw_header(interface, buf, bufp, NULL); assemble_udp_ip_header(buf, bufp, from.s_addr, to-sin_addr.s_addr, to-sin_port, (unsigned char *)raw, len); Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 21:43:41 2013 (r252613) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 21:45:29 2013 (r252614) @@ -1232,7 +1232,7 @@ again: /* Send out a packet. */ (void)send_packet(ip, ip-client-packet, ip-client-packet_length, - inaddr_any, sockaddr_broadcast, NULL); + inaddr_any, sockaddr_broadcast); add_timeout(cur_time + ip-client-interval, send_discover, ip); } @@ -1463,7 +1463,7 @@ cancel: /* Send out a packet. */ (void) send_packet(ip, ip-client-packet, ip-client-packet_length, - from, destination, NULL); + from, destination); add_timeout(cur_time + ip-client-interval, send_request, ip); } @@ -1479,7 +1479,7 @@ send_decline(void *ipp) /* Send out a packet. */ (void) send_packet(ip, ip-client-packet, ip-client-packet_length, - inaddr_any, sockaddr_broadcast, NULL); + inaddr_any, sockaddr_broadcast); } void Modified: head/sbin/dhclient/dhcpd.h == --- head/sbin/dhclient/dhcpd.h Wed Jul 3 21:43:41 2013(r252613) +++ head/sbin/dhclient/dhcpd.h Wed Jul 3 21:45:29 2013(r252614) @@ -301,7 +301,7 @@ int if_register_bpf(struct interface_inf void if_register_send(struct interface_info *); void if_register_receive(struct interface_info *); ssize_t send_packet(struct interface_info *, struct dhcp_packet *, size_t, -struct in_addr, struct sockaddr_in *, struct hardware *); +struct in_addr, struct sockaddr_in *); ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252615 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 21:49:10 2013 New Revision: 252615 URL: http://svnweb.freebsd.org/changeset/base/252615 Log: MFp4 @229471: Remove unused argument from assemble_hw_header(). Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c head/sbin/dhclient/dhcpd.h head/sbin/dhclient/packet.c Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 21:45:29 2013(r252614) +++ head/sbin/dhclient/bpf.cWed Jul 3 21:49:10 2013(r252615) @@ -260,7 +260,7 @@ send_packet(struct interface_info *inter /* Assemble the headers... */ if (to-sin_addr.s_addr == INADDR_BROADCAST) - assemble_hw_header(interface, buf, bufp, NULL); + assemble_hw_header(interface, buf, bufp); assemble_udp_ip_header(buf, bufp, from.s_addr, to-sin_addr.s_addr, to-sin_port, (unsigned char *)raw, len); Modified: head/sbin/dhclient/dhcpd.h == --- head/sbin/dhclient/dhcpd.h Wed Jul 3 21:45:29 2013(r252614) +++ head/sbin/dhclient/dhcpd.h Wed Jul 3 21:49:10 2013(r252615) @@ -405,8 +405,7 @@ void bootp(struct packet *); void dhcp(struct packet *); /* packet.c */ -void assemble_hw_header(struct interface_info *, unsigned char *, -int *, struct hardware *); +void assemble_hw_header(struct interface_info *, unsigned char *, int *); void assemble_udp_ip_header(unsigned char *, int *, u_int32_t, u_int32_t, unsigned int, unsigned char *, int); ssize_t decode_hw_header(unsigned char *, int, struct hardware *); Modified: head/sbin/dhclient/packet.c == --- head/sbin/dhclient/packet.c Wed Jul 3 21:45:29 2013(r252614) +++ head/sbin/dhclient/packet.c Wed Jul 3 21:49:10 2013(r252615) @@ -90,14 +90,11 @@ wrapsum(u_int32_t sum) void assemble_hw_header(struct interface_info *interface, unsigned char *buf, -int *bufix, struct hardware *to) +int *bufix) { struct ether_header eh; - if (to != NULL to-hlen == 6) /* XXX */ - memcpy(eh.ether_dhost, to-haddr, sizeof(eh.ether_dhost)); - else - memset(eh.ether_dhost, 0xff, sizeof(eh.ether_dhost)); + memset(eh.ether_dhost, 0xff, sizeof(eh.ether_dhost)); if (interface-hw_address.hlen == sizeof(eh.ether_shost)) memcpy(eh.ether_shost, interface-hw_address.haddr, sizeof(eh.ether_shost)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252616 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 21:53:54 2013 New Revision: 252616 URL: http://svnweb.freebsd.org/changeset/base/252616 Log: MFp4 @229472: Use the same type for 'from' and 'to' argument in send_packet(). Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcpd.h Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 21:49:10 2013(r252615) +++ head/sbin/dhclient/bpf.cWed Jul 3 21:53:54 2013(r252616) @@ -251,7 +251,7 @@ if_register_receive(struct interface_inf ssize_t send_packet(struct interface_info *interface, struct dhcp_packet *raw, -size_t len, struct in_addr from, struct sockaddr_in *to) +size_t len, struct in_addr from, struct in_addr to) { unsigned char buf[256]; struct iovec iov[2]; @@ -259,10 +259,10 @@ send_packet(struct interface_info *inter int result, bufp = 0; /* Assemble the headers... */ - if (to-sin_addr.s_addr == INADDR_BROADCAST) + if (to.s_addr == INADDR_BROADCAST) assemble_hw_header(interface, buf, bufp); - assemble_udp_ip_header(buf, bufp, from.s_addr, - to-sin_addr.s_addr, to-sin_port, (unsigned char *)raw, len); + assemble_udp_ip_header(buf, bufp, from.s_addr, to.s_addr, + htons(REMOTE_PORT), (unsigned char *)raw, len); iov[0].iov_base = (char *)buf; iov[0].iov_len = bufp; @@ -270,12 +270,19 @@ send_packet(struct interface_info *inter iov[1].iov_len = len; /* Fire it off */ - if (to-sin_addr.s_addr == INADDR_BROADCAST) + if (to.s_addr == INADDR_BROADCAST) result = writev(interface-wfdesc, iov, 2); else { + struct sockaddr_in sato; + + sato.sin_addr = to; + sato.sin_port = htons(REMOTE_PORT); + sato.sin_family = AF_INET; + sato.sin_len = sizeof(sato); + memset(msg, 0, sizeof(msg)); - msg.msg_name = (struct sockaddr *)to; - msg.msg_namelen = sizeof(*to); + msg.msg_name = (struct sockaddr *)sato; + msg.msg_namelen = sizeof(sato); msg.msg_iov = iov; msg.msg_iovlen = 2; result = sendmsg(interface-ufdesc, msg, 0); Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 21:49:10 2013 (r252615) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 21:53:54 2013 (r252616) @@ -92,8 +92,7 @@ int privfd; int nullfd = -1; struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; -struct in_addr inaddr_any; -struct sockaddr_in sockaddr_broadcast; +struct in_addr inaddr_any, inaddr_broadcast; char *path_dhclient_pidfile; struct pidfh *pidfile; @@ -410,11 +409,7 @@ main(int argc, char *argv[]) tzset(); time(cur_time); - memset(sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); - sockaddr_broadcast.sin_family = AF_INET; - sockaddr_broadcast.sin_port = htons(REMOTE_PORT); - sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; - sockaddr_broadcast.sin_len = sizeof(sockaddr_broadcast); + inaddr_broadcast.s_addr = INADDR_BROADCAST; inaddr_any.s_addr = INADDR_ANY; read_client_conf(); @@ -1226,13 +1221,12 @@ again: ip-client-secs = ip-client-packet.secs; note(DHCPDISCOVER on %s to %s port %d interval %d, - ip-name, inet_ntoa(sockaddr_broadcast.sin_addr), - ntohs(sockaddr_broadcast.sin_port), + ip-name, inet_ntoa(inaddr_broadcast), REMOTE_PORT, (int)ip-client-interval); /* Send out a packet. */ (void)send_packet(ip, ip-client-packet, ip-client-packet_length, - inaddr_any, sockaddr_broadcast); + inaddr_any, inaddr_broadcast); add_timeout(cur_time + ip-client-interval, send_discover, ip); } @@ -1340,8 +1334,7 @@ void send_request(void *ipp) { struct interface_info *ip = ipp; - struct sockaddr_in destination; - struct in_addr from; + struct in_addr from, to; int interval; /* Figure out how long it's been since we started transmitting. */ @@ -1429,18 +1422,13 @@ cancel: /* If the lease T2 time has elapsed, or if we're not yet bound, broadcast the DHCPREQUEST rather than unicasting. */ - memset(destination, 0, sizeof(destination)); if (ip-client-state == S_REQUESTING || ip-client-state == S_REBOOTING || cur_time ip-client-active-rebind) - destination.sin_addr.s_addr = INADDR_BROADCAST; + to.s_addr = INADDR_BROADCAST; else -
svn commit: r252617 - in stable/9: bin/sh tools/regression/bin/sh/builtins
Author: jilles Date: Wed Jul 3 21:56:25 2013 New Revision: 252617 URL: http://svnweb.freebsd.org/changeset/base/252617 Log: MFC r248349: sh: Recognize -- and explicitly reject options in wait builtin. If syntactically invalid job identifiers are to be taken as jobs that exited with status 127, this should not apply to options, so that we can add options later if need be. Added: stable/9/tools/regression/bin/sh/builtins/wait6.0 - copied unchanged from r248349, head/tools/regression/bin/sh/builtins/wait6.0 stable/9/tools/regression/bin/sh/builtins/wait7.0 - copied unchanged from r248349, head/tools/regression/bin/sh/builtins/wait7.0 Modified: stable/9/bin/sh/jobs.c Directory Properties: stable/9/bin/sh/ (props changed) stable/9/tools/regression/bin/sh/ (props changed) Modified: stable/9/bin/sh/jobs.c == --- stable/9/bin/sh/jobs.c Wed Jul 3 21:53:54 2013(r252616) +++ stable/9/bin/sh/jobs.c Wed Jul 3 21:56:25 2013(r252617) @@ -459,14 +459,15 @@ freejob(struct job *jp) int -waitcmd(int argc, char **argv) +waitcmd(int argc __unused, char **argv __unused) { struct job *job; int status, retval; struct job *jp; - if (argc 1) { - job = getjob(argv[1]); + nextopt(); + if (*argptr != NULL) { + job = getjob(*argptr); } else { job = NULL; } Copied: stable/9/tools/regression/bin/sh/builtins/wait6.0 (from r248349, head/tools/regression/bin/sh/builtins/wait6.0) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/wait6.0 Wed Jul 3 21:56:25 2013(r252617, copy of r248349, head/tools/regression/bin/sh/builtins/wait6.0) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +wait -- Copied: stable/9/tools/regression/bin/sh/builtins/wait7.0 (from r248349, head/tools/regression/bin/sh/builtins/wait7.0) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/bin/sh/builtins/wait7.0 Wed Jul 3 21:56:25 2013(r252617, copy of r248349, head/tools/regression/bin/sh/builtins/wait7.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +: +wait -- $! ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252618 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 21:57:24 2013 New Revision: 252618 URL: http://svnweb.freebsd.org/changeset/base/252618 Log: MFp4 @229473: No caller checks send_packet() return value, so make it void. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcpd.h Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 21:56:25 2013(r252617) +++ head/sbin/dhclient/bpf.cWed Jul 3 21:57:24 2013(r252618) @@ -249,7 +249,7 @@ if_register_receive(struct interface_inf error(Cannot lock bpf); } -ssize_t +void send_packet(struct interface_info *interface, struct dhcp_packet *raw, size_t len, struct in_addr from, struct in_addr to) { @@ -290,7 +290,6 @@ send_packet(struct interface_info *inter if (result 0) warning(send_packet: %m); - return (result); } ssize_t Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 21:56:25 2013 (r252617) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 21:57:24 2013 (r252618) @@ -1225,7 +1225,7 @@ again: (int)ip-client-interval); /* Send out a packet. */ - (void)send_packet(ip, ip-client-packet, ip-client-packet_length, + send_packet(ip, ip-client-packet, ip-client-packet_length, inaddr_any, inaddr_broadcast); add_timeout(cur_time + ip-client-interval, send_discover, ip); @@ -1450,7 +1450,7 @@ cancel: REMOTE_PORT); /* Send out a packet. */ - (void) send_packet(ip, ip-client-packet, ip-client-packet_length, + send_packet(ip, ip-client-packet, ip-client-packet_length, from, to); add_timeout(cur_time + ip-client-interval, send_request, ip); @@ -1465,7 +1465,7 @@ send_decline(void *ipp) inet_ntoa(inaddr_broadcast), REMOTE_PORT); /* Send out a packet. */ - (void) send_packet(ip, ip-client-packet, ip-client-packet_length, + send_packet(ip, ip-client-packet, ip-client-packet_length, inaddr_any, inaddr_broadcast); } Modified: head/sbin/dhclient/dhcpd.h == --- head/sbin/dhclient/dhcpd.h Wed Jul 3 21:56:25 2013(r252617) +++ head/sbin/dhclient/dhcpd.h Wed Jul 3 21:57:24 2013(r252618) @@ -300,7 +300,7 @@ struct hash_bucket *new_hash_bucket(void int if_register_bpf(struct interface_info *); void if_register_send(struct interface_info *); void if_register_receive(struct interface_info *); -ssize_t send_packet(struct interface_info *, struct dhcp_packet *, size_t, +void send_packet(struct interface_info *, struct dhcp_packet *, size_t, struct in_addr, struct in_addr); ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, struct sockaddr_in *, struct hardware *); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252619 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 21:58:26 2013 New Revision: 252619 URL: http://svnweb.freebsd.org/changeset/base/252619 Log: MFp4 @229474: iov_base field is 'void *' in FreeBSD, no need to cast. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 21:57:24 2013(r252618) +++ head/sbin/dhclient/bpf.cWed Jul 3 21:58:26 2013(r252619) @@ -264,9 +264,9 @@ send_packet(struct interface_info *inter assemble_udp_ip_header(buf, bufp, from.s_addr, to.s_addr, htons(REMOTE_PORT), (unsigned char *)raw, len); - iov[0].iov_base = (char *)buf; + iov[0].iov_base = buf; iov[0].iov_len = bufp; - iov[1].iov_base = (char *)raw; + iov[1].iov_base = raw; iov[1].iov_len = len; /* Fire it off */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252620 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:01:52 2013 New Revision: 252620 URL: http://svnweb.freebsd.org/changeset/base/252620 Log: MFp4 @229476,229478: Make use of two fields: rfdesc and wfdesc to keep bpf descriptor open for reading only in rfdesc and bpf descriptor open for writing only in wfdesc. In the end they will be used by two different processes. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c head/sbin/dhclient/dhcpd.h Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 21:58:26 2013(r252619) +++ head/sbin/dhclient/bpf.cWed Jul 3 22:01:52 2013(r252620) @@ -61,15 +61,15 @@ __FBSDID($FreeBSD$); * mask. */ int -if_register_bpf(struct interface_info *info) +if_register_bpf(struct interface_info *info, int flags) { char filename[50]; int sock, b; /* Open a BPF device */ - for (b = 0; 1; b++) { + for (b = 0;; b++) { snprintf(filename, sizeof(filename), BPF_FORMAT, b); - sock = open(filename, O_RDWR, 0); + sock = open(filename, flags); if (sock 0) { if (errno == EBUSY) continue; @@ -87,16 +87,76 @@ if_register_bpf(struct interface_info *i return (sock); } +/* + * Packet write filter program: + * 'ip and udp and src port bootps and dst port (bootps or bootpc)' + */ +struct bpf_insn dhcp_bpf_wfilter[] = { + BPF_STMT(BPF_LD + BPF_B + BPF_IND, 14), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (IPVERSION 4) + 5, 0, 12), + + /* Make sure this is an IP packet... */ + BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 10), + + /* Make sure it's a UDP packet... */ + BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 23), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 8), + + /* Make sure this isn't a fragment... */ + BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 20), + BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 6, 0), /* patched */ + + /* Get the IP header length... */ + BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 14), + + /* Make sure it's from the right port... */ + BPF_STMT(BPF_LD + BPF_H + BPF_IND, 14), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 68, 0, 3), + + /* Make sure it is to the right ports ... */ + BPF_STMT(BPF_LD + BPF_H + BPF_IND, 16), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), + + /* If we passed all the tests, ask for the whole packet. */ + BPF_STMT(BPF_RET+BPF_K, (u_int)-1), + + /* Otherwise, drop it. */ + BPF_STMT(BPF_RET+BPF_K, 0), +}; + +int dhcp_bpf_wfilter_len = sizeof(dhcp_bpf_wfilter) / sizeof(struct bpf_insn); + void if_register_send(struct interface_info *info) { + struct bpf_version v; + struct bpf_program p; int sock, on = 1; - /* -* If we're using the bpf API for sending and receiving, we -* don't need to register this interface twice. -*/ - info-wfdesc = info-rfdesc; + /* Open a BPF device and hang it on this interface... */ + info-wfdesc = if_register_bpf(info, O_WRONLY); + + /* Make sure the BPF version is in range... */ + if (ioctl(info-wfdesc, BIOCVERSION, v) 0) + error(Can't get BPF version: %m); + + if (v.bv_major != BPF_MAJOR_VERSION || + v.bv_minor BPF_MINOR_VERSION) + error(Kernel BPF version out of range - recompile dhcpd!); + + /* Set up the bpf write filter program structure. */ + p.bf_len = dhcp_bpf_wfilter_len; + p.bf_insns = dhcp_bpf_wfilter; + + if (dhcp_bpf_wfilter[7].k == 0x1fff) + dhcp_bpf_wfilter[7].k = htons(IP_MF|IP_OFFMASK); + + if (ioctl(info-wfdesc, BIOCSETWF, p) 0) + error(Can't install write filter program: %m); + + if (ioctl(info-wfdesc, BIOCLOCK, NULL) 0) + error(Cannot lock bpf); /* * Use raw socket for unicast send. @@ -144,46 +204,6 @@ struct bpf_insn dhcp_bpf_filter[] = { int dhcp_bpf_filter_len = sizeof(dhcp_bpf_filter) / sizeof(struct bpf_insn); -/* - * Packet write filter program: - * 'ip and udp and src port bootps and dst port (bootps or bootpc)' - */ -struct bpf_insn dhcp_bpf_wfilter[] = { - BPF_STMT(BPF_LD + BPF_B + BPF_IND, 14), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, (IPVERSION 4) + 5, 0, 12), - - /* Make sure this is an IP packet... */ - BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 12), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETHERTYPE_IP, 0, 10), - - /* Make sure it's a UDP packet... */ - BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 23), - BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 8), - - /* Make sure this isn't a fragment... */ - BPF_STMT(BPF_LD + BPF_H +
svn commit: r252621 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:03:19 2013 New Revision: 252621 URL: http://svnweb.freebsd.org/changeset/base/252621 Log: Remove redundant white-spaces. Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:01:52 2013 (r252620) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:03:19 2013 (r252621) @@ -1523,7 +1523,7 @@ make_discover(struct interface_info *ip, ip-client-config-send_options[i].len; options[i]-timeout = 0x; } - + /* send host name if not set via config file. */ char hostname[_POSIX_HOST_NAME_MAX+1]; if (!options[DHO_HOST_NAME]) { @@ -1548,7 +1548,7 @@ make_discover(struct interface_info *ip, int hwlen = (ip-hw_address.hlen sizeof(client_ident)-1) ? ip-hw_address.hlen : sizeof(client_ident)-1; client_ident[0] = ip-hw_address.htype; - memcpy(client_ident[1], ip-hw_address.haddr, hwlen); + memcpy(client_ident[1], ip-hw_address.haddr, hwlen); options[DHO_DHCP_CLIENT_IDENTIFIER] = option_elements[DHO_DHCP_CLIENT_IDENTIFIER]; options[DHO_DHCP_CLIENT_IDENTIFIER]-value = client_ident; options[DHO_DHCP_CLIENT_IDENTIFIER]-len = hwlen+1; @@ -1647,7 +1647,7 @@ make_request(struct interface_info *ip, ip-client-config-send_options[i].len; options[i]-timeout = 0x; } - + /* send host name if not set via config file. */ char hostname[_POSIX_HOST_NAME_MAX+1]; if (!options[DHO_HOST_NAME]) { @@ -1672,7 +1672,7 @@ make_request(struct interface_info *ip, int hwlen = (ip-hw_address.hlen sizeof(client_ident)-1) ? ip-hw_address.hlen : sizeof(client_ident)-1; client_ident[0] = ip-hw_address.htype; - memcpy(client_ident[1], ip-hw_address.haddr, hwlen); + memcpy(client_ident[1], ip-hw_address.haddr, hwlen); options[DHO_DHCP_CLIENT_IDENTIFIER] = option_elements[DHO_DHCP_CLIENT_IDENTIFIER]; options[DHO_DHCP_CLIENT_IDENTIFIER]-value = client_ident; options[DHO_DHCP_CLIENT_IDENTIFIER]-len = hwlen+1; @@ -2489,19 +2489,19 @@ check_classless_option(unsigned char *da i += 4; continue; } else if (width 9) { - addr = (in_addr_t)(data[i] 24); + addr = (in_addr_t)(data[i] 24); i += 1; } else if (width 17) { - addr = (in_addr_t)(data[i] 24) + + addr = (in_addr_t)(data[i] 24) + (in_addr_t)(data[i + 1] 16); i += 2; } else if (width 25) { - addr = (in_addr_t)(data[i] 24) + + addr = (in_addr_t)(data[i] 24) + (in_addr_t)(data[i + 1] 16) + (in_addr_t)(data[i + 2] 8); i += 3; } else if (width 33) { - addr = (in_addr_t)(data[i] 24) + + addr = (in_addr_t)(data[i] 24) + (in_addr_t)(data[i + 1] 16) + (in_addr_t)(data[i + 2] 8) + data[i + 3]; @@ -2525,7 +2525,7 @@ check_classless_option(unsigned char *da addr = mask; data[i - 1] = (unsigned char)( (addr (((32 - width)/8)*8)) 0xFF); - } + } i += 4; } if (i len) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252622 - stable/9/lib/libc/sys
Author: jilles Date: Wed Jul 3 22:04:35 2013 New Revision: 252622 URL: http://svnweb.freebsd.org/changeset/base/252622 Log: MFC r248774: accept(2): Mention inheritance of O_ASYNC and signal destination. While almost nobody uses O_ASYNC, and rightly so, the inheritance of the related properties across accept() is a portability issue like the inheritance of O_NONBLOCK. Modified: stable/9/lib/libc/sys/accept.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/accept.2 == --- stable/9/lib/libc/sys/accept.2 Wed Jul 3 22:03:19 2013 (r252621) +++ stable/9/lib/libc/sys/accept.2 Wed Jul 3 22:04:35 2013 (r252622) @@ -28,7 +28,7 @@ .\ @(#)accept.2 8.2 (Berkeley) 12/11/93 .\ $FreeBSD$ .\ -.Dd December 11, 1993 +.Dd March 26, 2013 .Dt ACCEPT 2 .Os .Sh NAME @@ -57,7 +57,13 @@ queue of pending connections, creates a and allocates a new file descriptor for the socket which inherits the state of the .Dv O_NONBLOCK -property from the original socket +and +.Dv O_ASYNC +properties and the destination of +.Dv SIGIO +and +.Dv SIGURG +signals from the original socket .Fa s . .Pp If no pending connections are @@ -129,7 +135,11 @@ to pre-process incoming connections. .Pp Portable programs should not rely on the .Dv O_NONBLOCK -property being inherited. +and +.Dv O_ASYNC +properties and the signal destination being inherited, +but should set them explicitly using +.Xr fcntl 2 . .Sh RETURN VALUES The call returns \-1 on error. If it succeeds, it returns a non-negative ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252623 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:05:36 2013 New Revision: 252623 URL: http://svnweb.freebsd.org/changeset/base/252623 Log: MFp4 @229477: The gethostname(3) function won't work in capability mode, because reading kern.hostname sysctl is not permitted there. Cache hostname early and use cached value later. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:04:35 2013 (r252622) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:05:36 2013 (r252623) @@ -91,6 +91,8 @@ int log_perror = 1; int privfd; int nullfd = -1; +char hostname[_POSIX_HOST_NAME_MAX + 1]; + struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; struct in_addr inaddr_any, inaddr_broadcast; @@ -446,6 +448,13 @@ main(int argc, char *argv[]) error(no such user: nobody); } + /* +* Obtain hostname before entering capability mode - it won't be +* possible then, as reading kern.hostname is not permitted. +*/ + if (gethostname(hostname, sizeof(hostname)) 0) + hostname[0] = '\0'; + if (pipe(pipe_fd) == -1) error(pipe); @@ -1525,9 +1534,8 @@ make_discover(struct interface_info *ip, } /* send host name if not set via config file. */ - char hostname[_POSIX_HOST_NAME_MAX+1]; if (!options[DHO_HOST_NAME]) { - if (gethostname(hostname, sizeof(hostname)) == 0) { + if (hostname[0] != '\0') { size_t len; char* posDot = strchr(hostname, '.'); if (posDot != NULL) @@ -1649,9 +1657,8 @@ make_request(struct interface_info *ip, } /* send host name if not set via config file. */ - char hostname[_POSIX_HOST_NAME_MAX+1]; if (!options[DHO_HOST_NAME]) { - if (gethostname(hostname, sizeof(hostname)) == 0) { + if (hostname[0] != '\0') { size_t len; char* posDot = strchr(hostname, '.'); if (posDot != NULL) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252624 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:07:55 2013 New Revision: 252624 URL: http://svnweb.freebsd.org/changeset/base/252624 Log: MFp4 @229479: - Add new request (IMSG_SEND_PACKET) that will be handled by privileged process. - Add $FreeBSD$. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/privsep.h Modified: head/sbin/dhclient/privsep.h == --- head/sbin/dhclient/privsep.hWed Jul 3 22:05:36 2013 (r252623) +++ head/sbin/dhclient/privsep.hWed Jul 3 22:07:55 2013 (r252624) @@ -14,6 +14,8 @@ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ */ #include sys/types.h @@ -33,7 +35,8 @@ enum imsg_code { IMSG_SCRIPT_INIT, IMSG_SCRIPT_WRITE_PARAMS, IMSG_SCRIPT_GO, - IMSG_SCRIPT_GO_RET + IMSG_SCRIPT_GO_RET, + IMSG_SEND_PACKET }; struct imsg_hdr { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252625 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:09:02 2013 New Revision: 252625 URL: http://svnweb.freebsd.org/changeset/base/252625 Log: MFp4 @229480: Shutdown write direction of the routing socket. We only need to read from it. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:07:55 2013 (r252624) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:09:02 2013 (r252625) @@ -476,6 +476,8 @@ main(int argc, char *argv[]) if ((routefd = socket(PF_ROUTE, SOCK_RAW, 0)) != -1) add_protocol(AF_ROUTE, routefd, routehandler, ifi); + if (shutdown(routefd, SHUT_WR) 0) + error(can't shutdown route socket: %m); /* set up the interface */ discover_interfaces(ifi); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252626 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:12:54 2013 New Revision: 252626 URL: http://svnweb.freebsd.org/changeset/base/252626 Log: MFp4 @229481: Currently it was allowed to send any UDP packets from unprivileged process and possibly any packets because /dev/bpf was open for writing. Move sending packets to privileged process. Unprivileged process has no longer access to not connected UDP socket and has only access to /dev/bpf in read-only mode. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcpd.h head/sbin/dhclient/privsep.c Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 22:09:02 2013(r252625) +++ head/sbin/dhclient/bpf.cWed Jul 3 22:12:54 2013(r252626) @@ -44,6 +44,7 @@ __FBSDID($FreeBSD$); #include dhcpd.h +#include privsep.h #include sys/ioctl.h #include sys/uio.h @@ -260,23 +261,67 @@ if_register_receive(struct interface_inf } void -send_packet(struct interface_info *interface, struct dhcp_packet *raw, -size_t len, struct in_addr from, struct in_addr to) +send_packet_unpriv(int privfd, struct dhcp_packet *raw, size_t len, +struct in_addr from, struct in_addr to) +{ + struct imsg_hdr hdr; + struct buf *buf; + int errs; + + hdr.code = IMSG_SEND_PACKET; + hdr.len = sizeof(hdr) + + sizeof(size_t) + len + + sizeof(from) + sizeof(to); + + if ((buf = buf_open(hdr.len)) == NULL) + error(buf_open: %m); + + errs = 0; + errs += buf_add(buf, hdr, sizeof(hdr)); + errs += buf_add(buf, len, sizeof(len)); + errs += buf_add(buf, raw, len); + errs += buf_add(buf, from, sizeof(from)); + errs += buf_add(buf, to, sizeof(to)); + if (errs) + error(buf_add: %m); + + if (buf_close(privfd, buf) == -1) + error(buf_close: %m); +} + +void +send_packet_priv(struct interface_info *interface, struct imsg_hdr *hdr, int fd) { unsigned char buf[256]; struct iovec iov[2]; struct msghdr msg; + struct dhcp_packet raw; + size_t len; + struct in_addr from, to; int result, bufp = 0; + if (hdr-len sizeof(*hdr) + sizeof(size_t)) + error(corrupted message received); + buf_read(fd, len, sizeof(len)); + if (hdr-len != sizeof(*hdr) + sizeof(size_t) + len + + sizeof(from) + sizeof(to)) { + error(corrupted message received); + } + if (len sizeof(raw)) + error(corrupted message received); + buf_read(fd, raw, len); + buf_read(fd, from, sizeof(from)); + buf_read(fd, to, sizeof(to)); + /* Assemble the headers... */ if (to.s_addr == INADDR_BROADCAST) assemble_hw_header(interface, buf, bufp); assemble_udp_ip_header(buf, bufp, from.s_addr, to.s_addr, - htons(REMOTE_PORT), (unsigned char *)raw, len); + htons(REMOTE_PORT), (unsigned char *)raw, len); iov[0].iov_base = buf; iov[0].iov_len = bufp; - iov[1].iov_base = raw; + iov[1].iov_base = raw; iov[1].iov_len = len; /* Fire it off */ Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:09:02 2013 (r252625) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:12:54 2013 (r252626) @@ -455,11 +455,19 @@ main(int argc, char *argv[]) if (gethostname(hostname, sizeof(hostname)) 0) hostname[0] = '\0'; + /* set up the interface */ + discover_interfaces(ifi); + if (pipe(pipe_fd) == -1) error(pipe); fork_privchld(pipe_fd[0], pipe_fd[1]); + close(ifi-ufdesc); + ifi-ufdesc = -1; + close(ifi-wfdesc); + ifi-wfdesc = -1; + close(pipe_fd[0]); privfd = pipe_fd[1]; @@ -479,9 +487,6 @@ main(int argc, char *argv[]) if (shutdown(routefd, SHUT_WR) 0) error(can't shutdown route socket: %m); - /* set up the interface */ - discover_interfaces(ifi); - if (chroot(_PATH_VAREMPTY) == -1) error(chroot); if (chdir(/) == -1) @@ -1236,8 +1241,8 @@ again: (int)ip-client-interval); /* Send out a packet. */ - send_packet(ip, ip-client-packet, ip-client-packet_length, - inaddr_any, inaddr_broadcast); + send_packet_unpriv(privfd, ip-client-packet, + ip-client-packet_length, inaddr_any, inaddr_broadcast); add_timeout(cur_time + ip-client-interval, send_discover, ip); } @@ -1461,8 +1466,8 @@ cancel: REMOTE_PORT); /* Send out a packet. */ - send_packet(ip,
svn commit: r252627 - stable/9/lib/libc/sys
Author: jilles Date: Wed Jul 3 22:14:12 2013 New Revision: 252627 URL: http://svnweb.freebsd.org/changeset/base/252627 Log: MFC r251181: fork(2): #include sys/types.h is not needed. Modified: stable/9/lib/libc/sys/fork.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/fork.2 == --- stable/9/lib/libc/sys/fork.2Wed Jul 3 22:12:54 2013 (r252626) +++ stable/9/lib/libc/sys/fork.2Wed Jul 3 22:14:12 2013 (r252627) @@ -28,7 +28,7 @@ .\@(#)fork.2 8.1 (Berkeley) 6/4/93 .\ $FreeBSD$ .\ -.Dd June 4, 1993 +.Dd May 31, 2013 .Dt FORK 2 .Os .Sh NAME @@ -37,7 +37,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In unistd.h .Ft pid_t .Fn fork void ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252628 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:16:02 2013 New Revision: 252628 URL: http://svnweb.freebsd.org/changeset/base/252628 Log: MFp4 @229482: - Limit bpf descriptor in unprivileged process to CAP_POLL_EVENT, CAP_READ and allow for SIOCGIFFLAGS, SIOCGIFMEDIA ioctls. - While here limit bpf descriptor in privileged process to only CAP_WRITE. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/bpf.c Modified: head/sbin/dhclient/bpf.c == --- head/sbin/dhclient/bpf.cWed Jul 3 22:14:12 2013(r252627) +++ head/sbin/dhclient/bpf.cWed Jul 3 22:16:02 2013(r252628) @@ -45,6 +45,7 @@ __FBSDID($FreeBSD$); #include dhcpd.h #include privsep.h +#include sys/capability.h #include sys/ioctl.h #include sys/uio.h @@ -159,6 +160,9 @@ if_register_send(struct interface_info * if (ioctl(info-wfdesc, BIOCLOCK, NULL) 0) error(Cannot lock bpf); + if (cap_rights_limit(info-wfdesc, CAP_WRITE) 0 errno != ENOSYS) + error(Can't limit bpf descriptor: %m); + /* * Use raw socket for unicast send. */ @@ -208,6 +212,7 @@ int dhcp_bpf_filter_len = sizeof(dhcp_bp void if_register_receive(struct interface_info *info) { + static const unsigned long cmds[2] = { SIOCGIFFLAGS, SIOCGIFMEDIA }; struct bpf_version v; struct bpf_program p; int flag = 1, sz; @@ -258,6 +263,13 @@ if_register_receive(struct interface_inf if (ioctl(info-rfdesc, BIOCLOCK, NULL) 0) error(Cannot lock bpf); + + if (cap_rights_limit(info-rfdesc, + CAP_IOCTL | CAP_POLL_EVENT | CAP_READ) 0 errno != ENOSYS) { + error(Can't limit bpf descriptor: %m); + } + if (cap_ioctls_limit(info-rfdesc, cmds, 2) 0 errno != ENOSYS) + error(Can't limit ioctls for bpf descriptor: %m); } void ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252629 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:17:29 2013 New Revision: 252629 URL: http://svnweb.freebsd.org/changeset/base/252629 Log: MFp4 @229483: Limit communication pipe with privileged process to CAP_READ and CAP_WRITE. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:16:02 2013 (r252628) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:17:29 2013 (r252629) @@ -59,6 +59,8 @@ __FBSDID($FreeBSD$); #include dhcpd.h #include privsep.h +#include sys/capability.h + #include net80211/ieee80211_freebsd.h #ifndef _PATH_VAREMPTY @@ -470,6 +472,10 @@ main(int argc, char *argv[]) close(pipe_fd[0]); privfd = pipe_fd[1]; + if (cap_rights_limit(privfd, CAP_READ | CAP_WRITE) 0 + errno != ENOSYS) { + error(can't limit private descriptor: %m); + } if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1) error(can't open and lock %s: %m, path_dhclient_db); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252630 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:18:40 2013 New Revision: 252630 URL: http://svnweb.freebsd.org/changeset/base/252630 Log: MFp4 @229484: Limit routing socket so only poll(2) and read(2) are allowed (CAP_POLL_EVENT and CAP_READ). This prevents unprivileged process from adding, removing or modifying system routes. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:17:29 2013 (r252629) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:18:40 2013 (r252630) @@ -492,6 +492,10 @@ main(int argc, char *argv[]) add_protocol(AF_ROUTE, routefd, routehandler, ifi); if (shutdown(routefd, SHUT_WR) 0) error(can't shutdown route socket: %m); + if (cap_rights_limit(routefd, CAP_POLL_EVENT | CAP_READ) 0 + errno != ENOSYS) { + error(can't limit route socket: %m); + } if (chroot(_PATH_VAREMPTY) == -1) error(chroot); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252631 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:19:43 2013 New Revision: 252631 URL: http://svnweb.freebsd.org/changeset/base/252631 Log: MFp4 @229485: Only allow to overwrite lease file. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:18:40 2013 (r252630) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:19:43 2013 (r252631) @@ -1842,6 +1842,11 @@ rewrite_client_leases(void) leaseFile = fopen(path_dhclient_db, w); if (!leaseFile) error(can't create %s: %m, path_dhclient_db); + if (cap_rights_limit(fileno(leaseFile), CAP_FSTAT | CAP_FSYNC | + CAP_FTRUNCATE | CAP_SEEK | CAP_WRITE) 0 + errno != ENOSYS) { + error(can't limit lease descriptor: %m); + } } else { fflush(leaseFile); rewind(leaseFile); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252632 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:21:11 2013 New Revision: 252632 URL: http://svnweb.freebsd.org/changeset/base/252632 Log: MFp4 @229486: Once PID is written to the pidfile, revoke all capability rights. We just want to keep the pidfile open. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:19:43 2013 (r252631) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:21:11 2013 (r252632) @@ -2363,8 +2363,13 @@ go_daemon(void) if (daemon(1, 0) == -1) error(daemon); - if (pidfile != NULL) + if (pidfile != NULL) { pidfile_write(pidfile); + if (cap_rights_limit(pidfile_fileno(pidfile), CAP_NONE) 0 + errno != ENOSYS) { + error(can't limit pidfile descriptor: %m); + } + } /* we are chrooted, daemon(3) fails to open /dev/null */ if (nullfd != -1) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252633 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:22:29 2013 New Revision: 252633 URL: http://svnweb.freebsd.org/changeset/base/252633 Log: MFp4 @229487: Revoke all capability rights from STDIN and allow only for write to STDOUT and STDERR. All those descriptors are redirected to /dev/null. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:21:11 2013 (r252632) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:22:29 2013 (r252633) @@ -2379,6 +2379,13 @@ go_daemon(void) close(nullfd); nullfd = -1; } + + if (cap_rights_limit(STDIN_FILENO, CAP_NONE) 0 errno != ENOSYS) + error(can't limit stdin: %m); + if (cap_rights_limit(STDOUT_FILENO, CAP_WRITE) 0 errno != ENOSYS) + error(can't limit stdout: %m); + if (cap_rights_limit(STDERR_FILENO, CAP_WRITE) 0 errno != ENOSYS) + error(can't limit stderr: %m); } int ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252634 - head/sbin/dhclient
Author: pjd Date: Wed Jul 3 22:23:25 2013 New Revision: 252634 URL: http://svnweb.freebsd.org/changeset/base/252634 Log: MFp4 @229488: Sandbox unprivileged process using capability mode. Reviewed by: brooks Sponsored by: The FreeBSD Foundation Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Wed Jul 3 22:22:29 2013 (r252633) +++ head/sbin/dhclient/dhclient.c Wed Jul 3 22:23:25 2013 (r252634) @@ -511,6 +511,9 @@ main(int argc, char *argv[]) setproctitle(%s, ifi-name); + if (cap_enter() 0 errno != ENOSYS) + error(can't enter capability mode: %m); + if (immediate_daemon) go_daemon(); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252635 - stable/9/usr.sbin/pkg_install/lib
Author: obrien Date: Wed Jul 3 22:25:00 2013 New Revision: 252635 URL: http://svnweb.freebsd.org/changeset/base/252635 Log: MFC: r252348, r252363: sysconf(3) returns a long, not an int. Modified: stable/9/usr.sbin/pkg_install/lib/exec.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/pkg_install/ (props changed) Modified: stable/9/usr.sbin/pkg_install/lib/exec.c == --- stable/9/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:23:25 2013 (r252634) +++ stable/9/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:25:00 2013 (r252635) @@ -34,7 +34,8 @@ vsystem(const char *fmt, ...) { va_list args; char *cmd; -int ret, maxargs; +long maxargs; +int ret; maxargs = sysconf(_SC_ARG_MAX); maxargs -= 32; /* some slop for the sh -c */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252636 - head/usr.bin/patch
Author: obrien Date: Wed Jul 3 22:44:26 2013 New Revision: 252636 URL: http://svnweb.freebsd.org/changeset/base/252636 Log: Merge r252512 from src/gnu/usr.bin/patch into src/usr.bin/patch: Make it so that 'patch FUBAR' and 'patch -i FUBAR' operate the same. The former makes a copy of stdin, but was not accurately putting the content of stdin into a temp file. This lead to the undercounting the number of lines in hunks containing NUL characters when reading from stdin. Thus resulting in unexpected end of file in patch errors. Modified: head/usr.bin/patch/pch.c Modified: head/usr.bin/patch/pch.c == --- head/usr.bin/patch/pch.cWed Jul 3 22:25:00 2013(r252635) +++ head/usr.bin/patch/pch.cWed Jul 3 22:44:26 2013(r252636) @@ -101,13 +101,17 @@ void open_patch_file(const char *filename) { struct stat filestat; + int nr, nw; if (filename == NULL || *filename == '\0' || strEQ(filename, -)) { pfp = fopen(TMPPATNAME, w); if (pfp == NULL) pfatal(can't create %s, TMPPATNAME); - while (fgets(buf, buf_size, stdin) != NULL) - fputs(buf, pfp); + while ((nr = fread(buf, 1, buf_size, stdin)) 0) { + nw = fwrite(buf, 1, nr, pfp); + if (nr != nw) + pfatal(write error to %s, TMPPATNAME); + } if (ferror(pfp) || fclose(pfp)) pfatal(can't write %s, TMPPATNAME); filename = TMPPATNAME; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252637 - head/usr.bin/patch
Author: obrien Date: Wed Jul 3 22:46:30 2013 New Revision: 252637 URL: http://svnweb.freebsd.org/changeset/base/252637 Log: Merge r252513 from src/gnu/usr.bin/patch into src/usr.bin/patch: Properly handle input lines containing NUL characters such that pgets() accurately fills the read buffer. Callers of pgets() still mis-process the buffer contents if the read line contains NUL characters, but this at least makes pgets() accurate. Modified: head/usr.bin/patch/pch.c Modified: head/usr.bin/patch/pch.c == --- head/usr.bin/patch/pch.cWed Jul 3 22:44:26 2013(r252636) +++ head/usr.bin/patch/pch.cWed Jul 3 22:46:30 2013(r252637) @@ -1204,7 +1204,7 @@ pgets(bool do_indent) indent++; } } - strncpy(buf, line, len - skipped); + memcpy(buf, line, len - skipped); buf[len - skipped] = '\0'; } return len; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252638 - in stable/9/usr.sbin/pkg_install: add create lib
Author: obrien Date: Wed Jul 3 22:57:20 2013 New Revision: 252638 URL: http://svnweb.freebsd.org/changeset/base/252638 Log: Really MFC r252363 (sysconf(3) returns a long, not an int). Modified: stable/9/usr.sbin/pkg_install/add/extract.c stable/9/usr.sbin/pkg_install/create/pl.c stable/9/usr.sbin/pkg_install/lib/exec.c Directory Properties: stable/9/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/pkg_install/ (props changed) stable/9/usr.sbin/pkg_install/add/ (props changed) Modified: stable/9/usr.sbin/pkg_install/add/extract.c == --- stable/9/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:46:30 2013 (r252637) +++ stable/9/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:57:20 2013 (r252638) @@ -110,7 +110,8 @@ extract_plist(const char *home, Package PackingList p = pkg-head; char *last_file, *prefix = NULL; char *where_args, *perm_args, *last_chdir; -int maxargs, where_count = 0, perm_count = 0, add_count; +long maxargs; +int where_count = 0, perm_count = 0, add_count; Boolean preserve; maxargs = sysconf(_SC_ARG_MAX) / 2;/* Just use half the argument space */ Modified: stable/9/usr.sbin/pkg_install/create/pl.c == --- stable/9/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:46:30 2013 (r252637) +++ stable/9/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:57:20 2013 (r252638) @@ -140,7 +140,8 @@ copy_plist(const char *home, Package *pl const char *there = NULL, *mythere; char *where_args, *prefix = NULL; const char *last_chdir, *root = /; -int maxargs, where_count = 0, add_count; +long maxargs; +int where_count = 0, add_count; struct stat stb; dev_t curdir; Modified: stable/9/usr.sbin/pkg_install/lib/exec.c == --- stable/9/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:46:30 2013 (r252637) +++ stable/9/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:57:20 2013 (r252638) @@ -64,7 +64,7 @@ vpipe(const char *fmt, ...) { FILE *fp; char *cmd, *rp; - int maxargs; + long maxargs; va_list args; rp = malloc(MAXPATHLEN); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252639 - in stable/8/usr.sbin/pkg_install: add create lib
Author: obrien Date: Wed Jul 3 22:59:46 2013 New Revision: 252639 URL: http://svnweb.freebsd.org/changeset/base/252639 Log: MF9: r252635, r252638: MFC: r252348, r252363: sysconf(3) returns a long, not an int. Modified: stable/8/usr.sbin/pkg_install/add/extract.c stable/8/usr.sbin/pkg_install/create/pl.c stable/8/usr.sbin/pkg_install/lib/exec.c Directory Properties: stable/8/ (props changed) stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/pkg_install/ (props changed) stable/8/usr.sbin/pkg_install/add/ (props changed) Modified: stable/8/usr.sbin/pkg_install/add/extract.c == --- stable/8/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:57:20 2013 (r252638) +++ stable/8/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:59:46 2013 (r252639) @@ -110,7 +110,8 @@ extract_plist(const char *home, Package PackingList p = pkg-head; char *last_file, *prefix = NULL; char *where_args, *perm_args, *last_chdir; -int maxargs, where_count = 0, perm_count = 0, add_count; +long maxargs; +int where_count = 0, perm_count = 0, add_count; Boolean preserve; maxargs = sysconf(_SC_ARG_MAX) / 2;/* Just use half the argument space */ Modified: stable/8/usr.sbin/pkg_install/create/pl.c == --- stable/8/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:57:20 2013 (r252638) +++ stable/8/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:59:46 2013 (r252639) @@ -140,7 +140,8 @@ copy_plist(const char *home, Package *pl const char *there = NULL, *mythere; char *where_args, *prefix = NULL; const char *last_chdir, *root = /; -int maxargs, where_count = 0, add_count; +long maxargs; +int where_count = 0, add_count; struct stat stb; dev_t curdir; Modified: stable/8/usr.sbin/pkg_install/lib/exec.c == --- stable/8/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:57:20 2013 (r252638) +++ stable/8/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:59:46 2013 (r252639) @@ -34,7 +34,8 @@ vsystem(const char *fmt, ...) { va_list args; char *cmd; -int ret, maxargs; +long maxargs; +int ret; maxargs = sysconf(_SC_ARG_MAX); maxargs -= 32; /* some slop for the sh -c */ @@ -64,7 +65,7 @@ vpipe(const char *fmt, ...) { FILE *fp; char *cmd, *rp; - int maxargs; + long maxargs; va_list args; rp = malloc(MAXPATHLEN); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252640 - in stable/7/usr.sbin/pkg_install: add create lib
Author: obrien Date: Wed Jul 3 23:03:28 2013 New Revision: 252640 URL: http://svnweb.freebsd.org/changeset/base/252640 Log: MF8: r252639 MF9: r252635, r252638: MFC: r252348, r252363: sysconf(3) returns a long, not an int. Modified: stable/7/usr.sbin/pkg_install/add/extract.c stable/7/usr.sbin/pkg_install/create/pl.c stable/7/usr.sbin/pkg_install/lib/exec.c Directory Properties: stable/7/ (props changed) stable/7/usr.sbin/ (props changed) stable/7/usr.sbin/pkg_install/ (props changed) Modified: stable/7/usr.sbin/pkg_install/add/extract.c == --- stable/7/usr.sbin/pkg_install/add/extract.c Wed Jul 3 22:59:46 2013 (r252639) +++ stable/7/usr.sbin/pkg_install/add/extract.c Wed Jul 3 23:03:28 2013 (r252640) @@ -110,7 +110,8 @@ extract_plist(const char *home, Package PackingList p = pkg-head; char *last_file, *prefix = NULL; char *where_args, *perm_args, *last_chdir; -int maxargs, where_count = 0, perm_count = 0, add_count; +long maxargs; +int where_count = 0, perm_count = 0, add_count; Boolean preserve; maxargs = sysconf(_SC_ARG_MAX) / 2;/* Just use half the argument space */ Modified: stable/7/usr.sbin/pkg_install/create/pl.c == --- stable/7/usr.sbin/pkg_install/create/pl.c Wed Jul 3 22:59:46 2013 (r252639) +++ stable/7/usr.sbin/pkg_install/create/pl.c Wed Jul 3 23:03:28 2013 (r252640) @@ -140,7 +140,8 @@ copy_plist(const char *home, Package *pl const char *there = NULL, *mythere; char *where_args, *prefix = NULL; const char *last_chdir, *root = /; -int maxargs, where_count = 0, add_count; +long maxargs; +int where_count = 0, add_count; struct stat stb; dev_t curdir; Modified: stable/7/usr.sbin/pkg_install/lib/exec.c == --- stable/7/usr.sbin/pkg_install/lib/exec.cWed Jul 3 22:59:46 2013 (r252639) +++ stable/7/usr.sbin/pkg_install/lib/exec.cWed Jul 3 23:03:28 2013 (r252640) @@ -34,7 +34,8 @@ vsystem(const char *fmt, ...) { va_list args; char *cmd; -int ret, maxargs; +long maxargs; +int ret; maxargs = sysconf(_SC_ARG_MAX); maxargs -= 32; /* some slop for the sh -c */ @@ -63,7 +64,7 @@ vpipe(const char *fmt, ...) { FILE *fp; char *cmd, *rp; - int maxargs; + long maxargs; va_list args; rp = malloc(MAXPATHLEN); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252641 - head/sys/amd64/vmm
Author: neel Date: Wed Jul 3 23:05:17 2013 New Revision: 252641 URL: http://svnweb.freebsd.org/changeset/base/252641 Log: Verify that all bytes in the instruction buffer are consumed during decoding. Suggested by: grehan Modified: head/sys/amd64/vmm/vmm_instruction_emul.c Modified: head/sys/amd64/vmm/vmm_instruction_emul.c == --- head/sys/amd64/vmm/vmm_instruction_emul.c Wed Jul 3 23:03:28 2013 (r252640) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Wed Jul 3 23:05:17 2013 (r252641) @@ -780,6 +780,19 @@ decode_immediate(struct vie *vie) } /* + * Verify that all the bytes in the instruction buffer were consumed. + */ +static int +verify_inst_length(struct vie *vie) +{ + + if (vie-num_processed == vie-num_valid) + return (0); + else + return (-1); +} + +/* * Verify that the 'guest linear address' provided as collateral of the nested * page table fault matches with our instruction decoding. */ @@ -853,6 +866,9 @@ vmm_decode_instruction(struct vm *vm, in if (decode_immediate(vie)) return (-1); + if (verify_inst_length(vie)) + return (-1); + if (verify_gla(vm, cpuid, gla, vie)) return (-1); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252642 - in stable/6/usr.sbin/pkg_install: add create lib
Author: obrien Date: Wed Jul 3 23:06:58 2013 New Revision: 252642 URL: http://svnweb.freebsd.org/changeset/base/252642 Log: MF7: r252640 MF8: r252639 MF9: r252635, r252638: MFC: r252348, r252363: sysconf(3) returns a long, not an int. Modified: stable/6/usr.sbin/pkg_install/add/extract.c stable/6/usr.sbin/pkg_install/create/pl.c stable/6/usr.sbin/pkg_install/lib/exec.c Directory Properties: stable/6/ (props changed) stable/6/usr.sbin/pkg_install/ (props changed) Modified: stable/6/usr.sbin/pkg_install/add/extract.c == --- stable/6/usr.sbin/pkg_install/add/extract.c Wed Jul 3 23:05:17 2013 (r252641) +++ stable/6/usr.sbin/pkg_install/add/extract.c Wed Jul 3 23:06:58 2013 (r252642) @@ -110,7 +110,8 @@ extract_plist(const char *home, Package PackingList p = pkg-head; char *last_file, *prefix = NULL; char *where_args, *perm_args, *last_chdir; -int maxargs, where_count = 0, perm_count = 0, add_count; +long maxargs; +int where_count = 0, perm_count = 0, add_count; Boolean preserve; maxargs = sysconf(_SC_ARG_MAX) / 2;/* Just use half the argument space */ Modified: stable/6/usr.sbin/pkg_install/create/pl.c == --- stable/6/usr.sbin/pkg_install/create/pl.c Wed Jul 3 23:05:17 2013 (r252641) +++ stable/6/usr.sbin/pkg_install/create/pl.c Wed Jul 3 23:06:58 2013 (r252642) @@ -140,7 +140,8 @@ copy_plist(const char *home, Package *pl const char *there = NULL, *mythere; char *where_args, *prefix = NULL; const char *last_chdir, *root = /; -int maxargs, where_count = 0, add_count; +long maxargs; +int where_count = 0, add_count; struct stat stb; dev_t curdir; Modified: stable/6/usr.sbin/pkg_install/lib/exec.c == --- stable/6/usr.sbin/pkg_install/lib/exec.cWed Jul 3 23:05:17 2013 (r252641) +++ stable/6/usr.sbin/pkg_install/lib/exec.cWed Jul 3 23:06:58 2013 (r252642) @@ -34,7 +34,8 @@ vsystem(const char *fmt, ...) { va_list args; char *cmd; -int ret, maxargs; +long maxargs; +int ret; maxargs = sysconf(_SC_ARG_MAX); maxargs -= 32; /* some slop for the sh -c */ @@ -63,7 +64,7 @@ vpipe(const char *fmt, ...) { FILE *fp; char *cmd, *rp; - int maxargs; + long maxargs; va_list args; rp = malloc(MAXPATHLEN); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r252643 - stable/9/sys/dev/mfi
Author: markj Date: Wed Jul 3 23:15:30 2013 New Revision: 252643 URL: http://svnweb.freebsd.org/changeset/base/252643 Log: MFC r242726 (ambrisko): Add support for SCSI pass through devices to be attached and detached. MFC r251172 (sbruno): xpt_create_path() requires mfi_io_lock to be held, so do it. mfi(4) doesn't panic on host startup now. Modified: stable/9/sys/dev/mfi/mfi.c stable/9/sys/dev/mfi/mfi_cam.c stable/9/sys/dev/mfi/mfivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c == --- stable/9/sys/dev/mfi/mfi.c Wed Jul 3 23:06:58 2013(r252642) +++ stable/9/sys/dev/mfi/mfi.c Wed Jul 3 23:15:30 2013(r252643) @@ -1628,6 +1628,11 @@ mfi_decode_evt(struct mfi_softc *sc, str sx_xunlock(sc-mfi_config_lock); } } + if (sc-mfi_cam_rescan_cb != NULL + (detail-code == MR_EVT_PD_INSERTED || + detail-code == MR_EVT_PD_REMOVED)) { + sc-mfi_cam_rescan_cb(sc, detail-args.pd.device_id); + } break; } } Modified: stable/9/sys/dev/mfi/mfi_cam.c == --- stable/9/sys/dev/mfi/mfi_cam.c Wed Jul 3 23:06:58 2013 (r252642) +++ stable/9/sys/dev/mfi/mfi_cam.c Wed Jul 3 23:15:30 2013 (r252643) @@ -50,7 +50,9 @@ __FBSDID($FreeBSD$); #include cam/cam.h #include cam/cam_ccb.h #include cam/cam_debug.h +#include cam/cam_periph.h #include cam/cam_sim.h +#include cam/cam_xpt_periph.h #include cam/cam_xpt_sim.h #include cam/scsi/scsi_all.h #include cam/scsi/scsi_message.h @@ -63,12 +65,19 @@ __FBSDID($FreeBSD$); #include dev/mfi/mfi_ioctl.h #include dev/mfi/mfivar.h +enum mfip_state { + MFIP_STATE_NONE, + MFIP_STATE_DETACH, + MFIP_STATE_RESCAN +}; + struct mfip_softc { device_tdev; struct mfi_softc *mfi_sc; struct cam_devq *devq; struct cam_sim *sim; struct cam_path *path; + enum mfip_state state; }; static int mfip_probe(device_t); @@ -76,6 +85,7 @@ static intmfip_attach(device_t); static int mfip_detach(device_t); static voidmfip_cam_action(struct cam_sim *, union ccb *); static voidmfip_cam_poll(struct cam_sim *); +static voidmfip_cam_rescan(struct mfi_softc *, uint32_t tid); static struct mfi_command * mfip_start(void *); static voidmfip_done(struct mfi_command *cm); @@ -122,6 +132,7 @@ mfip_attach(device_t dev) mfisc = device_get_softc(device_get_parent(dev)); sc-dev = dev; + sc-state = MFIP_STATE_NONE; sc-mfi_sc = mfisc; mfisc-mfi_cam_start = mfip_start; @@ -138,6 +149,8 @@ mfip_attach(device_t dev) return (EINVAL); } + mfisc-mfi_cam_rescan_cb = mfip_cam_rescan; + mtx_lock(mfisc-mfi_io_lock); if (xpt_bus_register(sc-sim, dev, 0) != 0) { device_printf(dev, XPT bus registration failed\n); @@ -162,6 +175,16 @@ mfip_detach(device_t dev) if (sc == NULL) return (EINVAL); + mtx_lock(sc-mfi_sc-mfi_io_lock); + if (sc-state == MFIP_STATE_RESCAN) { + mtx_unlock(sc-mfi_sc-mfi_io_lock); + return (EBUSY); + } + sc-state = MFIP_STATE_DETACH; + mtx_unlock(sc-mfi_sc-mfi_io_lock); + + sc-mfi_sc-mfi_cam_rescan_cb = NULL; + if (sc-sim != NULL) { mtx_lock(sc-mfi_sc-mfi_io_lock); xpt_bus_deregister(cam_sim_path(sc-sim)); @@ -261,6 +284,57 @@ mfip_cam_action(struct cam_sim *sim, uni return; } +static void +mfip_cam_rescan(struct mfi_softc *sc, uint32_t tid) +{ + union ccb *ccb; + struct mfip_softc *camsc; + struct cam_sim *sim; + device_t mfip_dev; + + mtx_lock(Giant); + mfip_dev = device_find_child(sc-mfi_dev, mfip, -1); + mtx_unlock(Giant); + if (mfip_dev == NULL) { + device_printf(sc-mfi_dev, Couldn't find mfip child device!\n); + return; + } + + mtx_lock(sc-mfi_io_lock); + camsc = device_get_softc(mfip_dev); + if (camsc-state == MFIP_STATE_DETACH) { + mtx_unlock(sc-mfi_io_lock); + return; + } + camsc-state = MFIP_STATE_RESCAN; + mtx_unlock(sc-mfi_io_lock); + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + device_printf(sc-mfi_dev, + Cannot allocate ccb for bus rescan.\n); + return; + } + + sim = camsc-sim; + mtx_lock(sc-mfi_io_lock); + if (xpt_create_path(ccb-ccb_h.path, xpt_periph, cam_sim_path(sim), + tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { +
svn commit: r252644 - stable/8/sys/dev/mfi
Author: markj Date: Wed Jul 3 23:16:33 2013 New Revision: 252644 URL: http://svnweb.freebsd.org/changeset/base/252644 Log: MFC r242726 (ambrisko): Add support for SCSI pass through devices to be attached and detached. MFC r251172 (sbruno): xpt_create_path() requires mfi_io_lock to be held, so do it. mfi(4) doesn't panic on host startup now. Modified: stable/8/sys/dev/mfi/mfi.c stable/8/sys/dev/mfi/mfi_cam.c stable/8/sys/dev/mfi/mfivar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi.c == --- stable/8/sys/dev/mfi/mfi.c Wed Jul 3 23:15:30 2013(r252643) +++ stable/8/sys/dev/mfi/mfi.c Wed Jul 3 23:16:33 2013(r252644) @@ -1628,6 +1628,11 @@ mfi_decode_evt(struct mfi_softc *sc, str sx_xunlock(sc-mfi_config_lock); } } + if (sc-mfi_cam_rescan_cb != NULL + (detail-code == MR_EVT_PD_INSERTED || + detail-code == MR_EVT_PD_REMOVED)) { + sc-mfi_cam_rescan_cb(sc, detail-args.pd.device_id); + } break; } } Modified: stable/8/sys/dev/mfi/mfi_cam.c == --- stable/8/sys/dev/mfi/mfi_cam.c Wed Jul 3 23:15:30 2013 (r252643) +++ stable/8/sys/dev/mfi/mfi_cam.c Wed Jul 3 23:16:33 2013 (r252644) @@ -50,7 +50,9 @@ __FBSDID($FreeBSD$); #include cam/cam.h #include cam/cam_ccb.h #include cam/cam_debug.h +#include cam/cam_periph.h #include cam/cam_sim.h +#include cam/cam_xpt_periph.h #include cam/cam_xpt_sim.h #include cam/scsi/scsi_all.h #include cam/scsi/scsi_message.h @@ -66,12 +68,19 @@ __FBSDID($FreeBSD$); #include dev/mfi/mfi_ioctl.h #include dev/mfi/mfivar.h +enum mfip_state { + MFIP_STATE_NONE, + MFIP_STATE_DETACH, + MFIP_STATE_RESCAN +}; + struct mfip_softc { device_tdev; struct mfi_softc *mfi_sc; struct cam_devq *devq; struct cam_sim *sim; struct cam_path *path; + enum mfip_state state; }; static int mfip_probe(device_t); @@ -79,6 +88,7 @@ static intmfip_attach(device_t); static int mfip_detach(device_t); static voidmfip_cam_action(struct cam_sim *, union ccb *); static voidmfip_cam_poll(struct cam_sim *); +static voidmfip_cam_rescan(struct mfi_softc *, uint32_t tid); static struct mfi_command * mfip_start(void *); static voidmfip_done(struct mfi_command *cm); @@ -125,6 +135,7 @@ mfip_attach(device_t dev) mfisc = device_get_softc(device_get_parent(dev)); sc-dev = dev; + sc-state = MFIP_STATE_NONE; sc-mfi_sc = mfisc; mfisc-mfi_cam_start = mfip_start; @@ -141,6 +152,8 @@ mfip_attach(device_t dev) return (EINVAL); } + mfisc-mfi_cam_rescan_cb = mfip_cam_rescan; + mtx_lock(mfisc-mfi_io_lock); if (xpt_bus_register(sc-sim, dev, 0) != 0) { device_printf(dev, XPT bus registration failed\n); @@ -165,6 +178,16 @@ mfip_detach(device_t dev) if (sc == NULL) return (EINVAL); + mtx_lock(sc-mfi_sc-mfi_io_lock); + if (sc-state == MFIP_STATE_RESCAN) { + mtx_unlock(sc-mfi_sc-mfi_io_lock); + return (EBUSY); + } + sc-state = MFIP_STATE_DETACH; + mtx_unlock(sc-mfi_sc-mfi_io_lock); + + sc-mfi_sc-mfi_cam_rescan_cb = NULL; + if (sc-sim != NULL) { mtx_lock(sc-mfi_sc-mfi_io_lock); xpt_bus_deregister(cam_sim_path(sc-sim)); @@ -275,6 +298,57 @@ mfip_cam_action(struct cam_sim *sim, uni return; } +static void +mfip_cam_rescan(struct mfi_softc *sc, uint32_t tid) +{ + union ccb *ccb; + struct mfip_softc *camsc; + struct cam_sim *sim; + device_t mfip_dev; + + mtx_lock(Giant); + mfip_dev = device_find_child(sc-mfi_dev, mfip, -1); + mtx_unlock(Giant); + if (mfip_dev == NULL) { + device_printf(sc-mfi_dev, Couldn't find mfip child device!\n); + return; + } + + mtx_lock(sc-mfi_io_lock); + camsc = device_get_softc(mfip_dev); + if (camsc-state == MFIP_STATE_DETACH) { + mtx_unlock(sc-mfi_io_lock); + return; + } + camsc-state = MFIP_STATE_RESCAN; + mtx_unlock(sc-mfi_io_lock); + + ccb = xpt_alloc_ccb_nowait(); + if (ccb == NULL) { + device_printf(sc-mfi_dev, + Cannot allocate ccb for bus rescan.\n); + return; + } + + sim = camsc-sim; + mtx_lock(sc-mfi_io_lock); + if (xpt_create_path(ccb-ccb_h.path, xpt_periph, cam_sim_path(sim), + tid,