svn commit: r273526 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 07:05:14 2014 New Revision: 273526 URL: https://svnweb.freebsd.org/changeset/base/273526 Log: Omit the pollts testcases on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_poll.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_poll.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_poll.c Thu Oct 23 06:42:53 2014(r273525) +++ head/contrib/netbsd-tests/lib/libc/sys/t_poll.c Thu Oct 23 07:05:14 2014(r273526) @@ -233,6 +233,7 @@ ATF_TC_BODY(poll_err, tc) ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1); } +#if !defined(__FreeBSD__) ATF_TC(pollts_basic); ATF_TC_HEAD(pollts_basic, tc) { @@ -377,6 +378,7 @@ ATF_TC_BODY(pollts_sigmask, tc) ATF_REQUIRE_EQ(close(fd), 0); } +#endif ATF_TP_ADD_TCS(tp) { @@ -384,9 +386,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, poll_3way); ATF_TP_ADD_TC(tp, poll_basic); ATF_TP_ADD_TC(tp, poll_err); +#if !defined(__FreeBSD__) ATF_TP_ADD_TC(tp, pollts_basic); ATF_TP_ADD_TC(tp, pollts_err); ATF_TP_ADD_TC(tp, pollts_sigmask); +#endif return atf_no_error(); } ___ 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: r273527 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 07:07:35 2014 New Revision: 273527 URL: https://svnweb.freebsd.org/changeset/base/273527 Log: Omit all of the testcases as revoke(2) is only implemented on devfs(5) Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Thu Oct 23 07:05:14 2014(r273526) +++ head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Thu Oct 23 07:07:35 2014(r273527) @@ -58,6 +58,9 @@ ATF_TC_BODY(revoke_basic, tc) size_t i, n; int *buf; +#if defined(__FreeBSD__) + atf_tc_skip("revoke(2) is only implemented for devfs(5)."); +#endif (void)memset(&res, 0, sizeof(struct rlimit)); (void)getrlimit(RLIMIT_NOFILE, &res); @@ -113,6 +116,9 @@ ATF_TC_BODY(revoke_err, tc) errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1); +#if defined(__FreeBSD__) + atf_tc_skip("revoke(2) is only implemented for devfs(5)."); +#endif errno = 0; ATF_REQUIRE_ERRNO(EPERM, revoke("/etc/passwd") == -1); @@ -133,6 +139,9 @@ ATF_TC_BODY(revoke_perm, tc) int fd, sta; pid_t pid; +#if defined(__FreeBSD__) + atf_tc_skip("revoke(2) is only implemented for devfs(5)."); +#endif pw = getpwnam("nobody"); fd = open(path, O_RDWR | O_CREAT, 0600); ___ 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: r273528 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 07:11:58 2014 New Revision: 273528 URL: https://svnweb.freebsd.org/changeset/base/273528 Log: Mark signo __unused in handler(..) Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.cThu Oct 23 07:07:35 2014(r273527) +++ head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.cThu Oct 23 07:11:58 2014(r273528) @@ -45,7 +45,11 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 20 #include static void +#if defined(__FreeBSD__) +handler(int signo __unused) +#else handler(int signo) +#endif { /* Nothing. */ } ___ 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: r273529 - head/contrib/netbsd-tests/lib/libc/gen
Author: ngie Date: Thu Oct 23 07:20:35 2014 New Revision: 273529 URL: https://svnweb.freebsd.org/changeset/base/273529 Log: - Omit the poll testcases on FreeBSD (they require pollts) - Add necessary headers for the testcases Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c == --- head/contrib/netbsd-tests/lib/libc/gen/t_sleep.cThu Oct 23 07:11:58 2014(r273528) +++ head/contrib/netbsd-tests/lib/libc/gen/t_sleep.cThu Oct 23 07:20:35 2014(r273529) @@ -49,6 +49,11 @@ #define KEVNT_TIMEOUT 10300 /* measured in milli-seconds */ #define FUZZ (40 * MILLION) /* scheduling fuzz accepted - 40 ms */ +#ifdef __FreeBSD__ +#include +#include +#endif + /* * Timer notes * @@ -78,7 +83,9 @@ static volatile int sig; int sleeptest(int (*)(struct timespec *, struct timespec *), bool, bool); int do_nanosleep(struct timespec *, struct timespec *); int do_select(struct timespec *, struct timespec *); +#ifdef __NetBSD__ int do_poll(struct timespec *, struct timespec *); +#endif int do_sleep(struct timespec *, struct timespec *); int do_kevent(struct timespec *, struct timespec *); void sigalrm(int); @@ -116,6 +123,7 @@ do_select(struct timespec *delay, struct return ret; } +#ifdef __NetBSD__ int do_poll(struct timespec *delay, struct timespec *remain) { @@ -129,6 +137,7 @@ do_poll(struct timespec *delay, struct t ret = 0; return ret; } +#endif int do_sleep(struct timespec *delay, struct timespec *remain) @@ -210,6 +219,7 @@ ATF_TC_BODY(select, tc) sleeptest(do_select, true, true); } +#ifdef __NetBSD__ ATF_TC(poll); ATF_TC_HEAD(poll, tc) { @@ -223,6 +233,7 @@ ATF_TC_BODY(poll, tc) sleeptest(do_poll, true, true); } +#endif ATF_TC(sleep); ATF_TC_HEAD(sleep, tc) @@ -329,7 +340,9 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, nanosleep); ATF_TP_ADD_TC(tp, select); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, poll); +#endif ATF_TP_ADD_TC(tp, sleep); ATF_TP_ADD_TC(tp, kevent); ___ 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: r273530 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 07:22:18 2014 New Revision: 273530 URL: https://svnweb.freebsd.org/changeset/base/273530 Log: Add limits.h #include for INT_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c Thu Oct 23 07:20:35 2014(r273529) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c Thu Oct 23 07:22:18 2014(r273530) @@ -46,6 +46,10 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/ #include #include +#ifdef __FreeBSD__ +#include +#endif + #define MSG_KEY12345689 #define MSG_MTYPE_10x41 ___ 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: r273531 - stable/10/sys/cam/ctl
Author: mav Date: Thu Oct 23 07:36:33 2014 New Revision: 273531 URL: https://svnweb.freebsd.org/changeset/base/273531 Log: MFC r273163: Implement more functional CTL debug logging. Setting bits in kern.cam.ctl.debug allows to log errors, commands and some commands data respectively. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_debug.h stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/ctl/ctl_scsi_all.c stable/10/sys/cam/ctl/ctl_util.c stable/10/sys/cam/ctl/ctl_util.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:22:18 2014(r273530) +++ stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:36:33 2014(r273531) @@ -315,10 +315,10 @@ static int worker_threads = -1; TUNABLE_INT("kern.cam.ctl.worker_threads", &worker_threads); SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, &worker_threads, 1, "Number of worker threads"); -static int verbose = 0; -TUNABLE_INT("kern.cam.ctl.verbose", &verbose); -SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verbose, CTLFLAG_RWTUN, -&verbose, 0, "Show SCSI errors returned to initiator"); +static int ctl_debug = CTL_DEBUG_NONE; +TUNABLE_INT("kern.cam.ctl.debug", &ctl_debug); +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, +&ctl_debug, 0, "Enabled debug flags"); /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), @@ -5294,6 +5294,8 @@ ctl_config_move_done(union ctl_io *io) * * - Call some other function once the data is in? */ + if (ctl_debug & CTL_DEBUG_CDB_DATA) + ctl_data_print(io); /* * XXX KDM call ctl_scsiio() again for now, and check flag @@ -13766,17 +13768,14 @@ ctl_process_done(union ctl_io *io) case CTL_IO_SCSI: break; case CTL_IO_TASK: - if (bootverbose || verbose > 0) + if (bootverbose || (ctl_debug & CTL_DEBUG_INFO)) ctl_io_error_print(io, NULL); if (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) ctl_free_io(io); else fe_done(io); return (CTL_RETVAL_COMPLETE); - break; default: - printf("ctl_process_done: invalid io type %d\n", - io->io_hdr.io_type); panic("ctl_process_done: invalid io type %d\n", io->io_hdr.io_type); break; /* NOTREACHED */ @@ -13870,74 +13869,28 @@ ctl_process_done(union ctl_io *io) ctl_set_task_aborted(&io->scsiio); /* -* We print out status for every task management command. For SCSI -* commands, we filter out any unit attention errors; they happen -* on every boot, and would clutter up the log. Note: task -* management commands aren't printed here, they are printed above, -* since they should never even make it down here. +* If enabled, print command error status. +* We don't print UAs unless debugging was enabled explicitly. */ - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: { - int error_code, sense_key, asc, ascq; - - sense_key = 0; + do { + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) + break; + if (!bootverbose && (ctl_debug & CTL_DEBUG_INFO) == 0) + break; + if ((ctl_debug & CTL_DEBUG_INFO) == 0 && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR) && +(io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)) { + int error_code, sense_key, asc, ascq; - if (((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR) -&& (io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)) { - /* -* Since this is just for printing, no need to -* show errors here. -*/ scsi_extract_sense_len(&io->scsiio.sense_data, - io->scsiio.sense_len, - &error_code, - &sense_key, - &asc, - &ascq, - /*show_errors*/ 0); + io->scsiio.sense_len, &error_code, &sense_key, + &asc, &ascq, /*show_errors*/ 0); + if (sense_key == SSD_KEY_UNIT_ATTENTION) + break; } - if
svn commit: r273532 - stable/10/sys/cam/ctl
Author: mav Date: Thu Oct 23 07:37:48 2014 New Revision: 273532 URL: https://svnweb.freebsd.org/changeset/base/273532 Log: MFC r273259: Make VPD 80h (Serial Number) transfer length match serial number length. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:36:33 2014(r273531) +++ stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:37:48 2014(r273532) @@ -9963,17 +9963,17 @@ ctl_inquiry_evpd_serial(struct ctl_scsii { struct scsi_vpd_unit_serial_number *sn_ptr; struct ctl_lun *lun; + int data_len; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*sn_ptr), M_CTL, M_WAITOK | M_ZERO); + data_len = 4 + CTL_SN_LEN; + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; - ctsio->kern_sg_entries = 0; - - if (sizeof(*sn_ptr) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*sn_ptr); - ctsio->kern_data_len = sizeof(*sn_ptr); - ctsio->kern_total_len = sizeof(*sn_ptr); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; } else { ctsio->residual = 0; ctsio->kern_data_len = alloc_len; @@ -9995,16 +9995,16 @@ ctl_inquiry_evpd_serial(struct ctl_scsii sn_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; sn_ptr->page_code = SVPD_UNIT_SERIAL_NUMBER; - sn_ptr->length = ctl_min(sizeof(*sn_ptr) - 4, CTL_SN_LEN); + sn_ptr->length = CTL_SN_LEN; /* * If we don't have a LUN, we just leave the serial number as * all spaces. */ - memset(sn_ptr->serial_num, 0x20, sizeof(sn_ptr->serial_num)); if (lun != NULL) { strncpy((char *)sn_ptr->serial_num, (char *)lun->be_lun->serial_num, CTL_SN_LEN); - } + } else + memset(sn_ptr->serial_num, 0x20, CTL_SN_LEN); ctsio->scsi_status = SCSI_STATUS_OK; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; ___ 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: r273533 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 07:54:46 2014 New Revision: 273533 URL: https://svnweb.freebsd.org/changeset/base/273533 Log: Use /truncate_test.root_owned instead of /usr/bin/fpr as fpr does not exist on FreeBSD truncate_test.root_owned will be generated at build time and owned by root In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c Thu Oct 23 07:37:48 2014(r273532) +++ head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c Thu Oct 23 07:54:46 2014(r273533) @@ -40,6 +40,10 @@ __RCSID("$NetBSD: t_truncate.c,v 1.2 201 #include #include +#ifdef __FreeBSD__ +#include +#endif + static const char path[] = "truncate"; static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 }; @@ -149,6 +153,9 @@ ATF_TC_HEAD(truncate_err, tc) ATF_TC_BODY(truncate_err, tc) { +#ifndef __NetBSD__ + char buf[PATH_MAX]; +#endif errno = 0; ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1); @@ -160,7 +167,13 @@ ATF_TC_BODY(truncate_err, tc) ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1); errno = 0; +#ifdef __NetBSD__ ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1); +#else + snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned", + atf_tc_get_config_var(tc, "srcdir")); + ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1); +#endif } ATF_TP_ADD_TCS(tp) ___ 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: r273534 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 07:59:59 2014 New Revision: 273534 URL: https://svnweb.freebsd.org/changeset/base/273534 Log: - Mark sig/signo __unused - Do not provide a relative path via #include "h_macros.h" Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.cThu Oct 23 07:54:46 2014(r273533) +++ head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.cThu Oct 23 07:59:59 2014(r273534) @@ -42,12 +42,20 @@ __RCSID("$NetBSD: t_sigaction.c,v 1.2 20 #include #include +#ifdef __NetBSD__ #include "../../../h_macros.h" +#else +#include "h_macros.h" +#endif static bool handler_called = false; static void +#ifdef __FreeBSD__ +handler(int signo __unused) +#else handler(int signo) +#endif { handler_called = true; } @@ -80,7 +88,11 @@ wait_and_check_child(const pid_t pid, co } static void +#ifdef __FreeBSD__ +catch(int sig __unused) +#else catch(int sig) +#endif { 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: r273535 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 08:05:03 2014 New Revision: 273535 URL: https://svnweb.freebsd.org/changeset/base/273535 Log: - Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al) - Expect overflow with rlim_max at INT64_MAX, not UINT64_MAX (rlim_t is int64_t on FreeBSD) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.cThu Oct 23 07:59:59 2014(r273534) +++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.cThu Oct 23 08:05:03 2014(r273535) @@ -39,7 +39,9 @@ __RCSID("$NetBSD: t_setrlimit.c,v 1.4 20 #include #include #include +#ifdef __NetBSD__ #include +#endif #include #include #include @@ -438,6 +440,7 @@ ATF_TC_BODY(setrlimit_nproc, tc) atf_tc_fail("RLIMIT_NPROC not enforced"); } +#ifdef __NetBSD__ ATF_TC(setrlimit_nthr); ATF_TC_HEAD(setrlimit_nthr, tc) { @@ -474,6 +477,7 @@ ATF_TC_BODY(setrlimit_nthr, tc) makecontext(&c, func, 1, &lwpid); ATF_CHECK_ERRNO(EAGAIN, _lwp_create(&c, 0, &lwpid) == -1); } +#endif ATF_TC(setrlimit_perm); ATF_TC_HEAD(setrlimit_perm, tc) @@ -494,7 +498,11 @@ ATF_TC_BODY(setrlimit_perm, tc) ATF_REQUIRE(getrlimit(rlimit[i], &res) == 0); +#ifdef __FreeBSD__ + if (res.rlim_max == INT64_MAX) /* Overflow. */ +#else if (res.rlim_max == UINT64_MAX) /* Overflow. */ +#endif continue; errno = 0; @@ -516,7 +524,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, setrlimit_nofile_2); ATF_TP_ADD_TC(tp, setrlimit_nproc); ATF_TP_ADD_TC(tp, setrlimit_perm); +#ifdef __FreeBSD__ ATF_TP_ADD_TC(tp, setrlimit_nthr); +#endif return atf_no_error(); } ___ 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: r273536 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 08:05:47 2014 New Revision: 273536 URL: https://svnweb.freebsd.org/changeset/base/273536 Log: Add limits.h #include for SSIZE_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c Thu Oct 23 08:05:03 2014(r273535) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c Thu Oct 23 08:05:47 2014(r273536) @@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/ #include #include +#if defined(__FreeBSD__) +#include +#endif + #define MSG_KEY1234 #define MSG_MTYPE_10x41 #defineMSG_MTYPE_2 0x42 ___ 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: r273537 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 08:06:34 2014 New Revision: 273537 URL: https://svnweb.freebsd.org/changeset/base/273537 Log: Add limits.h #include for SSIZE_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c Thu Oct 23 08:05:47 2014(r273536) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c Thu Oct 23 08:06:34 2014(r273537) @@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/ #include #include +#if defined(__FreeBSD__) +#include +#endif + #define MSG_KEY1234 #define MSG_MTYPE_10x41 #defineMSG_MTYPE_2 0x42 ___ 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: r273538 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 08:12:31 2014 New Revision: 273538 URL: https://svnweb.freebsd.org/changeset/base/273538 Log: Fix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr) Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.cThu Oct 23 08:06:34 2014(r273537) +++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.cThu Oct 23 08:12:31 2014(r273538) @@ -524,7 +524,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, setrlimit_nofile_2); ATF_TP_ADD_TC(tp, setrlimit_nproc); ATF_TP_ADD_TC(tp, setrlimit_perm); -#ifdef __FreeBSD__ +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, setrlimit_nthr); #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: r273539 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 08:13:07 2014 New Revision: 273539 URL: https://svnweb.freebsd.org/changeset/base/273539 Log: Mark signum __unused Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_select.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_select.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_select.c Thu Oct 23 08:12:31 2014(r273538) +++ head/contrib/netbsd-tests/lib/libc/sys/t_select.c Thu Oct 23 08:13:07 2014(r273539) @@ -47,13 +47,21 @@ static sig_atomic_t keep_going = 1; static void +#ifdef __FreeBSD__ +sig_handler(int signum __unused) +#else sig_handler(int signum) +#endif { keep_going = 0; } static void +#ifdef __FreeBSD__ +sigchld(int signum __unused) +#else sigchld(int signum) +#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: r273540 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Thu Oct 23 08:29:09 2014 New Revision: 273540 URL: https://svnweb.freebsd.org/changeset/base/273540 Log: Omit the mprotect_exec testcase on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c Thu Oct 23 08:13:07 2014(r273539) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c Thu Oct 23 08:29:09 2014(r273540) @@ -44,7 +44,9 @@ __RCSID("$NetBSD: t_mprotect.c,v 1.3 201 #include +#ifdef __NetBSD__ #include "../common/exec_prot.h" +#endif static longpage = 0; static int pax_global = -1; @@ -160,6 +162,7 @@ ATF_TC_BODY(mprotect_err, tc) ATF_REQUIRE(errno == EINVAL); } +#ifdef __NetBSD__ ATF_TC(mprotect_exec); ATF_TC_HEAD(mprotect_exec, tc) { @@ -242,6 +245,7 @@ ATF_TC_BODY(mprotect_exec, tc) break; } } +#endif ATF_TC(mprotect_pax); ATF_TC_HEAD(mprotect_pax, tc) @@ -351,7 +355,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mprotect_access); ATF_TP_ADD_TC(tp, mprotect_err); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, mprotect_exec); +#endif ATF_TP_ADD_TC(tp, mprotect_pax); ATF_TP_ADD_TC(tp, mprotect_write); ___ 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: r273541 - head/sbin/ifconfig
Author: melifaro Date: Thu Oct 23 11:01:49 2014 New Revision: 273541 URL: https://svnweb.freebsd.org/changeset/base/273541 Log: Show SFP+/QSFP memory map dump on higher verbose levels. Sponsored by: Yandex LLC MFC after:1 week Modified: head/sbin/ifconfig/sfp.c Modified: head/sbin/ifconfig/sfp.c == --- head/sbin/ifconfig/sfp.cThu Oct 23 08:29:09 2014(r273540) +++ head/sbin/ifconfig/sfp.cThu Oct 23 11:01:49 2014(r273541) @@ -67,6 +67,9 @@ struct i2c_info { int chip_id; }; +static void dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off, +uint8_t len); + struct _nv { int v; const char *n; @@ -327,6 +330,9 @@ get_sfp_transceiver_class(struct i2c_inf const char *tech_class; uint8_t code; + unsigned char qbuf[8]; + ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (caddr_t)qbuf); + /* Check 10G Ethernet/IB first */ ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, (caddr_t)&code); tech_class = find_zero_bit(eth_10g, code, 1); @@ -662,6 +668,30 @@ read_i2c_generic(struct i2c_info *ii, ui } static void +dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len) +{ + unsigned char buf[16]; + int i, read; + + while (len > 0) { + memset(buf, 0, sizeof(buf)); + read = (len > sizeof(buf)) ? sizeof(buf) : len; + ii->f(ii, addr, off, read, buf); + if (ii->error != 0) { + fprintf(stderr, "Error reading i2c info\n"); + return; + } + + printf("\t"); + for (i = 0; i < read; i++) + printf("%02X ", buf[i]); + printf("\n"); + len -= read; + off += read; + } +} + +static void print_qsfp_status(struct i2c_info *ii, int verbose) { char buf[80], buf2[40], buf3[40]; @@ -703,6 +733,13 @@ print_qsfp_status(struct i2c_info *ii, i printf("\tlane %d: RX: %s TX: %s\n", i, buf, buf2); } } + + if (verbose > 2) { + printf("\n\tSFF8436 DUMP (0xA0 128..255 range):\n"); + dump_i2c_data(ii, SFF_8436_BASE, 128, 128); + printf("\n\tSFF8436 DUMP (0xA0 0..81 range):\n"); + dump_i2c_data(ii, SFF_8436_BASE, 0, 82); + } } static void @@ -730,12 +767,12 @@ print_sfp_status(struct i2c_info *ii, in get_sfp_connector(ii, buf3, sizeof(buf3)); if (ii->error == 0) printf("\tplugged: %s %s (%s)\n", buf, buf2, buf3); - if (verbose > 2) - printf_sfp_transceiver_descr(ii, buf, sizeof(buf)); print_sfp_vendor(ii, buf, sizeof(buf)); if (ii->error == 0) printf("\t%s\n", buf); + if (verbose > 5) + printf_sfp_transceiver_descr(ii, buf, sizeof(buf)); /* * Request current measurements iff they are provided: */ @@ -747,6 +784,11 @@ print_sfp_status(struct i2c_info *ii, in get_sfp_tx_power(ii, buf2, sizeof(buf2)); printf("\tRX: %s TX: %s\n", buf, buf2); } + + if (verbose > 2) { + printf("\n\tSFF8472 DUMP (0xA0 0..127 range):\n"); + dump_i2c_data(ii, SFF_8472_BASE, 0, 128); + } } 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: r273543 - head/usr.sbin/ctld
Author: trasz Date: Thu Oct 23 12:02:27 2014 New Revision: 273543 URL: https://svnweb.freebsd.org/changeset/base/273543 Log: Clean up (refactor) discovery a little; no functional changes. MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/discovery.c Modified: head/usr.sbin/ctld/discovery.c == --- head/usr.sbin/ctld/discovery.c Thu Oct 23 11:12:27 2014 (r273542) +++ head/usr.sbin/ctld/discovery.c Thu Oct 23 12:02:27 2014 (r273543) @@ -160,7 +160,7 @@ logout_new_response(struct pdu *request) } static void -discovery_add_target(struct keys *response_keys, struct target *targ) +discovery_add_target(struct keys *response_keys, const struct target *targ) { struct portal *portal; char *buf; @@ -206,9 +206,12 @@ discovery(struct connection *conn) { struct pdu *request, *response; struct keys *request_keys, *response_keys; - struct target *targ; + const struct portal_group *pg; + const struct target *targ; const char *send_targets; + pg = conn->conn_portal->p_portal_group; + log_debugx("beginning discovery session; waiting for Text PDU"); request = text_receive(conn); request_keys = keys_new(); @@ -222,11 +225,8 @@ discovery(struct connection *conn) response_keys = keys_new(); if (strcmp(send_targets, "All") == 0) { - TAILQ_FOREACH(targ, - &conn->conn_portal->p_portal_group->pg_conf->conf_targets, - t_next) { - if (targ->t_portal_group != - conn->conn_portal->p_portal_group) { + TAILQ_FOREACH(targ, &pg->pg_conf->conf_targets, t_next) { + if (targ->t_portal_group != pg) { log_debugx("not returning target \"%s\"; " "belongs to a different portal group", targ->t_name); @@ -235,8 +235,7 @@ discovery(struct connection *conn) discovery_add_target(response_keys, targ); } } else { - targ = target_find(conn->conn_portal->p_portal_group->pg_conf, - send_targets); + targ = target_find(pg->pg_conf, send_targets); if (targ == NULL) { log_debugx("initiator requested information on unknown " "target \"%s\"; returning nothing", send_targets); ___ 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: r273544 - in head: sys/dev/vt sys/sys usr.sbin/vidcontrol
Author: dumbbell Date: Thu Oct 23 12:38:05 2014 New Revision: 273544 URL: https://svnweb.freebsd.org/changeset/base/273544 Log: vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font To restore the default font using vidcontrol(1), use the "-f" flag without an argument: vidcontrol -f < /dev/ttyv0 PR: 193910 Differential Revision:https://reviews.freebsd.org/D971 Submitted by: Marcin Cieslak Reviewed by: ray@, emaste@ Approved by: ray@ MFC after:1 week Modified: head/sys/dev/vt/vt_core.c head/sys/sys/consio.h head/usr.sbin/vidcontrol/vidcontrol.1 head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/sys/dev/vt/vt_core.c == --- head/sys/dev/vt/vt_core.c Thu Oct 23 12:02:27 2014(r273543) +++ head/sys/dev/vt/vt_core.c Thu Oct 23 12:38:05 2014(r273544) @@ -2218,6 +2218,11 @@ skip_thunk: vtfont_unref(vf); return (error); } + case PIO_VFONT_DEFAULT: { + /* Reset to default font. */ + error = vt_change_font(vw, &vt_font_default); + return (error); + } case GIO_SCRNMAP: { scrmap_t *sm = (scrmap_t *)data; Modified: head/sys/sys/consio.h == --- head/sys/sys/consio.h Thu Oct 23 12:02:27 2014(r273543) +++ head/sys/sys/consio.h Thu Oct 23 12:38:05 2014(r273544) @@ -239,6 +239,7 @@ typedef struct vfnt vfnt_t; #define GIO_FONT8x16 _IOR('c', 69, fnt16_t) #define PIO_VFONT _IOW('c', 70, vfnt_t) #define GIO_VFONT _IOR('c', 71, vfnt_t) +#define PIO_VFONT_DEFAULT _IO('c', 72) /* get video mode information */ struct colors { Modified: head/usr.sbin/vidcontrol/vidcontrol.1 == --- head/usr.sbin/vidcontrol/vidcontrol.1 Thu Oct 23 12:02:27 2014 (r273543) +++ head/usr.sbin/vidcontrol/vidcontrol.1 Thu Oct 23 12:38:05 2014 (r273544) @@ -26,9 +26,11 @@ .Op Fl c Ar appearance .Oo .Fl f +.Oo .Op Ar size .Ar file .Oc +.Oc .Op Fl g Ar geometry .Op Fl h Ar size .Op Fl i Cm adapter | mode @@ -136,8 +138,10 @@ The latter is actually a simulation. Print out current output screen map. .It Xo .Fl f +.Oo .Op Ar size .Ar file +.Oc .Xc Load font .Ar file @@ -158,6 +162,14 @@ may be omitted, in this case .Nm will try to guess it from the size of font file. .Pp +When using +.Xr vt 4 +both +.Ar size +and +.Ar font +can be omitted, and the default font will be loaded. +.Pp Note that older video cards, such as MDA and CGA, do not support software font. See also Modified: head/usr.sbin/vidcontrol/vidcontrol.c == --- head/usr.sbin/vidcontrol/vidcontrol.c Thu Oct 23 12:02:27 2014 (r273543) +++ head/usr.sbin/vidcontrol/vidcontrol.c Thu Oct 23 12:38:05 2014 (r273544) @@ -197,7 +197,7 @@ usage(void) { if (vt4_mode) fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", -"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [size] file]", +"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]", " [-g geometry] [-h size] [-i adapter | mode]", " [-M char] [-m on | off] [-r foreground background]", " [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]", @@ -409,6 +409,19 @@ load_vt4mappingtable(unsigned int nmappi return (t); } +/* + * Set the default vt font. + */ + +static void +load_default_vt4font(void) +{ + if (ioctl(0, PIO_VFONT_DEFAULT) == -1) { + revert(); + errc(1, errno, "loading default vt font"); + } +} + static int load_vt4font(FILE *f) { @@ -1328,7 +1341,7 @@ main(int argc, char **argv) dumpopt = DUMP_FBF; termmode = NULL; if (vt4_mode) - opts = "b:Cc:f:g:h:Hi:M:m:pPr:S:s:T:t:x"; + opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x"; else opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x"; @@ -1349,15 +1362,23 @@ main(int argc, char **argv) print_scrnmap(); break; case 'f': - type = optarg; - font = nextarg(argc, argv, &optind, 'f', 0); + optarg = nextarg(argc, argv, &optind, 'f', 0); + if (optarg != NULL) { + font = nextarg(argc, argv, &optind, 'f', 0); + + if (font == NULL) { + type = NULL; + font = optarg; + } else + type = optarg; -
Re: svn commit: r273487 - head/sys/kern
Hi! The following change triggers a kernel trap 12 when env is NULL: > @@ -260,8 +262,10 @@ void > freeenv(char *env) > { > > - if (dynamic_kenv) > + if (dynamic_kenv) { > + memset(env, 0, strlen(env)); > free(env, M_KENV); > + } > } This happens very early in boot for me, just after the lines: WARNING: WITNESS option enabled, expect reduced performance. VT: running with driver "vga". The attached simple patch fixes the problem. What I don't know is if the same problem can occur in kern_unsetenv(): > @@ -437,6 +441,7 @@ kern_unsetenv(const char *name) > kenvp[i++] = kenvp[j]; > kenvp[i] = NULL; > mtx_unlock(&kenv_lock); > + memset(oldenv, 0, strlen(oldenv)); > free(oldenv, M_KENV); > return (0); > } -- Jean-Sébastien Pédron Index: sys/kern/kern_environment.c === --- sys/kern/kern_environment.c (revision 273540) +++ sys/kern/kern_environment.c (working copy) @@ -262,7 +262,7 @@ freeenv(char *env) { - if (dynamic_kenv) { + if (dynamic_kenv && env != NULL) { memset(env, 0, strlen(env)); free(env, M_KENV); } signature.asc Description: OpenPGP digital signature
svn commit: r273545 - stable/10/sys/dev/vt
Author: dumbbell Date: Thu Oct 23 13:32:01 2014 New Revision: 273545 URL: https://svnweb.freebsd.org/changeset/base/273545 Log: vt(4): Refuse to load a font if hw.vga.textmode is selected Before, the font was loaded and the window size recalculated, giving an unusable terminal, even if the actual font didn't change. Reported by: beeess...@ruggedinbox.com MFC of: r273330 Modified: stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt_core.c == --- stable/10/sys/dev/vt/vt_core.c Thu Oct 23 12:38:05 2014 (r273544) +++ stable/10/sys/dev/vt/vt_core.c Thu Oct 23 13:32:01 2014 (r273545) @@ -2200,6 +2200,9 @@ skip_thunk: case PIO_VFONT: { struct vt_font *vf; + if (vd->vd_flags & VDF_TEXTMODE) + return (ENOTSUP); + error = vtfont_load((void *)data, &vf); if (error != 0) return (error); ___ 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: r273546 - head/sys/dev/usb/net
Author: loos Date: Thu Oct 23 13:47:19 2014 New Revision: 273546 URL: https://svnweb.freebsd.org/changeset/base/273546 Log: Fix a bug where some DTS layouts could cause the premature ending of the search (i.e. without returning any result) and you would end up with a random MAC address. Change the search algorithm to a recursive one to ensure that all the nodes on DTS will be verified. The previous algorithm could not keep up if the DTS has too many sub-nodes. While here, fix the punctuation on comments. Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c == --- head/sys/dev/usb/net/if_smsc.c Thu Oct 23 13:32:01 2014 (r273545) +++ head/sys/dev/usb/net/if_smsc.c Thu Oct 23 13:47:19 2014 (r273546) @@ -1556,57 +1556,56 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd } #ifdef FDT +static phandle_t +smsc_fdt_find_eth_node(phandle_t start) +{ + phandle_t child, node; + + /* Traverse through entire tree to find usb ethernet nodes. */ + for (node = OF_child(start); node != 0; node = OF_peer(node)) { + if (fdt_is_compatible(node, "net,ethernet") && + fdt_is_compatible(node, "usb,device")) + return (node); + child = smsc_fdt_find_eth_node(node); + if (child != 0) + return (child); + } + + return (0); +} + /** - * Get MAC address from FDT blob. Firmware or loader should fill - * mac-address or local-mac-address property Returns 0 if MAC address - * obtained, error code otherwise + * Get MAC address from FDT blob. Firmware or loader should fill + * mac-address or local-mac-address property. Returns 0 if MAC address + * obtained, error code otherwise. */ static int smsc_fdt_find_mac(unsigned char *mac) { - phandle_t child, parent, root; + phandle_t node, root; int len; root = OF_finddevice("/"); - len = 0; - parent = root; - - /* Traverse through entire tree to find nodes usb ethernet nodes */ - for (child = OF_child(parent); child != 0; child = OF_peer(child)) { - - /* Find a 'leaf'. Start the search from this node. */ - while (OF_child(child)) { - parent = child; - child = OF_child(child); - } - - if (fdt_is_compatible(child, "net,ethernet") && - fdt_is_compatible(child, "usb,device")) { + node = smsc_fdt_find_eth_node(root); + if (node != 0) { - /* Check if there is property */ - if ((len = OF_getproplen(child, "local-mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(child, "local-mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - - if ((len = OF_getproplen(child, "mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(child, "mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } + /* Check if there is property */ + if ((len = OF_getproplen(node, "local-mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "local-mac-address", mac, + ETHER_ADDR_LEN); + return (0); } - if (OF_peer(child) == 0) { - /* No more siblings. */ - child = parent; - parent = OF_parent(child); + if ((len = OF_getproplen(node, "mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "mac-address", mac, + ETHER_ADDR_LEN); + 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: r273547 - head/sys/net
Author: ae Date: Thu Oct 23 14:29:52 2014 New Revision: 273547 URL: https://svnweb.freebsd.org/changeset/base/273547 Log: Move if_get_counter initialization from if_attach into if_alloc. Also, initialize all counters before ifnet will become available in the system. This fixes possible access to uninitialized ifned fields. PR: 194550 Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Thu Oct 23 13:47:19 2014(r273546) +++ head/sys/net/if.c Thu Oct 23 14:29:52 2014(r273547) @@ -467,11 +467,10 @@ if_alloc(u_char type) ifq_init(&ifp->if_snd, ifp); refcount_init(&ifp->if_refcount, 1);/* Index reference. */ - ifnet_setbyindex(ifp->if_index, ifp); - for (int i = 0; i < IFCOUNTERS; i++) ifp->if_counters[i] = counter_u64_alloc(M_WAITOK); - + ifp->if_get_counter = if_get_counter_default; + ifnet_setbyindex(ifp->if_index, ifp); return (ifp); } @@ -674,9 +673,6 @@ if_attach_internal(struct ifnet *ifp, in ifp->if_qflush = if_qflush; } - if (ifp->if_get_counter == NULL) - ifp->if_get_counter = if_get_counter_default; - if (!vmove) { #ifdef MAC mac_ifnet_create(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: r273548 - head/usr.bin/bluetooth/rfcomm_sppd
Author: emax Date: Thu Oct 23 15:16:40 2014 New Revision: 273548 URL: https://svnweb.freebsd.org/changeset/base/273548 Log: Change the code to use the openpty(3) API which uses the pts(4) driver instead of the pty(4) driver. PR: 184597 Submitted by: tobias.rehbein MFC after:2 weeks Modified: head/usr.bin/bluetooth/rfcomm_sppd/Makefile head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c Modified: head/usr.bin/bluetooth/rfcomm_sppd/Makefile == --- head/usr.bin/bluetooth/rfcomm_sppd/Makefile Thu Oct 23 14:29:52 2014 (r273547) +++ head/usr.bin/bluetooth/rfcomm_sppd/Makefile Thu Oct 23 15:16:40 2014 (r273548) @@ -6,6 +6,6 @@ SRCS= rfcomm_sppd.c rfcomm_sdp.c WARNS?=2 DPADD= ${LIBBLUETOOTH} ${LIBSDP} -LDADD= -lbluetooth -lsdp +LDADD= -lbluetooth -lsdp -lutil .include Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 == --- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1Thu Oct 23 14:29:52 2014(r273547) +++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1Thu Oct 23 15:16:40 2014(r273548) @@ -33,10 +33,9 @@ .Nd RFCOMM Serial Port Profile daemon .Sh SYNOPSIS .Nm -.Op Fl bhS +.Op Fl bhtS .Fl a Ar address .Fl c Ar channel -.Op Fl t Ar tty .Sh DESCRIPTION The .Nm @@ -53,7 +52,7 @@ Once connection is established, the .Nm utility provides access to the server's remote serial port via stdin/stdout or via -.Xr pty 4 +.Xr pts 4 interface if .Fl t option was specified. @@ -72,8 +71,7 @@ daemon. If .Fl t options was specified, -the server side of the virtual serial port is attached to the pseudo-terminal -.Ar tty . +the server side of the virtual serial port is attached to a pseudo-terminal. Otherwise the virtual serial port is attached to the stdin/stdout. .Nm should be run as root in order to communicate with @@ -146,24 +144,22 @@ Display usage message and exit. .It Fl S Server mode; see .Sx DESCRIPTION . -.It Fl t Ar tty -Slave pseudo tty name. +.It Fl t +Use slave pseudo tty. If not set stdin/stdout will be used. This option is required if .Fl b option was specified. .El .Sh FILES -.Bl -tag -width ".Pa /dev/tty[p-sP-S][0-9a-v]" -compact -.It Pa /dev/pty[p-sP-S][0-9a-v] -master pseudo terminals -.It Pa /dev/tty[p-sP-S][0-9a-v] +.Bl -tag -width ".Pa /dev/pts/[num]" -compact +.It Pa /dev/pts/[num] slave pseudo terminals .El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES -.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t /dev/ttyp1" +.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t" .Pp Will start the .Nm @@ -171,13 +167,17 @@ utility and open RFCOMM connection to th .Li 00:01:02:03:04:05 and channel .Li 1 . -Once the connection has been established, -.Pa /dev/ttyp1 +Once the connection has been established, a +.Xr pts 4 can be used to talk to the remote serial port on the server. +.Nm +prints the name of the +.Xr pts 4 +to use on stdout. .Sh SEE ALSO .Xr bluetooth 3 , .Xr ng_btsocket 4 , -.Xr pty 4 , +.Xr pts 4 , .Xr rfcomm_pppd 8 , .Xr sdpd 8 .Sh AUTHORS Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c == --- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.cThu Oct 23 14:29:52 2014(r273547) +++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.cThu Oct 23 15:16:40 2014(r273548) @@ -32,6 +32,7 @@ */ #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include #include +#include #define SPPD_IDENT "rfcomm_sppd" #define SPPD_BUFFER_SIZE 1024 @@ -58,7 +60,7 @@ int rfcomm_channel_lookup (bdaddr_t con bdaddr_t const *remote, int service, int *channel, int *error); -static int sppd_ttys_open (char const *tty, int *amaster, int *aslave); +static int sppd_ttys_open (char **tty, int *amaster, int *aslave); static int sppd_read (int fd, char *buffer, int size); static int sppd_write (int fd, char *buffer, int size); static voidsppd_sighandler (int s); @@ -74,7 +76,8 @@ main(int argc, char *argv[]) struct sockaddr_rfcomm ra; bdaddr_t addr; int n, background, channel, service, -s, amaster, aslave, fd, doserver; +s, amaster, aslave, fd, doserver, +dopty; fd_set rfd; char*tty = NULL, *ep = NULL, buf[SPPD_BUFFER_SIZE]; @@ -82,9 +85,10 @@ main(int argc, char *argv[]) background = channel = 0; service = SDP_SERVICE_CLASS_SERIAL_PORT; dos
svn commit: r273549 - head/sys/kern
Author: mjg Date: Thu Oct 23 15:35:47 2014 New Revision: 273549 URL: https://svnweb.freebsd.org/changeset/base/273549 Log: Avoid taking the lock in selfdfree when not needed. Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c == --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014(r273548) +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014(r273549) @@ -1600,10 +1600,11 @@ static void selfdfree(struct seltd *stp, struct selfd *sfp) { STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); - mtx_lock(sfp->sf_mtx); - if (sfp->sf_si) + if (sfp->sf_si != NULL) { + mtx_lock(sfp->sf_mtx); TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); - mtx_unlock(sfp->sf_mtx); + mtx_unlock(sfp->sf_mtx); + } uma_zfree(selfd_zone, sfp); } ___ 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: r273550 - head/share/man/man9
Author: jmg Date: Thu Oct 23 17:24:50 2014 New Revision: 273550 URL: https://svnweb.freebsd.org/changeset/base/273550 Log: minor updates to make it more explicit that when using fpu_kern_thread, you don't need to use fpu_kern_enter/_leave... Reviewed by: kib Modified: head/share/man/man9/fpu_kern.9 Modified: head/share/man/man9/fpu_kern.9 == --- head/share/man/man9/fpu_kern.9 Thu Oct 23 15:35:47 2014 (r273549) +++ head/share/man/man9/fpu_kern.9 Thu Oct 23 17:24:50 2014 (r273550) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2014 +.Dd October 23, 2014 .Dt FPU_KERN 9 .Os .Sh NAME @@ -157,12 +157,17 @@ There are no errors defined for the func .Pp The .Fn fpu_kern_thread -function provides an optimization for threads which never leave to +function enables an optimization for threads which never leave to the usermode. -Such thread can reuse the usermode save area for the FPU state, -which is allowed by the function call. -There is no flags defined for the function, and no error states +The current thread will reuse the usermode save area for the kernel FPU state +instead of requiring an explicitly allocated context. +There are no flags defined for the function, and no error states that the function returns. +Once this function has been called, neither +.Fn fpu_kern_enter +nor +.Fn fpu_kern_leave +is required to be called and the fpu is available for use in the calling thread. .Pp The .Fn is_fpu_kern_thread ___ 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: r273551 - head/sys/dev/puc
Author: rpaulo Date: Thu Oct 23 18:03:27 2014 New Revision: 273551 URL: https://svnweb.freebsd.org/changeset/base/273551 Log: puc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card. Submitted by: Alex Burlyga MFC after:1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c == --- head/sys/dev/puc/pucdata.c Thu Oct 23 17:24:50 2014(r273550) +++ head/sys/dev/puc/pucdata.c Thu Oct 23 18:03:27 2014(r273551) @@ -839,6 +839,13 @@ const struct puc_cfg puc_pci_devices[] = * http://www.startech.com> */ + { 0x1415, 0xc11b, 0x, 0, +"Oxford Semiconductor OXPCIe952 1S1P", +DEFAULT_RCLK * 0x22, +PUC_PORT_NONSTANDARD, 0x10, 0, -1, + .config_function = puc_config_oxford_pcie + }, + { 0x1415, 0xc138, 0x, 0, "Oxford Semiconductor OXPCIe952 UARTs", DEFAULT_RCLK * 0x22, ___ 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: r273552 - head/sys/kern
Author: delphij Date: Thu Oct 23 18:23:50 2014 New Revision: 273552 URL: https://svnweb.freebsd.org/changeset/base/273552 Log: Test if 'env' is NULL before doing memset() and strlen(), the caller may pass NULL to freeenv(). Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c == --- head/sys/kern/kern_environment.cThu Oct 23 18:03:27 2014 (r273551) +++ head/sys/kern/kern_environment.cThu Oct 23 18:23:50 2014 (r273552) @@ -262,7 +262,7 @@ void freeenv(char *env) { - if (dynamic_kenv) { + if (dynamic_kenv && env != NULL) { memset(env, 0, strlen(env)); free(env, M_KENV); } ___ 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: r273446 - head/sys/x86/isa
On Tuesday, October 21, 2014 9:37:33 pm Marcel Moolenaar wrote: > Author: marcel > Date: Wed Oct 22 01:37:32 2014 > New Revision: 273446 > URL: https://svnweb.freebsd.org/changeset/base/273446 > > Log: > Virtual machines can easily have more than 16 option ROMs and > when that happens, we happily access our resource array out of > bounds. Make sure we stay within the MAX_ROMS limit. > While here, bump MAX_ROMS from 16 to 32 to minimize the chance > of leaving option ROMs unaccounted for. > > Obtained from: Juniper Networks, Inc. The res[] array should just go away entirely. This driver never gets detached, so its detach routine can get removed. sc->rnum can become a local variable in attach, the arrays can be axed, and the entire softc should be empty. -- John Baldwin ___ 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: r273549 - head/sys/kern
On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: > Author: mjg > Date: Thu Oct 23 15:35:47 2014 > New Revision: 273549 > URL: https://svnweb.freebsd.org/changeset/base/273549 > > Log: > Avoid taking the lock in selfdfree when not needed. > > Modified: > head/sys/kern/sys_generic.c > > Modified: head/sys/kern/sys_generic.c > == > --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014 > (r273548) > +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014 > (r273549) > @@ -1600,10 +1600,11 @@ static void > selfdfree(struct seltd *stp, struct selfd *sfp) > { > STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); > - mtx_lock(sfp->sf_mtx); > - if (sfp->sf_si) > + if (sfp->sf_si != NULL) { > + mtx_lock(sfp->sf_mtx); > TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); > - mtx_unlock(sfp->sf_mtx); > + mtx_unlock(sfp->sf_mtx); > + } > uma_zfree(selfd_zone, sfp); How do you ensure that the value you read for sf_si here is up to date? In particular, if a thread is selecting on multiple fds and one awakens it, another fd can invoke selwakeup() while the thread is in seltdclear(). In that case, you might see a stale value of sf_si and not realize it is cleared by the selwakeup() after you get the lock and you will invoke TAILQ_REMOVE an extra time. -- John Baldwin ___ 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: r273401 - head/sys/kern
On Tuesday, October 21, 2014 3:05:45 pm Mateusz Guzik wrote: > Author: mjg > Date: Tue Oct 21 19:05:44 2014 > New Revision: 273401 > URL: https://svnweb.freebsd.org/changeset/base/273401 > > Log: > Implement shared locking for sysctl. A bit more detail in this message was warranted. We had some shared locking in the past (r192125) but it was subsequently reverted (r216060). In particular, explaining how you fixed the part of 216060 that caused the shared locking to be reverted would have answered Bjoern's earlier question as well. It's important that log messages not only explain what they are doing, but why they are doing so. (For exmaple, it would have been nice if 216060 had explained why it was reverting the shared locking in its log message, but it didn't. :( ) I think that you fixed the issues by a combination of using sysctl_lock/unlock to handle shared vs exclusive locking for the caller and you used atomic ops on the running count (previously the xlock allowed use of non-atomic ops on the running count). sysctl_root() is now only called with a shared lock held, so you should change its assertion accordingly. sysctl_register_oid() is still called with the xlock held, so you can't remove the sysctl_lock() stuff from sysctl_root_handler_locked() entirely. OTOH, there is a stale comment in kern_sysctl.c about having a public sysctl_lock/unlock API that you can just remove. Also, given that sysctl_lock/unlock are only used in sysctl_root_handler_locked(), I would probably remove them and just inline them in the one place they are needed. Finally, getting pre-commit review is fairly easy these days with phabricator and would allow you to have had all these things noted and addressed before it went into the tree. -- John Baldwin ___ 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: r273549 - head/sys/kern
Dnia 23 paź 2014 o godz. 20:38 John Baldwin napisał(a): >> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: >> Author: mjg >> Date: Thu Oct 23 15:35:47 2014 >> New Revision: 273549 >> URL: https://svnweb.freebsd.org/changeset/base/273549 >> >> Log: >> Avoid taking the lock in selfdfree when not needed. >> >> Modified: >> head/sys/kern/sys_generic.c >> >> Modified: head/sys/kern/sys_generic.c > == >> --- head/sys/kern/sys_generic.cThu Oct 23 15:16:40 2014(r273548) >> +++ head/sys/kern/sys_generic.cThu Oct 23 15:35:47 2014(r273549) >> @@ -1600,10 +1600,11 @@ static void >> selfdfree(struct seltd *stp, struct selfd *sfp) >> { >>STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); >> -mtx_lock(sfp->sf_mtx); >> -if (sfp->sf_si) >> +if (sfp->sf_si != NULL) { >> +mtx_lock(sfp->sf_mtx); >>TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); >> -mtx_unlock(sfp->sf_mtx); >> +mtx_unlock(sfp->sf_mtx); >> +} >>uma_zfree(selfd_zone, sfp); > > How do you ensure that the value you read for sf_si here is up to date? In > particular, if a thread is selecting on multiple fds and one awakens it, > another fd can invoke selwakeup() while the thread is in seltdclear(). > In that case, you might see a stale value of sf_si and not realize it is > cleared by the selwakeup() after you get the lock and you will invoke > TAILQ_REMOVE an extra time. FWIW, I've just hit a panic in selfdfree(). ___ 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: r273553 - stable/9/usr.sbin/newsyslog
Author: markj Date: Thu Oct 23 18:48:43 2014 New Revision: 273553 URL: https://svnweb.freebsd.org/changeset/base/273553 Log: MFC 272763: If we fail to send a signal after rotation, print the pidfile from which the corresponding PID was obtained. PR: 194143 Modified: stable/9/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c == --- stable/9/usr.sbin/newsyslog/newsyslog.c Thu Oct 23 18:23:50 2014 (r273552) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Thu Oct 23 18:48:43 2014 (r273553) @@ -1966,8 +1966,8 @@ do_sigwork(struct sigwork_entry *swork) */ if (errno != ESRCH) swork->sw_pidok = 0; - warn("can't notify %s, pid %d", swork->sw_pidtype, - (int)swork->sw_pid); + warn("can't notify %s, pid %d = %s", swork->sw_pidtype, + (int)swork->sw_pid, swork->sw_fname); } else { if (verbose) printf("Notified %s pid %d = %s\n", swork->sw_pidtype, ___ 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: r273554 - stable/10/usr.sbin/newsyslog
Author: markj Date: Thu Oct 23 18:50:44 2014 New Revision: 273554 URL: https://svnweb.freebsd.org/changeset/base/273554 Log: MFC r272763: If we fail to send a signal after rotation, print the pidfile from which the corresponding PID was obtained. PR: 194143 Modified: stable/10/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/newsyslog/newsyslog.c == --- stable/10/usr.sbin/newsyslog/newsyslog.cThu Oct 23 18:48:43 2014 (r273553) +++ stable/10/usr.sbin/newsyslog/newsyslog.cThu Oct 23 18:50:44 2014 (r273554) @@ -1968,8 +1968,8 @@ do_sigwork(struct sigwork_entry *swork) */ if (errno != ESRCH) swork->sw_pidok = 0; - warn("can't notify %s, pid %d", swork->sw_pidtype, - (int)swork->sw_pid); + warn("can't notify %s, pid %d = %s", swork->sw_pidtype, + (int)swork->sw_pid, swork->sw_fname); } else { if (verbose) printf("Notified %s pid %d = %s\n", swork->sw_pidtype, ___ 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: r273555 - head/sys/kern
Author: mjg Date: Thu Oct 23 19:06:08 2014 New Revision: 273555 URL: https://svnweb.freebsd.org/changeset/base/273555 Log: In selfdfree re-evaulate sf_si after takin the lock. Otherwise we can race with doselwakeup. This is a fixup to r273549 Reviewed by: jhb Reported by: everyone and their dog Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c == --- head/sys/kern/sys_generic.c Thu Oct 23 18:50:44 2014(r273554) +++ head/sys/kern/sys_generic.c Thu Oct 23 19:06:08 2014(r273555) @@ -1602,7 +1602,8 @@ selfdfree(struct seltd *stp, struct self STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); if (sfp->sf_si != NULL) { mtx_lock(sfp->sf_mtx); - TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); + if (sfp->sf_si != NULL) + TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); mtx_unlock(sfp->sf_mtx); } uma_zfree(selfd_zone, sfp); ___ 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: r273549 - head/sys/kern
Please back this out; it looks like the lock is protecting sf_si. -adrian On 23 October 2014 11:45, Edward Tomasz Napierała wrote: > Dnia 23 paź 2014 o godz. 20:38 John Baldwin napisał(a): > >>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: >>> Author: mjg >>> Date: Thu Oct 23 15:35:47 2014 >>> New Revision: 273549 >>> URL: https://svnweb.freebsd.org/changeset/base/273549 >>> >>> Log: >>> Avoid taking the lock in selfdfree when not needed. >>> >>> Modified: >>> head/sys/kern/sys_generic.c >>> >>> Modified: head/sys/kern/sys_generic.c >> == >>> --- head/sys/kern/sys_generic.cThu Oct 23 15:16:40 2014(r273548) >>> +++ head/sys/kern/sys_generic.cThu Oct 23 15:35:47 2014(r273549) >>> @@ -1600,10 +1600,11 @@ static void >>> selfdfree(struct seltd *stp, struct selfd *sfp) >>> { >>>STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); >>> -mtx_lock(sfp->sf_mtx); >>> -if (sfp->sf_si) >>> +if (sfp->sf_si != NULL) { >>> +mtx_lock(sfp->sf_mtx); >>>TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); >>> -mtx_unlock(sfp->sf_mtx); >>> +mtx_unlock(sfp->sf_mtx); >>> +} >>>uma_zfree(selfd_zone, sfp); >> >> How do you ensure that the value you read for sf_si here is up to date? In >> particular, if a thread is selecting on multiple fds and one awakens it, >> another fd can invoke selwakeup() while the thread is in seltdclear(). >> In that case, you might see a stale value of sf_si and not realize it is >> cleared by the selwakeup() after you get the lock and you will invoke >> TAILQ_REMOVE an extra time. > > FWIW, I've just hit a panic in selfdfree(). > > ___ 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: r273487 - head/sys/kern
On 10/23/14 05:49, Jean-Sébastien Pédron wrote: > The following change triggers a kernel trap 12 when env is NULL: > >> @@ -260,8 +262,10 @@ void >> freeenv(char *env) >> { >> >> -if (dynamic_kenv) >> +if (dynamic_kenv) { >> +memset(env, 0, strlen(env)); >> free(env, M_KENV); >> +} >> } > > This happens very early in boot for me, just after the lines: > WARNING: WITNESS option enabled, expect reduced performance. > VT: running with driver "vga". This sounds like a bug in the code which is using kern_getenv / freeenv. The comment at kern_getenv says * Look up an environment variable by name. * Return a pointer to the string if found. * The pointer has to be freed with freeenv() * after use. which I interpret to mean that if the environment variable is not found and you don't get a pointer to a string, you shouldn't be freeing it. I'm willing to work around this in freeenv, but since we're in HEAD and this isn't going to be MFCed, it seems like an opportunity to fix the code which is calling freeenv(NULL). > The attached simple patch fixes the problem. > > What I don't know is if the same problem can occur in kern_unsetenv(): > >> @@ -437,6 +441,7 @@ kern_unsetenv(const char *name) >> kenvp[i++] = kenvp[j]; >> kenvp[i] = NULL; >> mtx_unlock(&kenv_lock); >> +memset(oldenv, 0, strlen(oldenv)); >> free(oldenv, M_KENV); >> return (0); >> } We can only get into that code if cp != NULL, and cp is part of the string pointed to by kenvp[i] (aka. oldenv) so unless I'm missing something we're guaranteed that oldenv is a pointer to a string here. Colin Percival ___ 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: r273557 - head/sys/netipsec
Author: jhb Date: Thu Oct 23 20:43:16 2014 New Revision: 273557 URL: https://svnweb.freebsd.org/changeset/base/273557 Log: Use a static callout to drive key_timehandler() instead of timeout(). While here, make key_timehandler() private to key.c. Submitted by: bz (2) Tested by:bz Modified: head/sys/netipsec/key.c head/sys/netipsec/key.h Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Thu Oct 23 20:01:55 2014(r273556) +++ head/sys/netipsec/key.c Thu Oct 23 20:43:16 2014(r273557) @@ -410,6 +410,10 @@ struct sadb_msghdr { int extlen[SADB_EXT_MAX + 1]; }; +#ifndef IPSEC_DEBUG2 +static struct callout key_timer; +#endif + static struct secasvar *key_allocsa_policy __P((const struct secasindex *)); static void key_freesp_so __P((struct secpolicy **)); static struct secasvar *key_do_allocsa_policy __P((struct secashead *, u_int)); @@ -4525,8 +4529,8 @@ key_flush_spacq(time_t now) * and do to remove or to expire. * XXX: year 2038 problem may remain. */ -void -key_timehandler(void) +static void +key_timehandler(void *arg) { VNET_ITERATOR_DECL(vnet_iter); time_t now = time_second; @@ -4544,7 +4548,7 @@ key_timehandler(void) #ifndef IPSEC_DEBUG2 /* do exchange to tick time !! */ - (void)timeout((void *)key_timehandler, (void *)0, hz); + callout_schedule(&key_timer, hz); #endif /* IPSEC_DEBUG2 */ } @@ -7769,7 +7773,8 @@ key_init(void) SPACQ_LOCK_INIT(); #ifndef IPSEC_DEBUG2 - timeout((void *)key_timehandler, (void *)0, hz); + callout_init(&key_timer, CALLOUT_MPSAFE); + callout_reset(&key_timer, hz, key_timehandler, NULL); #endif /*IPSEC_DEBUG2*/ /* initialize key statistics */ Modified: head/sys/netipsec/key.h == --- head/sys/netipsec/key.h Thu Oct 23 20:01:55 2014(r273556) +++ head/sys/netipsec/key.h Thu Oct 23 20:43:16 2014(r273557) @@ -97,7 +97,6 @@ extern struct secpolicy *key_msg2sp __P( extern struct mbuf *key_sp2msg __P((struct secpolicy *)); extern int key_ismyaddr __P((struct sockaddr *)); extern int key_spdacquire __P((struct secpolicy *)); -extern void key_timehandler __P((void)); extern u_long key_random __P((void)); extern void key_randomfill __P((void *, size_t)); extern void key_freereg __P((struct socket *)); ___ 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: r273549 - head/sys/kern
On Thursday, October 23, 2014 3:39:39 pm Adrian Chadd wrote: > Please back this out; it looks like the lock is protecting sf_si. The followup fix should be fine. The lock does indeed protect sf_si, but the value can only transition from non-NULL to NULL at this point, so if it is == NULL without the lock, it is safe to assume it has already been cleared. > -adrian > > On 23 October 2014 11:45, Edward Tomasz Napierała wrote: > > Dnia 23 paź 2014 o godz. 20:38 John Baldwin napisał(a): > > > >>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: > >>> Author: mjg > >>> Date: Thu Oct 23 15:35:47 2014 > >>> New Revision: 273549 > >>> URL: https://svnweb.freebsd.org/changeset/base/273549 > >>> > >>> Log: > >>> Avoid taking the lock in selfdfree when not needed. > >>> > >>> Modified: > >>> head/sys/kern/sys_generic.c > >>> > >>> Modified: head/sys/kern/sys_generic.c > >> == > >>> --- head/sys/kern/sys_generic.cThu Oct 23 15:16:40 2014(r273548) > >>> +++ head/sys/kern/sys_generic.cThu Oct 23 15:35:47 2014(r273549) > >>> @@ -1600,10 +1600,11 @@ static void > >>> selfdfree(struct seltd *stp, struct selfd *sfp) > >>> { > >>>STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); > >>> -mtx_lock(sfp->sf_mtx); > >>> -if (sfp->sf_si) > >>> +if (sfp->sf_si != NULL) { > >>> +mtx_lock(sfp->sf_mtx); > >>>TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); > >>> -mtx_unlock(sfp->sf_mtx); > >>> +mtx_unlock(sfp->sf_mtx); > >>> +} > >>>uma_zfree(selfd_zone, sfp); > >> > >> How do you ensure that the value you read for sf_si here is up to date? In > >> particular, if a thread is selecting on multiple fds and one awakens it, > >> another fd can invoke selwakeup() while the thread is in seltdclear(). > >> In that case, you might see a stale value of sf_si and not realize it is > >> cleared by the selwakeup() after you get the lock and you will invoke > >> TAILQ_REMOVE an extra time. > > > > FWIW, I've just hit a panic in selfdfree(). > > > > > > -- John Baldwin ___ 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: r273558 - head/sys/i386/i386
Author: alc Date: Thu Oct 23 21:02:40 2014 New Revision: 273558 URL: https://svnweb.freebsd.org/changeset/base/273558 Log: Under PAE ULONG is insufficient for representing the physical memory size. Use QUAD for "hw.physmem" so that a physical memory size greater than 4 GB can be specified from the boot loader. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c == --- head/sys/i386/i386/machdep.cThu Oct 23 20:43:16 2014 (r273557) +++ head/sys/i386/i386/machdep.cThu Oct 23 21:02:40 2014 (r273558) @@ -2463,10 +2463,10 @@ static void getmemsize(int first) { int has_smap, off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest; + u_long memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; - quad_t dcons_addr, dcons_size; + quad_t dcons_addr, dcons_size, physmem_tunable; #ifndef XEN int hasbrokenint12, i, res; u_int extmem; @@ -2650,7 +2650,7 @@ physmap_done: Maxmem = MAXMEM / 4; #endif - if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) + if (TUNABLE_QUAD_FETCH("hw.physmem", &physmem_tunable)) Maxmem = atop(physmem_tunable); /* ___ 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: r273561 - head/sys/arm/freescale/imx
Author: ian Date: Thu Oct 23 22:21:22 2014 New Revision: 273561 URL: https://svnweb.freebsd.org/changeset/base/273561 Log: Install a temporary workaround to avoid problems in fdt data with linux's workaround for an imx6 chip erratum. Linux works around the bug with changes in fdt data that we can't currently handle, so to enable running with standard vendor-supplied fdt data, this watches for an attempt to map the gpio1_6 interrupt and remaps it back to the standard ethernet interrupt. This can be undone when the intrng project is completed and our gpio drivers can also be interrupt controllers. Modified: head/sys/arm/freescale/imx/imx6_machdep.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c == --- head/sys/arm/freescale/imx/imx6_machdep.c Thu Oct 23 21:38:54 2014 (r273560) +++ head/sys/arm/freescale/imx/imx6_machdep.c Thu Oct 23 22:21:22 2014 (r273561) @@ -54,8 +54,39 @@ struct fdt_fixup_entry fdt_fixup_table[] { NULL, NULL } }; +static uint32_t gpio1_node; + +/* + * Work around the linux workaround for imx6 erratum 006687, in which some + * ethernet interrupts don't go to the GPC and thus won't wake the system from + * Wait mode. We don't use Wait mode (which halts the GIC, leaving only GPC + * interrupts able to wake the system), so we don't experience the bug at all. + * The linux workaround is to reconfigure GPIO1_6 as the ENET interrupt by + * writing magic values to an undocumented IOMUX register, then letting the gpio + * interrupt driver notify the ethernet driver. We'll be able to do all that + * (even though we don't need to) once the INTRNG project is committed and the + * imx_gpio driver becomes an interrupt driver. Until then, this crazy little + * workaround watches for requests to map an interrupt 6 with the interrupt + * controller node referring to gpio1, and it substitutes the proper ffec + * interrupt number. + */ +static int +imx6_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt, +int *trig, int *pol) +{ + + if (fdt32_to_cpu(intr[0]) == 6 && + OF_node_from_xref(iparent) == gpio1_node) { + *interrupt = 150; + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + return (0); + } + return (gic_decode_fdt(iparent, intr, interrupt, trig, pol)); +} + fdt_pic_decode_t fdt_pic_table[] = { - &gic_decode_fdt, + &imx6_decode_fdt, NULL }; @@ -84,6 +115,9 @@ void platform_late_init(void) { + /* Cache the gpio1 node handle for imx6_decode_fdt() workaround code. */ + gpio1_node = OF_node_from_xref( + OF_finddevice("/soc/aips-bus@0200/gpio@0209c000")); } /* ___ 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: r273562 - in head/contrib/libxo: . bin build doc libxo m4 packaging tests tests/core tests/core/saved tests/xo tests/xo/saved xo xohtml xohtml/external xolint
Author: marcel Date: Thu Oct 23 22:30:14 2014 New Revision: 273562 URL: https://svnweb.freebsd.org/changeset/base/273562 Log: Import libxo 0.1.4 Obtained from:https://github.com/Juniper/libxo Sponsored by: Juniper Networks, Inc. Added: head/contrib/libxo/ head/contrib/libxo/.gitignore head/contrib/libxo/.travis.yml head/contrib/libxo/Copyright head/contrib/libxo/LICENSE head/contrib/libxo/Makefile.am (contents, props changed) head/contrib/libxo/README.md head/contrib/libxo/bin/ head/contrib/libxo/bin/Makefile.am (contents, props changed) head/contrib/libxo/bin/Zaliases head/contrib/libxo/bin/setup.sh (contents, props changed) head/contrib/libxo/build/ head/contrib/libxo/build/.create head/contrib/libxo/configure.ac head/contrib/libxo/doc/ head/contrib/libxo/doc/Makefile.am (contents, props changed) head/contrib/libxo/doc/libxo.txt (contents, props changed) head/contrib/libxo/install-sh (contents, props changed) head/contrib/libxo/libxo/ head/contrib/libxo/libxo-config.in (contents, props changed) head/contrib/libxo/libxo/Makefile.am (contents, props changed) head/contrib/libxo/libxo/gen-wide.sh (contents, props changed) head/contrib/libxo/libxo/libxo.3 (contents, props changed) head/contrib/libxo/libxo/libxo.c (contents, props changed) head/contrib/libxo/libxo/xo.h (contents, props changed) head/contrib/libxo/libxo/xo_attr.3 (contents, props changed) head/contrib/libxo/libxo/xo_create.3 (contents, props changed) head/contrib/libxo/libxo/xo_emit.3 (contents, props changed) head/contrib/libxo/libxo/xo_err.3 (contents, props changed) head/contrib/libxo/libxo/xo_finish.3 (contents, props changed) head/contrib/libxo/libxo/xo_flush.3 (contents, props changed) head/contrib/libxo/libxo/xo_format.5 (contents, props changed) head/contrib/libxo/libxo/xo_no_setlocale.3 (contents, props changed) head/contrib/libxo/libxo/xo_open_container.3 (contents, props changed) head/contrib/libxo/libxo/xo_open_list.3 (contents, props changed) head/contrib/libxo/libxo/xo_parse_args.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_allocator.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_flags.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_info.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_options.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_style.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_writer.3 (contents, props changed) head/contrib/libxo/libxo/xoconfig.h.in (contents, props changed) head/contrib/libxo/libxo/xoversion.h.in (contents, props changed) head/contrib/libxo/m4/ head/contrib/libxo/m4/libtool.m4 head/contrib/libxo/m4/ltoptions.m4 head/contrib/libxo/m4/ltsugar.m4 head/contrib/libxo/m4/ltversion.m4 head/contrib/libxo/m4/lt~obsolete.m4 head/contrib/libxo/packaging/ head/contrib/libxo/packaging/libxo.pc.in (contents, props changed) head/contrib/libxo/packaging/libxo.spec.in (contents, props changed) head/contrib/libxo/tests/ head/contrib/libxo/tests/Makefile.am (contents, props changed) head/contrib/libxo/tests/core/ head/contrib/libxo/tests/core/Makefile.am (contents, props changed) head/contrib/libxo/tests/core/saved/ head/contrib/libxo/tests/core/saved/test_01.H.err head/contrib/libxo/tests/core/saved/test_01.H.out head/contrib/libxo/tests/core/saved/test_01.HIPx.err head/contrib/libxo/tests/core/saved/test_01.HIPx.out head/contrib/libxo/tests/core/saved/test_01.HP.err head/contrib/libxo/tests/core/saved/test_01.HP.out head/contrib/libxo/tests/core/saved/test_01.J.err head/contrib/libxo/tests/core/saved/test_01.J.out head/contrib/libxo/tests/core/saved/test_01.JP.err head/contrib/libxo/tests/core/saved/test_01.JP.out head/contrib/libxo/tests/core/saved/test_01.T.err head/contrib/libxo/tests/core/saved/test_01.T.out head/contrib/libxo/tests/core/saved/test_01.X.err head/contrib/libxo/tests/core/saved/test_01.X.out head/contrib/libxo/tests/core/saved/test_01.XP.err head/contrib/libxo/tests/core/saved/test_01.XP.out head/contrib/libxo/tests/core/saved/test_01.err head/contrib/libxo/tests/core/saved/test_01.out head/contrib/libxo/tests/core/saved/test_02.H.err head/contrib/libxo/tests/core/saved/test_02.H.out head/contrib/libxo/tests/core/saved/test_02.HIPx.err head/contrib/libxo/tests/core/saved/test_02.HIPx.out head/contrib/libxo/tests/core/saved/test_02.HP.err head/contrib/libxo/tests/core/saved/test_02.HP.out head/contrib/libxo/tests/core/saved/test_02.J.err head/contrib/libxo/tests/core/saved/test_02.J.out head/contrib/libxo/tests/core/saved/test_02.JP.err head/contrib/libxo/tests/core/saved/test_02.JP.out head/contrib/libxo/tests/core/saved/test_02.T.err head/contrib/libxo/tests/core/saved/test_02.T.out head/contrib/libxo/tests/core/saved/test_02.X.err head/contrib/libxo/tests
svn commit: r273563 - head/contrib/libxo/libxo
Author: marcel Date: Thu Oct 23 22:33:27 2014 New Revision: 273563 URL: https://svnweb.freebsd.org/changeset/base/273563 Log: Add generated headers xoversion.h and xoconfig.h. These are the result of configuring the source tree: % automake --add-missing % autoconf % ./configure Added: head/contrib/libxo/libxo/xoconfig.h (contents, props changed) head/contrib/libxo/libxo/xoversion.h (contents, props changed) Added: head/contrib/libxo/libxo/xoconfig.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/libxo/xoconfig.h Thu Oct 23 22:33:27 2014 (r273563) @@ -0,0 +1,199 @@ +/* libxo/xoconfig.h. Generated from xoconfig.h.in by configure. */ +/* libxo/xoconfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the `asprintf' function. */ +#define HAVE_ASPRINTF 1 + +/* Define to 1 if you have the `bzero' function. */ +#define HAVE_BZERO 1 + +/* Define to 1 if you have the `ctime' function. */ +#define HAVE_CTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlfunc' function. */ +#define HAVE_DLFUNC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `fdopen' function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `getpass' function. */ +#define HAVE_GETPASS 1 + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Support printflike */ +/* #undef HAVE_PRINTFLIKE */ + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `srand' function. */ +#define HAVE_SRAND 1 + +/* Define to 1 if you have the `sranddev' function. */ +#define HAVE_SRANDDEV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDTIME_TZFILE_H */ + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strcspn' function. */ +#define HAVE_STRCSPN 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strspn' function. */ +#define HAVE_STRSPN 1 + +/* Define to 1 if you have the `sysctlbyname' function. */ +#define HAVE_SYSCTLBYNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TZFILE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Enable debugging */ +/* #undef LIBXO_DEBUG */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libxo" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKA
svn commit: r273564 - head/sys/kern
Author: des Date: Thu Oct 23 22:42:56 2014 New Revision: 273564 URL: https://svnweb.freebsd.org/changeset/base/273564 Log: In all cases except CTLTYPE_STRING, penv is NULL here, so passing it indiscriminately to printf() and freeenv() is incorrect. Add a NULL check before freeenv(); as for printf(), we could use req.newptr instead, but we'd have to select the correct format string based on the type, and that's too much work for an error message, so just remove it. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Thu Oct 23 22:33:27 2014(r273563) +++ head/sys/kern/kern_sysctl.c Thu Oct 23 22:42:56 2014(r273564) @@ -280,11 +280,10 @@ sysctl_load_tunable_by_oid_locked(struct } error = sysctl_root_handler_locked(oidp, oidp->oid_arg1, oidp->oid_arg2, &req); - if (error != 0) { - printf("Setting sysctl '%s' to '%s' failed: %d\n", - path, penv, error); - } - freeenv(penv); + if (error != 0) + printf("Setting sysctl %s failed: %d\n", path, error); + if (penv != NULL) + freeenv(penv); } 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"
Re: svn commit: r273552 - head/sys/kern
Xin LI writes: > Log: > Test if 'env' is NULL before doing memset() and strlen(), > the caller may pass NULL to freeenv(). If this is in response to a panic in early boot, the real bug is elsewhere (see r273564). Adding a NULL check here only hides it. DES -- Dag-Erling Smørgrav - d...@des.no ___ 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: r273566 - head/sys/dev/gpio
Author: loos Date: Thu Oct 23 23:12:30 2014 New Revision: 273566 URL: https://svnweb.freebsd.org/changeset/base/273566 Log: Provide a working GPIOBUS_IVAR() macro for FDT systems. Modified: head/sys/dev/gpio/gpiobusvar.h Modified: head/sys/dev/gpio/gpiobusvar.h == --- head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:11:04 2014 (r273565) +++ head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:12:30 2014 (r273566) @@ -41,7 +41,12 @@ #include "gpio_if.h" +#ifdef FDT +#defineGPIOBUS_IVAR(d) (struct gpiobus_ivar *) \ + &((struct ofw_gpiobus_devinfo *)device_get_ivars(d))->opd_dinfo +#else #defineGPIOBUS_IVAR(d) (struct gpiobus_ivar *) device_get_ivars(d) +#endif #defineGPIOBUS_SOFTC(d) (struct gpiobus_softc *) device_get_softc(d) #defineGPIOBUS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #defineGPIOBUS_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) ___ 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: r273567 - in head: etc/mtree lib lib/libxo
Author: marcel Date: Thu Oct 23 23:14:23 2014 New Revision: 273567 URL: https://svnweb.freebsd.org/changeset/base/273567 Log: Hook libxo to the build. Sponsored by: Juniper Networks, Inc. Added: head/lib/libxo/ head/lib/libxo/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/lib/Makefile Modified: head/etc/mtree/BSD.include.dist == --- head/etc/mtree/BSD.include.dist Thu Oct 23 23:12:30 2014 (r273566) +++ head/etc/mtree/BSD.include.dist Thu Oct 23 23:14:23 2014 (r273567) @@ -249,6 +249,8 @@ .. libmilter .. +libxo +.. lzma .. machine Modified: head/lib/Makefile == --- head/lib/Makefile Thu Oct 23 23:12:30 2014(r273566) +++ head/lib/Makefile Thu Oct 23 23:14:23 2014(r273567) @@ -106,6 +106,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libvgl} \ ${_libvmmapi} \ libwrap \ + libxo \ liby \ ${_libypclnt} \ libz \ Added: head/lib/libxo/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libxo/Makefile Thu Oct 23 23:14:23 2014(r273567) @@ -0,0 +1,36 @@ +# $FreeBSD$ + +LIBXO= ${.CURDIR:H:H}/contrib/libxo + +.PATH: ${LIBXO}/libxo + +LIB= xo +SHLIB_MAJOR=0 + +SRCS= libxo.c + +CFLAGS+=-I${LIBXO}/libxo + +INCS= xo.h +INCSDIR=${INCLUDEDIR}/libxo + +MAN+= libxo.3 +MAN+= xo_attr.3 \ + xo_create.3 \ + xo_emit.3 \ + xo_err.3 \ + xo_finish.3 \ + xo_flush.3 \ + xo_no_setlocale.3 \ + xo_open_container.3 \ + xo_open_list.3 \ + xo_parse_args.3 \ + xo_set_allocator.3 \ + xo_set_flags.3 \ + xo_set_info.3 \ + xo_set_options.3 \ + xo_set_style.3 \ + xo_set_writer.3 +MAN+= xo_format.5 + +.include ___ 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: r273568 - in head/usr.bin: . xo
Author: marcel Date: Thu Oct 23 23:16:21 2014 New Revision: 273568 URL: https://svnweb.freebsd.org/changeset/base/273568 Log: Hook xo(1) to the build -- it's like echo, but uses libxo to support emitting machine-readable output. Sponsored by: Juniper Networks, Inc. Added: head/usr.bin/xo/ head/usr.bin/xo/Makefile (contents, props changed) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile == --- head/usr.bin/Makefile Thu Oct 23 23:14:23 2014(r273567) +++ head/usr.bin/Makefile Thu Oct 23 23:16:21 2014(r273568) @@ -196,6 +196,7 @@ SUBDIR= alias \ xargs \ xinstall \ ${_xlint} \ + xo \ ${_xstr} \ xz \ xzdec \ Added: head/usr.bin/xo/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/xo/MakefileThu Oct 23 23:16:21 2014(r273568) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +LIBXO= ${.CURDIR:H:H}/contrib/libxo + +.PATH: ${LIBXO}/xo + +PROG= xo +MAN= xo.1 + +# XXX For xoversion.h +CFLAGS+=-I${LIBXO}/libxo + +DPADD= ${LIBXO} +LDADD= -lxo + +.include ___ 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: r273552 - head/sys/kern
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 10/23/14 15:47, Dag-Erling Smørgrav wrote: > Xin LI writes: >> Log: Test if 'env' is NULL before doing memset() and strlen(), >> the caller may pass NULL to freeenv(). > > If this is in response to a panic in early boot, the real bug is > elsewhere (see r273564). Adding a NULL check here only hides it. Yes that would fix it. Does this look good to you? Index: sys/kern/kern_environment.c === - --- sys/kern/kern_environment.c (revision 273564) +++ sys/kern/kern_environment.c (working copy) @@ -262,7 +262,8 @@ void freeenv(char *env) { - - if (dynamic_kenv && env != NULL) { + MPASS(env != NULL); + if (dynamic_kenv) { memset(env, 0, strlen(env)); free(env, M_KENV); } Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0 iQIcBAEBCgAGBQJUSYzoAAoJEJW2GBstM+nsSnYP/i4boJtEHPzOiJceF0x1OW+h /Jn/ewoZh5itogPuGBcXB0QSNZIoQjH3x8Puv6S+bgfGwP6oXtWGpFHeH1EXtu0N pUqaft3VP8d/8+QeM0l5GSrYWverDZM0FpwnhWC0L/+0Fen52pseLGJIYGmG0Z80 vBxiRokXmNtC467tgu5upSSXDftEu9RFsWPCtuTr2yP+RZYC98hdSTl2EufA0L3Z ih46Iz+zIYcQt7ziryQ0nblGSuQy+AucqPa/0/fs9mSpqd0+fSphR+nd62P60yC4 mDUB093mMl/PhZY5IrfoU1DTxDdUJNoGc1wNdzKqsbxTbjpMJMeWr6dHX2pni8Ki MCR+Hh6aMxC+P0g2n5cCmTTff8ghRXSW0/pSluJjyPALmYHXCUdnXWAj59hkbpUA O6wOtth4rLi0ZcGPT4hNKu5bm+BvhQ4EEKjomB+WzZUmUL+/H8xoin2xEaItMs6T uDaZqaknRACr5+TFuwVbBP77QOZ9i9EcqBIMOSkNw1E0NqdGLxTwud8IQCqMAONJ ZHrwNOCM91sLk4ohjrPNzZzY3IXostBzRNNJQvFEXQJhbxJvQM3CDcr/QOoMajN2 1VWMbxrONgcyi8RTC8PvOgxRN36SFBJP0rxhrn465xGpAWsZ9M28sOWmKk2O4yhB LHZuuMYanWSQ0+SYJrGT =eSq9 -END PGP SIGNATURE- ___ 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: r273569 - head/sys/dev/gpio
Author: loos Date: Thu Oct 23 23:20:04 2014 New Revision: 273569 URL: https://svnweb.freebsd.org/changeset/base/273569 Log: Move the duplicated code to a single function. No functional changes. Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c == --- head/sys/dev/gpio/gpiobus.c Thu Oct 23 23:16:21 2014(r273568) +++ head/sys/dev/gpio/gpiobus.c Thu Oct 23 23:20:04 2014(r273569) @@ -99,6 +99,34 @@ gpiobus_print_pins(struct gpiobus_ivar * printf("%d", range_start); } +int +gpiobus_init_softc(device_t dev) +{ + struct gpiobus_softc *sc; + + sc = GPIOBUS_SOFTC(dev); + sc->sc_busdev = dev; + sc->sc_dev = device_get_parent(dev); + + if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0) + return (ENXIO); + + KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); + + /* Pins = GPIO_PIN_MAX() + 1 */ + sc->sc_npins++; + + sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->sc_pins_mapped == NULL) + return (ENOMEM); + + /* Initialize the bus lock. */ + GPIOBUS_LOCK_INIT(sc); + + return (0); +} + static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { @@ -163,30 +191,11 @@ gpiobus_probe(device_t dev) static int gpiobus_attach(device_t dev) { - struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); - int res; - - sc->sc_busdev = dev; - sc->sc_dev = device_get_parent(dev); - res = GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins); - if (res) - return (ENXIO); - - KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); - - /* -* Increase to get number of pins -*/ - sc->sc_npins++; - - sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (!sc->sc_pins_mapped) - return (ENOMEM); + int err; - /* init bus lock */ - GPIOBUS_LOCK_INIT(sc); + err = gpiobus_init_softc(dev); + if (err != 0) + return (err); /* * Get parent's pins and mark them as unmapped Modified: head/sys/dev/gpio/gpiobusvar.h == --- head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:20:04 2014 (r273569) @@ -89,6 +89,7 @@ gpio_map_gpios(device_t bus, phandle_t d device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t); #endif void gpiobus_print_pins(struct gpiobus_ivar *); +int gpiobus_init_softc(device_t); extern driver_t gpiobus_driver; Modified: head/sys/dev/gpio/ofw_gpiobus.c == --- head/sys/dev/gpio/ofw_gpiobus.c Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/ofw_gpiobus.c Thu Oct 23 23:20:04 2014 (r273569) @@ -264,33 +264,13 @@ ofw_gpiobus_probe(device_t dev) static int ofw_gpiobus_attach(device_t dev) { - struct gpiobus_softc *sc; + int err; phandle_t child; - sc = GPIOBUS_SOFTC(dev); - sc->sc_busdev = dev; - sc->sc_dev = device_get_parent(dev); - - /* Read the pin max. value */ - if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0) - return (ENXIO); - - KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); - - /* -* Increase to get number of pins. -*/ - sc->sc_npins++; - - sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (!sc->sc_pins_mapped) - return (ENOMEM); - - /* Init the bus lock. */ - GPIOBUS_LOCK_INIT(sc); - + err = gpiobus_init_softc(dev); + if (err != 0) + return (err); + bus_generic_probe(dev); bus_enumerate_hinted_children(dev); ___ 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: r273552 - head/sys/kern
On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > On 10/23/14 15:47, Dag-Erling Smørgrav wrote: > > Xin LI writes: > >> Log: Test if 'env' is NULL before doing memset() and strlen(), > >> the caller may pass NULL to freeenv(). > > > > If this is in response to a panic in early boot, the real bug is > > elsewhere (see r273564). Adding a NULL check here only hides it. > > Yes that would fix it. Does this look good to you? > > Index: sys/kern/kern_environment.c > === > - --- sys/kern/kern_environment.c (revision 273564) > +++ sys/kern/kern_environment.c (working copy) > @@ -262,7 +262,8 @@ void > freeenv(char *env) > { > > - - if (dynamic_kenv && env != NULL) { > + MPASS(env != NULL); > + if (dynamic_kenv) { > memset(env, 0, strlen(env)); > free(env, M_KENV); > } > There are at least 80 consumers of this function. Unless someone is up to reviewing them all, can we go with a warning + backtrace for the time being? -- Mateusz Guzik ___ 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: r273552 - head/sys/kern
On 10/23/2014 6:21 PM, Mateusz Guzik wrote: > On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA512 >> >> On 10/23/14 15:47, Dag-Erling Smørgrav wrote: >>> Xin LI writes: Log: Test if 'env' is NULL before doing memset() and strlen(), the caller may pass NULL to freeenv(). >>> >>> If this is in response to a panic in early boot, the real bug is >>> elsewhere (see r273564). Adding a NULL check here only hides it. >> >> Yes that would fix it. Does this look good to you? >> >> Index: sys/kern/kern_environment.c >> === >> - --- sys/kern/kern_environment.c(revision 273564) >> +++ sys/kern/kern_environment.c (working copy) >> @@ -262,7 +262,8 @@ void >> freeenv(char *env) >> { >> >> - - if (dynamic_kenv && env != NULL) { >> +MPASS(env != NULL); >> +if (dynamic_kenv) { >> memset(env, 0, strlen(env)); >> free(env, M_KENV); >> } >> > > There are at least 80 consumers of this function. Unless someone is up > to reviewing them all, can we go with a warning + backtrace for the time > being? > My DEBUG_WARN could be used for that. I had not committed yet, but it is ready. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
svn commit: r273570 - head/sys/cddl/dev/fbt/powerpc
Author: jhibbits Date: Fri Oct 24 03:33:01 2014 New Revision: 273570 URL: https://svnweb.freebsd.org/changeset/base/273570 Log: Three updates to PowerPC FBT: * Use a constant to define the number of stack frames in a probe exception. * Only allow function symbols in powerpc64 ('.' prefixed) * Set the fbtp_roffset for return probes, so the correct dtrace_probe call is made. MFC after:1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c == --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Thu Oct 23 23:20:04 2014 (r273569) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) @@ -48,6 +48,7 @@ #defineFBT_ENTRY "entry" #defineFBT_RETURN "return" +#define FBT_AFRAMES7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) @@ -116,9 +117,17 @@ fbt_provide_module_function(linker_file_ int j; uint32_t *instr, *limit; - /* PowerPC64 uses '.' prefixes on symbol names, ignore it. */ +#ifdef __powerpc64__ + /* +* PowerPC64 uses '.' prefixes on symbol names, ignore it, but only +* allow symbols with the '.' prefix, so that we don't get the function +* descriptor instead. +*/ if (name[0] == '.') name++; + else + return (0); +#endif if (strncmp(name, "dtrace_", 7) == 0 && strncmp(name, "dtrace_safe_", 12) != 0) { @@ -147,7 +156,7 @@ fbt_provide_module_function(linker_file_ fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 7, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; @@ -210,7 +219,7 @@ again: if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 7, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_next = fbt; fbt->fbtp_id = retfbt->fbtp_id; @@ -229,6 +238,9 @@ again: else fbt->fbtp_rval = DTRACE_INVOP_JUMP; + fbt->fbtp_roffset = + (uintptr_t)((uint8_t *)instr - (uint8_t *)symval->value); + fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; ___ 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: r273571 - head/sys/cddl/dev/fbt/powerpc
Author: jhibbits Date: Fri Oct 24 03:34:21 2014 New Revision: 273571 URL: https://svnweb.freebsd.org/changeset/base/273571 Log: Whitespace X-MFC-with: r273570 MFC after:1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c == --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:34:21 2014 (r273571) @@ -48,7 +48,7 @@ #defineFBT_ENTRY "entry" #defineFBT_RETURN "return" -#define FBT_AFRAMES7 +#defineFBT_AFRAMES 7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) ___ 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: r273572 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Fri Oct 24 03:42:37 2014 New Revision: 273572 URL: https://svnweb.freebsd.org/changeset/base/273572 Log: - Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always executed on a non-devfs filesystem - Expect mknod(path, S_IFREG, 0) to fail on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_mknod.cFri Oct 24 03:34:21 2014(r273571) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mknod.cFri Oct 24 03:42:37 2014(r273572) @@ -58,8 +58,15 @@ ATF_TC_BODY(mknod_err, tc) (void)memset(buf, 'x', sizeof(buf)); +#ifndef __FreeBSD__ + /* +* As of FreeBSD 6.0 device nodes may be created in regular file systems but +* such nodes cannot be used to access devices. As a result an invalid dev +* argument is unchecked. +*/ errno = 0; ATF_REQUIRE_ERRNO(EINVAL, mknod(path, S_IFCHR, -1) == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, mknod(buf, S_IFCHR, 0) == -1); @@ -166,6 +173,9 @@ ATF_TC_BODY(mknod_stat, tc) (void)memset(&st, 0, sizeof(struct stat)); +#ifdef __FreeBSD__ + atf_tc_expect_fail("mknod does not allow S_IFREG"); +#endif ATF_REQUIRE(mknod(path, S_IFREG, 0) == 0); ATF_REQUIRE(stat(path, &st) == 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: r273573 - stable/10/sys/amd64/amd64
Author: neel Date: Fri Oct 24 03:48:54 2014 New Revision: 273573 URL: https://svnweb.freebsd.org/changeset/base/273573 Log: MFC r273356: Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT misconfiguration VM-exit. Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c == --- stable/10/sys/amd64/amd64/pmap.cFri Oct 24 03:42:37 2014 (r273572) +++ stable/10/sys/amd64/amd64/pmap.cFri Oct 24 03:48:54 2014 (r273573) @@ -6791,9 +6791,19 @@ retry: if (ftype == VM_PROT_WRITE) { if ((*pte & PG_RW) == 0) goto done; - *pte |= PG_M; + /* +* Set the modified and accessed bits simultaneously. +* +* Intel EPT PTEs that do software emulation of A/D bits map +* PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE respectively. +* An EPT misconfiguration is triggered if the PTE is writable +* but not readable (WR=10). This is avoided by setting PG_A +* and PG_M simultaneously. +*/ + *pte |= PG_M | PG_A; + } else { + *pte |= PG_A; } - *pte |= PG_A; /* try to promote the mapping */ if (va < VM_MAXUSER_ADDRESS) ___ 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: r273574 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Fri Oct 24 03:53:49 2014 New Revision: 273574 URL: https://svnweb.freebsd.org/changeset/base/273574 Log: - Test for EINVAL requirement when passing an invalid flag in to msync(2) - Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msync.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_msync.cFri Oct 24 03:48:54 2014(r273573) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msync.cFri Oct 24 03:53:49 2014(r273574) @@ -170,8 +170,15 @@ ATF_TC_BODY(msync_err, tc) /* * Test that invalid flags error out. */ +#ifdef __FreeBSD__ + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", -1) != NULL); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", INT_MAX) != NULL); +#else ATF_REQUIRE(msync_sync("error", -1) != NULL); ATF_REQUIRE(msync_sync("error", INT_MAX) != NULL); +#endif errno = 0; @@ -185,7 +192,11 @@ ATF_TC_BODY(msync_err, tc) (void)munmap(map, page); ATF_REQUIRE(msync(map, page, MS_SYNC) != 0); +#ifdef __FreeBSD__ + ATF_REQUIRE(errno == ENOMEM); +#else ATF_REQUIRE(errno == EFAULT); +#endif } ATF_TC(msync_invalidate); ___ 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: r273575 - head/usr.bin/vmstat
Author: mckusick Date: Fri Oct 24 04:01:14 2014 New Revision: 273575 URL: https://svnweb.freebsd.org/changeset/base/273575 Log: Fix formatting of vmstat (1) so that it looks cleaner on standard 80 column displays. In particular it wraps far less often. Submitted by: Andy Kosela PR: 191976 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c == --- head/usr.bin/vmstat/vmstat.cFri Oct 24 03:53:49 2014 (r273574) +++ head/usr.bin/vmstat/vmstat.cFri Oct 24 04:01:14 2014 (r273575) @@ -767,22 +767,26 @@ dovmstat(unsigned int interval, int reps fill_vmmeter(&sum); fill_vmtotal(&total); - (void)printf("%2d %1d %1d", + (void)printf("%1d %1d %1d", total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); #define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) #definerate(x) (((x) * rate_adj + halfuptime) / uptime)/* round */ if (hflag) { + printf(""); + prthuman(total.t_avm * (u_int64_t)sum.v_page_size, 5); printf(" "); - prthuman(total.t_avm * (u_int64_t)sum.v_page_size, 7); - printf(" "); - prthuman(total.t_free * (u_int64_t)sum.v_page_size, 6); + prthuman(total.t_free * (u_int64_t)sum.v_page_size, 5); printf(" "); + (void)printf("%5lu ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } else { - printf(" %7d ", vmstat_pgtok(total.t_avm)); - printf(" %6d ", vmstat_pgtok(total.t_free)); + printf(" %7d", vmstat_pgtok(total.t_avm)); + printf(" %7d ", vmstat_pgtok(total.t_free)); + (void)printf("%4lu ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } - (void)printf("%5lu ", - (unsigned long)rate(sum.v_vm_faults - osum.v_vm_faults)); (void)printf("%3lu ", (unsigned long)rate(sum.v_reactivated - osum.v_reactivated)); (void)printf("%3lu ", @@ -793,10 +797,10 @@ dovmstat(unsigned int interval, int reps (osum.v_swapout + osum.v_vnodeout))); (void)printf("%5lu ", (unsigned long)rate(sum.v_tfree - osum.v_tfree)); - (void)printf("%3lu ", + (void)printf("%4lu ", (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); devstats(); - (void)printf("%4lu %4lu %4lu", + (void)printf("%4lu %5lu %5lu", (unsigned long)rate(sum.v_intr - osum.v_intr), (unsigned long)rate(sum.v_syscall - osum.v_syscall), (unsigned long)rate(sum.v_swtch - osum.v_swtch)); @@ -824,35 +828,43 @@ dovmstat(unsigned int interval, int reps } static void -printhdr(int maxid, u_long cpumask) +printhdr(int ncpus, u_long cpumask) { int i, num_shown; num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs; - (void)printf(" procs memory page%*s", 19, ""); + if (hflag) { + (void)printf("procs memory page%*s ", 19, ""); + } else { + (void)printf("procs memory page%*s ", 19, ""); + } if (num_shown > 1) - (void)printf(" disks %*s", num_shown * 4 - 7, ""); + (void)printf(" disks %*s", num_shown * 4 - 7, ""); else if (num_shown == 1) - (void)printf("disk"); - (void)printf(" faults "); + (void)printf(" disk"); + (void)printf(" faults "); if (Pflag) { - for (i = 0; i <= maxid; i++) { + for (i = 0; i < ncpus; i++) { if (cpumask & (1ul << i)) - printf("cpu%-2d", i); + printf(" cpu%d ", i); } printf("\n"); } else - printf("cpu\n"); - (void)printf(" r b w avmfre flt re pi pofr sr "); + printf(" cpu\n"); + if (hflag) { + (void)printf("r b w avm fre flt re pi pofr sr "); + } else { + (void)printf("r b w avm fre flt re pi pofr sr "); + } for (i = 0; i < num_devices; i++) if ((dev_select[i].selected) && (dev_select[i].selected <= maxshowdevs)) (void)printf("%c%c%d ", dev_select[i].device_nam
svn commit: r273576 - head/sys/dev/uart
Author: araujo (ports committer) Date: Fri Oct 24 05:39:32 2014 New Revision: 273576 URL: https://svnweb.freebsd.org/changeset/base/273576 Log: Fix a leaked Storage Variable. Phabric: D981 Submitted by: myself Reported by: Coverity CID: 1248848 Reworked by: kevlo Reviewed by: marcel, davide, ray, kevlo Approved by: marcel, kevlo Modified: head/sys/dev/uart/uart_subr.c Modified: head/sys/dev/uart/uart_subr.c == --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014 (r273575) +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014 (r273576) @@ -196,7 +196,7 @@ out: int uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) { - const char *spec; + const char *cp, *spec; bus_addr_t addr = ~0U; int error; @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev * port (resp). */ if (devtype == UART_DEV_CONSOLE) - spec = kern_getenv("hw.uart.console"); + cp = kern_getenv("hw.uart.console"); else if (devtype == UART_DEV_DBGPORT) - spec = kern_getenv("hw.uart.dbgport"); + cp = kern_getenv("hw.uart.dbgport"); else - spec = NULL; - if (spec == NULL) + cp = NULL; + if (cp == NULL) return (ENXIO); /* Set defaults. */ @@ -232,6 +232,7 @@ uart_getenv(int devtype, struct uart_dev di->parity = UART_PARITY_NONE; /* Parse the attributes. */ + spec = cp; while (1) { switch (uart_parse_tag(&spec)) { case UART_TAG_BR: @@ -267,14 +268,18 @@ uart_getenv(int devtype, struct uart_dev di->bas.rclk = uart_parse_long(&spec); break; default: + freeenv(__DECONST(char *, cp)); return (EINVAL); } if (*spec == '\0') break; - if (*spec != ',') + if (*spec != ',') { + freeenv(__DECONST(char *, cp)); return (EINVAL); + } spec++; } + freeenv(__DECONST(char *, cp)); /* * If we still have an invalid address, the specification must be ___ 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: r273576 - head/sys/dev/uart
On Fri, Oct 24, 2014 at 05:39:32AM +, Marcelo Araujo wrote: > Author: araujo (ports committer) > Date: Fri Oct 24 05:39:32 2014 > New Revision: 273576 > URL: https://svnweb.freebsd.org/changeset/base/273576 > > Log: > Fix a leaked Storage Variable. > > int > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) > { > - const char *spec; > + const char *cp, *spec; > bus_addr_t addr = ~0U; > int error; > > @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev >* port (resp). >*/ > if (devtype == UART_DEV_CONSOLE) > - spec = kern_getenv("hw.uart.console"); > + cp = kern_getenv("hw.uart.console"); > else if (devtype == UART_DEV_DBGPORT) > - spec = kern_getenv("hw.uart.dbgport"); > + cp = kern_getenv("hw.uart.dbgport"); > else > - spec = NULL; > - if (spec == NULL) > + cp = NULL; > + if (cp == NULL) > return (ENXIO); [..] > default: > + freeenv(__DECONST(char *, cp)); > return (EINVAL); > } > if (*spec == '\0') > break; > - if (*spec != ',') > + if (*spec != ',') { > + freeenv(__DECONST(char *, cp)); > return (EINVAL); > + } > spec++; > } > + freeenv(__DECONST(char *, cp)); > Why not 'char *cp;'? That would avoid __DECONST entirely and would not require spec to change type. There are some cosmetics around that may be worth fixing (e.g. if, else-if instead of switch, while (1) instead of for (;;)). -- Mateusz Guzik ___ 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: r273577 - in head/sys/dev/hyperv: netvsc stordisengage storvsc utilities
Author: delphij Date: Fri Oct 24 06:27:45 2014 New Revision: 273577 URL: https://svnweb.freebsd.org/changeset/base/273577 Log: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree driver. This change was verified by Microsoft. Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 05:39:32 2014(r273576) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 06:27:45 2014(r273577) @@ -218,7 +218,7 @@ netvsc_probe(device_t dev) if (bootverbose) printf("Netvsc probe... DONE \n"); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); Modified: head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c == --- head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.cFri Oct 24 05:39:32 2014(r273576) +++ head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.cFri Oct 24 06:27:45 2014(r273577) @@ -116,7 +116,7 @@ hv_ata_pci_probe(device_t dev) device_set_desc(dev, "Hyper-V ATA storage disengage driver"); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Oct 24 05:39:32 2014(r273576) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Oct 24 06:27:45 2014(r273577) @@ -689,14 +689,14 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); break; case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; break; default: ret = ENXIO; Modified: head/sys/dev/hyperv/utilities/hv_util.c == --- head/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 06:27:45 2014 (r273577) @@ -378,7 +378,7 @@ hv_util_probe(device_t dev) const char *p = vmbus_get_type(dev); if (service_table[i].enabled && !memcmp(p, &service_table[i].guid, sizeof(hv_guid))) { device_set_softc(dev, (void *) (&service_table[i])); - rtn_value = 0; + rtn_value = BUS_PROBE_DEFAULT; } } ___ 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: r273578 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Fri Oct 24 06:53:06 2014 New Revision: 273578 URL: https://svnweb.freebsd.org/changeset/base/273578 Log: - Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD - Use #include "h_macros.h" instead of relative path analog Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.cFri Oct 24 06:27:45 2014(r273577) +++ head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.cFri Oct 24 06:53:06 2014(r273578) @@ -63,7 +63,9 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1. #include #include +#if defined(__NetBSD__) #include +#endif #include #include @@ -73,7 +75,13 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1. #include #include +#if defined(__NetBSD__) #include "../../../h_macros.h" +#else +#include +#include +#include "h_macros.h" +#endif #define MINPOSDIFF 1500/* 15 ms for now */ #define TIMEOUT5 ___ 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: r273579 - head/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Fri Oct 24 06:57:16 2014 New Revision: 273579 URL: https://svnweb.freebsd.org/changeset/base/273579 Log: - Mark signo __unused in the signal handler function - Effectively #if 0 out some code that does not fail on FreeBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c == --- head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.cFri Oct 24 06:53:06 2014(r273578) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.cFri Oct 24 06:57:16 2014(r273579) @@ -47,7 +47,11 @@ static void sighandler(int); static const size_tmaxiter = 2000; static void +#if defined(__FreeBSD__) +sighandler(int signo __unused) +#else sighandler(int signo) +#endif { /* Nothing. */ } @@ -168,7 +172,9 @@ ATF_TC_BODY(getrusage_utime_zero, tc) * * See also (duplicate) PR port-amd64/41734. */ +#if defined(__NetBSD__) atf_tc_expect_fail("PR kern/30115"); +#endif for (i = 0; i < maxiter; i++) { @@ -182,7 +188,9 @@ ATF_TC_BODY(getrusage_utime_zero, tc) atf_tc_fail("zero user time from getrusage(2)"); } +#if defined(__NetBSD__) atf_tc_fail("anticipated error did not occur"); +#endif } ATF_TP_ADD_TCS(tp) ___ 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"