svn commit: r335362 - head/sys/net

2018-06-19 Thread Andrey V. Elsukov
Author: ae
Date: Tue Jun 19 10:34:45 2018
New Revision: 335362
URL: https://svnweb.freebsd.org/changeset/base/335362

Log:
  Move BPFIF_* macro definitions into .c file, where struct bpf_if is
  declared.
  
  They are only used in this file and there is no need to export them via
  bpfdesc.h.

Modified:
  head/sys/net/bpf.c
  head/sys/net/bpfdesc.h

Modified: head/sys/net/bpf.c
==
--- head/sys/net/bpf.c  Tue Jun 19 05:28:14 2018(r335361)
+++ head/sys/net/bpf.c  Tue Jun 19 10:34:45 2018(r335362)
@@ -117,6 +117,11 @@ struct bpf_if {
 
 CTASSERT(offsetof(struct bpf_if, bif_ext) == 0);
 
+#define BPFIF_RLOCK(bif)   rw_rlock(&(bif)->bif_lock)
+#define BPFIF_RUNLOCK(bif) rw_runlock(&(bif)->bif_lock)
+#define BPFIF_WLOCK(bif)   rw_wlock(&(bif)->bif_lock)
+#define BPFIF_WUNLOCK(bif) rw_wunlock(&(bif)->bif_lock)
+
 #if defined(DEV_BPF) || defined(NETGRAPH_BPF)
 
 #define PRINET  26 /* interruptible */

Modified: head/sys/net/bpfdesc.h
==
--- head/sys/net/bpfdesc.h  Tue Jun 19 05:28:14 2018(r335361)
+++ head/sys/net/bpfdesc.h  Tue Jun 19 10:34:45 2018(r335362)
@@ -152,11 +152,6 @@ struct xbpf_d {
u_int64_t   bd_spare[4];
 };
 
-#define BPFIF_RLOCK(bif)   rw_rlock(&(bif)->bif_lock)
-#define BPFIF_RUNLOCK(bif) rw_runlock(&(bif)->bif_lock)
-#define BPFIF_WLOCK(bif)   rw_wlock(&(bif)->bif_lock)
-#define BPFIF_WUNLOCK(bif) rw_wunlock(&(bif)->bif_lock)
-
 #define BPFIF_FLAG_DYING   1   /* Reject new bpf consumers */
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335363 - stable/11/sys/compat/linuxkpi/common/include/net

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun 19 11:06:36 2018
New Revision: 335363
URL: https://svnweb.freebsd.org/changeset/base/335363

Log:
  MFC r334993:
  Implement the ip_eth_mc_map() function in the LinuxKPI.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/net/ip.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/net/ip.h
==
--- stable/11/sys/compat/linuxkpi/common/include/net/ip.h   Tue Jun 19 
10:34:45 2018(r335362)
+++ stable/11/sys/compat/linuxkpi/common/include/net/ip.h   Tue Jun 19 
11:06:36 2018(r335363)
@@ -58,6 +58,20 @@ inet_get_local_port_range(struct vnet *vnet, int *low,
 }
 
 static inline void
+ip_eth_mc_map(uint32_t addr, char *buf)
+{
+
+   addr = ntohl(addr);
+
+   buf[0] = 0x01;
+   buf[1] = 0x00;
+   buf[2] = 0x5e;
+   buf[3] = (addr >> 16) & 0x7f;
+   buf[4] = (addr >> 8) & 0xff;
+   buf[5] = (addr & 0xff);
+}
+
+static inline void
 ip_ib_mc_map(uint32_t addr, const unsigned char *bcast, char *buf)
 {
unsigned char scope;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335364 - head/sys/netinet/tcp_stacks

2018-06-19 Thread Randall Stewart
Author: rrs
Date: Tue Jun 19 11:20:28 2018
New Revision: 335364
URL: https://svnweb.freebsd.org/changeset/base/335364

Log:
  Make sure that the t_peakrate_thr is not compiled in
  by default until NF can upstream it.
  
  Reviewed by:  and suggested lstewart
  Sponsored by: Netflix Inc.

Modified:
  head/sys/netinet/tcp_stacks/rack.c

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Tue Jun 19 11:06:36 2018
(r335363)
+++ head/sys/netinet/tcp_stacks/rack.c  Tue Jun 19 11:20:28 2018
(r335364)
@@ -1206,7 +1206,7 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *r
tp->t_stats_gput_prev);
tp->t_flags &= ~TF_GPUTINPROG;
tp->t_stats_gput_prev = gput;
-
+#ifdef NETFLIX_CWV
if (tp->t_maxpeakrate) {
/*
 * We update t_peakrate_thr. This gives us 
roughly
@@ -1214,6 +1214,7 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *r
 */
tcp_update_peakrate_thr(tp);
}
+#endif
}
 #endif
if (tp->snd_cwnd > tp->snd_ssthresh) {
@@ -1267,11 +1268,11 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *r
tcp_newcwv_update_pipeack(tp, data);
}
}
-#endif
/* we enforce max peak rate if it is set. */
if (tp->t_peakrate_thr && tp->snd_cwnd > tp->t_peakrate_thr) {
tp->snd_cwnd = tp->t_peakrate_thr;
}
+#endif
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335365 - head/sys/cam/mmc

2018-06-19 Thread Ilya Bakulin
Author: kibab
Date: Tue Jun 19 11:23:48 2018
New Revision: 335365
URL: https://svnweb.freebsd.org/changeset/base/335365

Log:
  Set MMC_DATA_MULTI flag when doing multi-block transfers
  
  Lower layers (MMC / SDHCI controller drivers) may make certain decisions
  based on the presence of this flag. The fact that sdhci.c doesn't
  look at this flag is another problem that should be fixed separately.
  
  Found when adding MMCCAM support to AllWinner MMC controller driver
  where the presence of this flag actually matters.
  
  Approved by:  imp (mentor)
  Differential Revision:https://reviews.freebsd.org/D15888

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Jun 19 11:20:28 2018(r335364)
+++ head/sys/cam/mmc/mmc_da.c   Tue Jun 19 11:23:48 2018(r335365)
@@ -1778,6 +1778,7 @@ sddastart(struct cam_periph *periph, union ccb *start_
mmcio->cmd.data->flags = (bp->bio_cmd == BIO_READ ? 
MMC_DATA_READ : MMC_DATA_WRITE);
/* Direct h/w to issue CMD12 upon completion */
if (count > 1) {
+   mmcio->cmd.data->flags |= MMC_DATA_MULTI;
mmcio->stop.opcode = MMC_STOP_TRANSMISSION;
mmcio->stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
mmcio->stop.arg = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335366 - head/sys/cam/mmc

2018-06-19 Thread Ilya Bakulin
Author: kibab
Date: Tue Jun 19 11:25:40 2018
New Revision: 335366
URL: https://svnweb.freebsd.org/changeset/base/335366

Log:
  Correctly define rawscr so initializing it doesn't result in overwriting 
memory.
  
  We need 8 bytes of storage for rawscr.
  
  Approved by:  imp (mentor)
  Differential Revision:https://reviews.freebsd.org/D15889

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Jun 19 11:23:48 2018(r335365)
+++ head/sys/cam/mmc/mmc_da.c   Tue Jun 19 11:25:40 2018(r335366)
@@ -818,6 +818,7 @@ mmc_app_get_scr(struct cam_periph *periph, union ccb *
struct mmc_data d;
 
memset(&cmd, 0, sizeof(cmd));
+   memset(&d, 0, sizeof(d));
 
memset(rawscr, 0, 8);
cmd.opcode = ACMD_SEND_SCR;
@@ -1296,13 +1297,13 @@ sdda_start_init(void *context, union ccb *start_ccb)
/* Find out if the card supports High speed timing */
if (mmcp->card_features & CARD_FEATURE_SD20) {
/* Get and decode SCR */
-   uint32_t rawscr;
+   uint32_t rawscr[2];
uint8_t res[64];
-   if (mmc_app_get_scr(periph, start_ccb, &rawscr)) {
+   if (mmc_app_get_scr(periph, start_ccb, rawscr)) {
CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, 
("Cannot get SCR\n"));
goto finish_hs_tests;
}
-   mmc_app_decode_scr(&rawscr, &softc->scr);
+   mmc_app_decode_scr(rawscr, &softc->scr);
 
if ((softc->scr.sda_vsn >= 1) && (softc->csd.ccc & 
(1<<10))) {
mmc_sd_switch(periph, start_ccb, 
SD_SWITCH_MODE_CHECK,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335367 - head/sys/cam/mmc

2018-06-19 Thread Ilya Bakulin
Author: kibab
Date: Tue Jun 19 11:28:50 2018
New Revision: 335367
URL: https://svnweb.freebsd.org/changeset/base/335367

Log:
  Don't try to turn power down MMC bus if it is already down
  
  Regulator framework doens't like turning off already turned off
  regulators, so we get panic on AllWinner boards.
  
  Approved by:  imp (mentor)
  Differential Revision:https://reviews.freebsd.org/D15890

Modified:
  head/sys/cam/mmc/mmc_xpt.c

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Tue Jun 19 11:25:40 2018(r335366)
+++ head/sys/cam/mmc/mmc_xpt.c  Tue Jun 19 11:28:50 2018(r335367)
@@ -574,14 +574,16 @@ mmcprobe_start(struct cam_periph *periph, union ccb *s
/* FALLTHROUGH */
case PROBE_IDENTIFY:
xpt_path_inq(&start_ccb->cpi, periph->path);
-
CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with 
PROBE_RESET\n"));
-   init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS);
-   cts->ios.power_mode = power_off;
-   cts->ios_valid = MMC_PM;
+   init_standard_ccb(start_ccb, XPT_GET_TRAN_SETTINGS);
xpt_action(start_ccb);
-   mtx_sleep(periph, p_mtx, 0, "mmcios", 100);
-
+   if (cts->ios.power_mode != power_off) {
+   init_standard_ccb(start_ccb, XPT_SET_TRAN_SETTINGS);
+   cts->ios.power_mode = power_off;
+   cts->ios_valid = MMC_PM;
+   xpt_action(start_ccb);
+   mtx_sleep(periph, p_mtx, 0, "mmcios", 100);
+   }
/* mmc_power_up */
/* Get the host OCR */
init_standard_ccb(start_ccb, XPT_GET_TRAN_SETTINGS);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335368 - head/share/misc

2018-06-19 Thread Kurt Jaeger
Author: pi (ports committer)
Date: Tue Jun 19 12:16:19 2018
New Revision: 335368
URL: https://svnweb.freebsd.org/changeset/base/335368

Log:
  share/misc/organization.dot: updates
  
  - add krion, philip to postmaster@
  - remove trhodes from donations@, email bounces
  
  Approved by:  remko

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotTue Jun 19 11:28:50 2018
(r335367)
+++ head/share/misc/organization.dotTue Jun 19 12:16:19 2018
(r335368)
@@ -48,13 +48,13 @@ clusteradm [label="Cluster Administrators\nclusteradm@
 dnsadm [label="DNS Administrators\ndns...@freebsd.org\nbillf, dg, 
ps,\nkensmith, peter"]
 mirroradmin [label="FTP/WWW Mirror Site 
Coordinators\nmirror-ad...@freebsd.org\nkuriyama, kensmith"]
 perforceadmin [label="Perforce Repository 
Administrators\nperforce-ad...@freebsd.org\nscottl, kensmith, gordon,\nrwatson, 
peter, dhw"]
-postmaster [label="Postmaster Team\npostmas...@freebsd.org\ndhw, ler, pi, rea, 
remko, zi"]
+postmaster [label="Postmaster Team\npostmas...@freebsd.org\ndhw, krion, ler, 
philip, pi, rea, remko, zi"]
 refadm [label="Reference Systems Administrators\nref...@freebsd.org\njake, 
billf, markm, simon,\nobrien, ps, kensmith,\npeter, dhw"]
 webmaster [label="Webmaster Team\nwebmas...@freebsd.org\ngjb, wblock, 
blackend,\ngabor, hrs, wosch"]
 
 # Misc hats go here alphabetically sorted
 
-donations [label="Donations Team\ndonati...@freebsd.org\nwilko, gahr, 
pgolluci,\nobrien, trhodes, ds,\nrwatson"]
+donations [label="Donations Team\ndonati...@freebsd.org\nwilko, gahr, 
pgolluci,\nobrien, ds,\nrwatson"]
 marketing [label="Marketing Team\nmarket...@freebsd.org\nSteven Beedle, Denise 
Ebery, deb,\njkoshy, dru, mwlucas, imp,\nKris Moore, murray, mattt,\nJeremy C. 
Reed, rwatson"]
 vendorrelations [label="Vendor Relations\nvendor-relati...@freebsd.org\ncore, 
FreeBSD Foundation"]
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335369 - head/share/mk

2018-06-19 Thread Ruslan Bukin
Author: br
Date: Tue Jun 19 13:28:02 2018
New Revision: 335369
URL: https://svnweb.freebsd.org/changeset/base/335369

Log:
  Don't use TARGET_ARCH in this file, use MACHINE_ARCH instead.
  
  TARGET_ARCH is not defined when building ports/packages.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/share/mk/bsd.cpu.mk

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkTue Jun 19 12:16:19 2018(r335368)
+++ head/share/mk/bsd.cpu.mkTue Jun 19 13:28:02 2018(r335369)
@@ -366,7 +366,7 @@ CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -m
 .endif
 
 .if ${MACHINE_CPUARCH} == "riscv"
-.if ${TARGET_ARCH:Mriscv*sf}
+.if ${MACHINE_ARCH:Mriscv*sf}
 CFLAGS += -march=rv64imac -mabi=lp64
 ACFLAGS += -march=rv64imac -mabi=lp64
 .else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335370 - head/contrib/llvm/projects/libunwind/src

2018-06-19 Thread Ruslan Bukin
Author: br
Date: Tue Jun 19 14:46:59 2018
New Revision: 335370
URL: https://svnweb.freebsd.org/changeset/base/335370

Log:
  o Implement unw_getcontext()
  o Restore floating-point registers in jumpto()
  
  These are required to native cross build GCC and GDB
  (both do require libc++ and libunwind).
  
  These are not tested.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S
  head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S

Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S
==
--- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S   Tue Jun 
19 13:28:02 2018(r335369)
+++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S   Tue Jun 
19 14:46:59 2018(r335370)
@@ -488,6 +488,41 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Regis
 //
   .p2align 2
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_riscv6jumptoEv)
+#ifdef __riscv_float_abi_double
+  fldf0, (8 * 32 + 8 * 0)(a0)
+  fldf1, (8 * 32 + 8 * 1)(a0)
+  fldf2, (8 * 32 + 8 * 2)(a0)
+  fldf3, (8 * 32 + 8 * 3)(a0)
+  fldf4, (8 * 32 + 8 * 4)(a0)
+  fldf5, (8 * 32 + 8 * 5)(a0)
+  fldf6, (8 * 32 + 8 * 6)(a0)
+  fldf7, (8 * 32 + 8 * 7)(a0)
+  fldf8, (8 * 32 + 8 * 8)(a0)
+  fldf9, (8 * 32 + 8 * 9)(a0)
+  fldf10, (8 * 32 + 8 * 10)(a0)
+  fldf11, (8 * 32 + 8 * 11)(a0)
+  fldf12, (8 * 32 + 8 * 12)(a0)
+  fldf13, (8 * 32 + 8 * 13)(a0)
+  fldf14, (8 * 32 + 8 * 14)(a0)
+  fldf15, (8 * 32 + 8 * 15)(a0)
+  fldf16, (8 * 32 + 8 * 16)(a0)
+  fldf17, (8 * 32 + 8 * 17)(a0)
+  fldf18, (8 * 32 + 8 * 18)(a0)
+  fldf19, (8 * 32 + 8 * 19)(a0)
+  fldf20, (8 * 32 + 8 * 20)(a0)
+  fldf21, (8 * 32 + 8 * 21)(a0)
+  fldf22, (8 * 32 + 8 * 22)(a0)
+  fldf23, (8 * 32 + 8 * 23)(a0)
+  fldf24, (8 * 32 + 8 * 24)(a0)
+  fldf25, (8 * 32 + 8 * 25)(a0)
+  fldf26, (8 * 32 + 8 * 26)(a0)
+  fldf27, (8 * 32 + 8 * 27)(a0)
+  fldf28, (8 * 32 + 8 * 28)(a0)
+  fldf29, (8 * 32 + 8 * 29)(a0)
+  fldf30, (8 * 32 + 8 * 30)(a0)
+  fldf31, (8 * 32 + 8 * 31)(a0)
+#endif
+
   // x0 is zero
   ldx1, (8 * 1)(a0)
   ldx2, (8 * 2)(a0)
@@ -521,8 +556,6 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Regis
   ldx30, (8 * 30)(a0)
   ldx31, (8 * 31)(a0)
   ldx10, (8 * 10)(a0)   // restore a0
-
-  /* RISCVTODO: restore FPU registers */
 
   ret   // jump to ra
 

Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S
==
--- head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S  Tue Jun 
19 13:28:02 2018(r335369)
+++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S  Tue Jun 
19 14:46:59 2018(r335370)
@@ -665,8 +665,83 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
 
 #elif defined(__riscv)
 
-/* RISCVTODO */
+#
+# extern int unw_getcontext(unw_context_t* thread_state)
+#
+# On entry:
+#  thread_state pointer is in a0
+#
+DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
+  // x0 is zero
+  sdx1, (8 * 1)(a0)
+  sdx2, (8 * 2)(a0)
+  sdx3, (8 * 3)(a0)
+  sdx4, (8 * 4)(a0)
+  sdx5, (8 * 5)(a0)
+  sdx6, (8 * 6)(a0)
+  sdx7, (8 * 7)(a0)
+  sdx8, (8 * 8)(a0)
+  sdx9, (8 * 9)(a0)
+  sdx10, (8 * 10)(a0)
+  sdx11, (8 * 11)(a0)
+  sdx12, (8 * 12)(a0)
+  sdx13, (8 * 13)(a0)
+  sdx14, (8 * 14)(a0)
+  sdx15, (8 * 15)(a0)
+  sdx16, (8 * 16)(a0)
+  sdx17, (8 * 17)(a0)
+  sdx18, (8 * 18)(a0)
+  sdx19, (8 * 19)(a0)
+  sdx20, (8 * 20)(a0)
+  sdx21, (8 * 21)(a0)
+  sdx22, (8 * 22)(a0)
+  sdx23, (8 * 23)(a0)
+  sdx24, (8 * 24)(a0)
+  sdx25, (8 * 25)(a0)
+  sdx26, (8 * 26)(a0)
+  sdx27, (8 * 27)(a0)
+  sdx28, (8 * 28)(a0)
+  sdx29, (8 * 29)(a0)
+  sdx30, (8 * 30)(a0)
+  sdx31, (8 * 31)(a0)
 
+#ifdef __riscv_float_abi_double
+  fsdf0, (8 * 32 + 8 * 0)(a0)
+  fsdf1, (8 * 32 + 8 * 1)(a0)
+  fsdf2, (8 * 32 + 8 * 2)(a0)
+  fsdf3, (8 * 32 + 8 * 3)(a0)
+  fsdf4, (8 * 32 + 8 * 4)(a0)
+  fsdf5, (8 * 32 + 8 * 5)(a0)
+  fsdf6, (8 * 32 + 8 * 6)(a0)
+  fsdf7, (8 * 32 + 8 * 7)(a0)
+  fsdf8, (8 * 32 + 8 * 8)(a0)
+  fsdf9, (8 * 32 + 8 * 9)(a0)
+  fsdf10, (8 * 32 + 8 * 10)(a0)
+  fsdf11, (8 * 32 + 8 * 11)(a0)
+  fsdf12, (8 * 32 + 8 * 12)(a0)
+  fsdf13, (8 * 32 + 8 * 13)(a0)
+  fsdf14, (8 * 32 + 8 * 14)(a0)
+  fsdf15, (8 * 32 + 8 * 15)(a0)
+  fsdf16, (8 * 32 + 8 * 16)(a0)
+  fsdf17, (8 * 32 + 8 * 17)(a0)
+  fsdf18, (8 * 32 + 8 * 18)(a0)
+  fsdf19, (8 * 32 + 8 * 19)(a0)
+  fsdf20, (8 * 32 + 8 * 20)(a0)
+  fsdf21, (8 * 32 + 8 * 21)(a0)
+  fsdf22, (8 * 32 + 8 * 22)(a0)
+  fsdf23, (8 * 32 + 8 * 23)(a0)
+  fsdf24,

svn commit: r335371 - head/stand/lua

2018-06-19 Thread Kyle Evans
Author: kevans
Date: Tue Jun 19 15:05:31 2018
New Revision: 335371
URL: https://svnweb.freebsd.org/changeset/base/335371

Log:
  lualoader: Correct kernel_options handling
  
  `kernel_options` were being passed as flags to load, rather than to the
  kernel being loaded. This is the kernel_options counterpart to r335009.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==
--- head/stand/lua/config.lua   Tue Jun 19 14:46:59 2018(r335370)
+++ head/stand/lua/config.lua   Tue Jun 19 15:05:31 2018(r335371)
@@ -425,8 +425,8 @@ function config.loadKernel(other_kernel)
 
local function tryLoad(names)
for name in names:gmatch("([^;]+)%s*;?") do
-   local r = loader.perform("load " .. flags ..
-   " " .. name)
+   local r = loader.perform("load " .. name ..
+" " .. flags)
if r == 0 then
return name
end
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335372 - head/sys/dev/ixl

2018-06-19 Thread Sean Bruno
Author: sbruno
Date: Tue Jun 19 15:55:21 2018
New Revision: 335372
URL: https://svnweb.freebsd.org/changeset/base/335372

Log:
  Remove "diff" line indicator.  Next to see if this code works or not.
  
  Submitted by: mmacy
  Sponsored by: Limelight Networks

Modified:
  head/sys/dev/ixl/ixlvc.c

Modified: head/sys/dev/ixl/ixlvc.c
==
--- head/sys/dev/ixl/ixlvc.cTue Jun 19 15:05:31 2018(r335371)
+++ head/sys/dev/ixl/ixlvc.cTue Jun 19 15:55:21 2018(r335372)
@@ -386,9 +386,9 @@ ixlv_configure_queues(struct ixlv_sc *sc)
 {
device_tdev = sc->dev;
struct ixl_vsi  *vsi = &sc->vsi;
-+  if_softc_ctx_t  scctx = iflib_get_softc_ctx(vsi->ctx);
-+  struct ixl_tx_queue *tx_que = vsi->tx_queues;
-+  struct ixl_rx_queue *rx_que = vsi->rx_queues;
+   if_softc_ctx_t  scctx = iflib_get_softc_ctx(vsi->ctx);
+   struct ixl_tx_queue *tx_que = vsi->tx_queues;
+   struct ixl_rx_queue *rx_que = vsi->rx_queues;
struct tx_ring  *txr;
struct rx_ring  *rxr;
int len, pairs;
@@ -396,9 +396,9 @@ ixlv_configure_queues(struct ixlv_sc *sc)
struct virtchnl_vsi_queue_config_info *vqci;
struct virtchnl_queue_pair_info *vqpi;
 
-+  /* XXX: Linux PF driver wants matching ids in each tx/rx struct, so 
both TX/RX
-+   * queues of a pair need to be configured */
-+  pairs = max(vsi->num_tx_queues, vsi->num_rx_queues);
+   /* XXX: Linux PF driver wants matching ids in each tx/rx struct, so 
both TX/RX
+* queues of a pair need to be configured */
+   pairs = max(vsi->num_tx_queues, vsi->num_rx_queues);
len = sizeof(struct virtchnl_vsi_queue_config_info) +
   (sizeof(struct virtchnl_queue_pair_info) * pairs);
vqci = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO);
@@ -413,24 +413,24 @@ ixlv_configure_queues(struct ixlv_sc *sc)
/* Size check is not needed here - HW max is 16 queue pairs, and we
 * can fit info for 31 of them into the AQ buffer before it overflows.
 */
-+  for (int i = 0; i < pairs; i++, tx_que++, rx_que++, vqpi++) {
-+  txr = &tx_que->txr;
-+  rxr = &rx_que->rxr;
-+
+   for (int i = 0; i < pairs; i++, tx_que++, rx_que++, vqpi++) {
+   txr = &tx_que->txr;
+   rxr = &rx_que->rxr;
+
vqpi->txq.vsi_id = vqci->vsi_id;
vqpi->txq.queue_id = i;
-+  vqpi->txq.ring_len = scctx->isc_ntxd[0];
-+  vqpi->txq.dma_ring_addr = txr->tx_paddr;
+   vqpi->txq.ring_len = scctx->isc_ntxd[0];
+   vqpi->txq.dma_ring_addr = txr->tx_paddr;
/* Enable Head writeback */
vqpi->txq.headwb_enabled = 0;
vqpi->txq.dma_headwb_addr = 0;
 
vqpi->rxq.vsi_id = vqci->vsi_id;
vqpi->rxq.queue_id = i;
-+  vqpi->rxq.ring_len = scctx->isc_nrxd[0];
-+  vqpi->rxq.dma_ring_addr = rxr->rx_paddr;
-+  vqpi->rxq.max_pkt_size = scctx->isc_max_frame_size;
-+  // TODO: Get this value from iflib, somehow
+   vqpi->rxq.ring_len = scctx->isc_nrxd[0];
+   vqpi->rxq.dma_ring_addr = rxr->rx_paddr;
+   vqpi->rxq.max_pkt_size = scctx->isc_max_frame_size;
+   // TODO: Get this value from iflib, somehow
vqpi->rxq.databuffer_size = rxr->mbuf_sz;
vqpi->rxq.splithdr_enabled = 0;
}
@@ -451,8 +451,8 @@ ixlv_enable_queues(struct ixlv_sc *sc)
struct virtchnl_queue_select vqs;
 
vqs.vsi_id = sc->vsi_res->vsi_id;
-+  /* XXX: In Linux PF, as long as neither of these is 0,
-+   * every queue in VF VSI is enabled. */
+   /* XXX: In Linux PF, as long as neither of these is 0,
+* every queue in VF VSI is enabled. */
vqs.tx_queues = (1 << sc->vsi_res->num_queue_pairs) - 1;
vqs.rx_queues = vqs.tx_queues;
ixlv_send_pf_msg(sc, VIRTCHNL_OP_ENABLE_QUEUES,
@@ -470,8 +470,8 @@ ixlv_disable_queues(struct ixlv_sc *sc)
struct virtchnl_queue_select vqs;
 
vqs.vsi_id = sc->vsi_res->vsi_id;
-+  /* XXX: In Linux PF, as long as neither of these is 0,
-+   * every queue in VF VSI is disabled. */
+   /* XXX: In Linux PF, as long as neither of these is 0,
+* every queue in VF VSI is disabled. */
vqs.tx_queues = (1 << sc->vsi_res->num_queue_pairs) - 1;
vqs.rx_queues = vqs.tx_queues;
ixlv_send_pf_msg(sc, VIRTCHNL_OP_DISABLE_QUEUES,
@@ -490,29 +490,29 @@ ixlv_map_queues(struct ixlv_sc *sc)
struct virtchnl_irq_map_info *vm;
int i, q, len;
struct ixl_vsi  *vsi = &sc->vsi;
-+  struct ixl_rx_queue *rx_que = vsi->rx_queues;
-+  if_softc_ctx_t  scctx = vsi->share

Re: svn commit: r335244 - head

2018-06-19 Thread Bryan Drewery
On 6/15/2018 10:02 PM, Cy Schubert wrote:
> In message <201806160436.w5g4axks039...@slippy.cwsent.com>, Cy Schubert 
> writes:
>> In message <201806160035.w5g0zjfd066...@repo.freebsd.org>, Bryan 
>> Drewery writes
>> :
>>> Author: bdrewery
>>> Date: Sat Jun 16 00:35:19 2018
>>> New Revision: 335244
>>> URL: https://svnweb.freebsd.org/changeset/base/335244
>>>
>>> Log:
>>>   Assert that a build is done before an install.
>>>   
>>>   This should also catch cases where the wrong MAKEOBJDIRPREFIX is used for
>>>   install.
>>>   
>>>   MFC after:2 weeks
>>>   Sponsored by: Dell EMC
>>>
>>> Modified:
>>>   head/Makefile.inc1
>>>
>>> Modified: head/Makefile.inc1
>>> ===
>> ==
>>> =
>>> --- head/Makefile.inc1  Fri Jun 15 23:42:22 2018(r335243)
>>> +++ head/Makefile.inc1  Sat Jun 16 00:35:19 2018(r335244)
>>> @@ -89,7 +89,10 @@ MK_GCC_BOOTSTRAP=no
>>>  .if make(installworld) || make(install) || make(distributeworld) || \
>>>  make(stageworld)
>>>  .-include "${OBJTOP}/compiler-metadata.mk"
>>> +.if !defined(_LOADED_COMPILER_METADATA)
>>> +.error A build is required first.  You may have the wrong MAKEOBJDIRPREFIX
>>  s
>>> et.
>>>  .endif
>>> +.endif
>>>  
>>>  # Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from t
>> he
>>>  # tree to be friendlier to foreign OS builds. It's safe to do so unconditi
>> on
>>> ally
>>> @@ -195,6 +198,7 @@ compiler-metadata.mk: .PHONY .META
>>> @: > ${.TARGET}
>>> @echo ".info Using cached compiler metadata from build at $$(hostname) 
>>> on $$(date)" \
>>> > ${.TARGET}
>>> +   @echo "_LOADED_COMPILER_METADATA=t" >> ${.TARGET}
>>>  .for v in ${_COMPILER_METADATA_VARS}
>>> @echo "${v}=${${v}}" >> ${.TARGET}
>>>  .endfor
>>>
>>
>> Another data point: This also broke the following:
>>
>> cwsys# poudriere jail -c -m src=/opt/src/svn-current -j HEADi386 -a i386
>> [00:00:00] Creating HEADi386 fs at /poudriere/amd64/jails/HEADi386... 
>> done
>> [00:00:01] Copying /opt/src/svn-current to /poudriere/amd64/jails/HEADi3
>> 86/usr/src... done
>> [00:06:01] Starting make installworld
>> --- installworld ---
>> make[1]: "/export/obj/opt/src/svn-current/i386.i386/compiler-metadata.mk
>> " line 1: Using cached compiler metadata from build at cwsys on Fri Jun 
>> 15 18:39:46 PDT 2018
>> make[1]: "/opt/src/svn-current/Makefile.inc1" line 93: A build is 
>> required first.  You may have the wrong MAKEOBJDIRPREFIX set.
>> *** [installworld] Error code 1
>>
>> make: stopped in /opt/src/svn-current
>> 1 error
>>
>> make: stopped in /opt/src/svn-current
>> [00:06:01] Error: Failed to 'make installworld'
>> [00:06:01] Error while creating jail, cleaning up.
>> [00:06:01] Removing HEADi386 jail... done
>> [00:06:03] Cleaning HEADi386 data... done
>> cwsys# 
> 
> Nevermind. I found it. Stupid error on my part.
> 
> 

I'm curious what you did? Did you svn update after a buildworld and then
tried installworld? That would fail 1 time here but not again in the
future.

(Thinking outloud now, I could probably reuse the vcsversion code in
newvers.sh to record the build revision during buildworld and check it
matches at installworld time, but the assumes the same vcs tool is on
the install machine so it probably wouldn't work.)

I'm happy to see it may have caught a subtle mistake for you.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r335373 - in head/sys: arm/arm arm64/arm64

2018-06-19 Thread Andrew Turner
Author: andrew
Date: Tue Jun 19 16:14:23 2018
New Revision: 335373
URL: https://svnweb.freebsd.org/changeset/base/335373

Log:
  Move common GIC interrupt numbers to the common header. These are the same
  across the GICv2 and GICv3 drivers so we only need a single copy of them.
  
  Sponsored by: Turing Robotic Industries

Modified:
  head/sys/arm/arm/gic.h
  head/sys/arm/arm/gic_common.h
  head/sys/arm64/arm64/gic_v3_reg.h

Modified: head/sys/arm/arm/gic.h
==
--- head/sys/arm/arm/gic.h  Tue Jun 19 15:55:21 2018(r335372)
+++ head/sys/arm/arm/gic.h  Tue Jun 19 16:14:23 2018(r335373)
@@ -39,12 +39,6 @@
 #ifndef _ARM_GIC_H_
 #define _ARM_GIC_H_
 
-#defineGIC_FIRST_SGI0  /* Irqs 0-15 are SGIs/IPIs. */
-#defineGIC_LAST_SGI15
-#defineGIC_FIRST_PPI   16  /* Irqs 16-31 are private (per 
*/
-#defineGIC_LAST_PPI31  /* core) peripheral interrupts. 
*/
-#defineGIC_FIRST_SPI   32  /* Irqs 32+ are shared 
peripherals. */
-
 #ifdef INTRNG
 struct arm_gic_range {
uint64_t bus;

Modified: head/sys/arm/arm/gic_common.h
==
--- head/sys/arm/arm/gic_common.h   Tue Jun 19 15:55:21 2018
(r335372)
+++ head/sys/arm/arm/gic_common.h   Tue Jun 19 16:14:23 2018
(r335373)
@@ -44,6 +44,15 @@
 __BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int);
 __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int);
 
+/* Software Generated Interrupts */
+#defineGIC_FIRST_SGI0  /* Irqs 0-15 are SGIs/IPIs. */
+#defineGIC_LAST_SGI15
+/* Private Peripheral Interrupts */
+#defineGIC_FIRST_PPI   16  /* Irqs 16-31 are private (per 
*/
+#defineGIC_LAST_PPI31  /* core) peripheral interrupts. 
*/
+/* Shared Peripheral Interrupts */
+#defineGIC_FIRST_SPI   32  /* Irqs 32+ are shared 
peripherals. */
+
 /* Common register values */
 #defineGICD_CTLR   0x  /* v1 
ICDDCR */
 #defineGICD_TYPER  0x0004  /* v1 
ICDICTR */

Modified: head/sys/arm64/arm64/gic_v3_reg.h
==
--- head/sys/arm64/arm64/gic_v3_reg.h   Tue Jun 19 15:55:21 2018
(r335372)
+++ head/sys/arm64/arm64/gic_v3_reg.h   Tue Jun 19 16:14:23 2018
(r335373)
@@ -44,14 +44,7 @@
 /* Upper value is determined by LPI max priority */
 #defineGIC_PRIORITY_MIN(0xFCUL)
 
-/* Numbers for software generated interrupts */
-#defineGIC_FIRST_SGI   (0)
-#defineGIC_LAST_SGI(15)
-/* Numbers for private peripheral interrupts */
-#defineGIC_FIRST_PPI   (16)
-#defineGIC_LAST_PPI(31)
-/* Numbers for spared peripheral interrupts */
-#defineGIC_FIRST_SPI   (32)
+/* Numbers for shared peripheral interrupts */
 #defineGIC_LAST_SPI(1019)
 /* Numbers for local peripheral interrupts */
 #defineGIC_FIRST_LPI   (8192)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335278 - head/bin/pwd

2018-06-19 Thread John Baldwin
On 6/18/18 10:26 PM, Eitan Adler wrote:
> On 18 June 2018 at 10:57, John Baldwin  wrote:
>> On 6/16/18 10:14 PM, Eitan Adler wrote:
>>> Author: eadler
>>> Date: Sun Jun 17 05:14:50 2018
>>> New Revision: 335278
>>> URL: https://svnweb.freebsd.org/changeset/base/335278
>>>
>>> Log:
>>>   pwd: mark usage as dead
>>
>> You keep committing changes like this and ignoring e-mails about them.
> 
> I replied both the first time and this time. I may have
> (accidentally?) ignored similar emails though. The question I have is
> other than the mild code churn what's the harm?

It adds clutter.  Also, fixing the tool means you fix all the places at
once rather than slowly adding workarounds one by one.

>> What broken compiler are you using that doesn't properly inherit __dead2
>> from the call to exit()?
> 
> In this case, scan-build50 was getting annoyed.

Does scan-build from LLVM 6.0 handle this correctly?  If so, I'd say to
just mark this warning as broken (and thus ignore it) for scan-build50
just as we ignore certain warnings from GCC 4.2.1 because they are
broken-as-implemented.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


RE: svn commit: r335244 - head

2018-06-19 Thread Cy Schubert
I have a script that invokes buildworld/kernel, installworld/kernel, then 
proceeds to update jails if the jails are not in use. I passed the wrong 
argument to my script. I hastily did control-r to find my last command and hit 
enter without thinking (being rushed as usual). I assumed I used the correct 
arguments. My assumption was incorrect. Sloppiness on my part.

My script takes a snapshot of /usr/src and /usr/obj (whatever dataset they 
reside in), svn up, buildworld/kernel, install*, mergemaster if requested, then 
finally deletes the snapshots (depending on arguments). The return code 
specifies whether poudeiere updates or not.

I was rushing out the door that evening, so I figured I could squeeze in a 
build by the time I got home. I specified to my script to build and install 
only the kernel but the poudeiere invocation that followed wasn't aware that I 
had invoked the previous script to only build and install the kernel. Not 
enough care for details that evening on my part. When I got home to discover 
the install failure I had forgotten that I passed an argument to the script to 
build/install only the kernel.

Not a big deal, just need to be more careful next time.

---
Sent using a tiny phone keyboard.
Apologies for any typos and autocorrect.
Also, this old phone only supports top post. Apologies.

Cy Schubert
 or 
The need of the many outweighs the greed of the few.
---

-Original Message-
From: Bryan Drewery
Sent: 19/06/2018 08:57
To: Cy Schubert
Cc: src-committ...@freebsd.org; svn-src-all@freebsd.org; 
svn-src-h...@freebsd.org
Subject: Re: svn commit: r335244 - head

On 6/15/2018 10:02 PM, Cy Schubert wrote:
> In message <201806160436.w5g4axks039...@slippy.cwsent.com>, Cy Schubert 
> writes:
>> In message <201806160035.w5g0zjfd066...@repo.freebsd.org>, Bryan 
>> Drewery writes
>> :
>>> Author: bdrewery
>>> Date: Sat Jun 16 00:35:19 2018
>>> New Revision: 335244
>>> URL: https://svnweb.freebsd.org/changeset/base/335244
>>>
>>> Log:
>>>   Assert that a build is done before an install.
>>>   
>>>   This should also catch cases where the wrong MAKEOBJDIRPREFIX is used for
>>>   install.
>>>   
>>>   MFC after:2 weeks
>>>   Sponsored by: Dell EMC
>>>
>>> Modified:
>>>   head/Makefile.inc1
>>>
>>> Modified: head/Makefile.inc1
>>> ===
>> ==
>>> =
>>> --- head/Makefile.inc1  Fri Jun 15 23:42:22 2018(r335243)
>>> +++ head/Makefile.inc1  Sat Jun 16 00:35:19 2018(r335244)
>>> @@ -89,7 +89,10 @@ MK_GCC_BOOTSTRAP=no
>>>  .if make(installworld) || make(install) || make(distributeworld) || \
>>>  make(stageworld)
>>>  .-include "${OBJTOP}/compiler-metadata.mk"
>>> +.if !defined(_LOADED_COMPILER_METADATA)
>>> +.error A build is required first.  You may have the wrong MAKEOBJDIRPREFIX
>>  s
>>> et.
>>>  .endif
>>> +.endif
>>>  
>>>  # Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. Pull it from t
>> he
>>>  # tree to be friendlier to foreign OS builds. It's safe to do so unconditi
>> on
>>> ally
>>> @@ -195,6 +198,7 @@ compiler-metadata.mk: .PHONY .META
>>> @: > ${.TARGET}
>>> @echo ".info Using cached compiler metadata from build at $$(hostname) 
>>> on $$(date)" \
>>> > ${.TARGET}
>>> +   @echo "_LOADED_COMPILER_METADATA=t" >> ${.TARGET}
>>>  .for v in ${_COMPILER_METADATA_VARS}
>>> @echo "${v}=${${v}}" >> ${.TARGET}
>>>  .endfor
>>>
>>
>> Another data point: This also broke the following:
>>
>> cwsys# poudriere jail -c -m src=/opt/src/svn-current -j HEADi386 -a i386
>> [00:00:00] Creating HEADi386 fs at /poudriere/amd64/jails/HEADi386... 
>> done
>> [00:00:01] Copying /opt/src/svn-current to /poudriere/amd64/jails/HEADi3
>> 86/usr/src... done
>> [00:06:01] Starting make installworld
>> --- installworld ---
>> make[1]: "/export/obj/opt/src/svn-current/i386.i386/compiler-metadata.mk
>> " line 1: Using cached compiler metadata from build at cwsys on Fri Jun 
>> 15 18:39:46 PDT 2018
>> make[1]: "/opt/src/svn-current/Makefile.inc1" line 93: A build is 
>> required first.  You may have the wrong MAKEOBJDIRPREFIX set.
>> *** [installworld] Error code 1
>>
>> make: stopped in /opt/src/svn-current
>> 1 error
>>
>> make: stopped in /opt/src/svn-current
>> [00:06:01] Error: Failed to 'make installworld'
>> [00:06:01] Error while creating jail, cleaning up.
>> [00:06:01] Removing HEADi386 jail... done
>> [00:06:03] Cleaning HEADi386 data... done
>> cwsys# 
> 
> Nevermind. I found it. Stupid error on my part.
> 
> 

I'm curious what you did? Did you svn update after a buildworld and then
tried installworld? That would fail 1 time here but not again in the
future.

(Thinking outloud now, I could probably reuse the vcsversion code in
newvers.sh to record the build revision during buildworld and check it
matches at installworld time, but the assumes the same vcs tool is on
the install machine so it probably wouldn't work.)

I'm happy to see it may have caught a

svn commit: r335374 - head/tests/sys/audit

2018-06-19 Thread Alan Somers
Author: asomers
Date: Tue Jun 19 16:55:39 2018
New Revision: 335374
URL: https://svnweb.freebsd.org/changeset/base/335374

Log:
  audit(4): add tests for utimes(2) and friends, mprotect, and undelete
  
  Includes utimes(2), futimes(2), lutimes(2), futimesat(2), mprotect(2), and
  undelete(2).  undelete, for now, is tested only in failure mode.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15893

Modified:
  head/tests/sys/audit/file-attribute-modify.c

Modified: head/tests/sys/audit/file-attribute-modify.c
==
--- head/tests/sys/audit/file-attribute-modify.cTue Jun 19 16:14:23 
2018(r335373)
+++ head/tests/sys/audit/file-attribute-modify.cTue Jun 19 16:55:39 
2018(r335374)
@@ -28,10 +28,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 #include 
 
 #include "utils.h"
@@ -689,6 +692,257 @@ ATF_TC_CLEANUP(lchflags_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(utimes_success);
+ATF_TC_HEAD(utimes_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "utimes(2) call");
+}
+
+ATF_TC_BODY(utimes_success, tc)
+{
+   /* File needs to exist to call utimes(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, utimes(path, NULL));
+   check_audit(fds, successreg, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(utimes_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(utimes_failure);
+ATF_TC_HEAD(utimes_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "utimes(2) call");
+}
+
+ATF_TC_BODY(utimes_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: file does not exist */
+   ATF_REQUIRE_EQ(-1, utimes(errpath, NULL));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(utimes_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(futimes_success);
+ATF_TC_HEAD(futimes_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "futimes(2) call");
+}
+
+ATF_TC_BODY(futimes_success, tc)
+{
+   pid = getpid();
+   snprintf(extregex, sizeof(extregex), "futimes.*%d.*ret.*success", pid);
+
+   /* File needs to exist to call futimes(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, futimes(filedesc, NULL));
+   check_audit(fds, extregex, pipefd);
+   close(filedesc);
+}
+
+ATF_TC_CLEANUP(futimes_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(futimes_failure);
+ATF_TC_HEAD(futimes_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "futimes(2) call");
+}
+
+ATF_TC_BODY(futimes_failure, tc)
+{
+   const char *regex = "futimes.*return,failure : Bad file descriptor";
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: Invalid file descriptor */
+   ATF_REQUIRE_EQ(-1, futimes(-1, NULL));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(futimes_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lutimes_success);
+ATF_TC_HEAD(lutimes_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "lutimes(2) call");
+}
+
+ATF_TC_BODY(lutimes_success, tc)
+{
+   /* Symbolic link needs to exist to call lutimes(2) */
+   ATF_REQUIRE_EQ(0, symlink("symlink", path));
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, lutimes(path, NULL));
+   check_audit(fds, successreg, pipefd);
+}
+
+ATF_TC_CLEANUP(lutimes_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(lutimes_failure);
+ATF_TC_HEAD(lutimes_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "lutimes(2) call");
+}
+
+ATF_TC_BODY(lutimes_failure, tc)
+{
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: symbolic link does not exist */
+   ATF_REQUIRE_EQ(-1, lutimes(errpath, NULL));
+   check_audit(fds, failurereg, pipefd);
+}
+
+ATF_TC_CLEANUP(lutimes_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(futimesat_success);
+ATF_TC_HEAD(futimesat_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "futimesat(2) call");
+}
+
+ATF_TC_BODY(futimesat_success, tc)
+{
+   /* File needs to exist to call futimesat(2) */
+   ATF_REQUIRE((filedesc = open(path, O_CREAT

svn commit: r335375 - stable/11/usr.bin/elfdump

2018-06-19 Thread Ed Maste
Author: emaste
Date: Tue Jun 19 17:11:53 2018
New Revision: 335375
URL: https://svnweb.freebsd.org/changeset/base/335375

Log:
  MFC r334363: elfdump: chase ABI tag note name change from r232832
  
  r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
  Follow suit in elfdump.
  
  Elfdump's note parsing is very basic and should be significantly
  reworked, but for now just restore the broken functionality.
  
  PR:   228290
  Submitted by: martin at lispworks.com

Modified:
  stable/11/usr.bin/elfdump/elfdump.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/elfdump/elfdump.c
==
--- stable/11/usr.bin/elfdump/elfdump.c Tue Jun 19 16:55:39 2018
(r335374)
+++ stable/11/usr.bin/elfdump/elfdump.c Tue Jun 19 17:11:53 2018
(r335375)
@@ -663,7 +663,7 @@ main(int ac, char **av)
case SHT_NOTE:
name = elf_get_word(e, v, SH_NAME);
if (flags & ED_NOTE &&
-   strcmp(shstrtab + name, ".note.ABI-tag") == 0)
+   strcmp(shstrtab + name, ".note.tag") == 0)
elf_print_note(e, v);
break;
case SHT_DYNSYM:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335376 - head/usr.bin/ar

2018-06-19 Thread Ed Maste
Author: emaste
Date: Tue Jun 19 17:28:05 2018
New Revision: 335376
URL: https://svnweb.freebsd.org/changeset/base/335376

Log:
  usr.bin/ar: use standard 2-Clause FreeBSD license
  
  Many licenses on ar files contained small variations from the standard
  FreeBSD license text. To avoid license proliferation switch to the usual
  standard 2-clause FreeBSD license for those files where I have obtained
  permission from all of the listed copyright holders.
  
  Approved by:  jkoshy, kaiw
  Differential Revision:https://reviews.freebsd.org/D14561

Modified:
  head/usr.bin/ar/acplex.l
  head/usr.bin/ar/acpyacc.y
  head/usr.bin/ar/ar.h
  head/usr.bin/ar/write.c

Modified: head/usr.bin/ar/acplex.l
==
--- head/usr.bin/ar/acplex.lTue Jun 19 17:11:53 2018(r335375)
+++ head/usr.bin/ar/acplex.lTue Jun 19 17:28:05 2018(r335376)
@@ -9,22 +9,22 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer
- *in this position and unchanged.
+ *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include 

Modified: head/usr.bin/ar/acpyacc.y
==
--- head/usr.bin/ar/acpyacc.y   Tue Jun 19 17:11:53 2018(r335375)
+++ head/usr.bin/ar/acpyacc.y   Tue Jun 19 17:28:05 2018(r335376)
@@ -9,22 +9,22 @@
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer
- *in this position and unchanged.
+ *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, S

svn commit: r335377 - head/usr.bin/ar

2018-06-19 Thread Ed Maste
Author: emaste
Date: Tue Jun 19 17:30:11 2018
New Revision: 335377
URL: https://svnweb.freebsd.org/changeset/base/335377

Log:
  usr.bin/ar: remove incorrect SPDX tags
  
  Three ar files have a non-standard variation of the BSD license, so
  remove their SPDX tags.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/ar/ar.c
  head/usr.bin/ar/read.c
  head/usr.bin/ar/util.c

Modified: head/usr.bin/ar/ar.c
==
--- head/usr.bin/ar/ar.cTue Jun 19 17:28:05 2018(r335376)
+++ head/usr.bin/ar/ar.cTue Jun 19 17:30:11 2018(r335377)
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
  * Copyright (c) 2007 Kai Wang
  * Copyright (c) 2007 Tim Kientzle
  * Copyright (c) 2007 Joseph Koshy

Modified: head/usr.bin/ar/read.c
==
--- head/usr.bin/ar/read.c  Tue Jun 19 17:28:05 2018(r335376)
+++ head/usr.bin/ar/read.c  Tue Jun 19 17:30:11 2018(r335377)
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2007 Kai Wang
  * Copyright (c) 2007 Tim Kientzle
  * All rights reserved.

Modified: head/usr.bin/ar/util.c
==
--- head/usr.bin/ar/util.c  Tue Jun 19 17:28:05 2018(r335376)
+++ head/usr.bin/ar/util.c  Tue Jun 19 17:30:11 2018(r335377)
@@ -1,6 +1,4 @@
 /*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
  * Copyright (c) 2003-2007 Tim Kientzle
  * All rights reserved.
  *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335377 - head/usr.bin/ar

2018-06-19 Thread Rodney W. Grimes
> Author: emaste
> Date: Tue Jun 19 17:30:11 2018
> New Revision: 335377
> URL: https://svnweb.freebsd.org/changeset/base/335377
> 
> Log:
>   usr.bin/ar: remove incorrect SPDX tags
>   
>   Three ar files have a non-standard variation of the BSD license, so
>   remove their SPDX tags.
>   
>   Sponsored by:   The FreeBSD Foundation
> 
> Modified:
>   head/usr.bin/ar/ar.c
>   head/usr.bin/ar/read.c
>   head/usr.bin/ar/util.c
> 
> Modified: head/usr.bin/ar/ar.c
> ==
> --- head/usr.bin/ar/ar.c  Tue Jun 19 17:28:05 2018(r335376)
> +++ head/usr.bin/ar/ar.c  Tue Jun 19 17:30:11 2018(r335377)
> @@ -1,6 +1,4 @@
>  /*-
> - * SPDX-License-Identifier: BSD-3-Clause
> - *

Does it make since to put some comment here to keep these from
coming back in the future?

Thanks,
Rod
>   * Copyright (c) 2007 Kai Wang
>   * Copyright (c) 2007 Tim Kientzle
>   * Copyright (c) 2007 Joseph Koshy
> 
> Modified: head/usr.bin/ar/read.c
> ==
> --- head/usr.bin/ar/read.cTue Jun 19 17:28:05 2018(r335376)
> +++ head/usr.bin/ar/read.cTue Jun 19 17:30:11 2018(r335377)
> @@ -1,6 +1,4 @@
>  /*-
> - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> - *
>   * Copyright (c) 2007 Kai Wang
>   * Copyright (c) 2007 Tim Kientzle
>   * All rights reserved.
> 
> Modified: head/usr.bin/ar/util.c
> ==
> --- head/usr.bin/ar/util.cTue Jun 19 17:28:05 2018(r335376)
> +++ head/usr.bin/ar/util.cTue Jun 19 17:30:11 2018(r335377)
> @@ -1,6 +1,4 @@
>  /*-
> - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> - *
>   * Copyright (c) 2003-2007 Tim Kientzle
>   * All rights reserved.
>   *
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335378 - head/tests/sys/audit

2018-06-19 Thread Alan Somers
Author: asomers
Date: Tue Jun 19 17:41:46 2018
New Revision: 335378
URL: https://svnweb.freebsd.org/changeset/base/335378

Log:
  audit(4): add tests for sendmsg, recvmsg, shutdown, and sendfile
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15895

Modified:
  head/tests/sys/audit/network.c

Modified: head/tests/sys/audit/network.c
==
--- head/tests/sys/audit/network.c  Tue Jun 19 17:30:11 2018
(r335377)
+++ head/tests/sys/audit/network.c  Tue Jun 19 17:41:46 2018
(r335378)
@@ -27,31 +27,65 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
 #include 
 #include 
+#include 
 
 #include "utils.h"
 
-#define MAX_DATA 1024
+#define MAX_DATA 128
 #define SERVER_PATH "server"
 
+static pid_t pid;
+static mode_t mode = 0777;
 static int sockfd, sockfd2, connectfd;
 static ssize_t data_bytes;
+static socklen_t len = sizeof(struct sockaddr_un);
+static struct iovec io1, io2;
 static struct pollfd fds[1];
 static struct sockaddr_un server;
-static char extregex[80];
+static struct msghdr sendbuf, recvbuf;
+static char extregex[MAX_DATA];
 static char data[MAX_DATA];
-static socklen_t len = sizeof(struct sockaddr_un);
 static char msgbuff[MAX_DATA] = "This message does not exist";
 static const char *auclass = "nt";
+static const char *path = "fileforaudit";
 static const char *nosupregex = "return,failure : Address family "
"not supported by protocol family";
 static const char *invalregex = "return,failure : Bad file descriptor";
 
 /*
+ * Initialize iovec structure to be used as a field of struct msghdr
+ */
+static void
+init_iov(struct iovec *io, char msgbuf[], int datalen)
+{
+   io->iov_base = msgbuf;
+   io->iov_len = datalen;
+}
+
+/*
+ * Initialize msghdr structure for communication via datagram sockets
+ */
+static void
+init_msghdr(struct msghdr *hdrbuf, struct iovec *io, struct sockaddr_un *addr)
+{
+   socklen_t length;
+
+   bzero(hdrbuf, sizeof(*hdrbuf));
+   length = (socklen_t)sizeof(struct sockaddr_un);
+   hdrbuf->msg_name = addr;
+   hdrbuf->msg_namelen = length;
+   hdrbuf->msg_iov = io;
+   hdrbuf->msg_iovlen = 1;
+}
+
+/*
  * Variadic function to close socket descriptors
  */
 static void
@@ -648,7 +682,6 @@ ATF_TC_BODY(recv_success, tc)
 
/* Receive data once connectfd is ready for reading */
FILE *pipefd = setup(fds, auclass);
-   //ATF_REQUIRE(check_readfs(connectfd) != 0);
ATF_REQUIRE((data_bytes = recv(connectfd, data, MAX_DATA, 0)) != 0);
 
/* Audit record must contain connectfd and data_bytes */
@@ -808,6 +841,253 @@ ATF_TC_CLEANUP(recvfrom_failure, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(sendmsg_success);
+ATF_TC_HEAD(sendmsg_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "recvmsg(2) call");
+}
+
+ATF_TC_BODY(sendmsg_success, tc)
+{
+   assign_address(&server);
+   /* Create a datagram server socket & bind to UNIX address family */
+   ATF_REQUIRE((sockfd = socket(PF_UNIX, SOCK_DGRAM, 0)) != -1);
+   ATF_REQUIRE_EQ(0, bind(sockfd, (struct sockaddr *)&server, len));
+
+   /* Message buffer to be sent to the server */
+   init_iov(&io1, msgbuff, sizeof(msgbuff));
+   init_msghdr(&sendbuf, &io1, &server);
+
+   /* Set up UDP client to communicate with the server */
+   ATF_REQUIRE((sockfd2 = socket(PF_UNIX, SOCK_DGRAM, 0)) != -1);
+
+   /* Send a sample message to the specified client address */
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE((data_bytes = sendmsg(sockfd2, &sendbuf, 0)) != -1);
+
+   /* Audit record must contain sockfd2 and data_bytes */
+   snprintf(extregex, sizeof(extregex),
+   "sendmsg.*0x%x.*return,success,%zd", sockfd2, data_bytes);
+   check_audit(fds, extregex, pipefd);
+
+   /* Close all socket descriptors */
+   close_sockets(2, sockfd, sockfd2);
+}
+
+ATF_TC_CLEANUP(sendmsg_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(sendmsg_failure);
+ATF_TC_HEAD(sendmsg_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "sendmsg(2) call");
+}
+
+ATF_TC_BODY(sendmsg_failure, tc)
+{
+   snprintf(extregex, sizeof(extregex),
+   "sendmsg.*return,failure : Bad address");
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, sendmsg(-1, NULL, 0));
+   check_audit(fds, extregex, pipefd);
+}
+
+ATF_TC_CLEANUP(sendmsg_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(recvmsg_success);
+ATF_TC_HEAD(recvmsg_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "recvmsg(2) call"

svn commit: r335379 - head/sys/contrib/libnv

2018-06-19 Thread Sean Bruno
Author: sbruno
Date: Tue Jun 19 18:09:15 2018
New Revision: 335379
URL: https://svnweb.freebsd.org/changeset/base/335379

Log:
  Set prev to NULL so its garaunteed to have a value of some kind and
  gcc doesn't explode.  Feel free to fix this correctly or whatever for
  gcc builds.
  
  This *should* quiesce tinderbox after r335347 for the gcc builds.

Modified:
  head/sys/contrib/libnv/nvpair.c

Modified: head/sys/contrib/libnv/nvpair.c
==
--- head/sys/contrib/libnv/nvpair.c Tue Jun 19 17:41:46 2018
(r335378)
+++ head/sys/contrib/libnv/nvpair.c Tue Jun 19 18:09:15 2018
(r335379)
@@ -1979,7 +1979,7 @@ int
 nvpair_append_nvlist_array(nvpair_t *nvp, const nvlist_t *value)
 {
nvpair_t *tmpnvp;
-   nvlist_t *nvl, *prev;
+   nvlist_t *nvl, *prev = NULL;
int flags;
 
NVPAIR_ASSERT(nvp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335380 - head/sys/contrib/libnv

2018-06-19 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Tue Jun 19 18:25:43 2018
New Revision: 335380
URL: https://svnweb.freebsd.org/changeset/base/335380

Log:
  style(9) fix, I was also going to silence gcc.
  
  Approved by:  emaste, oshogbo
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/contrib/libnv/nvpair.c

Modified: head/sys/contrib/libnv/nvpair.c
==
--- head/sys/contrib/libnv/nvpair.c Tue Jun 19 18:09:15 2018
(r335379)
+++ head/sys/contrib/libnv/nvpair.c Tue Jun 19 18:25:43 2018
(r335380)
@@ -1997,6 +1997,7 @@ nvpair_append_nvlist_array(nvpair_t *nvp, const nvlist
nvlist_set_flags(nvl, flags);
 
tmpnvp = NULL;
+   prev = NULL;
if (nvp->nvp_nitems > 0) {
nvlist_t **nvls = (void *)(uintptr_t)nvp->nvp_data;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335381 - head/usr.bin/top

2018-06-19 Thread Alan Somers
Author: asomers
Date: Tue Jun 19 18:32:06 2018
New Revision: 335381
URL: https://svnweb.freebsd.org/changeset/base/335381

Log:
  top(1): Fix Coverity warning
  
  Don't call strerror on negative errnos
  
  Reported by:  Coverity
  CID:  976708
  Reviewed by:  eadler
  Differential Revision:https://reviews.freebsd.org/D15909

Modified:
  head/usr.bin/top/commands.c

Modified: head/usr.bin/top/commands.c
==
--- head/usr.bin/top/commands.c Tue Jun 19 18:25:43 2018(r335380)
+++ head/usr.bin/top/commands.c Tue Jun 19 18:32:06 2018(r335381)
@@ -242,7 +242,7 @@ err_string(void)
errp = &(errs[cnt++]);
if (errp->errnum != currerr)
{
-   if (currerr != -1)
+   if (currerr >= 0)
{
if ((stringlen = str_adderr(string, stringlen, currerr)) < 2)
{
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335382 - head/sys/contrib/libnv

2018-06-19 Thread Li-Wen Hsu
Author: lwhsu (ports committer)
Date: Tue Jun 19 18:43:02 2018
New Revision: 335382
URL: https://svnweb.freebsd.org/changeset/base/335382

Log:
  Really fix the style.
  
  Approved by:  oshogbo
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/contrib/libnv/nvpair.c

Modified: head/sys/contrib/libnv/nvpair.c
==
--- head/sys/contrib/libnv/nvpair.c Tue Jun 19 18:32:06 2018
(r335381)
+++ head/sys/contrib/libnv/nvpair.c Tue Jun 19 18:43:02 2018
(r335382)
@@ -1979,7 +1979,7 @@ int
 nvpair_append_nvlist_array(nvpair_t *nvp, const nvlist_t *value)
 {
nvpair_t *tmpnvp;
-   nvlist_t *nvl, *prev = NULL;
+   nvlist_t *nvl, *prev;
int flags;
 
NVPAIR_ASSERT(nvp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335383 - head/share/man/man8

2018-06-19 Thread Mark Felder
Author: feld (ports committer)
Date: Tue Jun 19 19:27:37 2018
New Revision: 335383
URL: https://svnweb.freebsd.org/changeset/base/335383

Log:
  Document the new ${name}_env_file feature
  
  Approved by:  bcr
  MFH:  3 days
  Differential Revision:https://reviews.freebsd.org/D15578

Modified:
  head/share/man/man8/rc.subr.8

Modified: head/share/man/man8/rc.subr.8
==
--- head/share/man/man8/rc.subr.8   Tue Jun 19 18:43:02 2018
(r335382)
+++ head/share/man/man8/rc.subr.8   Tue Jun 19 19:27:37 2018
(r335383)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 3, 2018
+.Dd June 19, 2018
 .Dt RC.SUBR 8
 .Os
 .Sh NAME
@@ -554,6 +554,13 @@ with.
 This will be passed as arguments to the
 .Xr env 1
 utility.
+.It Va ${name}_env_file
+A file to source for environmental variables to run
+.Va command
+with.
+Note that all the variables which are being assigned in this file are going
+to be exported into the environment of
+.Va command .
 .It Va ${name}_fib
 FIB
 .Pa Routing Table
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335278 - head/bin/pwd

2018-06-19 Thread Pedro Giffuni




On 19/06/2018 11:25, John Baldwin wrote:

On 6/18/18 10:26 PM, Eitan Adler wrote:

On 18 June 2018 at 10:57, John Baldwin  wrote:

On 6/16/18 10:14 PM, Eitan Adler wrote:

Author: eadler
Date: Sun Jun 17 05:14:50 2018
New Revision: 335278
URL: https://svnweb.freebsd.org/changeset/base/335278

Log:
   pwd: mark usage as dead

You keep committing changes like this and ignoring e-mails about them.

I replied both the first time and this time. I may have
(accidentally?) ignored similar emails though. The question I have is
other than the mild code churn what's the harm?

It adds clutter.  Also, fixing the tool means you fix all the places at
once rather than slowly adding workarounds one by one.


What broken compiler are you using that doesn't properly inherit __dead2
from the call to exit()?

In this case, scan-build50 was getting annoyed.

Does scan-build from LLVM 6.0 handle this correctly?  If so, I'd say to
just mark this warning as broken (and thus ignore it) for scan-build50
just as we ignore certain warnings from GCC 4.2.1 because they are
broken-as-implemented.

FWIW, clang's scan-build is made to even more false positives and 
general noise than the regular compiler warnings.

It is better to just ignore it unless it finds something real.

Pedro.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335384 - head/sys/cam/mmc

2018-06-19 Thread Ilya Bakulin
Author: kibab
Date: Tue Jun 19 20:02:03 2018
New Revision: 335384
URL: https://svnweb.freebsd.org/changeset/base/335384

Log:
  Fix setting RCA for MMC cards
  
  Unlike SD cards, that publish RCA in response to CMD3,
  MMC cards expect the host to set RCA itself.
  
  Since we don't support multiple MMC cards on the bus,
  just assign a static RCA of 2 to the attached MMC card.
  
  Approved by:  imp (mentor)
  Differential Revision:https://reviews.freebsd.org/D13063

Modified:
  head/sys/cam/mmc/mmc.h
  head/sys/cam/mmc/mmc_xpt.c

Modified: head/sys/cam/mmc/mmc.h
==
--- head/sys/cam/mmc/mmc.h  Tue Jun 19 19:27:37 2018(r335383)
+++ head/sys/cam/mmc/mmc.h  Tue Jun 19 20:02:03 2018(r335384)
@@ -94,4 +94,12 @@ struct mmc_params {
 uint8_t sdio_func_count;
 } __packed;
 
+/*
+ * Only one MMC card on bus is supported now.
+ * If we ever want to support multiple MMC cards on the same bus,
+ * mmc_xpt needs to be extended to issue new RCAs based on number
+ * of already probed cards. Furthermore, retuning and high-speed
+ * settings should also take all cards into account.
+ */
+#define MMC_PROPOSED_RCA2
 #endif

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Tue Jun 19 19:27:37 2018(r335383)
+++ head/sys/cam/mmc/mmc_xpt.c  Tue Jun 19 20:02:03 2018(r335384)
@@ -98,7 +98,8 @@ typedef enum {
 PROBE_GET_CID,
 PROBE_GET_CSD,
 PROBE_SEND_RELATIVE_ADDR,
-PROBE_SELECT_CARD,
+   PROBE_MMC_SET_RELATIVE_ADDR,
+   PROBE_SELECT_CARD,
PROBE_DONE,
PROBE_INVALID
 } probe_action;
@@ -114,6 +115,7 @@ static char *probe_action_text[] = {
 "PROBE_GET_CID",
 "PROBE_GET_CSD",
 "PROBE_SEND_RELATIVE_ADDR",
+   "PROBE_MMC_SET_RELATIVE_ADDR",
 "PROBE_SELECT_CARD",
"PROBE_DONE",
"PROBE_INVALID"
@@ -702,7 +704,6 @@ mmcprobe_start(struct cam_periph *periph, union ccb *s
mmcio->cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
mmcio->stop.opcode = 0;
break;
-
case PROBE_SEND_RELATIVE_ADDR:
init_standard_ccb(start_ccb, XPT_MMC_IO);
mmcio->cmd.opcode = SD_SEND_RELATIVE_ADDR;
@@ -710,6 +711,13 @@ mmcprobe_start(struct cam_periph *periph, union ccb *s
mmcio->cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR;
mmcio->stop.opcode = 0;
break;
+   case PROBE_MMC_SET_RELATIVE_ADDR:
+   init_standard_ccb(start_ccb, XPT_MMC_IO);
+   mmcio->cmd.opcode = MMC_SET_RELATIVE_ADDR;
+   mmcio->cmd.arg = MMC_PROPOSED_RCA << 16;
+   mmcio->cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+   mmcio->stop.opcode = 0;
+   break;
case PROBE_SELECT_CARD:
init_standard_ccb(start_ccb, XPT_MMC_IO);
mmcio->cmd.opcode = MMC_SELECT_CARD;
@@ -985,7 +993,10 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do
mmcp->card_cid[1],
mmcp->card_cid[2],
mmcp->card_cid[3]));
-PROBE_SET_ACTION(softc, PROBE_SEND_RELATIVE_ADDR);
+   if (mmcp->card_features & CARD_FEATURE_MMC)
+   PROBE_SET_ACTION(softc, PROBE_MMC_SET_RELATIVE_ADDR);
+   else
+   PROBE_SET_ACTION(softc, PROBE_SEND_RELATIVE_ADDR);
 break;
 }
 case PROBE_SEND_RELATIVE_ADDR: {
@@ -1010,6 +1021,18 @@ mmcprobe_done(struct cam_periph *periph, union ccb *do
 PROBE_SET_ACTION(softc, PROBE_SELECT_CARD);
break;
 }
+   case PROBE_MMC_SET_RELATIVE_ADDR:
+   mmcio = &done_ccb->mmcio;
+   err = mmcio->cmd.error;
+   if (err != MMC_ERR_NONE) {
+   CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_PROBE,
+   ("PROBE_MMC_SET_RELATIVE_ADDR: error %d\n", err));
+   PROBE_SET_ACTION(softc, PROBE_INVALID);
+   break;
+   }
+   path->device->mmc_ident_data.card_rca = MMC_PROPOSED_RCA;
+   PROBE_SET_ACTION(softc, PROBE_GET_CSD);
+   break;
 case PROBE_GET_CSD: {
mmcio = &done_ccb->mmcio;
err = mmcio->cmd.error;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335379 - head/sys/contrib/libnv

2018-06-19 Thread Rodney W. Grimes
> Author: sbruno
> Date: Tue Jun 19 18:09:15 2018
> New Revision: 335379
> URL: https://svnweb.freebsd.org/changeset/base/335379
> 
> Log:
>   Set prev to NULL so its garaunteed to have a value of some kind and
>   gcc doesn't explode.  Feel free to fix this correctly or whatever for
>   gcc builds.
>   
>   This *should* quiesce tinderbox after r335347 for the gcc builds.
> 
> Modified:
>   head/sys/contrib/libnv/nvpair.c
> 
> Modified: head/sys/contrib/libnv/nvpair.c
> ==
> --- head/sys/contrib/libnv/nvpair.c   Tue Jun 19 17:41:46 2018
> (r335378)
> +++ head/sys/contrib/libnv/nvpair.c   Tue Jun 19 18:09:15 2018
> (r335379)
> @@ -1979,7 +1979,7 @@ int
>  nvpair_append_nvlist_array(nvpair_t *nvp, const nvlist_t *value)
>  {
>   nvpair_t *tmpnvp;
> - nvlist_t *nvl, *prev;
> + nvlist_t *nvl, *prev = NULL;

Please please please mark these so that people *can* at some time
know that this was 1) done to quiet some compiler, and 2) fix it
properly so all things are quiet about it.

-   nvlist_t *nvl, *prev;
+   nvlist_t *nvl;
+   nvlist_t *prev = NULL;  /* Quiet gcc foo.bar XXX */

>   int flags;
>  

Or even less intrusive would of been to put this one line add in
leaving the declarations untouched.  I think this would be the prefered
mothod for these types of things.

+   *prev = NULL;   /* Quiet gcc foo.bar XXX */
>   NVPAIR_ASSERT(nvp);
> 

Thanks,
-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Sun, 17 Jun 2018 03:18:57 + (UTC)
Allan Jude  schrieb:

> Author: allanjude
> Date: Sun Jun 17 03:18:56 2018
> New Revision: 335276
> URL: https://svnweb.freebsd.org/changeset/base/335276
> 
> Log:
>   gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
>   
>   Normally the serial console is not enabled until /boot.config is read and
>   we know how the serial console should be configured.  Initialize the
>   consoles early in 'dual' mode (serial & keyboard) with a default serial
>   rate of 115200. Then serial is re-initialized once the disk is decrypted
>   and the /boot.config file can be read.
>   
>   This allows the GELIBoot passphrase to be provided via the serial console.
>   
>   PR: 221526
>   Requested by:   many
>   Reviewed by:imp
>   Sponsored by:   Klara Systems
>   Differential Revision:  https://reviews.freebsd.org/D15862
> 
> Modified:
>   head/stand/i386/gptboot/gptboot.c
>   head/stand/i386/zfsboot/zfsboot.c
> 
> Modified: head/stand/i386/gptboot/gptboot.c
> ==
> --- head/stand/i386/gptboot/gptboot.c Sun Jun 17 03:10:25 2018
> (r335275)
> +++ head/stand/i386/gptboot/gptboot.c Sun Jun 17 03:18:56 2018
> (r335276)
> @@ -285,6 +285,16 @@ main(void)
>   bootinfo.bi_memsizes_valid++;
>   bootinfo.bi_bios_dev = dsk.drive;
>  
> + /*
> +  * Initialize the serial console early with a modern default of 115200.
> +  * Later, we'll read PATH_DOTCONFIG and reconfigure serial according
> +  * to the configuration provided.
> +  */
> + opts = OPT_SET(RBX_DUAL);
> + ioctrl = (IO_SERIAL|IO_KEYBOARD);
> + if (sio_init(115200) != 0)
> + ioctrl &= ~IO_SERIAL;
> +
>  #ifdef LOADER_GELI_SUPPORT
>   geli_init();
>  #endif
> 
> Modified: head/stand/i386/zfsboot/zfsboot.c
> ==
> --- head/stand/i386/zfsboot/zfsboot.c Sun Jun 17 03:10:25 2018
> (r335275)
> +++ head/stand/i386/zfsboot/zfsboot.c Sun Jun 17 03:18:56 2018
> (r335276)
> @@ -693,6 +693,16 @@ main(void)
>  }
>  setheap(heap_next, heap_end);
>  
> +/*
> + * Initialize the serial console early with a modern default of 115200.
> + * Later, we'll read PATH_DOTCONFIG and reconfigure serial according
> + * to the configuration provided.
> + */
> +opts = OPT_SET(RBX_DUAL);
> +ioctrl = (IO_SERIAL|IO_KEYBOARD);
> +if (sio_init(115200) != 0)
> + ioctrl &= ~IO_SERIAL;
> +
>  dsk = malloc(sizeof(struct dsk));
>  dsk->drive = *(uint8_t *)PTOV(ARGS);
>  dsk->type = dsk->drive & DRV_HARD ? TYPE_AD : TYPE_FD;
> ___
> svn-src-h...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

This commit breaks booting off GPT partition (using NanoBSD, as Iposted 
mistakenly to
commit r335254, see there).
Having CURRENT applied to a SD card for usage on a PCEngines APU 2C4, the boot 
process
dies immediately showing "Booting from harddisk". r335275 boots well.

- -- 
O. Hartmann

Ich widerspreche der Nutzung oder Übermittlung meiner Daten für
Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG).
-BEGIN PGP SIGNATURE-

iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWyloHQAKCRDS528fyFhY
lLOLAgCcjWzTgedHN1tUalrIV/TNsnmo4vVhr1MuPMNvzeKp8VCsebl8yDaIMwnf
GOQ2aLxBl7tqp+XWQTt8yLDLlj9/Af0XvKkWiFkf4BOLRpKqbClew2gYJRSdMR+6
RMXE77Js4wQslzSXiidHcweIDmiPrlo4JysjPdQdzAAjCn+J3YU9
=LpXy
-END PGP SIGNATURE-
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335386 - in head: share/examples tools/build/mk usr.sbin

2018-06-19 Thread Sean Bruno
Author: sbruno
Date: Tue Jun 19 21:07:25 2018
New Revision: 335386
URL: https://svnweb.freebsd.org/changeset/base/335386

Log:
  MK_EFI - Add uefisign and friends to this knob and ensure that we don't
  try to build them if MK_OPENSSL is unset.
  
  Reviewed by:  emaste imp kevans
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D15211

Modified:
  head/share/examples/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/Makefile

Modified: head/share/examples/Makefile
==
--- head/share/examples/MakefileTue Jun 19 20:32:43 2018
(r335385)
+++ head/share/examples/MakefileTue Jun 19 21:07:25 2018
(r335386)
@@ -31,7 +31,6 @@ LDIRS=BSD_daemon \
ses \
scsi_target \
sunrpc \
-   uefisign \
ypldap
 
 
@@ -343,8 +342,11 @@ SE_SUNRPC_SORT= \
sort.x \
sort_proc.c
 
+.if ${MK_EFI} != "no"
+LDIRS+=uefisign
 SE_DIRS+=  uefisign
 SE_UEFISIGN=   uefikeys
+.endif
 
 SE_DIRS+=  ypldap
 SE_YPLDAP= ypldap.conf

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Jun 19 20:32:43 
2018(r335385)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Jun 19 21:07:25 
2018(r335386)
@@ -1614,6 +1614,14 @@ OLD_DIRS+=usr/share/bsdconfig/timezone
 OLD_DIRS+=usr/share/bsdconfig/usermgmt
 .endif
 
+.if ${MK_EFI} == no
+OLD_FILES+=usr/sbin/efibootmgr
+OLD_FILES+=usr/sbin/efidp
+OLD_FILES+=usr/sbin/efivar
+OLD_FILES+=usr/sbin/uefisign
+OLD_FILES+=usr/share/examples/uefisign/uefikeys
+.endif
+
 .if ${MK_FMTREE} == no
 OLD_FILES+=usr/sbin/fmtree
 OLD_FILES+=usr/share/man/man8/fmtree.8.gz

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Jun 19 20:32:43 2018(r335385)
+++ head/usr.sbin/Makefile  Tue Jun 19 21:07:25 2018(r335386)
@@ -92,7 +92,6 @@ SUBDIR=   adduser \
traceroute \
trpt \
tzsetup \
-   uefisign \
ugidfw \
vigr \
vipw \
@@ -126,6 +125,9 @@ SUBDIR.${MK_CTM}+=  ctm
 SUBDIR.${MK_CXGBETOOL}+=   cxgbetool
 SUBDIR.${MK_DIALOG}+=  bsdconfig
 SUBDIR.${MK_EFI}+= efivar efidp efibootmgr
+.if ${MK_OPENSSL} != "no"
+SUBDIR.${MK_EFI}+= uefisign
+.endif
 SUBDIR.${MK_FLOPPY}+=  fdcontrol
 SUBDIR.${MK_FLOPPY}+=  fdformat
 SUBDIR.${MK_FLOPPY}+=  fdread
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335387 - head/sys/compat/linux

2018-06-19 Thread Ed Maste
Author: emaste
Date: Tue Jun 19 21:26:23 2018
New Revision: 335387
URL: https://svnweb.freebsd.org/changeset/base/335387

Log:
  linuxulator: handle V3 capget/capset
  
  Linux 2.6.26 introduced 64-bit capability sets.  Extend our stub
  implementation to handle both 32- and 64-bit.  (We still report no
  capabilities in capget, and disallow any in capset.)
  
  Reviewed by:  chuck
  Sponsored by: Turing Robotic Industries Inc.
  Differential Revision:https://reviews.freebsd.org/D15887

Modified:
  head/sys/compat/linux/linux_misc.c

Modified: head/sys/compat/linux/linux_misc.c
==
--- head/sys/compat/linux/linux_misc.c  Tue Jun 19 21:07:25 2018
(r335386)
+++ head/sys/compat/linux/linux_misc.c  Tue Jun 19 21:26:23 2018
(r335387)
@@ -1867,7 +1867,9 @@ linux_exit_group(struct thread *td, struct linux_exit_
/* NOTREACHED */
 }
 
-#define _LINUX_CAPABILITY_VERSION  0x19980330
+#define _LINUX_CAPABILITY_VERSION_1  0x19980330
+#define _LINUX_CAPABILITY_VERSION_2  0x20071026
+#define _LINUX_CAPABILITY_VERSION_3  0x20080522
 
 struct l_user_cap_header {
l_int   version;
@@ -1881,27 +1883,35 @@ struct l_user_cap_data {
 };
 
 int
-linux_capget(struct thread *td, struct linux_capget_args *args)
+linux_capget(struct thread *td, struct linux_capget_args *uap)
 {
struct l_user_cap_header luch;
-   struct l_user_cap_data lucd;
-   int error;
+   struct l_user_cap_data lucd[2];
+   int error, u32s;
 
-   if (args->hdrp == NULL)
+   if (uap->hdrp == NULL)
return (EFAULT);
 
-   error = copyin(args->hdrp, &luch, sizeof(luch));
+   error = copyin(uap->hdrp, &luch, sizeof(luch));
if (error != 0)
return (error);
 
-   if (luch.version != _LINUX_CAPABILITY_VERSION) {
+   switch (luch.version) {
+   case _LINUX_CAPABILITY_VERSION_1:
+   u32s = 1;
+   break;
+   case _LINUX_CAPABILITY_VERSION_2:
+   case _LINUX_CAPABILITY_VERSION_3:
+   u32s = 2;
+   break;
+   default:
 #ifdef DEBUG
if (ldebug(capget))
printf(LMSG("invalid capget capability version 0x%x"),
luch.version);
 #endif
-   luch.version = _LINUX_CAPABILITY_VERSION;
-   error = copyout(&luch, args->hdrp, sizeof(luch));
+   luch.version = _LINUX_CAPABILITY_VERSION_1;
+   error = copyout(&luch, uap->hdrp, sizeof(luch));
if (error)
return (error);
return (EINVAL);
@@ -1910,42 +1920,50 @@ linux_capget(struct thread *td, struct linux_capget_ar
if (luch.pid)
return (EPERM);
 
-   if (args->datap) {
+   if (uap->datap) {
/*
 * The current implementation doesn't support setting
 * a capability (it's essentially a stub) so indicate
 * that no capabilities are currently set or available
 * to request.
 */
-   bzero (&lucd, sizeof(lucd));
-   error = copyout(&lucd, args->datap, sizeof(lucd));
+   memset(&lucd, 0, u32s * sizeof(lucd[0]));
+   error = copyout(&lucd, uap->datap, u32s * sizeof(lucd[0]));
}
 
return (error);
 }
 
 int
-linux_capset(struct thread *td, struct linux_capset_args *args)
+linux_capset(struct thread *td, struct linux_capset_args *uap)
 {
struct l_user_cap_header luch;
-   struct l_user_cap_data lucd;
-   int error;
+   struct l_user_cap_data lucd[2];
+   int error, i, u32s;
 
-   if (args->hdrp == NULL || args->datap == NULL)
+   if (uap->hdrp == NULL || uap->datap == NULL)
return (EFAULT);
 
-   error = copyin(args->hdrp, &luch, sizeof(luch));
+   error = copyin(uap->hdrp, &luch, sizeof(luch));
if (error != 0)
return (error);
 
-   if (luch.version != _LINUX_CAPABILITY_VERSION) {
+   switch (luch.version) {
+   case _LINUX_CAPABILITY_VERSION_1:
+   u32s = 1;
+   break;
+   case _LINUX_CAPABILITY_VERSION_2:
+   case _LINUX_CAPABILITY_VERSION_3:
+   u32s = 2;
+   break;
+   default:
 #ifdef DEBUG
if (ldebug(capset))
printf(LMSG("invalid capset capability version 0x%x"),
luch.version);
 #endif
-   luch.version = _LINUX_CAPABILITY_VERSION;
-   error = copyout(&luch, args->hdrp, sizeof(luch));
+   luch.version = _LINUX_CAPABILITY_VERSION_1;
+   error = copyout(&luch, uap->hdrp, sizeof(luch));
if (error)
return (error);
return (EINVAL);
@@ -1954,18 +1972,21 @@ linux_capset(struct thread *td, struct linux_capset_ar
 

svn commit: r335388 - head/tools/tools/git

2018-06-19 Thread Warner Losh
Author: imp
Date: Tue Jun 19 21:58:04 2018
New Revision: 335388
URL: https://svnweb.freebsd.org/changeset/base/335388

Log:
  Fix typo noticed by pstef@.

Modified:
  head/tools/tools/git/HOWTO

Modified: head/tools/tools/git/HOWTO
==
--- head/tools/tools/git/HOWTO  Tue Jun 19 21:26:23 2018(r335387)
+++ head/tools/tools/git/HOWTO  Tue Jun 19 21:58:04 2018(r335388)
@@ -147,7 +147,7 @@ III. git-svn-rebase
 
 git-svn-rebase is a script that helps you keep current when using git 
 plus subversion as outline in https://wiki.freebsd.org/GitWorkflow/GitSvn
-since it's otherwise a pain to have many branhes active. It will rebase
+since it's otherwise a pain to have many branches active. It will rebase
 those branches that haven't been merged yet. Some tweaking may be needed
 if you have other, weird branches in your tree (including any stable
 branches). To run it just cd into the git subversion tree somewhere and
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335389 - head/lib/libcasper/services/cap_pwd

2018-06-19 Thread Mariusz Zaborski
Author: oshogbo
Date: Tue Jun 19 22:19:42 2018
New Revision: 335389
URL: https://svnweb.freebsd.org/changeset/base/335389

Log:
  Fix typo.

Modified:
  head/lib/libcasper/services/cap_pwd/cap_pwd.3

Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.3
==
--- head/lib/libcasper/services/cap_pwd/cap_pwd.3   Tue Jun 19 21:58:04 
2018(r335388)
+++ head/lib/libcasper/services/cap_pwd/cap_pwd.3   Tue Jun 19 22:19:42 
2018(r335389)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 18, 2018
+.Dd June 20, 2018
 .Dt CAP_PWD 3
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@
 .Nm cap_pwd_limit_users
 .Nd "library for password database operations in capability mode"
 .Sh LIBRARY
-.Lb libcap_grp
+.Lb libcap_pwd
 .Sh SYNOPSIS
 .In libcasper.h
 .In casper/cap_pwd.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335390 - head/usr.bin/top

2018-06-19 Thread Eitan Adler
Author: eadler
Date: Tue Jun 19 23:30:55 2018
New Revision: 335390
URL: https://svnweb.freebsd.org/changeset/base/335390

Log:
  top(1): fix top -mio

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Tue Jun 19 22:19:42 2018(r335389)
+++ head/usr.bin/top/machine.c  Tue Jun 19 23:30:55 2018(r335390)
@@ -455,6 +455,7 @@ format_header(const char *uname_field)
case DISP_IO:
prehead = io_header;
snprintf(Header, sizeof(Header), prehead,
+   ps.thread_id ? " THR" : "PID",
jidlength, ps.jail ? " JID" : "",
namelength, namelength, uname_field);
break;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335393 - head

2018-06-19 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jun 19 23:40:39 2018
New Revision: 335393
URL: https://svnweb.freebsd.org/changeset/base/335393

Log:
  Let CROSS_BINUTILS_PREFIX work without a trailing slash.
  
  Reported by:  jhb
  MFC after:2 weeks
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jun 19 23:40:36 2018(r335392)
+++ head/Makefile.inc1  Tue Jun 19 23:40:39 2018(r335393)
@@ -211,8 +211,8 @@ CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebs
 XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS
 .for BINUTIL in ${XBINUTILS}
 .if defined(CROSS_BINUTILS_PREFIX) && \
-exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}})
-X${BINUTIL}?=  ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
+exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}})
+X${BINUTIL}?=  ${CROSS_BINUTILS_PREFIX:C,/*$,,}/${${BINUTIL}}
 .else
 X${BINUTIL}?=  ${${BINUTIL}}
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335391 - head

2018-06-19 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jun 19 23:39:55 2018
New Revision: 335391
URL: https://svnweb.freebsd.org/changeset/base/335391

Log:
  Fix X_COMPILER_* and X_LINKER_* not being passed to installworld environment.
  
  This could lead to 'sh: head: not found' warnings which were a symptom
  of running 'ld --version' during installworld.  This was only happening
  with XCC or XLD set.  It is intended that cc and ld do not run during
  installworld.  The metadata for these are already stored in
  compiler-metadata.mk added in r316794.
  
  This also removes redundant CROSSENV additions that were for
  WITH_SYSTEM_COMPILER, WITHOUT_CROSS_COMPILER, and WITHOUT_TOOLCHAIN
  which all don't have a cc or ld in their PATH during install.
  
  Reported by:  Mark Millard
  MFC after:2 weeks
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jun 19 23:30:55 2018(r335390)
+++ head/Makefile.inc1  Tue Jun 19 23:39:55 2018(r335391)
@@ -169,22 +169,6 @@ test-system-compiler: .PHONY
 .info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree.  Not 
bootstrapping a cross-compiler.
 .endif
 
-# For installworld need to ensure that the looked-up compiler metadata is
-# passed along rather than trying to run cc from the restricted
-# STRICTTMPPATH.
-.if ${MK_CLANG_BOOTSTRAP} == "no" && ${MK_GCC_BOOTSTRAP} == "no"
-.if !defined(X_COMPILER_TYPE)
-CROSSENV+= COMPILER_VERSION=${COMPILER_VERSION} \
-   COMPILER_TYPE=${COMPILER_TYPE} \
-   COMPILER_FEATURES="${COMPILER_FEATURES}" \
-   COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION}
-.else
-CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \
-   COMPILER_FEATURES="${X_COMPILER_FEATURES}" \
-   COMPILER_TYPE=${X_COMPILER_TYPE} \
-   COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION}
-.endif
-.endif
 # Store some compiler metadata for use in installworld where we don't
 # want to invoke CC at all.
 _COMPILER_METADATA_VARS=   COMPILER_VERSION \
@@ -201,8 +185,10 @@ compiler-metadata.mk: .PHONY .META
@echo "_LOADED_COMPILER_METADATA=t" >> ${.TARGET}
 .for v in ${_COMPILER_METADATA_VARS}
@echo "${v}=${${v}}" >> ${.TARGET}
+   @echo "X_${v}=${X_${v}}" >> ${.TARGET}
 .endfor
@echo ".export ${_COMPILER_METADATA_VARS}" >> ${.TARGET}
+   @echo ".export ${_COMPILER_METADATA_VARS:C,^,X_,}" >> ${.TARGET}
 
 # Handle external binutils.
 .if defined(CROSS_TOOLCHAIN_PREFIX)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335392 - head

2018-06-19 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jun 19 23:40:36 2018
New Revision: 335392
URL: https://svnweb.freebsd.org/changeset/base/335392

Log:
  SYSTEM_COMPILER: Should use X_ vars for comparing wanted version.
  
  It is XCC used during the build of target binaries that replaces the
  bootstrap compiler.
  
  Also slightly tweak style.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jun 19 23:39:55 2018(r335391)
+++ head/Makefile.inc1  Tue Jun 19 23:40:36 2018(r335392)
@@ -138,10 +138,10 @@ WANT_COMPILER_VERSION!= \
 .if ${MK_SYSTEM_COMPILER} == "yes" && \
 (${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \
 !make(showconfig) && !make(xdev*) && \
-${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} && \
-(${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
-${COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \
-${COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION}
+${X_COMPILER_TYPE} == ${WANT_COMPILER_TYPE} && \
+(${X_COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
+${X_COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \
+${X_COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION}
 # Everything matches, disable the bootstrap compiler.
 MK_CLANG_BOOTSTRAP=no
 MK_GCC_BOOTSTRAP=  no
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335394 - head

2018-06-19 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jun 19 23:40:42 2018
New Revision: 335394
URL: https://svnweb.freebsd.org/changeset/base/335394

Log:
  Fix detection for binutils bootstrap package.
  
  The path was changed recently in the port to be the full target triple.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jun 19 23:40:39 2018(r335393)
+++ head/Makefile.inc1  Tue Jun 19 23:40:42 2018(r335394)
@@ -202,7 +202,7 @@ CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
 .if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \
 ${MK_LLD_BOOTSTRAP} == "no" && \
 !defined(CROSS_BINUTILS_PREFIX)
-CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/
+CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_TRIPLE}/bin/
 .if !exists(${CROSS_BINUTILS_PREFIX})
 .error In-tree binutils does not support the ${TARGET_ARCH} architecture. 
Install the ${TARGET_ARCH}-binutils port or package or set 
CROSS_BINUTILS_PREFIX.
 .endif
@@ -641,6 +641,10 @@ TARGET_ABI=gnueabihf
 TARGET_ABI=gnueabi
 .endif
 .endif
+MACHINE_ABI?=  unknown
+MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.0
+TARGET_ABI?=   unknown
+TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.0
 .if ${WANT_COMPILER_TYPE} == gcc || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 # GCC requires -isystem and -L when using a cross-compiler.  --sysroot
@@ -658,10 +662,6 @@ XCXXFLAGS+=-isystem ${WORLDTMP}/usr/include/c++/v1 
-s
 .endif
 .elif ${WANT_COMPILER_TYPE} == clang || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang)
-MACHINE_ABI?=  unknown
-MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.0
-TARGET_ABI?=   unknown
-TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.0
 XCFLAGS+=  -target ${TARGET_TRIPLE}
 .endif
 XCFLAGS+=  --sysroot=${WORLDTMP}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335395 - in head: bin/dd bin/echo bin/sleep bin/uuidgen contrib/dma sbin/decryptcore sbin/dhclient sbin/dumpon sbin/md5 usr.bin/basename usr.bin/cmp usr.bin/col usr.bin/diff usr.bin/di...

2018-06-19 Thread Mariusz Zaborski
Author: oshogbo
Date: Tue Jun 19 23:43:14 2018
New Revision: 335395
URL: https://svnweb.freebsd.org/changeset/base/335395

Log:
  Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.
  
  No functional change intended.

Modified:
  head/bin/dd/dd.c
  head/bin/echo/echo.c
  head/bin/sleep/sleep.c
  head/bin/uuidgen/uuidgen.c
  head/contrib/dma/dma-mbox-create.c
  head/sbin/decryptcore/decryptcore.c
  head/sbin/dhclient/dhclient.c
  head/sbin/dumpon/dumpon.c
  head/sbin/md5/md5.c
  head/usr.bin/basename/basename.c
  head/usr.bin/cmp/cmp.c
  head/usr.bin/col/col.c
  head/usr.bin/diff/diffreg.c
  head/usr.bin/diff3/diff3.c
  head/usr.bin/dirname/dirname.c
  head/usr.bin/elfdump/elfdump.c
  head/usr.bin/getopt/getopt.c
  head/usr.bin/hexdump/display.c
  head/usr.bin/iconv/iconv.c
  head/usr.bin/ident/ident.c
  head/usr.bin/indent/indent.c
  head/usr.bin/jot/jot.c
  head/usr.bin/kdump/kdump.c
  head/usr.bin/ktrdump/ktrdump.c
  head/usr.bin/lam/lam.c
  head/usr.bin/last/last.c
  head/usr.bin/locate/bigram/locate.bigram.c
  head/usr.bin/logname/logname.c
  head/usr.bin/ministat/ministat.c
  head/usr.bin/pom/pom.c
  head/usr.bin/primes/primes.c
  head/usr.bin/printenv/printenv.c
  head/usr.bin/rwho/rwho.c
  head/usr.bin/tee/tee.c
  head/usr.bin/tr/tr.c
  head/usr.bin/uniq/uniq.c
  head/usr.bin/units/units.c
  head/usr.bin/write/write.c
  head/usr.bin/yes/yes.c
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/rwhod/rwhod.c

Modified: head/bin/dd/dd.c
==
--- head/bin/dd/dd.cTue Jun 19 23:40:42 2018(r335394)
+++ head/bin/dd/dd.cTue Jun 19 23:43:14 2018(r335395)
@@ -98,7 +98,7 @@ main(int argc __unused, char *argv[])
setup();
 
caph_cache_catpages();
-   if (cap_enter() == -1 && errno != ENOSYS)
+   if (caph_enter() < 0)
err(1, "unable to enter capability mode");
 
(void)signal(SIGINFO, siginfo_handler);

Modified: head/bin/echo/echo.c
==
--- head/bin/echo/echo.cTue Jun 19 23:40:42 2018(r335394)
+++ head/bin/echo/echo.cTue Jun 19 23:43:14 2018(r335395)
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
char newline[] = "\n";
char *progname = argv[0];
 
-   if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
+   if (caph_limit_stdio() < 0 || caph_enter() < 0)
err(1, "capsicum");
 
/* This utility may NOT do getopt(3) option parsing. */

Modified: head/bin/sleep/sleep.c
==
--- head/bin/sleep/sleep.c  Tue Jun 19 23:40:42 2018(r335394)
+++ head/bin/sleep/sleep.c  Tue Jun 19 23:43:14 2018(r335395)
@@ -70,7 +70,7 @@ main(int argc, char *argv[])
time_t original;
char buf[2];
 
-   if (caph_limit_stdio() < 0 || (cap_enter() < 0 && errno != ENOSYS))
+   if (caph_limit_stdio() < 0 || caph_enter() < 0)
err(1, "capsicum");
 
if (argc != 2)

Modified: head/bin/uuidgen/uuidgen.c
==
--- head/bin/uuidgen/uuidgen.c  Tue Jun 19 23:40:42 2018(r335394)
+++ head/bin/uuidgen/uuidgen.c  Tue Jun 19 23:43:14 2018(r335395)
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
caph_cache_catpages();
if (caph_limit_stdio() < 0)
err(1, "Unable to limit stdio");
-   if (cap_enter() < 0 && errno != ENOSYS)
+   if (caph_enter() < 0)
err(1, "Unable to enter capability mode");
 
if (count == -1)

Modified: head/contrib/dma/dma-mbox-create.c
==
--- head/contrib/dma/dma-mbox-create.c  Tue Jun 19 23:40:42 2018
(r335394)
+++ head/contrib/dma/dma-mbox-create.c  Tue Jun 19 23:43:14 2018
(r335395)
@@ -166,7 +166,7 @@ main(int argc, char **argv)
err(EX_OSERR, "can't limit maildirfd rights");
 
/* Enter Capsicum capability sandbox */
-   if (cap_enter() < 0 && errno != ENOSYS)
+   if (caph_enter() < 0)
err(EX_OSERR, "cap_enter");
 #endif
 

Modified: head/sbin/decryptcore/decryptcore.c
==
--- head/sbin/decryptcore/decryptcore.c Tue Jun 19 23:40:42 2018
(r335394)
+++ head/sbin/decryptcore/decryptcore.c Tue Jun 19 23:43:14 2018
(r335395)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -167,7 +168,7 @@ decrypt(int ofd, const char *privkeyfile, const char *
goto failed;
}
 
-   if (cap_enter() < 0 && errno != ENOSYS) {
+   if (caph_enter() < 0) {
pjdlog_errno(LOG_ERR, "Unable to enter capability mode");

svn commit: r335396 - head

2018-06-19 Thread Bryan Drewery
Author: bdrewery
Date: Tue Jun 19 23:57:12 2018
New Revision: 335396
URL: https://svnweb.freebsd.org/changeset/base/335396

Log:
  TARGET_TRIPLE is needed much earlier now for CROSS_BINUTILS_PREFIX check.
  
  This was missed in r335394 since the check became exists(/usr/local) in
  my testing.
  
  X-MFC-With:   r335394
  MFC after:2 weeks
  Sponsored by: Dell EMC

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Jun 19 23:43:14 2018(r335395)
+++ head/Makefile.inc1  Tue Jun 19 23:57:12 2018(r335396)
@@ -190,6 +190,28 @@ compiler-metadata.mk: .PHONY .META
@echo ".export ${_COMPILER_METADATA_VARS}" >> ${.TARGET}
@echo ".export ${_COMPILER_METADATA_VARS:C,^,X_,}" >> ${.TARGET}
 
+.if ${TARGET} == ${MACHINE}
+TARGET_CPUTYPE?=${CPUTYPE}
+.else
+TARGET_CPUTYPE?=
+.endif
+.if !empty(TARGET_CPUTYPE)
+_TARGET_CPUTYPE=${TARGET_CPUTYPE}
+.else
+_TARGET_CPUTYPE=dummy
+.endif
+.if ${TARGET} == "arm"
+.if ${TARGET_ARCH:Marmv[67]*} != "" && ${TARGET_CPUTYPE:M*soft*} == ""
+TARGET_ABI=gnueabihf
+.else
+TARGET_ABI=gnueabi
+.endif
+.endif
+MACHINE_ABI?=  unknown
+MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.0
+TARGET_ABI?=   unknown
+TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.0
+
 # Handle external binutils.
 .if defined(CROSS_TOOLCHAIN_PREFIX)
 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
@@ -440,17 +462,6 @@ _t=${TARGET_ARCH}/${TARGET}
 .endif
 .endfor
 
-.if ${TARGET} == ${MACHINE}
-TARGET_CPUTYPE?=${CPUTYPE}
-.else
-TARGET_CPUTYPE?=
-.endif
-
-.if !empty(TARGET_CPUTYPE)
-_TARGET_CPUTYPE=${TARGET_CPUTYPE}
-.else
-_TARGET_CPUTYPE=dummy
-.endif
 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \
-m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE
 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
@@ -634,17 +645,6 @@ BFLAGS+=   -B${CROSS_BINUTILS_PREFIX}
 .if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX})
 BFLAGS+=   -B${WORLDTMP}/usr/bin
 .endif
-.if ${TARGET} == "arm"
-.if ${TARGET_ARCH:Marmv[67]*} != "" && ${TARGET_CPUTYPE:M*soft*} == ""
-TARGET_ABI=gnueabihf
-.else
-TARGET_ABI=gnueabi
-.endif
-.endif
-MACHINE_ABI?=  unknown
-MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd12.0
-TARGET_ABI?=   unknown
-TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.0
 .if ${WANT_COMPILER_TYPE} == gcc || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 # GCC requires -isystem and -L when using a cross-compiler.  --sysroot
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335278 - head/bin/pwd

2018-06-19 Thread Eitan Adler
On 19 June 2018 at 12:57, Pedro Giffuni  wrote:
>
>
> On 19/06/2018 11:25, John Baldwin wrote:
>>
>> On 6/18/18 10:26 PM, Eitan Adler wrote:
>>>
>>> On 18 June 2018 at 10:57, John Baldwin  wrote:

 On 6/16/18 10:14 PM, Eitan Adler wrote:
>
> Author: eadler
> Date: Sun Jun 17 05:14:50 2018
> New Revision: 335278
> URL: https://svnweb.freebsd.org/changeset/base/335278
>
> Log:
>pwd: mark usage as dead

 You keep committing changes like this and ignoring e-mails about them.
>>>
>>> I replied both the first time and this time. I may have
>>> (accidentally?) ignored similar emails though. The question I have is
>>> other than the mild code churn what's the harm?
>>
>> It adds clutter.  Also, fixing the tool means you fix all the places at
>> once rather than slowly adding workarounds one by one.
>>
 What broken compiler are you using that doesn't properly inherit __dead2
 from the call to exit()?
>>>
>>> In this case, scan-build50 was getting annoyed.
>>
>> Does scan-build from LLVM 6.0 handle this correctly?  If so, I'd say to
>> just mark this warning as broken (and thus ignore it) for scan-build50
>> just as we ignore certain warnings from GCC 4.2.1 because they are
>> broken-as-implemented.
>>
> FWIW, clang's scan-build is made to even more false positives and general
> noise than the regular compiler warnings.
> It is better to just ignore it unless it finds something real.

I don't consider this a real harm, but I'll try and remember to ignore
these in the future.

-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335397 - in head/usr.bin: primes uniq

2018-06-19 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jun 20 00:13:09 2018
New Revision: 335397
URL: https://svnweb.freebsd.org/changeset/base/335397

Log:
  Use capsicum helpers to cache NLS data.

Modified:
  head/usr.bin/primes/primes.c
  head/usr.bin/uniq/uniq.c

Modified: head/usr.bin/primes/primes.c
==
--- head/usr.bin/primes/primes.cTue Jun 19 23:57:12 2018
(r335396)
+++ head/usr.bin/primes/primes.cWed Jun 20 00:13:09 2018
(r335397)
@@ -101,9 +101,7 @@ main(int argc, char *argv[])
int ch;
char *p;
 
-   /* Cache NLS data, for strerror, for err(3), before cap_enter. */
-   (void)catopen("libc", NL_CAT_LOCALE);
-
+   caph_cache_catpages();
if (caph_enter() < 0)
err(1, "cap_enter");
 

Modified: head/usr.bin/uniq/uniq.c
==
--- head/usr.bin/uniq/uniq.cTue Jun 19 23:57:12 2018(r335396)
+++ head/usr.bin/uniq/uniq.cWed Jun 20 00:13:09 2018(r335397)
@@ -87,17 +87,6 @@ static wchar_t   *skip(wchar_t *);
 static void obsolete(char *[]);
 static void usage(void);
 
-static void
-strerror_init(void)
-{
-
-   /*
-* Cache NLS data before entering capability mode.
-* XXXPJD: There should be strerror_init() and strsignal_init() in libc.
-*/
-   (void)catopen("libc", NL_CAT_LOCALE);
-}
-
 int
 main (int argc, char *argv[])
 {
@@ -177,7 +166,7 @@ main (int argc, char *argv[])
}
}
 
-   strerror_init();
+   caph_cache_catpages();
if (caph_enter() < 0)
err(1, "unable to enter capability mode");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335398 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread Allan Jude
Author: allanjude
Date: Wed Jun 20 00:14:54 2018
New Revision: 335398
URL: https://svnweb.freebsd.org/changeset/base/335398

Log:
  Revert r335276
  
  This was causing issues for people booting.
  I will likely bring this back as an optional feature, similar to
  boot0sio, like gptboot-serial or something.
  
  PR:   221526
  Reported by:  O. Hartmann , Thomas Laus 


Modified:
  head/stand/i386/gptboot/gptboot.c
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/gptboot/gptboot.c
==
--- head/stand/i386/gptboot/gptboot.c   Wed Jun 20 00:13:09 2018
(r335397)
+++ head/stand/i386/gptboot/gptboot.c   Wed Jun 20 00:14:54 2018
(r335398)
@@ -285,16 +285,6 @@ main(void)
bootinfo.bi_memsizes_valid++;
bootinfo.bi_bios_dev = dsk.drive;
 
-   /*
-* Initialize the serial console early with a modern default of 115200.
-* Later, we'll read PATH_DOTCONFIG and reconfigure serial according
-* to the configuration provided.
-*/
-   opts = OPT_SET(RBX_DUAL);
-   ioctrl = (IO_SERIAL|IO_KEYBOARD);
-   if (sio_init(115200) != 0)
-   ioctrl &= ~IO_SERIAL;
-
 #ifdef LOADER_GELI_SUPPORT
geli_init();
 #endif

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Wed Jun 20 00:13:09 2018
(r335397)
+++ head/stand/i386/zfsboot/zfsboot.c   Wed Jun 20 00:14:54 2018
(r335398)
@@ -693,16 +693,6 @@ main(void)
 }
 setheap(heap_next, heap_end);
 
-/*
- * Initialize the serial console early with a modern default of 115200.
- * Later, we'll read PATH_DOTCONFIG and reconfigure serial according
- * to the configuration provided.
- */
-opts = OPT_SET(RBX_DUAL);
-ioctrl = (IO_SERIAL|IO_KEYBOARD);
-if (sio_init(115200) != 0)
-   ioctrl &= ~IO_SERIAL;
-
 dsk = malloc(sizeof(struct dsk));
 dsk->drive = *(uint8_t *)PTOV(ARGS);
 dsk->type = dsk->drive & DRV_HARD ? TYPE_AD : TYPE_FD;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread Allan Jude
On 2018-06-19 16:30, O. Hartmann wrote:
> Am Sun, 17 Jun 2018 03:18:57 + (UTC)
> Allan Jude  schrieb:
> 
>> Author: allanjude
>> Date: Sun Jun 17 03:18:56 2018
>> New Revision: 335276
>> URL: https://svnweb.freebsd.org/changeset/base/335276
> 
>> Log:
>>   gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
> 
>>   Normally the serial console is not enabled until /boot.config is read and
>>   we know how the serial console should be configured.  Initialize the
>>   consoles early in 'dual' mode (serial & keyboard) with a default serial
>>   rate of 115200. Then serial is re-initialized once the disk is decrypted
>>   and the /boot.config file can be read.
> 
>>   This allows the GELIBoot passphrase to be provided via the serial console.
> 
>>   PR:221526
>>   Requested by:  many
>>   Reviewed by:   imp
>>   Sponsored by:  Klara Systems
>>   Differential Revision: https://reviews.freebsd.org/D15862
> 
>> Modified:
>>   head/stand/i386/gptboot/gptboot.c
>>   head/stand/i386/zfsboot/zfsboot.c
> 
> 
> This commit breaks booting off GPT partition (using NanoBSD, as Iposted 
> mistakenly to
> commit r335254, see there).
> Having CURRENT applied to a SD card for usage on a PCEngines APU 2C4, the 
> boot process
> dies immediately showing "Booting from harddisk". r335275 boots well.
> 
> 

I have reverted this commit in r335398.

As I mentioned in that commit, it will likely come back as an optional
feature in the near future.


-- 
Allan Jude



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r335276 - in head/stand/i386: gptboot zfsboot

2018-06-19 Thread Allan Jude
On 2018-06-17 07:32, Eugene Grosbein wrote:
> 17.06.2018 10:18, Allan Jude wrote:
> 
>> Author: allanjude
>> Date: Sun Jun 17 03:18:56 2018
>> New Revision: 335276
>> URL: https://svnweb.freebsd.org/changeset/base/335276
>>
>> Log:
>>   gptboot, zfsboot, gptzfsboot: Enable the video and serial consoles early
>>   
>>   Normally the serial console is not enabled until /boot.config is read and
>>   we know how the serial console should be configured.  Initialize the
>>   consoles early in 'dual' mode (serial & keyboard) with a default serial
>>   rate of 115200. Then serial is re-initialized once the disk is decrypted
>>   and the /boot.config file can be read.
>>   
>>   This allows the GELIBoot passphrase to be provided via the serial console.
>>   
>>   PR:221526
>>   Requested by:  many
>>   Reviewed by:   imp
>>   Sponsored by:  Klara Systems
>>   Differential Revision: https://reviews.freebsd.org/D15862
> 
> I had several cases when booting FreeBSD/amd64 with motherboard having no 
> serial ports
> hang hard early at boot unless I rebuilt boot media configuring it to NOT try 
> accessing
> missing serial ports. I even could reproduce that with VirtualBox machine 
> configured
> with no serial ports (not same as existing bug inactive serial port).
> 
> Should there be some way to disable this serial ports configuration at 
> compile time?
> 
> 
> 

I think what we'll do it compile it both ways, and use the non-serial
one by default, because it is safer. Then you can just use
'gptboot-serial' if you want serial support.

This will likely make Warner a bit sad, since we are just finally
getting around to reducing the number of different bootcode files.

-- 
Allan Jude
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335399 - in head/sys: conf modules modules/mac_veriexec modules/mac_veriexec_rmd160 modules/mac_veriexec_sha1 modules/mac_veriexec_sha256 modules/mac_veriexec_sha384 modules/mac_veriex...

2018-06-19 Thread Stephen J. Kiernan
Author: stevek
Date: Wed Jun 20 00:41:30 2018
New Revision: 335399
URL: https://svnweb.freebsd.org/changeset/base/335399

Log:
  MAC/veriexec implements a verified execution environment using the MAC
  framework.
  
  The code is organized into a few distinct pieces:
  
  * The meta-data store (in veriexec_metadata.c) which maps a file system
identifier, file identifier, and generation key tuple to veriexec
meta-data record.
  
  * Fingerprint management (in veriexec_fingerprint.c) which deals with
calculating the cryptographic hash for a file and verifying it. It also
manages the loadable fingerprint modules.
  
  * MAC policy implementation (in mac_veriexec.c) which implements the
following MAC methods:
  
  mpo_init
Initializes the veriexec state, meta-data store, fingerprint modules,
and registers mount and unmount EVENTHANDLERs
  
  mpo_syscall
Implements the following per-policy system calls:
MAC_VERIEXEC_CHECK_FD_SYSCALL
  Check a file descriptor to see if the referenced file has a valid
  fingerprint.
MAC_VERIEXEC_CHECK_PATH_SYSCALL
  Check a path to see if the referenced file has a valid fingerprint.
  
  mpo_kld_check_load
Check if loading a kld is allowed. This checks if the referenced vnode
has a valid fingerprint.
  
  mpo_mount_destroy_label
Clears the veriexec slot data in a mount point label.
  
  mpo_mount_init_label
Initializes the veriexec slot data in a mount point label.
The file system identifier is saved in the veriexec slot data.
  
  mpo_priv_check
Check if a process is allowed to write to /dev/kmem and /dev/mem
devices.
If a process is flagged as trusted, it is allowed to write.
  
  mpo_proc_check_debug
Check if a process is allowed to be debugged. If a process is not
flagged with VERIEXEC_NOTRACE, then debugging is allowed.
  
  mpo_vnode_check_exec
Check is an exectuable is allowed to run. If veriexec is not enforcing
or the executable has a valid fingerprint, then it is allowed to run.
NOTE: veriexec will complain about mismatched fingerprints if it is
active, regardless of the state of the enforcement.
  
  mpo_vnode_check_open
Check is a file is allowed to be opened. If verification was not
requested, veriexec is not enforcing, or the file has a valid
fingerprint, then veriexec will allow the file to be opened.
  
  mpo_vnode_copy_label
Copies the veriexec slot data from one label to another.
  
  mpo_vnode_destroy_label
Clears the veriexec slot data in a vnode label.
  
  mpo_vnode_init_label
Initializes the veriexec slot data in a vnode label.
The fingerprint status for the file is stored in the veriexec slot data.
  
  * Some sysctls, under security.mac.veriexec, for setting debug level,
fetching the current state in a human-readable form, and dumping the
fingerprint database are implemented.
  
  * The MAC policy implementation source file also contains some utility
functions.
  
  * A set of fingerprint modules for the following cryptographic hash
algorithms:
RIPEMD-160, SHA1, SHA2-256, SHA2-384, SHA2-512
  
  * Loadable module builds for MAC/veriexec and fingerprint modules.
  
   WARNING: Using veriexec with NFS (or other network-based) file systems is
not recommended as one cannot guarantee the integrity of the files
served, nor the uniqueness of file system identifiers which are
used as key in the meta-data store.
  
  Reviewed by:  ian, jtl
  Obtained from:Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D8554

Added:
  head/sys/modules/mac_veriexec/
  head/sys/modules/mac_veriexec/Makefile   (contents, props changed)
  head/sys/modules/mac_veriexec_rmd160/
  head/sys/modules/mac_veriexec_rmd160/Makefile   (contents, props changed)
  head/sys/modules/mac_veriexec_sha1/
  head/sys/modules/mac_veriexec_sha1/Makefile   (contents, props changed)
  head/sys/modules/mac_veriexec_sha256/
  head/sys/modules/mac_veriexec_sha256/Makefile   (contents, props changed)
  head/sys/modules/mac_veriexec_sha384/
  head/sys/modules/mac_veriexec_sha384/Makefile   (contents, props changed)
  head/sys/modules/mac_veriexec_sha512/
  head/sys/modules/mac_veriexec_sha512/Makefile   (contents, props changed)
  head/sys/security/mac_veriexec/
  head/sys/security/mac_veriexec/mac_veriexec.c   (contents, props changed)
  head/sys/security/mac_veriexec/mac_veriexec.h   (contents, props changed)
  head/sys/security/mac_veriexec/mac_veriexec_internal.h   (contents, props 
changed)
  head/sys/security/mac_veriexec/mac_veriexec_rmd160.c   (contents, props 
changed)
  head/sys/security/mac_veriexec/mac_veriexec_sha1.c   (contents, props changed)
  head/sys/security/mac_veriexec/mac_veriexec_sha256.c   (contents, props 
changed)
  head/sys/security/mac_veriexec/mac_veriexec_sha384.c   (contents, props 
changed)
  head/sys/security/mac_veriexec/mac_veriexec_sha512.c   (co

svn commit: r335400 - in head/sys: dev/veriexec modules modules/veriexec

2018-06-19 Thread Stephen J. Kiernan
Author: stevek
Date: Wed Jun 20 00:48:46 2018
New Revision: 335400
URL: https://svnweb.freebsd.org/changeset/base/335400

Log:
  Device for user space to interface with MAC/veriexec.
  
  The veriexec device features the following ioctl commands:
  
  VERIEXEC_ACTIVE
Activate veriexec functionality
  VERIEXEC_DEBUG_ON
Enable debugging mode and increment or set the debug level
  VERIEXEC_DEBUG_OFF
Disable debugging mode
  VERIEXEC_ENFORCE
Enforce veriexec fingerprinting (and acitvate if not already)
  VERIEXEC_GETSTATE
Get current veriexec state
  VERIEXEC_LOCK
Lock changes to veriexec meta-data store
  VERIEXEC_LOAD
Load veriexec fingerprint if secure level is not raised (and passes the
checks for VERIEXEC_SIGNED_LOAD)
  VERIEXEC_SIGNED_LOAD
Load veriexec fingerprints from loader that supports signed manifest
(and thus we can be more lenient about secure level being raised.)
Fingerprints can be loaded if the meta-data store is not locked. Also
securelevel must not have been raised or some fingerprints must have
already been loaded, otherwise it would be dangerous to allow loading.
(Note: this assumes that the fingerprints in the meta-data store at
   least cover the fingerprint loader.)
  
  Reviewed by:  jtl
  Obtained from:Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D8561

Added:
  head/sys/dev/veriexec/
  head/sys/dev/veriexec/veriexec_ioctl.h   (contents, props changed)
  head/sys/dev/veriexec/verified_exec.c   (contents, props changed)
  head/sys/modules/veriexec/
  head/sys/modules/veriexec/Makefile   (contents, props changed)
Modified:
  head/sys/modules/Makefile

Added: head/sys/dev/veriexec/veriexec_ioctl.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/veriexec/veriexec_ioctl.h  Wed Jun 20 00:48:46 2018
(r335400)
@@ -0,0 +1,60 @@
+/*
+ * $FreeBSD$
+ *
+ * Copyright (c) 2011-2013, 2015, Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ *
+ * Definitions for the Verified Executables kernel function.
+ *
+ */
+#ifndef _DEV_VERIEXEC_VERIEXEC_IOCTL_H
+#define _DEV_VERIEXEC_VERIEXEC_IOCTL_H
+
+#include 
+#include 
+
+#defineVERIEXEC_FPTYPELEN  16
+
+struct verified_exec_params  {
+   unsigned char flags;
+   char fp_type[VERIEXEC_FPTYPELEN];   /* type of fingerprint */
+   char file[MAXPATHLEN];
+   unsigned char fingerprint[MAXFINGERPRINTLEN];
+};
+
+#define VERIEXEC_LOAD  _IOW('S', 0x1, struct verified_exec_params)
+#define VERIEXEC_ACTIVE_IO('S', 0x2)   /* start checking */
+#define VERIEXEC_ENFORCE   _IO('S', 0x3)   /* fail exec */
+#define VERIEXEC_LOCK  _IO('S', 0x4)   /* don't allow new sigs */
+#define VERIEXEC_DEBUG_ON  _IOWR('S', 0x5, int) /* set/get debug level */
+#define VERIEXEC_DEBUG_OFF _IO('S', 0x6)   /* reset debug */
+#define VERIEXEC_GETSTATE  _IOR('S', 0x7, int) /* get state */
+#define VERIEXEC_SIGNED_LOAD   _IOW('S', 0x8, struct verified_exec_params)
+
+#define_PATH_DEV_VERIEXEC  _PATH_DEV "veriexec"
+
+#endif

Added: head/sys/dev/veriexec/verified_exec.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/veriexec/verified_exec.c   Wed Jun 20 00:48:46 2018
(r335400)
@@ -0,0 +1,224 @@
+/*
+ * $FreeBSD$
+ *
+ * Copyright (c) 2011-2013, 2015, Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modif

Re: svn commit: r335278 - head/bin/pwd

2018-06-19 Thread Warner Losh
On Tue, Jun 19, 2018 at 5:56 PM, Eitan Adler  wrote:

> On 19 June 2018 at 12:57, Pedro Giffuni  wrote:
> >
> >
> > On 19/06/2018 11:25, John Baldwin wrote:
> >>
> >> On 6/18/18 10:26 PM, Eitan Adler wrote:
> >>>
> >>> On 18 June 2018 at 10:57, John Baldwin  wrote:
> 
>  On 6/16/18 10:14 PM, Eitan Adler wrote:
> >
> > Author: eadler
> > Date: Sun Jun 17 05:14:50 2018
> > New Revision: 335278
> > URL: https://svnweb.freebsd.org/changeset/base/335278
> >
> > Log:
> >pwd: mark usage as dead
> 
>  You keep committing changes like this and ignoring e-mails about them.
> >>>
> >>> I replied both the first time and this time. I may have
> >>> (accidentally?) ignored similar emails though. The question I have is
> >>> other than the mild code churn what's the harm?
> >>
> >> It adds clutter.  Also, fixing the tool means you fix all the places at
> >> once rather than slowly adding workarounds one by one.
> >>
>  What broken compiler are you using that doesn't properly inherit
> __dead2
>  from the call to exit()?
> >>>
> >>> In this case, scan-build50 was getting annoyed.
> >>
> >> Does scan-build from LLVM 6.0 handle this correctly?  If so, I'd say to
> >> just mark this warning as broken (and thus ignore it) for scan-build50
> >> just as we ignore certain warnings from GCC 4.2.1 because they are
> >> broken-as-implemented.
> >>
> > FWIW, clang's scan-build is made to even more false positives and general
> > noise than the regular compiler warnings.
> > It is better to just ignore it unless it finds something real.
>
> I don't consider this a real harm, but I'll try and remember to ignore
> these in the future.


We're in danger of being nibbled to death by ducks by these sorts of
things. We need to choose carefully where we annotate to accommodate the
competing needs of simplicity and automated tools providing assistance in
boosting our code quality. So this one may or may not matter. But it's not
just this one change that we have to look at...

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335401 - head/lib/libveriexec

2018-06-19 Thread Stephen J. Kiernan
Author: stevek
Date: Wed Jun 20 00:55:18 2018
New Revision: 335401
URL: https://svnweb.freebsd.org/changeset/base/335401

Log:
  This library allows for user space applications to check file descriptors
  or paths to see if they can be verified by MAC/veriexec.
  
  Reviewed by:  jtl, wblock
  Obtained from:Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D8562

Added:
  head/lib/libveriexec/
  head/lib/libveriexec/Makefile   (contents, props changed)
  head/lib/libveriexec/libveriexec.h   (contents, props changed)
  head/lib/libveriexec/veriexec.3   (contents, props changed)
  head/lib/libveriexec/veriexec_check.c   (contents, props changed)

Added: head/lib/libveriexec/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libveriexec/Makefile   Wed Jun 20 00:55:18 2018
(r335401)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.include 
+
+LIB=   veriexec
+MAN=   veriexec.3
+INCS=  libveriexec.h
+
+WARNS?=2
+
+SRCS=  veriexec_check.c
+
+.include 
+

Added: head/lib/libveriexec/libveriexec.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libveriexec/libveriexec.h  Wed Jun 20 00:55:18 2018
(r335401)
@@ -0,0 +1,37 @@
+/*
+ * $FreeBSD$
+ *
+ * Copyright (c) 2011, 2012, 2013, 2015, Juniper Networks, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __LIBVERIEXEC_H__
+#define __LIBVERIEXEC_H__
+
+intveriexec_check_fd_mode(int, unsigned int);
+intveriexec_check_path_mode(const char *, unsigned int);
+intveriexec_check_fd(int);
+intveriexec_check_path(const char *);
+
+#endif  /* __LIBVERIEXEC_H__ */

Added: head/lib/libveriexec/veriexec.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libveriexec/veriexec.3 Wed Jun 20 00:55:18 2018
(r335401)
@@ -0,0 +1,65 @@
+.\" Copyright (c) 2018, Juniper Networks, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 19, 2018
+.Dt VERIEXEC 3
+.Os
+.Sh NAME
+.Nm veriexec_check_fd ,
+.Nm veriexec_check_path
+.Nd Verified execution routines
+.Sh LIBRARY
+.Lb lib

svn commit: r335402 - head/sbin/veriexecctl

2018-06-19 Thread Stephen J. Kiernan
Author: stevek
Date: Wed Jun 20 01:08:54 2018
New Revision: 335402
URL: https://svnweb.freebsd.org/changeset/base/335402

Log:
  This application (veriexecctl) handles reading a fingerprints file
  containing paths, fingerprints, and optional option flags which in turn
  get pushed into the MAC/veriexec meta-data store via the veriexec device.
  
  The format of the fingerprints file is as follows:
  path type fingerprint options
  
  The type of fingerprint supported depends on what MAC/veriexec fingerprint
  modules have been loaded into the system. The veriexecctl application is
  able to determine which ones are available by consulting the
  security.mac.veriexec.algorithms sysctl.
  
  The following options are currently supported in MAC/veriexec and by the
  veriexecctl application:
  
  indirect
If this option is set then the executable cannot be invoked directly, it
can only be used as an interpreter in shell scripts.
  file
Indicates that the fingerprint is associated with a file, not an
executable. Files have their fingerprints verified during open(2) and are
automatically made read only. This option may be used to verify shared
libraries have not been tampered with.
  no_ptrace
If this option is set then the executable cannot be traced with the
ptrace(2) process tracing and debugging call.
  trusted
If this option is set then the executable is allowed to write to the
mem(4) devices. By default, when verified execution is enforced, no
process is allowed to write to the mem(4) devices.
  
  The options are not case sensitive.
  
  Reviewed by:  jtl, wblock
  Obtained from:Juniper Networks, Inc.
  Differential Revision:https://reviews.freebsd.org/D8575

Added:
  head/sbin/veriexecctl/
  head/sbin/veriexecctl/Makefile   (contents, props changed)
  head/sbin/veriexecctl/veriexecctl.8   (contents, props changed)
  head/sbin/veriexecctl/veriexecctl.c   (contents, props changed)
  head/sbin/veriexecctl/veriexecctl_conf.l   (contents, props changed)
  head/sbin/veriexecctl/veriexecctl_parse.y   (contents, props changed)

Added: head/sbin/veriexecctl/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/veriexecctl/Makefile  Wed Jun 20 01:08:54 2018
(r335402)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PROG=  veriexecctl
+MAN=   veriexecctl.8
+SRCS=  veriexecctl_parse.y veriexecctl_conf.l veriexecctl.c
+
+WARNS?=3
+
+LIBADD=l
+
+.include 

Added: head/sbin/veriexecctl/veriexecctl.8
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/veriexecctl/veriexecctl.8 Wed Jun 20 01:08:54 2018
(r335402)
@@ -0,0 +1,121 @@
+.\" $NetBSD: veriexecctl.8,v 1.5 2004/03/06 23:40:13 wiz Exp $
+.\"
+.\" Copyright (c) 1999
+.\"Brett Lymn - bl...@baea.com.au, brett_l...@yahoo.com.au
+.\"
+.\" This code is donated to The NetBSD Foundation by the author.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\" 3. The name of the Author may not be used to endorse or promote
+.\"products derived from this software without specific prior written
+.\"permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 19, 2018
+.Dt VERIEXECCTL 8
+.Os
+.Sh NAME
+.Nm veriexecctl
+.Nd load verified exec fingerprints
+.Sh SYNOPSIS
+.Nm
+.Ar fingerprints
+.Sh DESCRIPTION
+The
+.Nm
+command loads an in-kernel metadata store of the fingerprints
+given in the
+.Ar fingerprints
+file.
+The kernel can then calculate the fingerprint of programs at time of
+execution or files that are opened with
+.Dv O_VERIFY
+and verify whether

Re: svn commit: r335402 - head/sbin/veriexecctl

2018-06-19 Thread Eitan Adler
On 19 June 2018 at 18:08, Stephen J. Kiernan  wrote:
> Added: head/sbin/veriexecctl/Makefile
> ==
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/sbin/veriexecctl/Makefile  Wed Jun 20 01:08:54 2018
> (r335402)
> @@ -0,0 +1,11 @@
> +# $FreeBSD$
> +
> +PROG=  veriexecctl
> +MAN=   veriexecctl.8
> +SRCS=  veriexecctl_parse.y veriexecctl_conf.l veriexecctl.c
> +
> +WARNS?=3

Why are we introducing new code with lower-than-6 warnings ?

-- 
Eitan Adler
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335403 - in head/usr.bin/sort: . tests

2018-06-19 Thread Kyle Evans
Author: kevans
Date: Wed Jun 20 03:10:49 2018
New Revision: 335403
URL: https://svnweb.freebsd.org/changeset/base/335403

Log:
  sort(1): Add bits to allow easy checking against NetBSD tests
  
  I'm looking at sort(1) failures, for better or worse.

Added:
  head/usr.bin/sort/tests/
  head/usr.bin/sort/tests/Makefile   (contents, props changed)
Modified:
  head/usr.bin/sort/Makefile

Modified: head/usr.bin/sort/Makefile
==
--- head/usr.bin/sort/Makefile  Wed Jun 20 01:08:54 2018(r335402)
+++ head/usr.bin/sort/Makefile  Wed Jun 20 03:10:49 2018(r335403)
@@ -32,4 +32,7 @@ CFLAGS+= -DWITHOUT_NLS
 MAN_SUB+= -e 's|%%NLS%%|\.\\"|g'
 .endif
 
+#HAS_TESTS=
+#SUBDIR.${MK_TESTS}+= tests
+
 .include 

Added: head/usr.bin/sort/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/sort/tests/MakefileWed Jun 20 03:10:49 2018
(r335403)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+NETBSD_ATF_TESTS_SH=   sort_test
+
+${PACKAGE}FILES+=  d_any_char_dflag_out.txt
+${PACKAGE}FILES+=  d_any_char_fflag_out.txt
+${PACKAGE}FILES+=  d_any_char_iflag_out.txt
+${PACKAGE}FILES+=  d_any_char_in.txt
+
+.include 
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335403 - in head/usr.bin/sort: . tests

2018-06-19 Thread Kyle Evans
On Tue, Jun 19, 2018 at 10:10 PM, Kyle Evans  wrote:
> Author: kevans
> Date: Wed Jun 20 03:10:49 2018
> New Revision: 335403
> URL: https://svnweb.freebsd.org/changeset/base/335403
>
> Log:
>   sort(1): Add bits to allow easy checking against NetBSD tests
>
>   I'm looking at sort(1) failures, for better or worse.
>

In the past four minutes, I've learned that this isn't a sustainable
long-term idea due to major differences between NetBSD sort(1) and
ours. I'll look to adding FreeBSD tests and not using the NetBSD
tests, but will use theirs as a baseline where it makes sense for the
time being.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335404 - head/usr.bin/sort

2018-06-19 Thread Kyle Evans
Author: kevans
Date: Wed Jun 20 03:31:19 2018
New Revision: 335404
URL: https://svnweb.freebsd.org/changeset/base/335404

Log:
  sort(1): Fix -m when only implicit stdin is used for input
  
  Observe:
  
  printf "a\nb\nc\n" > /tmp/foo
  # Next command results in no output
  cat /tmp/foo | sort -m
  # Next command results in proper output
  cat /tmp/foo | sort -m -
  # Also works:
  sort -m /tmp/foo
  
  Some const'ification was done to simplify the actual solution of adding "-"
  explicitly to the file list if we didn't have any file arguments left over.
  
  PR:   190099
  MFC after:1 week

Modified:
  head/usr.bin/sort/file.c
  head/usr.bin/sort/file.h
  head/usr.bin/sort/sort.c

Modified: head/usr.bin/sort/file.c
==
--- head/usr.bin/sort/file.cWed Jun 20 03:10:49 2018(r335403)
+++ head/usr.bin/sort/file.cWed Jun 20 03:31:19 2018(r335404)
@@ -227,7 +227,7 @@ file_list_init(struct file_list *fl, bool tmp)
  * Add a file name to the list
  */
 void
-file_list_add(struct file_list *fl, char *fn, bool allocate)
+file_list_add(struct file_list *fl, const char *fn, bool allocate)
 {
 
if (fl && fn) {
@@ -1115,7 +1115,7 @@ file_headers_merge(size_t fnum, struct file_header **f
  * stdout.
  */
 static void
-merge_files_array(size_t argc, char **argv, const char *fn_out)
+merge_files_array(size_t argc, const char **argv, const char *fn_out)
 {
 
if (argv && fn_out) {

Modified: head/usr.bin/sort/file.h
==
--- head/usr.bin/sort/file.hWed Jun 20 03:10:49 2018(r335403)
+++ head/usr.bin/sort/file.hWed Jun 20 03:31:19 2018(r335404)
@@ -66,7 +66,7 @@ struct file_reader;
  */
 struct file_list
 {
-   char**fns;
+   const char **fns;
size_t   count;
size_t   sz;
bool tmp;
@@ -108,7 +108,7 @@ char *new_tmp_file_name(void);
 void tmp_file_atexit(const char *tmp_file);
 
 void file_list_init(struct file_list *fl, bool tmp);
-void file_list_add(struct file_list *fl, char *fn, bool allocate);
+void file_list_add(struct file_list *fl, const char *fn, bool allocate);
 void file_list_populate(struct file_list *fl, int argc, char **argv, bool 
allocate);
 void file_list_clean(struct file_list *fl);
 

Modified: head/usr.bin/sort/sort.c
==
--- head/usr.bin/sort/sort.cWed Jun 20 03:10:49 2018(r335403)
+++ head/usr.bin/sort/sort.cWed Jun 20 03:31:19 2018(r335404)
@@ -1299,7 +1299,11 @@ main(int argc, char **argv)
struct file_list fl;
 
file_list_init(&fl, false);
-   file_list_populate(&fl, argc, argv, true);
+   /* No file arguments remaining means "read from stdin." */
+   if (argc == 0)
+   file_list_add(&fl, "-", true);
+   else
+   file_list_populate(&fl, argc, argv, true);
merge_files(&fl, outfile);
file_list_clean(&fl);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335402 - head/sbin/veriexecctl

2018-06-19 Thread Conrad Meyer
On Tue, Jun 19, 2018 at 6:08 PM, Stephen J. Kiernan  wrote:
> Author: stevek
> Date: Wed Jun 20 01:08:54 2018
> New Revision: 335402
> URL: https://svnweb.freebsd.org/changeset/base/335402
>
> Log:
>   This application (veriexecctl) handles reading a fingerprints file

Hi,

This patchset needed design and code review prior to commit.  It
appears to have serious problems.

First and foremost: nothing is actually signed, anywhere.  The
veriexecctl tool parses and tells the kernel to trust a file input.
But if we don't trust other files on the filesystem, why do we trust
that one?  There is no embedded signature mechanism proving the hash
list file is trustworthy.

As a corollary to the above, the name "signature file" is used
repeatedly in the code, which is misleading.  The file contains hashes
(digests), not signatures (MACs).  The file itself is unsigned.
Nothing about this has signatures.

There's absolutely no reason to use sha1 or ripemd in new designs.
These should be removed.

The patchset is littered with style issues.  One fairly obvious issue
is mixed indentation styles — some files vary between space and tab
indentation from line to line.

Please revert this patchset.  It's not ready.

Some suggestions for a second attempt:

- Maybe use HMACs instead of raw hashes
- Maybe sign the source-of-trust file
- Fix the style issues
- Fix the compiler warnings at 6

Thank you,
Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335402 - head/sbin/veriexecctl

2018-06-19 Thread Conrad Meyer
I forgot to mention that the kernel code also introduces severe
performance problems due to really pessimal data structures, small IO
sizes, and problematic locking.

Again: please revert and proceed through a round or two of design review.

Thank you,
Conrad

On Tue, Jun 19, 2018 at 8:33 PM, Conrad Meyer  wrote:
> On Tue, Jun 19, 2018 at 6:08 PM, Stephen J. Kiernan  
> wrote:
>> Author: stevek
>> Date: Wed Jun 20 01:08:54 2018
>> New Revision: 335402
>> URL: https://svnweb.freebsd.org/changeset/base/335402
>>
>> Log:
>>   This application (veriexecctl) handles reading a fingerprints file
>
> Hi,
>
> This patchset needed design and code review prior to commit.  It
> appears to have serious problems.
>
> First and foremost: nothing is actually signed, anywhere.  The
> veriexecctl tool parses and tells the kernel to trust a file input.
> But if we don't trust other files on the filesystem, why do we trust
> that one?  There is no embedded signature mechanism proving the hash
> list file is trustworthy.
>
> As a corollary to the above, the name "signature file" is used
> repeatedly in the code, which is misleading.  The file contains hashes
> (digests), not signatures (MACs).  The file itself is unsigned.
> Nothing about this has signatures.
>
> There's absolutely no reason to use sha1 or ripemd in new designs.
> These should be removed.
>
> The patchset is littered with style issues.  One fairly obvious issue
> is mixed indentation styles — some files vary between space and tab
> indentation from line to line.
>
> Please revert this patchset.  It's not ready.
>
> Some suggestions for a second attempt:
>
> - Maybe use HMACs instead of raw hashes
> - Maybe sign the source-of-trust file
> - Fix the style issues
> - Fix the compiler warnings at 6
>
> Thank you,
> Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r335402 - head/sbin/veriexecctl

2018-06-19 Thread Cy Schubert
In message 
, Conrad Meyer writes:
> On Tue, Jun 19, 2018 at 6:08 PM, Stephen J. Kiernan  wrot
> e:
> > Author: stevek
> > Date: Wed Jun 20 01:08:54 2018
> > New Revision: 335402
> > URL: https://svnweb.freebsd.org/changeset/base/335402
> >
> > Log:
> >   This application (veriexecctl) handles reading a fingerprints file
>
> Hi,
>
> This patchset needed design and code review prior to commit.  It
> appears to have serious problems.
>
> First and foremost: nothing is actually signed, anywhere.  The
> veriexecctl tool parses and tells the kernel to trust a file input.
> But if we don't trust other files on the filesystem, why do we trust
> that one?  There is no embedded signature mechanism proving the hash
> list file is trustworthy.
>
> As a corollary to the above, the name "signature file" is used
> repeatedly in the code, which is misleading.  The file contains hashes
> (digests), not signatures (MACs).  The file itself is unsigned.
> Nothing about this has signatures.
>
> There's absolutely no reason to use sha1 or ripemd in new designs.
> These should be removed.
>
> The patchset is littered with style issues.  One fairly obvious issue
> is mixed indentation styles — some files vary between space and tab
> indentation from line to line.
>
> Please revert this patchset.  It's not ready.
>
> Some suggestions for a second attempt:
>
> - Maybe use HMACs instead of raw hashes
> - Maybe sign the source-of-trust file
> - Fix the style issues
> - Fix the compiler warnings at 6
  - i386 format issues, build failures in multiple places 


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335405 - stable/11/usr.sbin/sysrc

2018-06-19 Thread Devin Teske
Author: dteske
Date: Wed Jun 20 05:10:30 2018
New Revision: 335405
URL: https://svnweb.freebsd.org/changeset/base/335405

Log:
  MFC r335277:
  
  sysrc(8): Exit with failure on API error
  
  Fix exit status when f_sysrc_set() fails. Errors in the underlying API
  provided by bsdconfig(8) -- /usr/share/bsdconfig/sysrc.subr -- were not
  being communicated back to the command-line. This was affecting ansible
  modules using sysrc as they were not able to accurately test for error.
  
  PR:   bin/211448
  Reported by:  Christian Schwarz 
  Sponsored by: Smule, Inc.

Modified:
  stable/11/usr.sbin/sysrc/sysrc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/sysrc/sysrc
==
--- stable/11/usr.sbin/sysrc/sysrc  Wed Jun 20 03:31:19 2018
(r335404)
+++ stable/11/usr.sbin/sysrc/sysrc  Wed Jun 20 05:10:30 2018
(r335405)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #-
-# Copyright (c) 2010-2016 Devin Teske
+# Copyright (c) 2010-2018 Devin Teske
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
 #
 # Version information
 #
-SYSRC_VERSION="7.1 Feb-2,2016"
+SYSRC_VERSION="7.2 Jun-16,2018"
 
 #
 # Options
@@ -842,7 +842,7 @@ while [ $# -gt 0 ]; do
#
if [ ! "$SHOW_VALUE" ]; then
echo "$NAME"
-   f_sysrc_set "$NAME" "$new"
+   f_sysrc_set "$NAME" "$new" || status=$FAILURE
else
if f_sysrc_set "$NAME" "$new"; then
if [ "$SHOW_FILE" ]; then
@@ -854,6 +854,8 @@ while [ $# -gt 0 ]; do
echo -n "$before${SHOW_EQUALS:+\" #}"
echo -n " -> ${SHOW_EQUALS:+\"}$after"
echo "${SHOW_EQUALS:+\"}"
+   else
+   status=$FAILURE
fi
fi
;;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335406 - stable/11/lib/libdpv

2018-06-19 Thread Devin Teske
Author: dteske
Date: Wed Jun 20 05:45:41 2018
New Revision: 335406
URL: https://svnweb.freebsd.org/changeset/base/335406

Log:
  dpv(3): MFC r330943, r335264
  
  r330943:
  Fix bad error messages from dpv(3)
  
  Before = dpv: <__func__>: posix_spawnp(3): No such file or directory
   After = dpv: : No such file or directory
  
  Most notably, show the 2nd argument being passed to posix_spawnp(3)
  so we know what path/cmd failed.
  
  Also, we don't need to have "posix_spawnp(3)" in the error message
  nor the function because that can [a] change and [b] traversed using
  a debugger if necessary.
  
  r335264:
  Fix comparison between pointer and char literal
  
  PR:   misc/204252
  Reported by:  David Binderman 
  Sponsored by: Smule, Inc.

Modified:
  stable/11/lib/libdpv/dialog_util.c
  stable/11/lib/libdpv/dprompt.c
  stable/11/lib/libdpv/util.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libdpv/dialog_util.c
==
--- stable/11/lib/libdpv/dialog_util.c  Wed Jun 20 05:10:30 2018
(r335405)
+++ stable/11/lib/libdpv/dialog_util.c  Wed Jun 20 05:45:41 2018
(r335406)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2014 Devin Teske 
+ * Copyright (c) 2013-2018 Devin Teske 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -328,8 +328,7 @@ dialog_spawn_gauge(char *init_prompt, pid_t *pid)
posix_spawn_file_actions_addclose(&action, stdin_pipe[1]);
error = posix_spawnp(pid, dialog, &action,
(const posix_spawnattr_t *)NULL, dargv, environ);
-   if (error != 0)
-   err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__);
+   if (error != 0) err(EXIT_FAILURE, "%s", dialog);
 
/* NB: Do not free(3) *dargv[], else SIGSEGV */
 

Modified: stable/11/lib/libdpv/dprompt.c
==
--- stable/11/lib/libdpv/dprompt.c  Wed Jun 20 05:10:30 2018
(r335405)
+++ stable/11/lib/libdpv/dprompt.c  Wed Jun 20 05:45:41 2018
(r335406)
@@ -89,7 +89,7 @@ spin_char(void)
 {
char ch;
 
-   if (spin_cp == '\0')
+   if (*spin_cp == '\0')
spin_cp = spin;
ch = *spin_cp;
 

Modified: stable/11/lib/libdpv/util.c
==
--- stable/11/lib/libdpv/util.c Wed Jun 20 05:10:30 2018(r335405)
+++ stable/11/lib/libdpv/util.c Wed Jun 20 05:45:41 2018(r335406)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2014 Devin Teske 
+ * Copyright (c) 2013-2018 Devin Teske 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -100,8 +100,7 @@ shell_spawn_pipecmd(const char *cmd, const char *label
posix_spawn_file_actions_addclose(&action, stdin_pipe[1]);
error = posix_spawnp(pid, shellcmd, &action,
(const posix_spawnattr_t *)NULL, shellcmd_argv, environ);
-   if (error != 0)
-   err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__);
+   if (error != 0) err(EXIT_FAILURE, "%s", shellcmd);
 
return stdin_pipe[1];
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335407 - stable/10/lib/libdpv

2018-06-19 Thread Devin Teske
Author: dteske
Date: Wed Jun 20 05:50:54 2018
New Revision: 335407
URL: https://svnweb.freebsd.org/changeset/base/335407

Log:
  dpv(3): MFC r330943, r335264
  
  r330943:
  Fix bad error messages from dpv(3)
  
  Before = dpv: <__func__>: posix_spawnp(3): No such file or directory
   After = dpv: : No such file or directory
  
  Most notably, show the 2nd argument being passed to posix_spawnp(3)
  so we know what path/cmd failed.
  
  Also, we don't need to have "posix_spawnp(3)" in the error message
  nor the function because that can [a] change and [b] traversed using
  a debugger if necessary.
  
  r335264:
  Fix comparison between pointer and char literal
  
  PR:   misc/204252
  Reported by:  David Binderman 
  Sponsored by: Smule, Inc.

Modified:
  stable/10/lib/libdpv/dialog_util.c
  stable/10/lib/libdpv/dprompt.c
  stable/10/lib/libdpv/util.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libdpv/dialog_util.c
==
--- stable/10/lib/libdpv/dialog_util.c  Wed Jun 20 05:45:41 2018
(r335406)
+++ stable/10/lib/libdpv/dialog_util.c  Wed Jun 20 05:50:54 2018
(r335407)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2014 Devin Teske 
+ * Copyright (c) 2013-2018 Devin Teske 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -328,8 +328,7 @@ dialog_spawn_gauge(char *init_prompt, pid_t *pid)
posix_spawn_file_actions_addclose(&action, stdin_pipe[1]);
error = posix_spawnp(pid, dialog, &action,
(const posix_spawnattr_t *)NULL, dargv, environ);
-   if (error != 0)
-   err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__);
+   if (error != 0) err(EXIT_FAILURE, "%s", dialog);
 
/* NB: Do not free(3) *dargv[], else SIGSEGV */
 

Modified: stable/10/lib/libdpv/dprompt.c
==
--- stable/10/lib/libdpv/dprompt.c  Wed Jun 20 05:45:41 2018
(r335406)
+++ stable/10/lib/libdpv/dprompt.c  Wed Jun 20 05:50:54 2018
(r335407)
@@ -89,7 +89,7 @@ spin_char(void)
 {
char ch;
 
-   if (spin_cp == '\0')
+   if (*spin_cp == '\0')
spin_cp = spin;
ch = *spin_cp;
 

Modified: stable/10/lib/libdpv/util.c
==
--- stable/10/lib/libdpv/util.c Wed Jun 20 05:45:41 2018(r335406)
+++ stable/10/lib/libdpv/util.c Wed Jun 20 05:50:54 2018(r335407)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2014 Devin Teske 
+ * Copyright (c) 2013-2018 Devin Teske 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -100,8 +100,7 @@ shell_spawn_pipecmd(const char *cmd, const char *label
posix_spawn_file_actions_addclose(&action, stdin_pipe[1]);
error = posix_spawnp(pid, shellcmd, &action,
(const posix_spawnattr_t *)NULL, shellcmd_argv, environ);
-   if (error != 0)
-   err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__);
+   if (error != 0) err(EXIT_FAILURE, "%s", shellcmd);
 
return stdin_pipe[1];
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335408 - in stable/11: lib/libdpv lib/libfigpar usr.bin/dpv usr.sbin/bsdconfig

2018-06-19 Thread Devin Teske
Author: dteske
Date: Wed Jun 20 06:11:51 2018
New Revision: 335408
URL: https://svnweb.freebsd.org/changeset/base/335408

Log:
  MFC r330878-r330879, r330939, r330948: Man-page updates
  
  r330878: Fix typo and lint/igor warnings
  r330879: Fix lint/igor warnings
  r330939: Use full month in dpv(3), figpar(3), and bsdconfig(8) manuals
  r330948: Bump copyright following recent changes
  
  Sponsored by: Smule, Inc.

Modified:
  stable/11/lib/libdpv/dpv.3
  stable/11/lib/libfigpar/figpar.3
  stable/11/usr.bin/dpv/dpv.1
  stable/11/usr.sbin/bsdconfig/bsdconfig.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libdpv/dpv.3
==
--- stable/11/lib/libdpv/dpv.3  Wed Jun 20 05:50:54 2018(r335407)
+++ stable/11/lib/libdpv/dpv.3  Wed Jun 20 06:11:51 2018(r335408)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2013-2016 Devin Teske
+.\" Copyright (c) 2013-2018 Devin Teske
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Jan 26, 2016
+.Dd March 13, 2018
 .Dt DPV 3
 .Os
 .Sh NAME
@@ -36,7 +36,8 @@
 .In dpv.h
 .Ft int
 .Fo dpv
-.Fa "struct dpv_config *config, struct dpv_file_node *file_list"
+.Fa "struct dpv_config *config"
+.Fa "struct dpv_file_node *file_list"
 .Fc
 .Ft void
 .Fo dpv_free
@@ -60,8 +61,7 @@ or
 The
 .Fn dpv
 .Fa config
-argument contains the following properties for configuring global display
-features:
+argument properties for configuring global display features:
 .Bd -literal -offset indent
 struct dpv_config {
 uint8_t  keep_tite; /* Cleaner exit for scripts */
@@ -113,11 +113,12 @@ member of the
 .Fn dpv
 .Fa config
 argument is a mask of bit fields indicating various processing options.
-Possible flags are as follows:
+Possible flags are:
 .Bl -tag -width DPV_NO_OVERRUN
 .It Dv DPV_TEST_MODE
 Enable test mode.
-In test mode, the
+In test mode,
+the
 .Fn action
 callback of the
 .Fa config
@@ -126,18 +127,21 @@ Appends
 .Dq [TEST MODE]
 to the status line
 .Po
-to override, set the
+to override,
+set the
 .Va status_format
 member of the
 .Fn dpv
 .Fa config
 argument;
-e.g., to
+for example,
+to
 .Dv DPV_STATUS_DEFAULT
 .Pc .
 .It Dv DPV_WIDE_MODE
 Enable wide mode.
-In wide mode, the length of the
+In wide mode,
+the length of the
 .Va aprompt
 and
 .Va pprompt
@@ -169,7 +173,8 @@ does not support color
 environment variable is ignored
 .Pc .
 .It Dv DPV_NO_OVERRUN
-When enabled, callbacks for the current
+When enabled,
+callbacks for the current
 .Vt dpv_file_node
 are terminated when
 .Fn action
@@ -189,7 +194,7 @@ argument to
 .Fn dpv
 is a pointer to a
 .Dq linked-list ,
-described as follows in
+described in
 .In dpv.h :
 .Bd -literal -offset indent
 struct dpv_file_node {
@@ -206,7 +211,8 @@ struct dpv_file_node {
 For each of the items in the
 .Fa file_list
 .Dq linked-list
-argument, the
+argument,
+the
 .Fn action
 callback member of the
 .Fn dpv
@@ -214,7 +220,7 @@ callback member of the
 argument is called.
 The
 .Fn action
-function should perform a
+function performs a
 .Dq nominal
 action on the file and return.
 The return value of
@@ -231,7 +237,7 @@ provides a reference to the current
 .Vt dpv_file_node
 being processed.
 .Fa out
-provides a file descriptor where the data should go.
+provides a file descriptor where the data goes.
 .Pp
 If the
 .Va output
@@ -244,7 +250,7 @@ the
 .Fa out
 file descriptor of
 .Fn action
-will be zero and should be ignored.
+will be zero and can be ignored.
 If
 .Fa output
 was set to DPV_OUTPUT_FILE,
@@ -257,14 +263,16 @@ was set to DPV_OUTPUT_SHELL,
 will be an open file descriptor to a pipe for a spawned shell program.
 When
 .Fa out
-is greater than zero, you should write any data you have read back to
+is greater than zero,
+write data that has been read back to
 .Fa out .
 .Pp
 To abort
 .Fn dpv ,
 either from the
 .Fn action
-callback or asynchronously from a signal handler, two globals are provided via
+callback or asynchronously from a signal handler,
+two globals are provided via
 .In dpv.h :
 .Bd -literal -offset indent
 extern int dpv_interrupt; /* Set to TRUE in interrupt handler */
@@ -272,11 +280,12 @@ extern int dpv_abort; /* Set to true in callback t
 .Ed
 .Pp
 These globals are not automatically reset and must be manually maintained.
-Don't forget to reset these globals before subsequent invocations of
+Do not forget to reset these globals before subsequent invocations of
 .Fn dpv
 when making multiple calls from the same program.
 .Pp
-In addition, the
+In addition,
+the
 .Va status
 member of the
 .Fn action
@@ -284,7 +293,7 @@ member of the
 argument can be used to control callbacks for the current file.
 The
 .Va status
-member can be set to any of the following from
+member can be set to any of the below from
 .In dpv.h :
 .Bd -literal -offset indent
 enum dpv_status {
@@ -296,13 +305,17 @@ enum dp

Re: svn commit: r335402 - head/sbin/veriexecctl

2018-06-19 Thread Simon J. Gerraty
Conrad Meyer  wrote:
> First and foremost: nothing is actually signed, anywhere.  The

The signing of manifests is external.  The veriexecctl tool is I assume
a straight copy of what's in NetBSD (I've not looked at it in at least a
decade).

A veriexec loader that leverages signed manifests requires some signing
infra.  That's a big topic all by itself.

As I mentioned in my talk at BSDCan, the signing server we use is open
source and handles pretty much anything OpenSSL can, as well as OpenPGP
(and others).
I also made a point of suggesting that the packages for base system
include signed manifests.

Tweaking the veriexec loader to only process manifests after
verification is not hard - one of the first things I did when pulling
veriexec into Junos almost 15 years ago.

> As a corollary to the above, the name "signature file" is used
> repeatedly in the code, which is misleading.  The file contains hashes
> (digests), not signatures (MACs).  The file itself is unsigned.
> Nothing about this has signatures.

NetBSD refers to the hashes as fingerprints - AFAIK that terminology is
retained.

If the term signature is used to refer to anything other than the signed
manifests that should be fixed.

> There's absolutely no reason to use sha1 or ripemd in new designs.
> These should be removed.

Sorry I disagree - not with ripem (we never supported that or any of the
non-NIST approved hashes), but sha1 is still approved by NIST for
firmware integrity checks - which is what this is, and sha1 is cheaper
than sha256.

As I mentioned in my talk we've included support for sha256 for 10+
years, but do not plan to drop sha1 until NIST deprecate it for that
purpose since boot time is a very sensitive subject for us.

> The patchset is littered with style issues.  One fairly obvious issue
> is mixed indentation styles — some files vary between space and tab
> indentation from line to line.

You can probably blame me for some of that.
I only recently found a style9.el that does a half decent job of
formatting per style(9).

> Please revert this patchset.  It's not ready.
> 
> Some suggestions for a second attempt:
> 
> - Maybe use HMACs instead of raw hashes

Why?

> - Maybe sign the source-of-trust file

We do.  As noted above, we cannot upstream that until FreeBSD has
suitable signing infra.

> - Fix the style issues
> - Fix the compiler warnings at 6
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335409 - stable/11/usr.sbin/sysrc

2018-06-19 Thread Devin Teske
Author: dteske
Date: Wed Jun 20 06:24:03 2018
New Revision: 335409
URL: https://svnweb.freebsd.org/changeset/base/335409

Log:
  MFC r334303: sysrc(8): Test variable names for invalid characters
  
  PR:   bin/187461
  Reported by:  e...@looksharp.net
  Sponsored by: Smule, Inc.

Modified:
  stable/11/usr.sbin/sysrc/sysrc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/sysrc/sysrc
==
--- stable/11/usr.sbin/sysrc/sysrc  Wed Jun 20 06:11:51 2018
(r335408)
+++ stable/11/usr.sbin/sysrc/sysrc  Wed Jun 20 06:24:03 2018
(r335409)
@@ -370,6 +370,18 @@ if [ "$LIST_SERVICE_CONFS" ]; then
 fi
 
 #
+# Validate arguments
+#
+for name in "$@"; do
+   # NB: shell expansion syntax removed first
+   name="${name%%:[+=-]*}"
+   name="${name%%[%#+=-]*}"
+   [ "$name" = "${name#*[!$VALID_VARNAME_CHARS]}" ] || die \
+   "%s: %s: name contains characters not allowed in shell" \
+   "$pgm" "$name"
+done
+
+#
 # Process `-s name' argument
 #
 if [ "$SERVICE" -a ! "${RC_CONFS+set}" ]; then
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335410 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:34:31 2018
New Revision: 335410
URL: https://svnweb.freebsd.org/changeset/base/335410

Log:
  MFC r334481:
  Add more GFP macro definitions in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/gfp.hWed Jun 20 
06:24:03 2018(r335409)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/gfp.hWed Jun 20 
06:34:31 2018(r335410)
@@ -49,6 +49,9 @@
 #define__GFP_NORETRY   0
 #define__GFP_RECLAIM   0
 #define__GFP_RECLAIMABLE   0
+#define__GFP_RETRY_MAYFAIL 0
+#define__GFP_MOVABLE   0
+#define__GFP_COMP  0
 
 #define__GFP_IO0
 #define__GFP_NO_KSWAPD 0
@@ -56,6 +59,7 @@
 #define__GFP_DMA32 (1U << 24) /* LinuxKPI only */
 #define__GFP_BITS_SHIFT 25
 #define__GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
+#define__GFP_NOFAILM_WAITOK
 
 #defineGFP_NOWAIT  M_NOWAIT
 #defineGFP_ATOMIC  (M_NOWAIT | M_USE_RESERVE)
@@ -68,6 +72,7 @@
 #defineGFP_DMA32   __GFP_DMA32
 #defineGFP_TEMPORARY   M_NOWAIT
 #defineGFP_NATIVE_MASK (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_ZERO)
+#defineGFP_TRANSHUGE   0
 
 CTASSERT((__GFP_DMA32 & GFP_NATIVE_MASK) == 0);
 CTASSERT((__GFP_BITS_MASK & GFP_NATIVE_MASK) == GFP_NATIVE_MASK);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335411 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:35:37 2018
New Revision: 335411
URL: https://svnweb.freebsd.org/changeset/base/335411

Log:
  MFC r334482:
  Improve high resolution timer support in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/hrtimer.h
  stable/11/sys/compat/linuxkpi/common/src/linux_hrtimer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/hrtimer.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/hrtimer.hWed Jun 
20 06:34:31 2018(r335410)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/hrtimer.hWed Jun 
20 06:35:37 2018(r335411)
@@ -37,6 +37,7 @@
 
 enum hrtimer_mode {
HRTIMER_MODE_REL,
+   HRTIMER_MODE_REL_PINNED = HRTIMER_MODE_REL,
 };
 
 enum hrtimer_restart {
@@ -48,31 +49,42 @@ struct hrtimer {
enum hrtimer_restart (*function)(struct hrtimer *);
struct mtx mtx;
struct callout callout;
+   s64 expires;/* relative time in nanoseconds */
+   s64 precision;  /* in nanoseconds */
 };
 
 #definehrtimer_active(hrtimer) linux_hrtimer_active(hrtimer)
 #definehrtimer_cancel(hrtimer) linux_hrtimer_cancel(hrtimer)
+
 #definehrtimer_init(hrtimer, clock, mode) do { \
CTASSERT((clock) == CLOCK_MONOTONIC);   \
CTASSERT((mode) == HRTIMER_MODE_REL);   \
linux_hrtimer_init(hrtimer);\
 } while (0)
+
 #definehrtimer_set_expires(hrtimer, time)  \
linux_hrtimer_set_expires(hrtimer, time)
+
 #definehrtimer_start(hrtimer, time, mode) do { \
CTASSERT((mode) == HRTIMER_MODE_REL);   \
linux_hrtimer_start(hrtimer, time); \
 } while (0)
+
 #definehrtimer_start_range_ns(hrtimer, time, prec, mode) do {  \
CTASSERT((mode) == HRTIMER_MODE_REL);   \
linux_hrtimer_start_range_ns(hrtimer, time, prec);  \
 } while (0)
 
+#definehrtimer_forward_now(hrtimer, interval) do { \
+   linux_hrtimer_forward_now(hrtimer, interval);   \
+} while (0)
+
 bool   linux_hrtimer_active(struct hrtimer *);
 intlinux_hrtimer_cancel(struct hrtimer *);
 void   linux_hrtimer_init(struct hrtimer *);
 void   linux_hrtimer_set_expires(struct hrtimer *, ktime_t);
 void   linux_hrtimer_start(struct hrtimer *, ktime_t);
 void   linux_hrtimer_start_range_ns(struct hrtimer *, ktime_t, int64_t);
+void   linux_hrtimer_forward_now(struct hrtimer *, ktime_t);
 
 #endif /* _LINUX_HRTIMER_H_ */

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_hrtimer.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_hrtimer.cWed Jun 20 
06:34:31 2018(r335410)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_hrtimer.cWed Jun 20 
06:35:37 2018(r335411)
@@ -45,8 +45,13 @@ hrtimer_call_handler(void *arg)
 
hrtimer = arg;
ret = hrtimer->function(hrtimer);
-   MPASS(ret == HRTIMER_NORESTART);
-   callout_deactivate(&hrtimer->callout);
+
+   if (ret == HRTIMER_RESTART) {
+   callout_schedule_sbt(&hrtimer->callout,
+   nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0);
+   } else {
+   callout_deactivate(&hrtimer->callout);
+   }
 }
 
 bool
@@ -57,6 +62,7 @@ linux_hrtimer_active(struct hrtimer *hrtimer)
mtx_lock(&hrtimer->mtx);
ret = callout_active(&hrtimer->callout);
mtx_unlock(&hrtimer->mtx);
+
return (ret);
 }
 
@@ -75,15 +81,16 @@ void
 linux_hrtimer_init(struct hrtimer *hrtimer)
 {
 
-   hrtimer->function = NULL;
-   mtx_init(&hrtimer->mtx, "hrtimer", NULL, MTX_DEF | MTX_RECURSE);
+   memset(hrtimer, 0, sizeof(*hrtimer));
+   mtx_init(&hrtimer->mtx, "hrtimer", NULL,
+   MTX_DEF | MTX_RECURSE | MTX_NOWITNESS);
callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0);
 }
 
 void
-linux_hrtimer_set_expires(struct hrtimer *hrtimer __unused,
-ktime_t time __unused)
+linux_hrtimer_set_expires(struct hrtimer *hrtimer, ktime_t time)
 {
+   hrtimer->expires = ktime_to_ns(time);
 }
 
 void
@@ -94,11 +101,24 @@ linux_hrtimer_start(struct hrtimer *hrtimer, ktime_t t
 }
 
 void
-linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time, int64_t 
nsec)
+linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time,
+int64_t nsec)
 {
 
mtx_lock(&hrtimer->mtx);
-   callout_reset_sbt(&hrtimer->callout, nstosbt(time), nstosbt(nsec),
-   hrtimer_call_handler, hrtimer, 0);
+   hrtimer->precision = nsec;
+   c

svn commit: r335412 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:36:25 2018
New Revision: 335412
URL: https://svnweb.freebsd.org/changeset/base/335412

Log:
  MFC r334483:
  Implement radix_tree_iter_delete() in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/radix-tree.h
  stable/11/sys/compat/linuxkpi/common/src/linux_radix.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/radix-tree.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/radix-tree.h Wed Jun 
20 06:35:37 2018(r335411)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/radix-tree.h Wed Jun 
20 06:36:25 2018(r335412)
@@ -79,5 +79,6 @@ void  *radix_tree_lookup(struct radix_tree_root *, unsi
 void   *radix_tree_delete(struct radix_tree_root *, unsigned long);
 intradix_tree_insert(struct radix_tree_root *, unsigned long, void *);
 bool   radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter 
*, void ***);
+void   radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter 
*, void **);
 
 #endif /* _LINUX_RADIX_TREE_H_ */

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_radix.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_radix.c  Wed Jun 20 
06:35:37 2018(r335411)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_radix.c  Wed Jun 20 
06:36:25 2018(r335412)
@@ -162,6 +162,13 @@ out:
return (item);
 }
 
+void
+radix_tree_iter_delete(struct radix_tree_root *root,
+struct radix_tree_iter *iter, void **slot)
+{
+   radix_tree_delete(root, iter->index);
+}
+
 int
 radix_tree_insert(struct radix_tree_root *root, unsigned long index, void 
*item)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335413 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:37:15 2018
New Revision: 335413
URL: https://svnweb.freebsd.org/changeset/base/335413

Log:
  MFC r334484:
  Implement the __sg_alloc_table_from_pages() function based on the existing
  sg_alloc_table_from_pages() function in the LinuxKPI.
  
  This basically allow segments to have a limit, max_segment.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/scatterlist.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/scatterlist.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/scatterlist.hWed Jun 
20 06:36:25 2018(r335412)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/scatterlist.hWed Jun 
20 06:37:15 2018(r335413)
@@ -64,6 +64,8 @@ struct sg_page_iter {
} internal;
 };
 
+#defineSCATTERLIST_MAX_SEGMENT (-1U & ~(PAGE_SIZE - 1))
+
 #defineSG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
 
 #defineSG_MAGIC0x87654321UL
@@ -286,18 +288,26 @@ sg_alloc_table(struct sg_table *table, unsigned int ne
 }
 
 static inline int
-sg_alloc_table_from_pages(struct sg_table *sgt,
+__sg_alloc_table_from_pages(struct sg_table *sgt,
 struct page **pages, unsigned int count,
 unsigned long off, unsigned long size,
-gfp_t gfp_mask)
+unsigned int max_segment, gfp_t gfp_mask)
 {
-   unsigned int i, segs, cur;
+   unsigned int i, segs, cur, len;
int rc;
struct scatterlist *s;
 
+   if (__predict_false(!max_segment || offset_in_page(max_segment)))
+   return (-EINVAL);
+
+   len = 0;
for (segs = i = 1; i < count; ++i) {
-   if (page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1)
+   len += PAGE_SIZE;
+   if (len >= max_segment ||
+   page_to_pfn(pages[i]) != page_to_pfn(pages[i - 1]) + 1) {
++segs;
+   len = 0;
+   }
}
if (__predict_false((rc = sg_alloc_table(sgt, segs, gfp_mask
return (rc);
@@ -307,10 +317,13 @@ sg_alloc_table_from_pages(struct sg_table *sgt,
unsigned long seg_size;
unsigned int j;
 
-   for (j = cur + 1; j < count; ++j)
-   if (page_to_pfn(pages[j]) !=
+   len = 0;
+   for (j = cur + 1; j < count; ++j) {
+   len += PAGE_SIZE;
+   if (len >= max_segment || page_to_pfn(pages[j]) !=
page_to_pfn(pages[j - 1]) + 1)
break;
+   }
 
seg_size = ((j - cur) << PAGE_SHIFT) - off;
sg_set_page(s, pages[cur], min(size, seg_size), off);
@@ -321,6 +334,16 @@ sg_alloc_table_from_pages(struct sg_table *sgt,
return (0);
 }
 
+static inline int
+sg_alloc_table_from_pages(struct sg_table *sgt,
+struct page **pages, unsigned int count,
+unsigned long off, unsigned long size,
+gfp_t gfp_mask)
+{
+
+   return (__sg_alloc_table_from_pages(sgt, pages, count, off, size,
+   SCATTERLIST_MAX_SEGMENT, gfp_mask));
+}
 
 static inline int
 sg_nents(struct scatterlist *sg)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335414 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:38:03 2018
New Revision: 335414
URL: https://svnweb.freebsd.org/changeset/base/335414

Log:
  MFC r334658:
  Implement timer_setup() and from_timer() function macros in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/timer.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/timer.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/timer.h  Wed Jun 20 
06:37:15 2018(r335413)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/timer.h  Wed Jun 20 
06:38:03 2018(r335414)
@@ -39,7 +39,10 @@
 
 struct timer_list {
struct callout callout;
-   void(*function) (unsigned long);
+   union {
+   void (*function) (unsigned long);   /* < v4.15 */
+   void (*function_415) (struct timer_list *);
+   };
unsigned long data;
int expires;
 };
@@ -47,6 +50,16 @@ struct timer_list {
 extern unsigned long linux_timer_hz_mask;
 
 #defineTIMER_IRQSAFE   0x0001
+
+#definefrom_timer(var, arg, field) 
\
+container_of(arg, typeof(*(var)), field)
+
+#definetimer_setup(timer, func, flags) do {
\
+   CTASSERT(((flags) & ~TIMER_IRQSAFE) == 0);  \
+   (timer)->function_415 = (func); \
+   (timer)->data = (unsigned long)(timer); \
+   callout_init(&(timer)->callout, 1); \
+} while (0)
 
 #definesetup_timer(timer, func, dat) do {  
\
(timer)->function = (func); \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335415 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:38:46 2018
New Revision: 335415
URL: https://svnweb.freebsd.org/changeset/base/335415

Log:
  MFC r334659:
  Implement mul_u32_u32() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/math64.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/math64.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/math64.h Wed Jun 20 
06:38:03 2018(r335414)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/math64.h Wed Jun 20 
06:38:46 2018(r335415)
@@ -84,4 +84,11 @@ div_u64(uint64_t dividend, uint32_t divisor)
return (dividend / divisor);
 }
 
+static inline uint64_t
+mul_u32_u32(uint32_t a, uint32_t b)
+{
+
+   return ((uint64_t)a * b);
+}
+
 #endif /* _LINUX_MATH64_H */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335416 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:39:32 2018
New Revision: 335416
URL: https://svnweb.freebsd.org/changeset/base/335416

Log:
  MFC r334660:
  Add "access" function pointer to the "vm_operations_struct" structure
  in the LinuxKPI. While at it document when to use the "virtual_address" or
  the "address" field in the "vm_fault" structure.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/mm.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/mm.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Wed Jun 20 
06:38:46 2018(r335415)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/mm.h Wed Jun 20 
06:39:32 2018(r335416)
@@ -120,8 +120,8 @@ struct vm_fault {
pgoff_t pgoff;
union {
/* user-space address */
-   void *virtual_address;
-   unsigned long address;
+   void *virtual_address;  /* < 4.11 */
+   unsigned long address;  /* >= 4.11 */
};
struct page *page;
struct vm_area_struct *vma;
@@ -131,6 +131,7 @@ struct vm_operations_struct {
void(*open) (struct vm_area_struct *);
void(*close) (struct vm_area_struct *);
int (*fault) (struct vm_area_struct *, struct vm_fault *);
+   int (*access) (struct vm_area_struct *, unsigned long, void *, int, 
int);
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335417 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:40:19 2018
New Revision: 335417
URL: https://svnweb.freebsd.org/changeset/base/335417

Log:
  MFC r334661:
  Implement the task_pid_vnr() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/sched.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/sched.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/sched.h  Wed Jun 20 
06:39:32 2018(r335416)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/sched.h  Wed Jun 20 
06:40:19 2018(r335417)
@@ -89,6 +89,7 @@ struct task_struct {
 #definetask_pid_group_leader(task) (task)->task_thread->td_proc->p_pid
 #definetask_pid(task)  ((task)->pid)
 #definetask_pid_nr(task)   ((task)->pid)
+#definetask_pid_vnr(task)  ((task)->pid)
 #defineget_pid(x)  (x)
 #defineput_pid(x)  do { } while (0)
 #definecurrent_euid()  (curthread->td_ucred->cr_uid)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335418 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:41:15 2018
New Revision: 335418
URL: https://svnweb.freebsd.org/changeset/base/335418

Log:
  MFC r334663:
  Implement the INIT_DELAYED_WORK_ONSTACK() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h  Wed Jun 
20 06:40:19 2018(r335417)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h  Wed Jun 
20 06:41:15 2018(r335418)
@@ -117,6 +117,9 @@ do {
\
 #defineINIT_DELAYED_WORK(dwork, fn) \
linux_init_delayed_work(dwork, fn)
 
+#defineINIT_DELAYED_WORK_ONSTACK(dwork, fn) \
+   linux_init_delayed_work(dwork, fn)
+
 #defineINIT_DEFERRABLE_WORK(dwork, fn) \
INIT_DELAYED_WORK(dwork, fn)
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335419 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:42:04 2018
New Revision: 335419
URL: https://svnweb.freebsd.org/changeset/base/335419

Log:
  MFC r334664:
  Declare and set the global "system_highpri_wq" workqueue structure pointer
  in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h
  stable/11/sys/compat/linuxkpi/common/src/linux_work.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h  Wed Jun 
20 06:41:15 2018(r335418)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/workqueue.h  Wed Jun 
20 06:42:04 2018(r335419)
@@ -214,6 +214,7 @@ do {
\
 extern struct workqueue_struct *system_wq;
 extern struct workqueue_struct *system_long_wq;
 extern struct workqueue_struct *system_unbound_wq;
+extern struct workqueue_struct *system_highpri_wq;
 extern struct workqueue_struct *system_power_efficient_wq;
 
 extern void linux_init_delayed_work(struct delayed_work *, work_func_t);

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_work.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_work.c   Wed Jun 20 
06:41:15 2018(r335418)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_work.c   Wed Jun 20 
06:42:04 2018(r335419)
@@ -55,6 +55,7 @@ static struct workqueue_struct *linux_system_long_wq;
 struct workqueue_struct *system_wq;
 struct workqueue_struct *system_long_wq;
 struct workqueue_struct *system_unbound_wq;
+struct workqueue_struct *system_highpri_wq;
 struct workqueue_struct *system_power_efficient_wq;
 
 static int linux_default_wq_cpus = 4;
@@ -598,6 +599,7 @@ linux_work_init(void *arg)
system_wq = linux_system_short_wq;
system_power_efficient_wq = linux_system_short_wq;
system_unbound_wq = linux_system_short_wq;
+   system_highpri_wq = linux_system_short_wq;
 }
 SYSINIT(linux_work_init, SI_SUB_TASKQ, SI_ORDER_THIRD, linux_work_init, NULL);
 
@@ -612,5 +614,6 @@ linux_work_uninit(void *arg)
system_wq = NULL;
system_power_efficient_wq = NULL;
system_unbound_wq = NULL;
+   system_highpri_wq = NULL;
 }
 SYSUNINIT(linux_work_uninit, SI_SUB_TASKQ, SI_ORDER_THIRD, linux_work_uninit, 
NULL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335420 - stable/11/sys/compat/linuxkpi/common/include/asm

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:42:51 2018
New Revision: 335420
URL: https://svnweb.freebsd.org/changeset/base/335420

Log:
  MFC r334710:
  Implement the rdmsrl_safe() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/asm/msr.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/asm/msr.h
==
--- stable/11/sys/compat/linuxkpi/common/include/asm/msr.h  Wed Jun 20 
06:42:04 2018(r335419)
+++ stable/11/sys/compat/linuxkpi/common/include/asm/msr.h  Wed Jun 20 
06:42:51 2018(r335420)
@@ -32,5 +32,6 @@
 #include 
 
 #definerdmsrl(msr, val)((val) = rdmsr(msr))
+#definerdmsrl_safe(msr, val)   rdmsr_safe(msr, val)
 
 #endif /* _ASM_MSR_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335421 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:43:41 2018
New Revision: 335421
URL: https://svnweb.freebsd.org/changeset/base/335421

Log:
  MFC r334711:
  Implement the ktime_compare() and ktime_after() functions in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h  Wed Jun 20 
06:42:51 2018(r335420)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h  Wed Jun 20 
06:43:41 2018(r335421)
@@ -127,6 +127,25 @@ ktime_add(ktime_t lhs, ktime_t rhs)
return (lhs + rhs);
 }
 
+static inline int
+ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
+{
+
+   if (cmp1 > cmp2)
+   return (1);
+   else if (cmp1 < cmp2)
+   return (-1);
+   else
+   return (0);
+}
+
+static inline bool
+ktime_after(const ktime_t cmp1, const ktime_t cmp2)
+{
+
+   return (ktime_compare(cmp1, cmp2) > 0);
+}
+
 static inline ktime_t
 timespec_to_ktime(struct timespec ts)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335422 - stable/11/sys/compat/linuxkpi/common/include/asm

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:46:54 2018
New Revision: 335422
URL: https://svnweb.freebsd.org/changeset/base/335422

Log:
  MFC r334712 and r334718:
  Implement the atomic_dec_if_positive() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h
==
--- stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h   Wed Jun 20 
06:43:41 2018(r335421)
+++ stable/11/sys/compat/linuxkpi/common/include/asm/atomic.h   Wed Jun 20 
06:46:54 2018(r335422)
@@ -235,6 +235,23 @@ atomic_cmpxchg(atomic_t *v, int old, int new)
__ret.val;  \
 })
 
+static inline int
+atomic_dec_if_positive(atomic_t *v)
+{
+   int retval;
+   int old;
+
+   old = atomic_read(v);
+   for (;;) {
+   retval = old - 1;
+   if (unlikely(retval < 0))
+   break;
+   if (likely(atomic_fcmpset_int(&v->counter, &old, retval)))
+   break;
+   }
+   return (retval);
+}
+
 #defineLINUX_ATOMIC_OP(op, c_op)   \
 static inline void atomic_##op(int i, atomic_t *v) \
 {  \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335423 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:47:49 2018
New Revision: 335423
URL: https://svnweb.freebsd.org/changeset/base/335423

Log:
  MFC r334713:
  Implement the init_wait_entry() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
  stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:46:54 2018(r335422)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:47:49 2018(r335423)
@@ -106,8 +106,11 @@ extern wait_queue_func_t default_wake_function;
INIT_LIST_HEAD(&(wqh)->task_list);  \
 } while (0)
 
+void linux_init_wait_entry(wait_queue_t *, int);
 void linux_wake_up(wait_queue_head_t *, unsigned int, int, bool);
 
+#defineinit_wait_entry(wq, flags)  
\
+linux_init_wait_entry(wq, flags)
 #definewake_up(wqh)
\
linux_wake_up(wqh, TASK_NORMAL, 1, false)
 #definewake_up_all(wqh)
\

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Wed Jun 20 
06:46:54 2018(r335422)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Wed Jun 20 
06:47:49 2018(r335423)
@@ -188,6 +188,17 @@ default_wake_function(wait_queue_t *wq, unsigned int s
 }
 
 void
+linux_init_wait_entry(wait_queue_t *wq, int flags)
+{
+
+   memset(wq, 0, sizeof(*wq));
+   wq->flags = flags;
+   wq->private = current;
+   wq->func = autoremove_wake_function;
+   INIT_LIST_HEAD(&wq->task_list);
+}
+
+void
 linux_wake_up(wait_queue_head_t *wqh, unsigned int state, int nr, bool locked)
 {
wait_queue_t *pos, *next;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335424 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:48:41 2018
New Revision: 335424
URL: https://svnweb.freebsd.org/changeset/base/335424

Log:
  MFC r334714:
  Rename two structure field members while keeping backwards compatibility in
  the LinuxKPI. Add a comment saying in which Linux version this change was 
made.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:47:49 2018(r335423)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:48:41 2018(r335424)
@@ -63,12 +63,18 @@ struct wait_queue {
unsigned int flags; /* always 0 */
void *private;
wait_queue_func_t *func;
-   struct list_head task_list;
+   union {
+   struct list_head task_list; /* < v4.13 */
+   struct list_head entry; /* >= v4.13 */
+   };
 };
 
 struct wait_queue_head {
spinlock_t lock;
-   struct list_head task_list;
+   union {
+   struct list_head task_list; /* < v4.13 */
+   struct list_head head; /* >= v4.13 */
+   };
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335425 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:49:26 2018
New Revision: 335425
URL: https://svnweb.freebsd.org/changeset/base/335425

Log:
  MFC r334715:
  Implement the might_sleep_if() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:48:41 2018(r335424)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:49:26 2018(r335425)
@@ -47,6 +47,10 @@
 #definemight_sleep()   
\
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "might_sleep()")
 
+#definemight_sleep_if(cond) do { \
+   if (cond) { might_sleep(); } \
+} while (0)
+
 struct wait_queue;
 struct wait_queue_head;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335427 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:50:56 2018
New Revision: 335427
URL: https://svnweb.freebsd.org/changeset/base/335427

Log:
  MFC r334720:
  Make some list functions RCU safe in the LinuxKPI.
  While at it rename hlist_add_after() into hlist_add_behind().
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/list.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/list.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/list.h   Wed Jun 20 
06:50:11 2018(r335426)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/list.h   Wed Jun 20 
06:50:56 2018(r335427)
@@ -337,16 +337,16 @@ static inline int
 hlist_empty(const struct hlist_head *h)
 {
 
-   return !h->first;
+   return !READ_ONCE(h->first);
 }
 
 static inline void
 hlist_del(struct hlist_node *n)
 {
 
-   if (n->next)
+   WRITE_ONCE(*(n->pprev), n->next);
+   if (n->next != NULL)
n->next->pprev = n->pprev;
-   *n->pprev = n->next;
 }
 
 static inline void
@@ -364,9 +364,9 @@ hlist_add_head(struct hlist_node *n, struct hlist_head
 {
 
n->next = h->first;
-   if (h->first)
+   if (h->first != NULL)
h->first->pprev = &n->next;
-   h->first = n;
+   WRITE_ONCE(h->first, n);
n->pprev = &h->first;
 }
 
@@ -377,18 +377,19 @@ hlist_add_before(struct hlist_node *n, struct hlist_no
n->pprev = next->pprev;
n->next = next;
next->pprev = &n->next;
-   *(n->pprev) = n;
+   WRITE_ONCE(*(n->pprev), n);
 }
 
 static inline void
-hlist_add_after(struct hlist_node *n, struct hlist_node *next)
+hlist_add_behind(struct hlist_node *n, struct hlist_node *prev)
 {
 
-   next->next = n->next;
-   n->next = next;
-   next->pprev = &n->next;
-   if (next->next)
-   next->next->pprev = &next->next;
+   n->next = prev->next;
+   WRITE_ONCE(prev->next, n);
+   n->pprev = &prev->next;
+
+   if (n->next != NULL)
+   n->next->pprev = &n->next;
 }
 
 static inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335426 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:50:11 2018
New Revision: 335426
URL: https://svnweb.freebsd.org/changeset/base/335426

Log:
  MFC r334717:
  Implement the __add_wait_queue_entry_tail() function in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:49:26 2018(r335425)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/wait.h   Wed Jun 20 
06:50:11 2018(r335426)
@@ -54,7 +54,10 @@
 struct wait_queue;
 struct wait_queue_head;
 
+#definewait_queue_entry wait_queue
+
 typedef struct wait_queue wait_queue_t;
+typedef struct wait_queue_entry wait_queue_entry_t;
 typedef struct wait_queue_head wait_queue_head_t;
 
 typedef int wait_queue_func_t(wait_queue_t *, unsigned int, int, void *);
@@ -246,6 +249,12 @@ static inline void
 __add_wait_queue_tail(wait_queue_head_t *wqh, wait_queue_t *wq)
 {
list_add_tail(&wq->task_list, &wqh->task_list);
+}
+
+static inline void
+__add_wait_queue_entry_tail(wait_queue_head_t *wqh, wait_queue_entry_t *wq)
+{
+list_add_tail(&wq->entry, &wqh->head);
 }
 
 static inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335428 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:51:41 2018
New Revision: 335428
URL: https://svnweb.freebsd.org/changeset/base/335428

Log:
  MFC r334774:
  Implement the dev_pm_set_driver_flags() function macro in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/device.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/device.h Wed Jun 20 
06:50:56 2018(r335427)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/device.h Wed Jun 20 
06:51:41 2018(r335428)
@@ -461,6 +461,9 @@ device_destroy(struct class *class, dev_t devt)
device_unregister(device_get_softc(bsddev));
 }
 
+#definedev_pm_set_driver_flags(dev, flags) do { \
+} while (0)
+
 static inline void
 linux_class_kfree(struct class *class)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335429 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:52:32 2018
New Revision: 335429
URL: https://svnweb.freebsd.org/changeset/base/335429

Log:
  MFC r334777:
  Wrap timespec64 into timespec in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h
  stable/11/sys/compat/linuxkpi/common/include/linux/time.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h  Wed Jun 20 
06:51:41 2018(r335428)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/ktime.h  Wed Jun 20 
06:52:32 2018(r335429)
@@ -159,6 +159,7 @@ timeval_to_ktime(struct timeval tv)
 }
 
 #definektime_to_timespec(kt)   ns_to_timespec(kt)
+#definektime_to_timespec64(kt) ns_to_timespec(kt)
 #definektime_to_timeval(kt)ns_to_timeval(kt)
 #definektime_to_ns(kt) (kt)
 

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/time.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/time.h   Wed Jun 20 
06:51:41 2018(r335428)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/time.h   Wed Jun 20 
06:52:32 2018(r335429)
@@ -35,6 +35,8 @@
 #defineUSEC_PER_MSEC   1000L
 #defineUSEC_PER_SEC100L
 
+#definetimespec64 timespec
+
 #include 
 #include 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335430 - head/sys/security/mac_veriexec

2018-06-19 Thread Stephen J. Kiernan
Author: stevek
Date: Wed Jun 20 06:54:38 2018
New Revision: 335430
URL: https://svnweb.freebsd.org/changeset/base/335430

Log:
  Fix build breakage in veriexec for 32-bit architectures.
  
  fsid_t and ino_t are 64-bit entities, use uintmax_t typecast to ensure we
  can print it on 32-bit or 64-bit architectures by using the %ju format for
  prints.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/security/mac_veriexec/veriexec_fingerprint.c
  head/sys/security/mac_veriexec/veriexec_metadata.c

Modified: head/sys/security/mac_veriexec/veriexec_fingerprint.c
==
--- head/sys/security/mac_veriexec/veriexec_fingerprint.c   Wed Jun 20 
06:52:32 2018(r335429)
+++ head/sys/security/mac_veriexec/veriexec_fingerprint.c   Wed Jun 20 
06:54:38 2018(r335430)
@@ -108,11 +108,12 @@ identify_error (struct image_params *imgp, struct thre
gppid = (parent != NULL && parent->p_pptr != NULL) ?
parent->p_pptr->p_pid : 0;
 
-   log(LOG_ERR, MAC_VERIEXEC_FULLNAME ": %s (file=%s fsid=%lu fileid=%lu "
+   log(LOG_ERR, MAC_VERIEXEC_FULLNAME ": %s (file=%s fsid=%ju fileid=%ju "
"gen=%lu uid=%u pid=%u ppid=%u gppid=%u)", msg,
(imgp->args != NULL) ? imgp->args->fname : "",
-   imgp->attr->va_fsid, imgp->attr->va_fileid, imgp->attr->va_gen,
-   td->td_ucred->cr_ruid, imgp->proc->p_pid, ppid, gppid);
+   (uintmax_t)imgp->attr->va_fsid, (uintmax_t)imgp->attr->va_fileid,
+   imgp->attr->va_gen, td->td_ucred->cr_ruid, imgp->proc->p_pid,
+   ppid, gppid);
 }
 
 /**
@@ -217,8 +218,9 @@ mac_veriexec_fingerprint_check_vnode(struct vnode *vp,
return (ETXTBSY);
 
if ((vp->v_mount->mnt_flag & MNT_VERIFIED) != 0) {
-   VERIEXEC_DEBUG(2, ("file %lu.%lu on verified %s mount\n",
-   ip->fileid, ip->gen, vp->v_mount->mnt_vfc->vfc_name));
+   VERIEXEC_DEBUG(2, ("file %ju.%lu on verified %s mount\n",
+   (uintmax_t)ip->fileid, ip->gen,
+   vp->v_mount->mnt_vfc->vfc_name));
 
/*
 * The VFS is backed by a file which has been verified.

Modified: head/sys/security/mac_veriexec/veriexec_metadata.c
==
--- head/sys/security/mac_veriexec/veriexec_metadata.c  Wed Jun 20 06:52:32 
2018(r335429)
+++ head/sys/security/mac_veriexec/veriexec_metadata.c  Wed Jun 20 06:54:38 
2018(r335430)
@@ -110,8 +110,8 @@ get_veriexec_file(struct veriexec_devhead *head, dev_t
if (found_dev != NULL)
*found_dev = 0;
 
-   VERIEXEC_DEBUG(3, ("searching for file %lu.%lu on device %lu,"
-   " files=%d\n", fileid, gen, (unsigned long)fsid,
+   VERIEXEC_DEBUG(3, ("searching for file %ju.%lu on device %ju,"
+   " files=%d\n", (uintmax_t)fileid, gen, (uintmax_t)fsid,
(head == &veriexec_file_dev_head)));
 
/* Get a lock to access the list */
@@ -124,8 +124,8 @@ get_veriexec_file(struct veriexec_devhead *head, dev_t
 
/* We found the file system in the list */
if (lp != NULL) {
-   VERIEXEC_DEBUG(3, ("found matching dev number %lu\n",
-   lp->fsid));
+   VERIEXEC_DEBUG(3, ("found matching dev number %ju\n",
+   (uintmax_t)lp->fsid));
 
/* If found_dev is non-NULL, store true there */
if (found_dev != NULL)
@@ -182,8 +182,8 @@ find_veriexec_file(dev_t fsid, long fileid, unsigned l
}
search[2] = NULL;
 
-   VERIEXEC_DEBUG(3, ("%s: searching for dev %lu, file %lu\n",
-   __func__, fsid, fileid));
+   VERIEXEC_DEBUG(3, ("%s: searching for dev %ju, file %lu\n",
+   __func__, (uintmax_t)fsid, fileid));
 
/* Search for the specified file */
for (ip = NULL, x = 0; ip == NULL && search[x]; x++)
@@ -226,7 +226,7 @@ mac_veriexec_print_db_head(struct sbuf *sbp, struct ve
struct veriexec_dev_list *lp;
 
for (lp = LIST_FIRST(head); lp != NULL; lp = LIST_NEXT(lp, entries)) {
-   sbuf_printf(sbp, " FS id: %lu\n", lp->fsid);
+   sbuf_printf(sbp, " FS id: %ju\n", (uintmax_t)lp->fsid);
mac_veriexec_print_db_dev_list(sbp, lp);
}
 
@@ -524,9 +524,9 @@ mac_veriexec_metadata_fetch_fingerprint_status(struct 
status = (found_dev) ? FINGERPRINT_NOENTRY :
FINGERPRINT_NODEV;
VERIEXEC_DEBUG(3,
-   ("fingerprint status is %d for dev %lu, file "
-   "%lu.%lu\n", status, vap->va_fsid, vap->va_fileid,
-   vap->va_gen));
+   ("fingerprint status is %d for dev %ju, file "
+   "%ju.%lu\n", status, (uintmax_t)vap->va_fsid,

svn commit: r335431 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:56:18 2018
New Revision: 335431
URL: https://svnweb.freebsd.org/changeset/base/335431

Log:
  MFC r334778:
  Define ARCH_KMALLOC_MINALIGN in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Wed Jun 20 
06:54:38 2018(r335430)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Wed Jun 20 
06:56:18 2018(r335431)
@@ -85,6 +85,9 @@ struct linux_kmem_cache {
 #defineSLAB_DESTROY_BY_RCU \
SLAB_TYPESAFE_BY_RCU
 
+#defineARCH_KMALLOC_MINALIGN \
+   __alignof(unsigned long long)
+
 static inline gfp_t
 linux_check_m_flags(gfp_t flags)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335432 - stable/11/sys/compat/linuxkpi/common/include/asm

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:57:14 2018
New Revision: 335432
URL: https://svnweb.freebsd.org/changeset/base/335432

Log:
  MFC r334953:
  Implement the user_access_begin(), user_access_end(), usafe_get_user() and
  unsafe_put_user() function macros in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/asm/uaccess.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/asm/uaccess.h
==
--- stable/11/sys/compat/linuxkpi/common/include/asm/uaccess.h  Wed Jun 20 
06:56:18 2018(r335431)
+++ stable/11/sys/compat/linuxkpi/common/include/asm/uaccess.h  Wed Jun 20 
06:57:14 2018(r335432)
@@ -52,4 +52,17 @@ copy_from_user(void *to, const void *from, unsigned lo
 #define__copy_from_user(...)   copy_from_user(__VA_ARGS__)
 #define__copy_in_user(...) copy_from_user(__VA_ARGS__)
 
+#defineuser_access_begin() do { } while (0)
+#defineuser_access_end() do { } while (0)
+
+#defineunsafe_get_user(x, ptr, err) do { \
+   if (unlikely(__get_user(x, ptr))) \
+   goto err; \
+} while (0)
+
+#defineunsafe_put_user(x, ptr, err) do { \
+   if (unlikely(__put_user(x, ptr))) \
+   goto err; \
+} while (0)
+
 #endif /* _ASM_UACCESS_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335433 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:57:59 2018
New Revision: 335433
URL: https://svnweb.freebsd.org/changeset/base/335433

Log:
  MFC r334958:
  Implement the kstrtobool() and kstrtobool_from_user() functions
  in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Wed Jun 20 
06:57:14 2018(r335432)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/kernel.h Wed Jun 20 
06:57:59 2018(r335433)
@@ -50,7 +50,9 @@
 #include 
 #include 
 #include 
+
 #include 
+#include 
 
 #include 
 
@@ -370,6 +372,46 @@ kstrtou32(const char *cp, unsigned int base, u32 *res)
if (temp != (u32)temp)
return (-ERANGE);
return (0);
+}
+
+static inline int
+kstrtobool(const char *s, bool *res)
+{
+   int len;
+
+   if (s == NULL || (len = strlen(s)) == 0 || res == NULL)
+   return (-EINVAL);
+
+   /* skip newline character, if any */
+   if (s[len - 1] == '\n')
+   len--;
+
+   if (len == 1 && strchr("yY1", s[0]) != NULL)
+   *res = true;
+   else if (len == 1 && strchr("nN0", s[0]) != NULL)
+   *res = false;
+   else if (strncasecmp("on", s, len) == 0)
+   *res = true;
+   else if (strncasecmp("off", s, len) == 0)
+   *res = false;
+   else
+   return (-EINVAL);
+
+   return (0);
+}
+
+static inline int
+kstrtobool_from_user(const char __user *s, size_t count, bool *res)
+{
+   char buf[8] = {};
+
+   if (count > (sizeof(buf) - 1))
+   count = (sizeof(buf) - 1);
+
+   if (copy_from_user(buf, s, count))
+   return (-EFAULT);
+
+   return (kstrtobool(buf, res));
 }
 
 #define min(x, y)  ((x) < (y) ? (x) : (y))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335434 - stable/11/sys/compat/linuxkpi/common/include/linux

2018-06-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jun 20 06:58:51 2018
New Revision: 335434
URL: https://svnweb.freebsd.org/changeset/base/335434

Log:
  MFC r334662:
  Define the __kernel_size_t type in the LinuxKPI.
  
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/types.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/types.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/types.h  Wed Jun 20 
06:57:59 2018(r335433)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/types.h  Wed Jun 20 
06:58:51 2018(r335434)
@@ -62,6 +62,8 @@ typedef unsigned long pgoff_t;
 
 typedef u64 phys_addr_t;
 
+typedef size_t __kernel_size_t;
+
 #defineDECLARE_BITMAP(n, bits) 
\
unsigned long n[howmany(bits, sizeof(long) * 8)]
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"