From dd9d62b416761b3d7f6d5b701c19195a0d99c46f Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 11 Jan 2017 21:18:14 +0000 Subject: [PATCH 001/126] readelf: add PPC64 relocation types Reported by: Mark Millard MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9146 --- .../libelftc/elftc_reloc_type_str.c | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c index 19b23ad52904..0fa14fe04eda 100644 --- a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c +++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c @@ -501,6 +501,114 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type) case 116: return "R_PPC_EMB_RELSDA"; } break; + case EM_PPC64: + switch(type) { + case 0: return "R_PPC64_NONE"; + case 1: return "R_PPC64_ADDR32"; + case 2: return "R_PPC64_ADDR24"; + case 3: return "R_PPC64_ADDR16"; + case 4: return "R_PPC64_ADDR16_LO"; + case 5: return "R_PPC64_ADDR16_HI"; + case 6: return "R_PPC64_ADDR16_HA"; + case 7: return "R_PPC64_ADDR14"; + case 8: return "R_PPC64_ADDR14_BRTAKEN"; + case 9: return "R_PPC64_ADDR14_BRNTAKEN"; + case 10: return "R_PPC64_REL24"; + case 11: return "R_PPC64_REL14"; + case 12: return "R_PPC64_REL14_BRTAKEN"; + case 13: return "R_PPC64_REL14_BRNTAKEN"; + case 14: return "R_PPC64_GOT16"; + case 15: return "R_PPC64_GOT16_LO"; + case 16: return "R_PPC64_GOT16_HI"; + case 17: return "R_PPC64_GOT16_HA"; + case 19: return "R_PPC64_COPY"; + case 20: return "R_PPC64_GLOB_DAT"; + case 21: return "R_PPC64_JMP_SLOT"; + case 22: return "R_PPC64_RELATIVE"; + case 24: return "R_PPC64_UADDR32"; + case 25: return "R_PPC64_UADDR16"; + case 26: return "R_PPC64_REL32"; + case 27: return "R_PPC64_PLT32"; + case 28: return "R_PPC64_PLTREL32"; + case 29: return "R_PPC64_PLT16_LO"; + case 30: return "R_PPC64_PLT16_HI"; + case 31: return "R_PPC64_PLT16_HA"; + case 33: return "R_PPC64_SECTOFF"; + case 34: return "R_PPC64_SECTOFF_LO"; + case 35: return "R_PPC64_SECTOFF_HI"; + case 36: return "R_PPC64_SECTOFF_HA"; + case 37: return "R_PPC64_ADDR30"; + case 38: return "R_PPC64_ADDR64"; + case 39: return "R_PPC64_ADDR16_HIGHER"; + case 40: return "R_PPC64_ADDR16_HIGHERA"; + case 41: return "R_PPC64_ADDR16_HIGHEST"; + case 42: return "R_PPC64_ADDR16_HIGHESTA"; + case 43: return "R_PPC64_UADDR64"; + case 44: return "R_PPC64_REL64"; + case 45: return "R_PPC64_PLT64"; + case 46: return "R_PPC64_PLTREL64"; + case 47: return "R_PPC64_TOC16"; + case 48: return "R_PPC64_TOC16_LO"; + case 49: return "R_PPC64_TOC16_HI"; + case 50: return "R_PPC64_TOC16_HA"; + case 51: return "R_PPC64_TOC"; + case 52: return "R_PPC64_PLTGOT16"; + case 53: return "R_PPC64_PLTGOT16_LO"; + case 54: return "R_PPC64_PLTGOT16_HI"; + case 55: return "R_PPC64_PLTGOT16_HA"; + case 56: return "R_PPC64_ADDR16_DS"; + case 57: return "R_PPC64_ADDR16_LO_DS"; + case 58: return "R_PPC64_GOT16_DS"; + case 59: return "R_PPC64_GOT16_LO_DS"; + case 60: return "R_PPC64_PLT16_LO_DS"; + case 61: return "R_PPC64_SECTOFF_DS"; + case 62: return "R_PPC64_SECTOFF_LO_DS"; + case 63: return "R_PPC64_TOC16_DS"; + case 64: return "R_PPC64_TOC16_LO_DS"; + case 65: return "R_PPC64_PLTGOT16_DS"; + case 66: return "R_PPC64_PLTGOT16_LO_DS"; + case 67: return "R_PPC64_TLS"; + case 68: return "R_PPC64_DTPMOD64"; + case 69: return "R_PPC64_TPREL16"; + case 70: return "R_PPC64_TPREL16_LO"; + case 71: return "R_PPC64_TPREL16_HI"; + case 72: return "R_PPC64_TPREL16_HA"; + case 73: return "R_PPC64_TPREL64"; + case 74: return "R_PPC64_DTPREL16"; + case 75: return "R_PPC64_DTPREL16_LO"; + case 76: return "R_PPC64_DTPREL16_HI"; + case 77: return "R_PPC64_DTPREL16_HA"; + case 78: return "R_PPC64_DTPREL64"; + case 79: return "R_PPC64_GOT_TLSGD16"; + case 80: return "R_PPC64_GOT_TLSGD16_LO"; + case 81: return "R_PPC64_GOT_TLSGD16_HI"; + case 82: return "R_PPC64_GOT_TLSGD16_HA"; + case 83: return "R_PPC64_GOT_TLSLD16"; + case 84: return "R_PPC64_GOT_TLSLD16_LO"; + case 85: return "R_PPC64_GOT_TLSLD16_HI"; + case 86: return "R_PPC64_GOT_TLSLD16_HA"; + case 87: return "R_PPC64_GOT_TPREL16_DS"; + case 88: return "R_PPC64_GOT_TPREL16_LO_DS"; + case 89: return "R_PPC64_GOT_TPREL16_HI"; + case 90: return "R_PPC64_GOT_TPREL16_HA"; + case 91: return "R_PPC64_GOT_DTPREL16_DS"; + case 92: return "R_PPC64_GOT_DTPREL16_LO_DS"; + case 93: return "R_PPC64_GOT_DTPREL16_HI"; + case 94: return "R_PPC64_GOT_DTPREL16_HA"; + case 95: return "R_PPC64_TPREL16_DS"; + case 96: return "R_PPC64_TPREL16_LO_DS"; + case 97: return "R_PPC64_TPREL16_HIGHER"; + case 98: return "R_PPC64_TPREL16_HIGHERA"; + case 99: return "R_PPC64_TPREL16_HIGHEST"; + case 100: return "R_PPC64_TPREL16_HIGHESTA"; + case 101: return "R_PPC64_DTPREL16_DS"; + case 102: return "R_PPC64_DTPREL16_LO_DS"; + case 103: return "R_PPC64_DTPREL16_HIGHER"; + case 104: return "R_PPC64_DTPREL16_HIGHERA"; + case 105: return "R_PPC64_DTPREL16_HIGHEST"; + case 106: return "R_PPC64_DTPREL16_HIGHESTA"; + } + break; case EM_RISCV: switch(type) { case 0: return "R_RISCV_NONE"; From 0fbbe5bf870f31ef2a6c7b18c655c532eca0cac5 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 11 Jan 2017 21:28:22 +0000 Subject: [PATCH 002/126] readelf: add more PPC64 relocation types found in LLVM MFC after: 2 weeks MFC with: r311941 Sponsored by: The FreeBSD Foundation --- contrib/elftoolchain/libelftc/elftc_reloc_type_str.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c index 0fa14fe04eda..14bcb534b06d 100644 --- a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c +++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c @@ -607,6 +607,12 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type) case 104: return "R_PPC64_DTPREL16_HIGHERA"; case 105: return "R_PPC64_DTPREL16_HIGHEST"; case 106: return "R_PPC64_DTPREL16_HIGHESTA"; + case 107: return "R_PPC64_TLSGD"; + case 108: return "R_PPC64_TLSLD"; + case 249: return "R_PPC64_REL16"; + case 250: return "R_PPC64_REL16_LO"; + case 251: return "R_PPC64_REL16_HI"; + case 252: return "R_PPC64_REL16_HA"; } break; case EM_RISCV: From bf4730f9772197c754d946a4663bd4629c51d508 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Wed, 11 Jan 2017 22:50:57 +0000 Subject: [PATCH 003/126] Remove obsolete path from fortune(6). This was inadvertantly left over when fortune and other games moved from /usr/games to /usr/bin; I am removing rather than correcting it since we normally do not mention in the FILES section the paths to programs in /usr/bin/. PR: 215962 Reported by: Andras Farkas --- usr.bin/fortune/fortune/fortune.6 | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.bin/fortune/fortune/fortune.6 b/usr.bin/fortune/fortune/fortune.6 index d8f6bad177d0..bc6e26e182a0 100644 --- a/usr.bin/fortune/fortune/fortune.6 +++ b/usr.bin/fortune/fortune/fortune.6 @@ -176,7 +176,6 @@ it was up to on disk. .El .Sh FILES .Bl -tag -width ".Pa /usr/share/games/fortune/*" -.It Pa /usr/games/fortune .It Pa /usr/share/games/fortune/* the fortunes databases (those files ending .Dq Pa -o From c83bcfbd2e03e720b2b641033c683f1c7aad8389 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 11 Jan 2017 22:54:04 +0000 Subject: [PATCH 004/126] readelf: add S390 relocation types From https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries.html Reviewed by: bz MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9149 --- .../libelftc/elftc_reloc_type_str.c | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c index 14bcb534b06d..fdad9a6448c6 100644 --- a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c +++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c @@ -664,6 +664,37 @@ elftc_reloc_type_str(unsigned int mach, unsigned int type) case 48: return "R_RISCV_GPREL_S"; } break; + case EM_S390: + switch (type) { + case 0: return "R_390_NONE"; + case 1: return "R_390_8"; + case 2: return "R_390_12"; + case 3: return "R_390_16"; + case 4: return "R_390_32"; + case 5: return "R_390_PC32"; + case 6: return "R_390_GOT12"; + case 7: return "R_390_GOT32"; + case 8: return "R_390_PLT32"; + case 9: return "R_390_COPY"; + case 10: return "R_390_GLOB_DAT"; + case 11: return "R_390_JMP_SLOT"; + case 12: return "R_390_RELATIVE"; + case 13: return "R_390_GOTOFF"; + case 14: return "R_390_GOTPC"; + case 15: return "R_390_GOT16"; + case 16: return "R_390_PC16"; + case 17: return "R_390_PC16DBL"; + case 18: return "R_390_PLT16DBL"; + case 19: return "R_390_PC32DBL"; + case 20: return "R_390_PLT32DBL"; + case 21: return "R_390_GOTPCDBL"; + case 22: return "R_390_64"; + case 23: return "R_390_PC64"; + case 24: return "R_390_GOT64"; + case 25: return "R_390_PLT64"; + case 26: return "R_390_GOTENT"; + } + break; case EM_SPARC: case EM_SPARCV9: switch(type) { From e9ed334fd27ec8c13c698c01828215b4d3626bce Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Wed, 11 Jan 2017 23:05:29 +0000 Subject: [PATCH 005/126] rpcgen(1): Avoid unused variable warning on generated code. Avoid "unused variable 'i'" warnings in generated .c files by only emitting the "int i;" for non-opaque arrays. Opaque arrays use xdr_opaque() rather than iterating over the array. Obtained from: OpenBSD (CVS rev 1.28) MFC after: 1 week --- usr.bin/rpcgen/rpc_cout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index 0c2ce2098b36..6e245bf6ca42 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -551,7 +551,8 @@ emit_struct(definition *def) } for (dl = def->def.st.decls; dl != NULL; dl = dl->next) - if (dl->decl.rel == REL_VECTOR){ + if (dl->decl.rel == REL_VECTOR && + strcmp(dl->decl.type, "opaque") != 0){ f_print(fout, "\tint i;\n"); break; } From bd99d5d4d8d0687d75379163a9c2e036df5f797a Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Wed, 11 Jan 2017 23:32:40 +0000 Subject: [PATCH 006/126] rtwn: fix R92C_TXDW4_RTSRATE_M definition (0x3f -> 0x1f) Submitted by: kevlo --- sys/dev/rtwn/rtl8192c/r92c_tx_desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h b/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h index 037ac0e2066f..c3bc87caa31f 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h +++ b/sys/dev/rtwn/rtl8192c/r92c_tx_desc.h @@ -68,7 +68,7 @@ struct r92c_tx_desc { uint16_t txdseq; uint32_t txdw4; -#define R92C_TXDW4_RTSRATE_M 0x0000003f +#define R92C_TXDW4_RTSRATE_M 0x0000001f #define R92C_TXDW4_RTSRATE_S 0 #define R92C_TXDW4_SEQ_SEL_M 0x00000040 #define R92C_TXDW4_SEQ_SEL_S 6 From a342904bb5a48c4b9538669774fd6f98fc6b4e0b Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Wed, 11 Jan 2017 23:48:17 +0000 Subject: [PATCH 007/126] cxgbe/tom: Add VIMAGE support to the TOE driver. Active Open: - Save the socket's vnet at the time of the active open (t4_connect) and switch to it when processing the reply (do_act_open_rpl or do_act_establish). Passive Open: - Save the listening socket's vnet in the driver's listen_ctx and switch to it when processing incoming SYNs for the socket. - Reject SYNs that arrive on an ifnet that's not in the same vnet as the listening socket. CLIP (Compressed Local IPv6) table: - Add only those IPv6 addresses to the CLIP that are in a vnet associated with one of the card's ifnets. Misc: - Set vnet from the toepcb when processing TCP state transitions. - The kernel sets the vnet when calling the driver's output routine so t4_push_frames runs in proper vnet context already. One exception is when incoming credits trigger tx within the driver's ithread. Set the vnet explicitly in do_fw4_ack for that case. MFC after: 3 days Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_connect.c | 5 ++ sys/dev/cxgbe/tom/t4_cpl_io.c | 19 ++++-- sys/dev/cxgbe/tom/t4_ddp.c | 3 +- sys/dev/cxgbe/tom/t4_listen.c | 20 +++++- sys/dev/cxgbe/tom/t4_tom.c | 120 +++++++++++++++++++-------------- sys/dev/cxgbe/tom/t4_tom.h | 2 + 6 files changed, 113 insertions(+), 56 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c index f2e4ad456ef4..bd78c7fced61 100644 --- a/sys/dev/cxgbe/tom/t4_connect.c +++ b/sys/dev/cxgbe/tom/t4_connect.c @@ -126,6 +126,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_header *rss, CTR3(KTR_CXGBE, "%s: atid %u, tid %u", __func__, atid, tid); free_atid(sc, atid); + CURVNET_SET(toep->vnet); INP_WLOCK(inp); toep->tid = tid; insert_tid(sc, tid, toep, inp->inp_vflag & INP_IPV6 ? 2 : 1); @@ -141,6 +142,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_header *rss, make_established(toep, cpl->snd_isn, cpl->rcv_isn, cpl->tcp_opt); done: INP_WUNLOCK(inp); + CURVNET_RESTORE(); return (0); } @@ -178,6 +180,7 @@ act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status) free_atid(sc, atid); toep->tid = -1; + CURVNET_SET(toep->vnet); if (status != EAGAIN) INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); @@ -185,6 +188,7 @@ act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status) final_cpl_received(toep); /* unlocks inp */ if (status != EAGAIN) INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); } /* @@ -360,6 +364,7 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt, if (wr == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); + toep->vnet = so->so_vnet; if (sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0) set_tcpddp_ulp_mode(toep); else diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index c22f8bb17271..25ad1e355348 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -306,7 +306,6 @@ make_established(struct toepcb *toep, uint32_t snd_isn, uint32_t rcv_isn, uint16_t tcpopt = be16toh(opt); struct flowc_tx_params ftxp; - CURVNET_SET(so->so_vnet); INP_WLOCK_ASSERT(inp); KASSERT(tp->t_state == TCPS_SYN_SENT || tp->t_state == TCPS_SYN_RECEIVED, @@ -357,7 +356,6 @@ make_established(struct toepcb *toep, uint32_t snd_isn, uint32_t rcv_isn, send_flowc_wr(toep, &ftxp); soisconnected(so); - CURVNET_RESTORE(); } static int @@ -1146,6 +1144,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1191,6 +1190,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tcp_twstart(tp); INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); INP_WLOCK(inp); final_cpl_received(toep); @@ -1203,6 +1203,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) done: INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } @@ -1229,6 +1230,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__)); + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); tp = intotcpcb(inp); @@ -1248,6 +1250,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, release: INP_UNLOCK_ASSERT(inp); /* safe, we have a ref on the inp */ INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); INP_WLOCK(inp); final_cpl_received(toep); /* no more CPLs expected */ @@ -1272,6 +1275,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss, done: INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } @@ -1345,6 +1349,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) } inp = toep->inp; + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); /* for tcp_close */ INP_WLOCK(inp); @@ -1380,6 +1385,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) final_cpl_received(toep); done: INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); send_abort_rpl(sc, ofld_txq, tid, CPL_ABORT_NO_RST); return (0); } @@ -1501,18 +1507,21 @@ do_rx_data(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) DDP_UNLOCK(toep); INP_WUNLOCK(inp); + CURVNET_SET(toep->vnet); INP_INFO_RLOCK(&V_tcbinfo); INP_WLOCK(inp); tp = tcp_drop(tp, ECONNRESET); if (tp) INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } /* receive buffer autosize */ - CURVNET_SET(so->so_vnet); + MPASS(toep->vnet == so->so_vnet); + CURVNET_SET(toep->vnet); if (sb->sb_flags & SB_AUTOSIZE && V_tcp_do_autorcvbuf && sb->sb_hiwat < V_tcp_autorcvbuf_max && @@ -1713,10 +1722,12 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) tid); #endif toep->flags &= ~TPF_TX_SUSPENDED; + CURVNET_SET(toep->vnet); if (toep->ulp_mode == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, plen); else t4_push_frames(sc, toep, plen); + CURVNET_RESTORE(); } else if (plen > 0) { struct sockbuf *sb = &so->so_snd; int sbu; @@ -2143,7 +2154,7 @@ t4_aiotx_task(void *context, int pending) struct socket *so = inp->inp_socket; struct kaiocb *job; - CURVNET_SET(so->so_vnet); + CURVNET_SET(toep->vnet); SOCKBUF_LOCK(&so->so_snd); while (!TAILQ_EMPTY(&toep->aiotx_jobq) && sowriteable(so)) { job = TAILQ_FIRST(&toep->aiotx_jobq); diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c index 1a4cb7104360..762eb2eeeffa 100644 --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -546,7 +546,8 @@ handle_ddp_data(struct toepcb *toep, __be32 ddp_report, __be32 rcv_nxt, int len) #endif /* receive buffer autosize */ - CURVNET_SET(so->so_vnet); + MPASS(toep->vnet == so->so_vnet); + CURVNET_SET(toep->vnet); SOCKBUF_LOCK(sb); if (sb->sb_flags & SB_AUTOSIZE && V_tcp_do_autorcvbuf && diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index bdb93ac9a427..836c9cb6fcf4 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -222,6 +222,7 @@ alloc_lctx(struct adapter *sc, struct inpcb *inp, struct vi_info *vi) TAILQ_INIT(&lctx->synq); lctx->inp = inp; + lctx->vnet = inp->inp_socket->so_vnet; in_pcbref(inp); return (lctx); @@ -1200,6 +1201,8 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, pi = sc->port[G_SYN_INTF(be16toh(cpl->l2info))]; + CURVNET_SET(lctx->vnet); + /* * Use the MAC index to lookup the associated VI. If this SYN * didn't match a perfect MAC filter, punt. @@ -1274,6 +1277,13 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, ntids = 1; } + /* + * Don't offload if the ifnet that the SYN came in on is not in the same + * vnet as the listening socket. + */ + if (lctx->vnet != ifp->if_vnet) + REJECT_PASS_ACCEPT(); + e = get_l2te_for_nexthop(pi, ifp, &inc); if (e == NULL) REJECT_PASS_ACCEPT(); @@ -1313,7 +1323,6 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, REJECT_PASS_ACCEPT(); } so = inp->inp_socket; - CURVNET_SET(so->so_vnet); mtu_idx = find_best_mtu_idx(sc, &inc, be16toh(cpl->tcpopt.mss)); rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0; @@ -1360,7 +1369,6 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, */ toe_syncache_add(&inc, &to, &th, inp, tod, synqe); INP_UNLOCK_ASSERT(inp); /* ok to assert, we have a ref on the inp */ - CURVNET_RESTORE(); /* * If we replied during syncache_add (synqe->wr has been consumed), @@ -1415,10 +1423,12 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, return (__LINE__); } INP_WUNLOCK(inp); + CURVNET_RESTORE(); release_synqe(synqe); /* extra hold */ return (0); reject: + CURVNET_RESTORE(); CTR4(KTR_CXGBE, "%s: stid %u, tid %u, REJECT (%d)", __func__, stid, tid, reject_reason); @@ -1490,6 +1500,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, KASSERT(synqe->flags & TPF_SYNQE, ("%s: tid %u (ctx %p) not a synqe", __func__, tid, synqe)); + CURVNET_SET(lctx->vnet); INP_INFO_RLOCK(&V_tcbinfo); /* for syncache_expand */ INP_WLOCK(inp); @@ -1507,6 +1518,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } @@ -1532,6 +1544,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, send_reset_synqe(TOEDEV(ifp), synqe); INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); return (0); } toep->tid = tid; @@ -1568,6 +1581,8 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, /* New connection inpcb is already locked by syncache_expand(). */ new_inp = sotoinpcb(so); INP_WLOCK_ASSERT(new_inp); + MPASS(so->so_vnet == lctx->vnet); + toep->vnet = lctx->vnet; /* * This is for the unlikely case where the syncache entry that we added @@ -1591,6 +1606,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, if (inp != NULL) INP_WUNLOCK(inp); INP_INFO_RUNLOCK(&V_tcbinfo); + CURVNET_RESTORE(); release_synqe(synqe); return (0); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 5445e265f7dc..1448aad009f8 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -799,74 +799,96 @@ update_clip_table(struct adapter *sc, struct tom_data *td) struct in6_addr *lip, tlip; struct clip_head stale; struct clip_entry *ce, *ce_temp; - int rc, gen = atomic_load_acq_int(&in6_ifaddr_gen); + struct vi_info *vi; + int rc, gen, i, j; + uintptr_t last_vnet; ASSERT_SYNCHRONIZED_OP(sc); IN6_IFADDR_RLOCK(&in6_ifa_tracker); mtx_lock(&td->clip_table_lock); + gen = atomic_load_acq_int(&in6_ifaddr_gen); if (gen == td->clip_gen) goto done; TAILQ_INIT(&stale); TAILQ_CONCAT(&stale, &td->clip_table, link); - TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { - lip = &ia->ia_addr.sin6_addr; - - KASSERT(!IN6_IS_ADDR_MULTICAST(lip), - ("%s: mcast address in in6_ifaddr list", __func__)); - - if (IN6_IS_ADDR_LOOPBACK(lip)) + /* + * last_vnet optimizes the common cases where all if_vnet = NULL (no + * VIMAGE) or all if_vnet = vnet0. + */ + last_vnet = (uintptr_t)(-1); + for_each_port(sc, i) + for_each_vi(sc->port[i], j, vi) { + if (last_vnet == (uintptr_t)vi->ifp->if_vnet) continue; - if (IN6_IS_SCOPE_EMBED(lip)) { - /* Remove the embedded scope */ - tlip = *lip; - lip = &tlip; - in6_clearscope(lip); - } - /* - * XXX: how to weed out the link local address for the loopback - * interface? It's fe80::1 usually (always?). - */ - /* - * If it's in the main list then we already know it's not stale. - */ - TAILQ_FOREACH(ce, &td->clip_table, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) - goto next; - } + /* XXX: races with if_vmove */ + CURVNET_SET(vi->ifp->if_vnet); + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + lip = &ia->ia_addr.sin6_addr; - /* - * If it's in the stale list we should move it to the main list. - */ - TAILQ_FOREACH(ce, &stale, link) { - if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { - TAILQ_REMOVE(&stale, ce, link); - TAILQ_INSERT_TAIL(&td->clip_table, ce, link); - goto next; + KASSERT(!IN6_IS_ADDR_MULTICAST(lip), + ("%s: mcast address in in6_ifaddr list", __func__)); + + if (IN6_IS_ADDR_LOOPBACK(lip)) + continue; + if (IN6_IS_SCOPE_EMBED(lip)) { + /* Remove the embedded scope */ + tlip = *lip; + lip = &tlip; + in6_clearscope(lip); } - } + /* + * XXX: how to weed out the link local address for the + * loopback interface? It's fe80::1 usually (always?). + */ - /* A new IP6 address; add it to the CLIP table */ - ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); - memcpy(&ce->lip, lip, sizeof(ce->lip)); - ce->refcount = 0; - rc = add_lip(sc, lip); - if (rc == 0) - TAILQ_INSERT_TAIL(&td->clip_table, ce, link); - else { - char ip[INET6_ADDRSTRLEN]; + /* + * If it's in the main list then we already know it's + * not stale. + */ + TAILQ_FOREACH(ce, &td->clip_table, link) { + if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) + goto next; + } - inet_ntop(AF_INET6, &ce->lip, &ip[0], sizeof(ip)); - log(LOG_ERR, "%s: could not add %s (%d)\n", - __func__, ip, rc); - free(ce, M_CXGBE); - } + /* + * If it's in the stale list we should move it to the + * main list. + */ + TAILQ_FOREACH(ce, &stale, link) { + if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip)) { + TAILQ_REMOVE(&stale, ce, link); + TAILQ_INSERT_TAIL(&td->clip_table, ce, + link); + goto next; + } + } + + /* A new IP6 address; add it to the CLIP table */ + ce = malloc(sizeof(*ce), M_CXGBE, M_NOWAIT); + memcpy(&ce->lip, lip, sizeof(ce->lip)); + ce->refcount = 0; + rc = add_lip(sc, lip); + if (rc == 0) + TAILQ_INSERT_TAIL(&td->clip_table, ce, link); + else { + char ip[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, &ce->lip, &ip[0], + sizeof(ip)); + log(LOG_ERR, "%s: could not add %s (%d)\n", + __func__, ip, rc); + free(ce, M_CXGBE); + } next: - continue; + continue; + } + CURVNET_RESTORE(); + last_vnet = (uintptr_t)vi->ifp->if_vnet; } /* diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index c0a5288e9ad8..29d819252b4d 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -141,6 +141,7 @@ struct toepcb { int refcount; struct tom_data *td; struct inpcb *inp; /* backpointer to host stack's PCB */ + struct vnet *vnet; struct vi_info *vi; /* virtual interface */ struct sge_wrq *ofld_txq; struct sge_ofld_rxq *ofld_rxq; @@ -232,6 +233,7 @@ struct listen_ctx { struct stid_region stid_region; int flags; struct inpcb *inp; /* listening socket's inp */ + struct vnet *vnet; struct sge_wrq *ctrlq; struct sge_ofld_rxq *ofld_rxq; struct clip_entry *ce; From 2738f41598239ccd5b065d9f72c76310ea45e0e1 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Thu, 12 Jan 2017 00:01:02 +0000 Subject: [PATCH 008/126] Get rid of a compiler warning which I saw too often. Include netinet/in.h before ip_compat.t which will then check if IPPROTO_IPIP is defined or not. Doing it the other way round, ip_compat.h would not find it defined and netinet/in.h then redefine it. --- sys/contrib/ipfilter/netinet/ip_fil.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h index 076433c01439..646f5d661dc4 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.h +++ b/sys/contrib/ipfilter/netinet/ip_fil.h @@ -11,6 +11,10 @@ #ifndef __IP_FIL_H__ #define __IP_FIL_H__ +#if !defined(linux) || !defined(_KERNEL) +# include +#endif + #include "netinet/ip_compat.h" #include "netinet/ipf_rb.h" #if NETBSD_GE_REV(104040000) @@ -24,10 +28,6 @@ # endif #endif -#if !defined(linux) || !defined(_KERNEL) -# include -#endif - #ifndef SOLARIS # if defined(sun) && (defined(__svr4__) || defined(__SVR4)) # define SOLARIS 1 From 8a2ec16a9dda3df4ac9d853382b99f1985efeaf7 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Thu, 12 Jan 2017 00:09:31 +0000 Subject: [PATCH 009/126] Include sys/systm.h for use of bootverbose. Fixes powerpc MPC85XXSPE build. --- sys/dev/sdhci/sdhci_fdt_gpio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/sdhci/sdhci_fdt_gpio.c b/sys/dev/sdhci/sdhci_fdt_gpio.c index c3fa6ba583d3..9935f17c66a2 100644 --- a/sys/dev/sdhci/sdhci_fdt_gpio.c +++ b/sys/dev/sdhci/sdhci_fdt_gpio.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From 5fddef79998678d256ba30316353393b4d8ebb32 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 12 Jan 2017 00:22:36 +0000 Subject: [PATCH 010/126] Enable the use of ^C and ^S/^Q in DDB. This lets one interrupt DDB's output, which is useful if paging is disabled and the output device is slow. Submitted by: Anton Rang Reviewed by: jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9138 --- sys/ddb/db_input.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index a2a7b3829e8c..f40ee755ecac 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -63,7 +63,6 @@ static int db_lhist_nlines; #define BLANK ' ' #define BACKUP '\b' -static int cnmaygetc(void); static void db_delete(int n, int bwd); static int db_inputchar(int c); static void db_putnchars(int c, int count); @@ -291,12 +290,6 @@ db_inputchar(c) return (0); } -static int -cnmaygetc() -{ - return (-1); -} - int db_readline(lstart, lsize) char * lstart; @@ -350,7 +343,7 @@ db_check_interrupt(void) { int c; - c = cnmaygetc(); + c = cncheckc(); switch (c) { case -1: /* no character */ return; @@ -361,7 +354,7 @@ db_check_interrupt(void) case CTRL('s'): do { - c = cnmaygetc(); + c = cncheckc(); if (c == CTRL('c')) db_error((char *)0); } while (c != CTRL('q')); From ca7d74d4675911e8518a0cbf2f06b3de8158b383 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Thu, 12 Jan 2017 00:34:37 +0000 Subject: [PATCH 011/126] pciconf(8): Reallow trailing colon in selectors Reallow device selectors to have a trailing colon, as documented in the manual page. This was broken along with some unrelated cleanups in r295806. PR: 215979 Reported by: David Boyd Sponsored by: Dell EMC Isilon --- usr.sbin/pciconf/pciconf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c index 1bc5526a61aa..bfbcf742e84d 100644 --- a/usr.sbin/pciconf/pciconf.c +++ b/usr.sbin/pciconf/pciconf.c @@ -917,11 +917,8 @@ parsesel(const char *str) while (isdigit(*ep) && i < 4) { selarr[i++] = strtoul(ep, &eppos, 10); ep = eppos; - if (*ep == ':') { + if (*ep == ':') ep++; - if (*ep == '\0') - i = 0; - } } if (i > 0 && *ep == '\0') { sel.pc_func = (i > 2) ? selarr[--i] : 0; From f64342e354d95a2e5101850ad6d9199c211748ad Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Thu, 12 Jan 2017 00:48:06 +0000 Subject: [PATCH 012/126] Rework tty_drain() to poll the hardware for completion, and restore drain timeout handling to historical freebsd behavior. The primary reason for these changes is the need to have tty_drain() call ttydevsw_busy() at some reasonable sub-second rate, to poll hardware that doesn't signal an interrupt when the transmit shift register becomes empty (which includes virtually all USB serial hardware). Such hardware hangs in a ttyout wait, because it never gets an opportunity to trigger a wakeup from the sleep in tty_drain() by calling ttydisc_getc() again, after handing the last of the buffered data to the hardware. While researching the history of changes to tty_drain() I stumbled across some email describing the historical BSD behavior of tcdrain() and close() on serial ports, and the ability of comcontrol(1) to control timeout behavior. Using that and some advice from Bruce Evans as a guide, I've put together these changes to implement the hardware polling and restore the historical timeout behaviors... - tty_drain() now calls ttydevsw_busy() in a loop at 10 Hz to accomodate hardware that requires polling for busy state. - The "new historical" behavior for draining during close(2) is retained: the drain timeout is "1 second without making any progress". When the 1-second timeout expires, if the count of bytes remaining in the tty layer buffer is smaller than last time, the timeout is extended for another second. Unfortunately, the same logic cannot be extended all the way down to the hardware, because the interface to that layer is a simple busy/not-busy indication. - Due to the previous point, an application that needs a guarantee that all data has been transmitted must use TIOCDRAIN/tcdrain(3) before calling close(2). - The historical behavior of honoring the drainwait setting for TIOCDRAIN (used by tcdrain(3)) is restored. - The historical kern.drainwait sysctl to control the global default drainwait time is restored, but is now named kern.tty_drainwait. - The historical default drainwait timeout of 300 seconds is restored. - Handling of TIOCGDRAINWAIT and TIOCSDRAINWAIT ioctls is restored (this also makes the comcontrol(1) drainwait verb work again). - Manpages are updated to document these behaviors. Reviewed by: bde (prior version) --- lib/libc/gen/tcsendbreak.3 | 33 +++++++++++++++-- share/man/man4/tty.4 | 13 +++++-- sys/kern/tty.c | 73 ++++++++++++++++++++++++++++---------- sys/sys/tty.h | 1 + 4 files changed, 96 insertions(+), 24 deletions(-) diff --git a/lib/libc/gen/tcsendbreak.3 b/lib/libc/gen/tcsendbreak.3 index a7e86d0aed5b..dd43a298941e 100644 --- a/lib/libc/gen/tcsendbreak.3 +++ b/lib/libc/gen/tcsendbreak.3 @@ -28,7 +28,7 @@ .\" @(#)tcsendbreak.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd January 11, 2017 .Dt TCSENDBREAK 3 .Os .Sh NAME @@ -137,17 +137,44 @@ is not a terminal. A signal interrupted the .Fn tcdrain function. +.It Bq Er EWOULDBLOCK +The configured timeout expired before the +.Fn tcdrain +function could write all buffered output. .El .Sh SEE ALSO .Xr tcsetattr 3 , -.Xr termios 4 +.Xr termios 4 , +.Xr tty 4 , +.Xr comcontrol 8 .Sh STANDARDS The .Fn tcsendbreak , -.Fn tcdrain , .Fn tcflush and .Fn tcflow functions are expected to be compliant with the .St -p1003.1-88 specification. +.Pp +The +.Fn tcdrain +function is expected to be compliant with +.St -p1003.1-88 +when the drain wait value is set to zero with +.Xr comcontrol 8 , +or with +.Xr ioctl 2 +.Va TIOCSDRAINWAIT , +or with +.Xr sysctl 8 +.Va kern.tty_drainwait . +A non-zero drain wait value can result in +.Fn tcdrain +returning +.Va EWOULDBLOCK +without writing all output. +The default value for +.Va kern.tty_drainwait +is 300 seconds. + diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4 index ec6d9f155aca..ef5bed8be554 100644 --- a/share/man/man4/tty.4 +++ b/share/man/man4/tty.4 @@ -28,7 +28,7 @@ .\" @(#)tty.4 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 26, 2009 +.Dd January 11, 2017 .Dt TTY 4 .Os .Sh NAME @@ -238,7 +238,16 @@ Start output on the terminal (like typing ^Q at the keyboard). Make the terminal the controlling terminal for the process (the process must not currently have a controlling terminal). .It Dv TIOCDRAIN Fa void -Wait until all output is drained. +Wait until all output is drained, or until the drain wait timeout expires. +.It Dv TIOCGDRAINWAIT Fa int *timeout +Return the current drain wait timeout in seconds. +.It Dv TIOCSDRAINWAIT Fa int *timeout +Set the drain wait timeout in seconds. +A value of zero disables timeouts. +The default drain wait timeout is controlled by the tunable +.Xr sysctl 8 +OID +.Va kern.tty_drainwait . .It Dv TIOCEXCL Fa void Set exclusive use on the terminal. No further opens are permitted except by root. diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b37d5a557b4c..a252d5b87fa1 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -95,6 +95,10 @@ static const char *dev_console_filename; #define TTY_CALLOUT(tp,d) (dev2unit(d) & TTYUNIT_CALLOUT) +static int tty_drainwait = 5 * 60; +SYSCTL_INT(_kern, OID_AUTO, tty_drainwait, CTLFLAG_RWTUN, + &tty_drainwait, 0, "Default output drain timeout in seconds"); + /* * Set TTY buffer sizes. */ @@ -125,34 +129,56 @@ tty_watermarks(struct tty *tp) static int tty_drain(struct tty *tp, int leaving) { - size_t bytesused; + sbintime_t timeout_at; + size_t bytes; int error; if (ttyhook_hashook(tp, getc_inject)) /* buffer is inaccessible */ return (0); - while (ttyoutq_bytesused(&tp->t_outq) > 0 || ttydevsw_busy(tp)) { - ttydevsw_outwakeup(tp); - /* Could be handled synchronously. */ - bytesused = ttyoutq_bytesused(&tp->t_outq); - if (bytesused == 0 && !ttydevsw_busy(tp)) + /* + * For close(), use the recent historic timeout of "1 second without + * making progress". For tcdrain(), use t_drainwait as the timeout, + * with zero meaning "no timeout" which gives POSIX behavior. + */ + if (leaving) + timeout_at = getsbinuptime() + SBT_1S; + else if (tp->t_drainwait != 0) + timeout_at = getsbinuptime() + SBT_1S * tp->t_drainwait; + else + timeout_at = 0; + + /* + * Poll the output buffer and the hardware for completion, at 10 Hz. + * Polling is required for devices which are not able to signal an + * interrupt when the transmitter becomes idle (most USB serial devs). + * The unusual structure of this loop ensures we check for busy one more + * time after tty_timedwait() returns EWOULDBLOCK, so that success has + * higher priority than timeout if the IO completed in the last 100mS. + */ + error = 0; + bytes = ttyoutq_bytesused(&tp->t_outq); + for (;;) { + if (ttyoutq_bytesused(&tp->t_outq) == 0 && !ttydevsw_busy(tp)) return (0); - - /* Wait for data to be drained. */ - if (leaving) { - error = tty_timedwait(tp, &tp->t_outwait, hz); - if (error == EWOULDBLOCK && - ttyoutq_bytesused(&tp->t_outq) < bytesused) - error = 0; - } else - error = tty_wait(tp, &tp->t_outwait); - - if (error) + if (error != 0) return (error); + ttydevsw_outwakeup(tp); + error = tty_timedwait(tp, &tp->t_outwait, hz / 10); + if (timeout_at == 0 && error == EWOULDBLOCK) + error = 0; + if (error != EWOULDBLOCK) + continue; + if (getsbinuptime() < timeout_at) + error = 0; + else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) { + /* In close, making progress, grant an extra second. */ + error = 0; + timeout_at += SBT_1S; + bytes = ttyoutq_bytesused(&tp->t_outq); + } } - - return (0); } /* @@ -1015,6 +1041,7 @@ tty_alloc_mutex(struct ttydevsw *tsw, void *sc, struct mtx *mutex) tp->t_devsw = tsw; tp->t_devswsoftc = sc; tp->t_flags = tsw->tsw_flags; + tp->t_drainwait = tty_drainwait; tty_init_termios(tp); @@ -1755,6 +1782,14 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, case TIOCDRAIN: /* Drain TTY output. */ return tty_drain(tp, 0); + case TIOCGDRAINWAIT: + *(int *)data = tp->t_drainwait; + return (0); + case TIOCSDRAINWAIT: + error = priv_check(td, PRIV_TTY_DRAINWAIT); + if (error == 0) + tp->t_drainwait = *(int *)data; + return (error); case TIOCCONS: /* Set terminal as console TTY. */ if (*(int *)data) { diff --git a/sys/sys/tty.h b/sys/sys/tty.h index f1a044f1488c..09e04195ae55 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -62,6 +62,7 @@ struct tty { struct mtx *t_mtx; /* TTY lock. */ struct mtx t_mtxobj; /* Per-TTY lock (when not borrowing). */ TAILQ_ENTRY(tty) t_list; /* (l) TTY list entry. */ + int t_drainwait; /* (t) TIOCDRAIN timeout seconds. */ unsigned int t_flags; /* (t) Terminal option flags. */ /* Keep flags in sync with db_show_tty and pstat(8). */ #define TF_NOPREFIX 0x00001 /* Don't prepend "tty" to device name. */ From 94e4e732af501c7b6031fc0887e06753a0d2592a Mon Sep 17 00:00:00 2001 From: Scott Long Date: Thu, 12 Jan 2017 01:13:05 +0000 Subject: [PATCH 013/126] Print out the number of queues/MSIx vectors. Sponsored by: Netflix --- sys/dev/mpr/mpr_table.c | 1 + sys/dev/mps/mps_table.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/mpr/mpr_table.c b/sys/dev/mpr/mpr_table.c index 6ec6492d6402..de715259de79 100644 --- a/sys/dev/mpr/mpr_table.c +++ b/sys/dev/mpr/mpr_table.c @@ -209,6 +209,7 @@ mpr_print_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) mpr_dprint_field(sc, MPR_XINFO, "WhoInit: %s\n", mpr_describe_table(mpr_whoinit_names, facts->WhoInit)); MPR_PRINTFIELD(sc, facts, NumberOfPorts, %d); + MPR_PRINTFIELD(sc, facts, MaxMSIxVectors, %d); MPR_PRINTFIELD(sc, facts, RequestCredit, %d); MPR_PRINTFIELD(sc, facts, ProductID, 0x%x); mpr_dprint_field(sc, MPR_XINFO, "IOCCapabilities: %b\n", diff --git a/sys/dev/mps/mps_table.c b/sys/dev/mps/mps_table.c index f6e125d77c0c..d85a71a2e55d 100644 --- a/sys/dev/mps/mps_table.c +++ b/sys/dev/mps/mps_table.c @@ -208,6 +208,7 @@ mps_print_iocfacts(struct mps_softc *sc, MPI2_IOC_FACTS_REPLY *facts) mps_dprint_field(sc, MPS_XINFO, "WhoInit: %s\n", mps_describe_table(mps_whoinit_names, facts->WhoInit)); MPS_PRINTFIELD(sc, facts, NumberOfPorts, %d); + MPS_PRINTFIELD(sc, facts, MaxMSIxVectors, %d); MPS_PRINTFIELD(sc, facts, RequestCredit, %d); MPS_PRINTFIELD(sc, facts, ProductID, 0x%x); mps_dprint_field(sc, MPS_XINFO, "IOCCapabilities: %b\n", From 542c719c020fd51fd575621421ea7a2f4b0e75ab Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 12 Jan 2017 06:29:14 +0000 Subject: [PATCH 014/126] sfxge(4): do not ignore requested MAC stats update period Firmware version which takes PERIOD_MS parameter into account is required. Reviewed by: philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9129 --- sys/dev/sfxge/common/efx_mcdi.c | 24 ++++++++++++++---------- sys/dev/sfxge/common/efx_mcdi.h | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index dabf85e4c68f..81fb6a05c994 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -1725,7 +1725,8 @@ static __checkReturn efx_rc_t efx_mcdi_mac_stats( __in efx_nic_t *enp, __in_opt efsys_mem_t *esmp, - __in efx_stats_action_t action) + __in efx_stats_action_t action, + __in uint16_t period_ms) { efx_mcdi_req_t req; uint8_t payload[MAX(MC_CMD_MAC_STATS_IN_LEN, @@ -1750,7 +1751,7 @@ efx_mcdi_mac_stats( MAC_STATS_IN_PERIODIC_CHANGE, enable | events | disable, MAC_STATS_IN_PERIODIC_ENABLE, enable | events, MAC_STATS_IN_PERIODIC_NOEVENT, !events, - MAC_STATS_IN_PERIOD_MS, (enable | events) ? 1000 : 0); + MAC_STATS_IN_PERIOD_MS, (enable | events) ? period_ms : 0); if (esmp != NULL) { int bytes = MC_CMD_MAC_NSTATS * sizeof (uint64_t); @@ -1800,7 +1801,7 @@ efx_mcdi_mac_stats_clear( { efx_rc_t rc; - if ((rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_CLEAR)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_CLEAR, 0)) != 0) goto fail1; return (0); @@ -1823,7 +1824,7 @@ efx_mcdi_mac_stats_upload( * avoid having to pull the statistics buffer into the cache to * maintain cumulative statistics. */ - if ((rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_UPLOAD)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_UPLOAD, 0)) != 0) goto fail1; return (0); @@ -1838,7 +1839,7 @@ efx_mcdi_mac_stats_upload( efx_mcdi_mac_stats_periodic( __in efx_nic_t *enp, __in efsys_mem_t *esmp, - __in uint16_t period, + __in uint16_t period_ms, __in boolean_t events) { efx_rc_t rc; @@ -1847,14 +1848,17 @@ efx_mcdi_mac_stats_periodic( * The MC DMAs aggregate statistics for our convenience, so we can * avoid having to pull the statistics buffer into the cache to * maintain cumulative statistics. - * Huntington uses a fixed 1sec period, so use that on Siena too. + * Huntington uses a fixed 1sec period. + * Medford uses a fixed 1sec period before v6.2.1.1033 firmware. */ - if (period == 0) - rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_DISABLE); + if (period_ms == 0) + rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_DISABLE, 0); else if (events) - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_EVENTS); + rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_EVENTS, + period_ms); else - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_NOEVENTS); + rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_NOEVENTS, + period_ms); if (rc != 0) goto fail1; diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index ffa50f1948dc..ee11789e83aa 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -218,7 +218,7 @@ extern __checkReturn efx_rc_t efx_mcdi_mac_stats_periodic( __in efx_nic_t *enp, __in efsys_mem_t *esmp, - __in uint16_t period, + __in uint16_t period_ms, __in boolean_t events); From 62f5c496374baa60848f03c68dbdc227171e96fc Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 12 Jan 2017 06:30:44 +0000 Subject: [PATCH 015/126] sfxge(4): stats refresh in SW should depend on HW update period The period should be taken into account by the function which refreshes driver stats. Reviewed by: philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9130 --- sys/dev/sfxge/sfxge.h | 2 ++ sys/dev/sfxge/sfxge_port.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h index 2000652974d9..90914dac68fc 100644 --- a/sys/dev/sfxge/sfxge.h +++ b/sys/dev/sfxge/sfxge.h @@ -159,6 +159,8 @@ enum sfxge_evq_state { #define SFXGE_EV_BATCH 16384 +#define SFXGE_STATS_UPDATE_PERIOD_MS 1000 + struct sfxge_evq { /* Structure members below are sorted by usage order */ struct sfxge_softc *sc; diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index 58793ca54efd..cb574f0c9100 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -51,6 +51,7 @@ sfxge_mac_stat_update(struct sfxge_softc *sc) struct sfxge_port *port = &sc->port; efsys_mem_t *esmp = &(port->mac_stats.dma_buf); clock_t now; + unsigned int min_ticks; unsigned int count; int rc; @@ -61,8 +62,10 @@ sfxge_mac_stat_update(struct sfxge_softc *sc) goto out; } + min_ticks = (unsigned int)hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000; + now = ticks; - if ((unsigned int)(now - port->mac_stats.update_time) < (unsigned int)hz) { + if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) { rc = 0; goto out; } @@ -510,9 +513,10 @@ sfxge_port_start(struct sfxge_softc *sc) sfxge_mac_filter_set_locked(sc); - /* Update MAC stats by DMA every second */ + /* Update MAC stats by DMA every period */ if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, - 1000, B_FALSE)) != 0) + SFXGE_STATS_UPDATE_PERIOD_MS, + B_FALSE)) != 0) goto fail6; if ((rc = efx_mac_drain(enp, B_FALSE)) != 0) From 8e712af70b3604f2684b31ea9918548eb819219b Mon Sep 17 00:00:00 2001 From: Ravi Pokala Date: Thu, 12 Jan 2017 06:38:03 +0000 Subject: [PATCH 016/126] Remove writability requirement for single-mbuf, contiguous-range m_pulldown() m_pulldown() only needs to determine if a mbuf is writable if it is going to copy data into the data region of an existing mbuf. It does this to create a contiguous data region in a single mbuf from multiple mbufs in the chain. If the requested memory region is already contiguous and nothing needs to change, the mbuf does not need to be writeable. Submitted by: Brian Mueller Reviewed by: bz MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D9053 --- sys/kern/uipc_mbuf2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index 7e44eb6d3de8..3568a3aa609a 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -159,7 +159,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * the target data is on . * if we got enough data on the mbuf "n", we're done. */ - if ((off == 0 || offp) && len <= n->m_len - off && writable) + if ((off == 0 || offp) && len <= n->m_len - off) goto ok; /* From b28ea2c250f410bcbff858a013aa9dd7400dec7f Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Thu, 12 Jan 2017 06:58:31 +0000 Subject: [PATCH 017/126] g_raid: Prevent tasters from attempting excessively large reads Some g_raid tasters attempt metadata reads in multiples of the provider sectorsize. Reads larger than MAXPHYS are invalid, so detect and abort in such situations. Spiritually similar to r217305 / PR 147851. PR: 214721 Sponsored by: Dell EMC Isilon --- sys/geom/raid/md_ddf.c | 10 ++++++++++ sys/geom/raid/md_promise.c | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/sys/geom/raid/md_ddf.c b/sys/geom/raid/md_ddf.c index df58a1e8da03..87da8feedf9f 100644 --- a/sys/geom/raid/md_ddf.c +++ b/sys/geom/raid/md_ddf.c @@ -1161,6 +1161,16 @@ ddf_meta_read(struct g_consumer *cp, struct ddf_meta *meta) (GET16(meta, hdr->Configuration_Record_Length) * ss - 512) / 12)); } + if (GET32(meta, hdr->cd_length) * ss >= MAXPHYS || + GET32(meta, hdr->pdr_length) * ss >= MAXPHYS || + GET32(meta, hdr->vdr_length) * ss >= MAXPHYS || + GET32(meta, hdr->cr_length) * ss >= MAXPHYS || + GET32(meta, hdr->pdd_length) * ss >= MAXPHYS || + GET32(meta, hdr->bbmlog_length) * ss >= MAXPHYS) { + G_RAID_DEBUG(1, "%s: Blocksize is too big.", pp->name); + goto hdrerror; + } + /* Read controller data. */ buf = g_read_data(cp, (lba + GET32(meta, hdr->cd_section)) * ss, GET32(meta, hdr->cd_length) * ss, &error); diff --git a/sys/geom/raid/md_promise.c b/sys/geom/raid/md_promise.c index 245cd74f7dbb..258b4d30ec19 100644 --- a/sys/geom/raid/md_promise.c +++ b/sys/geom/raid/md_promise.c @@ -341,6 +341,11 @@ promise_meta_read(struct g_consumer *cp, struct promise_raid_conf **metaarr) pp = cp->provider; subdisks = 0; + + if (pp->sectorsize * 4 > MAXPHYS) { + G_RAID_DEBUG(1, "%s: Blocksize is too big.", pp->name); + return (subdisks); + } next: /* Read metadata block. */ buf = g_read_data(cp, pp->mediasize - pp->sectorsize * From 2254eda87e053e92fb9e0bd34a1fb5db0d9d7cd7 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 12 Jan 2017 07:21:56 +0000 Subject: [PATCH 018/126] Commit updates accepted upstream (NetBSD) --- lib/libc/gen/t_dir.c | 34 ++++++++++++++++++++++------------ lib/libc/string/t_memcpy.c | 5 +++-- lib/libc/string/t_memmem.c | 5 ++++- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/lib/libc/gen/t_dir.c b/lib/libc/gen/t_dir.c index 6142f68caf3c..40de1167d884 100644 --- a/lib/libc/gen/t_dir.c +++ b/lib/libc/gen/t_dir.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_dir.c,v 1.8 2017/01/11 07:26:17 christos Exp $ */ +/* $NetBSD: t_dir.c,v 1.10 2017/01/11 18:15:02 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ ATF_TC_BODY(seekdir_basic, tc) #define CREAT(x, m) do { \ int _creat_fd; \ - ATF_REQUIRE_MSG((_creat_fd = creat((x), (m)) != -1), \ + ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))) != -1, \ "creat(%s, %x) failed: %s", (x), (m), \ strerror(errno)); \ (void)close(_creat_fd); \ @@ -75,29 +75,40 @@ ATF_TC_BODY(seekdir_basic, tc) /* skip two for . and .. */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + ".", strerror(errno)); + entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "..", strerror(errno)); /* get first entry */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "first", strerror(errno)); + here = telldir(dp); - ATF_REQUIRE_MSG(here != -1, - "telldir failed: %s", strerror(errno)); + ATF_REQUIRE_MSG(here != -1, "telldir failed: %s", strerror(errno)); /* get second entry */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "second", strerror(errno)); + wasname = strdup(entry->d_name); if (wasname == NULL) atf_tc_fail("cannot allocate memory"); /* get third entry */ entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "third", strerror(errno)); /* try to return to the position after the first entry */ seekdir(dp, here); entry = readdir(dp); - - if (entry == NULL) - atf_tc_fail("entry 1 not found"); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "first[1]", strerror(errno)); if (strcmp(entry->d_name, wasname) != 0) atf_tc_fail("1st seekdir found wrong name"); @@ -105,18 +116,17 @@ ATF_TC_BODY(seekdir_basic, tc) seekdir(dp, here); here = telldir(dp); entry = readdir(dp); - - if (entry == NULL) - atf_tc_fail("entry 2 not found"); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "second[1]", strerror(errno)); if (strcmp(entry->d_name, wasname) != 0) atf_tc_fail("2nd seekdir found wrong name"); /* One more time, to make sure that telldir() doesn't affect result */ seekdir(dp, here); entry = readdir(dp); + ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s", + "third[1]", strerror(errno)); - if (entry == NULL) - atf_tc_fail("entry 3 not found"); if (strcmp(entry->d_name, wasname) != 0) atf_tc_fail("3rd seekdir found wrong name"); diff --git a/lib/libc/string/t_memcpy.c b/lib/libc/string/t_memcpy.c index 6485a88ae141..bc081a3cf303 100644 --- a/lib/libc/string/t_memcpy.c +++ b/lib/libc/string/t_memcpy.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_memcpy.c,v 1.5 2013/03/17 02:23:31 christos Exp $ */ +/* $NetBSD: t_memcpy.c,v 1.6 2017/01/11 18:05:54 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -96,7 +96,8 @@ ATF_TC_BODY(memcpy_basic, tc) if (i != j) runTest(start[i], start[j]); MD5End(mc, result); - ATF_REQUIRE_EQ(strcmp(result, goodResult), 0); + ATF_REQUIRE_EQ_MSG(strcmp(result, goodResult), 0, "%s != %s", + result, goodResult); } ATF_TC(memccpy_simple); diff --git a/lib/libc/string/t_memmem.c b/lib/libc/string/t_memmem.c index 1e87af892bd5..e20b0b7462ba 100644 --- a/lib/libc/string/t_memmem.c +++ b/lib/libc/string/t_memmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_memmem.c,v 1.2 2011/07/07 08:27:36 jruoho Exp $ */ +/* $NetBSD: t_memmem.c,v 1.3 2017/01/11 18:07:37 christos Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -51,6 +51,8 @@ char p6[] = "9"; int lp6 = 1; char p7[] = "654"; int lp7 = 3; +char p8[] = "89abc"; +int lp8 = 5; char b0[] = ""; int lb0 = 0; @@ -89,6 +91,7 @@ ATF_TC_BODY(memmem_basic, tc) expect(memmem(b2, lb2, p4, lp4) == NULL); expect(memmem(b2, lb2, p7, lp7) == NULL); + expect(memmem(b2, lb2, p8, lp8) == NULL); } ATF_TP_ADD_TCS(tp) From 20d24fbb933deae4ccdc875f54babfff8dace678 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 12 Jan 2017 07:26:39 +0000 Subject: [PATCH 019/126] Sync ^/vendor/NetBSD/tests/dist with upstream --- crypto/libcrypto/rc4/Makefile | 3 +- crypto/libcrypto/t_libcrypto.sh | 4 +- crypto/libcrypto/t_pubkey.sh | 8 +- dev/Makefile | 4 +- dev/audio/h_pad.c | 10 +- dev/audio/t_pad_output.bz2.uue | 2069 ++++----- dev/cgd/Makefile | 14 +- dev/cgd/t_cgd_3des.c | 913 ++++ dev/cgd/t_cgd_aes.c | 3606 +++++++++++++++ dev/cgd/t_cgd_blowfish.c | 2341 ++++++++++ fs/ffs/ffs_common.sh | 4 +- fs/fifofs/t_fifo.c | 3 +- fs/nfs/nfsservice/Makefile | 5 +- fs/psshfs/t_psshfs.sh | 23 +- fs/puffs/t_basic.c | 6 +- fs/vfs/Makefile | 7 +- fs/vfs/t_vnops.c | 100 +- h_macros.h | 4 +- kernel/Makefile | 14 +- kernel/msg.h | 136 + kernel/t_mqueue.c | 3 +- kernel/t_ptrace.c | 208 + kernel/t_ptrace_wait.c | 5082 +++++++++++++++++++++ kernel/t_ptrace_wait.h | 431 ++ kernel/t_ptrace_wait3.c | 30 + kernel/t_ptrace_wait4.c | 30 + kernel/t_ptrace_wait6.c | 30 + kernel/t_ptrace_waitid.c | 30 + kernel/t_ptrace_waitpid.c | 30 + lib/Makefile | 5 +- lib/libc/arch/sparc64/exec_prot_support.c | 7 +- lib/libc/arch/sparc64/return_one.S | 11 +- lib/libc/db/Makefile | 3 +- lib/libc/db/h_db.c | 61 +- lib/libc/db/t_db.sh | 301 +- lib/libc/gen/Makefile | 5 +- lib/libc/gen/t_fnmatch.c | 5 +- lib/libc/net/getaddrinfo/Makefile | 4 +- lib/libc/regex/Makefile | 4 +- lib/libc/rpc/t_rpc.c | 22 +- lib/libc/sync/cpp_atomic_ops_linkable.cc | 16 +- lib/libc/sys/Makefile | 5 +- lib/libc/sys/t_clock_nanosleep.c | 63 + lib/libc/sys/t_wait_noproc.c | 340 ++ lib/libc/sys/t_wait_noproc_wnohang.c | 30 + lib/libm/Makefile | 7 +- lib/libm/t_ldexp.c | 12 +- lib/libm/t_precision.c | 8 +- lib/libpthread/Makefile | 3 +- lib/libpthread/h_common.h | 6 + lib/libpthread/t_mutex.c | 194 +- lib/librumpclient/Makefile | 2 +- lib/librumpclient/h_execthr.c | 68 +- lib/librumphijack/t_tcpip.sh | 7 +- lib/libusbhid/t_usbhid.c | 7 +- net/Makefile | 4 +- net/arp/Makefile | 8 +- net/arp/t_arp.sh | 127 +- net/arp/t_dad.sh | 100 +- net/icmp/Makefile | 7 +- net/icmp/t_icmp6_redirect.sh | 65 +- net/icmp/t_icmp_redirect.sh | 100 +- net/if/t_compat.c | 4 +- net/if/t_ifconfig.sh | 22 +- net/if_bridge/Makefile | 7 +- net/if_bridge/t_bridge.sh | 105 +- net/if_gif/Makefile | 7 +- net/if_gif/t_gif.sh | 35 +- net/if_pppoe/Makefile | 7 +- net/if_pppoe/t_pppoe.sh | 267 +- net/if_tap/Makefile | 7 +- net/if_tap/t_tap.sh | 50 +- net/mcast/Makefile | 7 +- net/mcast/t_mcast.sh | 18 +- net/ndp/Makefile | 9 +- net/ndp/t_dad.sh | 156 +- net/ndp/t_ndp.sh | 100 +- net/ndp/t_ra.sh | 621 ++- net/net/Makefile | 12 +- net/net/t_forwarding.sh | 125 +- net/net/t_ipaddress.sh | 129 +- net/net/t_ipv6_lifetime.sh | 48 +- net/net/t_ipv6address.sh | 101 +- net/net/t_mtudisc.sh | 192 + net/net/t_mtudisc6.sh | 179 + net/net/t_ping6_opts.sh | 380 ++ net/net_common.sh | 314 ++ net/route/Makefile | 8 +- net/route/t_change.sh | 4 +- net/route/t_flags.sh | 116 +- net/route/t_flags6.sh | 88 +- net/route/t_route.sh | 78 +- rump/modautoload/Makefile | 6 +- rump/modautoload/t_modautoload.c | 3 +- rump/rumpkern/t_lwproc.c | 3 +- sys/net/t_print.c | 14 +- usr.bin/Makefile | 6 +- usr.bin/config/t_config.sh | 62 +- usr.bin/netpgpverify/t_netpgpverify.sh | 536 ++- usr.bin/xlint/lint1/Makefile | 4 +- usr.bin/xlint/lint1/d_c99_anon_union.c | 16 + usr.bin/xlint/lint1/d_c99_union_cast.c | 18 + 102 files changed, 18025 insertions(+), 2594 deletions(-) create mode 100644 dev/cgd/t_cgd_3des.c create mode 100644 dev/cgd/t_cgd_aes.c create mode 100644 dev/cgd/t_cgd_blowfish.c create mode 100644 kernel/msg.h create mode 100644 kernel/t_ptrace.c create mode 100644 kernel/t_ptrace_wait.c create mode 100644 kernel/t_ptrace_wait.h create mode 100644 kernel/t_ptrace_wait3.c create mode 100644 kernel/t_ptrace_wait4.c create mode 100644 kernel/t_ptrace_wait6.c create mode 100644 kernel/t_ptrace_waitid.c create mode 100644 kernel/t_ptrace_waitpid.c create mode 100644 lib/libc/sys/t_clock_nanosleep.c create mode 100644 lib/libc/sys/t_wait_noproc.c create mode 100644 lib/libc/sys/t_wait_noproc_wnohang.c create mode 100755 net/net/t_mtudisc.sh create mode 100755 net/net/t_mtudisc6.sh create mode 100755 net/net/t_ping6_opts.sh create mode 100755 net/net_common.sh create mode 100644 usr.bin/xlint/lint1/d_c99_anon_union.c create mode 100644 usr.bin/xlint/lint1/d_c99_union_cast.c diff --git a/crypto/libcrypto/rc4/Makefile b/crypto/libcrypto/rc4/Makefile index c4ade83d6e5d..db156a9461c5 100644 --- a/crypto/libcrypto/rc4/Makefile +++ b/crypto/libcrypto/rc4/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.1 2009/02/13 20:58:15 jmmv Exp $ +# $NetBSD: Makefile,v 1.2 2016/10/14 16:09:45 spz Exp $ HELPER_NAME= rc4test HELPER_DIR= rc4 +CPPFLAGS= -DOPENSSL_PIC .include diff --git a/crypto/libcrypto/t_libcrypto.sh b/crypto/libcrypto/t_libcrypto.sh index aa7af27ceee4..f460cf58241b 100755 --- a/crypto/libcrypto/t_libcrypto.sh +++ b/crypto/libcrypto/t_libcrypto.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_libcrypto.sh,v 1.3 2010/11/08 19:06:12 pooka Exp $ +# $NetBSD: t_libcrypto.sh,v 1.4 2016/10/13 09:25:37 martin Exp $ # # Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -49,7 +49,7 @@ atf_test_case bn bn_head() { atf_set "descr" "Checks BIGNUM library" - atf_set "timeout" "300" + atf_set "timeout" "360" } bn_body() { diff --git a/crypto/libcrypto/t_pubkey.sh b/crypto/libcrypto/t_pubkey.sh index 1453e757a4cc..eb8d0f5b6d2a 100755 --- a/crypto/libcrypto/t_pubkey.sh +++ b/crypto/libcrypto/t_pubkey.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_pubkey.sh,v 1.3 2011/06/09 05:25:21 spz Exp $ +# $NetBSD: t_pubkey.sh,v 1.4 2016/10/13 09:25:37 martin Exp $ # # Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -49,7 +49,7 @@ atf_test_case rsa rsa_head() { atf_set "descr" "Checks RSA" - atf_set "timeout" "300" + atf_set "timeout" "420" } rsa_body() { @@ -60,7 +60,7 @@ atf_test_case ec ec_head() { atf_set "descr" "Checks EC cipher" - atf_set "timeout" "300" + atf_set "timeout" "480" } ec_body() { @@ -81,7 +81,7 @@ atf_test_case ecdsa ecdsa_head() { atf_set "descr" "Checks ECDSA algorithm" - atf_set "timeout" "300" + atf_set "timeout" "480" } ecdsa_body() { diff --git a/dev/Makefile b/dev/Makefile index e255e24dd44e..4d774d422d96 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.11 2016/07/29 06:13:39 pgoyette Exp $ +# $NetBSD: Makefile,v 1.12 2016/08/14 14:55:42 jakllsch Exp $ # .include TESTSDIR= ${TESTSBASE}/dev -TESTS_SUBDIRS+= cgd fss raidframe +TESTS_SUBDIRS+= cgd clock_subr fss raidframe .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_SUBDIRS+= audio md scsipi sysmon usb .endif diff --git a/dev/audio/h_pad.c b/dev/audio/h_pad.c index dd481ac1a85c..b760d047c366 100644 --- a/dev/audio/h_pad.c +++ b/dev/audio/h_pad.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_pad.c,v 1.1 2010/08/04 13:15:15 pooka Exp $ */ +/* $NetBSD: h_pad.c,v 1.2 2016/10/15 07:08:06 nat Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -56,14 +56,14 @@ main(int argc, char *argv[]) ssize_t n; rump_init(); - audiofd = rump_sys_open("/dev/audio0", O_RDWR); - if (audiofd == -1) - err(1, "open audio"); - padfd = rump_sys_open("/dev/pad0", O_RDONLY); if (padfd == -1) err(1, "open pad"); + audiofd = rump_sys_open("/dev/audio0", O_RDWR); + if (audiofd == -1) + err(1, "open audio"); + if ((n = rump_sys_write(audiofd, musa, sizeof(musa))) != sizeof(musa)) err(1, "write"); diff --git a/dev/audio/t_pad_output.bz2.uue b/dev/audio/t_pad_output.bz2.uue index e0cbf5226c24..969ad9c88a25 100644 --- a/dev/audio/t_pad_output.bz2.uue +++ b/dev/audio/t_pad_output.bz2.uue @@ -1,1035 +1,1040 @@ begin 644 t_pad_output.bz2 -M0EIH.3%!629369%IQ#X`MT#FU'+1O7<;MT;NYNNYW<[N[OO;K>W7+>^Y[M;[LV]??=M] -MYZ[MMMO>WO;6=W.KIOKNUF:EFEJVK5I"+:J;8:B5K1JJIJVUJV,K6IK5MJJ6 -M--%5FJLS55K158M5K:U5FU4RVMJ(K0BK-6Q0-L+6JVLJ6MK559M5556*M54J -MJMIMFS-"U6LJRUBRJJRV;55::M6U[G=0JI5-4W66J=KVZ]LNW=]W=FW=S;YM -MDO<]LW>Z[WW%E@WUOD-[G!SN<'=W$CD8@[KN<36:PVO=W;*I*E%4SC -MV]XE)5!54*"@*JJMH)J0H*`4&V4`!11(``!4BJI27O>Z(]5()`22)**%4``I -M0`!*B5`D(DB*5@:5``AH`"8F3"8`F0#3(Q,FF@#1H&(&C)H-#3330!ID,C`C -M!-,F)IIA`TQ-,!,33$831@@R9&$T`!,`@TD@FC$``````&@```:-`3`F$P0T -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 07:39:58 alnsn Exp $ # .include @@ -9,4 +9,16 @@ FILESDIR= ${TESTSDIR} TESTS_SH= t_cgd +.if ${MKCRYPTO} != "no" && ${MKRUMP} != "no" +TESTS_C= t_cgd_3des t_cgd_aes t_cgd_blowfish + +WARNS= 4 +CPPFLAGS+= -D_KERNTYPES +LDADD+= -lrumpdev -lrumpdev_disk -lrumpdev_cgd -lrumpkern_crypto -lrumpvfs +LDADD+= -lrump +LDADD+= -lrumpuser +LDADD+= -lrump -lutil +LDADD+= -lpthread +.endif + .include diff --git a/dev/cgd/t_cgd_3des.c b/dev/cgd/t_cgd_3des.c new file mode 100644 index 000000000000..91e81f45ec5e --- /dev/null +++ b/dev/cgd/t_cgd_3des.c @@ -0,0 +1,913 @@ +/* $NetBSD: t_cgd_3des.c,v 1.1 2016/11/11 07:39:58 alnsn Exp $ */ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alexander Nasonov. + * + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "../../h_macros.h" + +#define SECSIZE 512 + +struct testvec { + unsigned int blkno; + const uint8_t *ptxt; /* PlainText */ + const uint8_t *ctxt; /* CipherText */ +}; + +/* + * 192 bits CBC key, NUL terminated. + */ +static const char c3des_cbc_192_key[25] = { + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* ABCDEFGH */ + 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* IJKLMNOP */ + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* QRSTUVWX */ + 0 +}; + +static const uint8_t c3des_cbc_ptxt[SECSIZE] = + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop"; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec0_ctxt[SECSIZE] = { + 0x19, 0x92, 0xc8, 0xce, 0xdf, 0xa3, 0x14, 0xef, + 0xff, 0x88, 0x9f, 0x01, 0xfa, 0x6f, 0xfa, 0xa6, + 0xdd, 0x2b, 0x43, 0x67, 0xfa, 0xce, 0x37, 0x95, + 0x73, 0x4d, 0x18, 0x33, 0x0c, 0x29, 0x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a1, 0xf9, 0x2a, + 0xa6, 0xef, 0x7c, 0x72, 0x26, 0x4e, 0xd7, 0xdf, + 0xec, 0x3a, 0xbc, 0x8e, 0xe6, 0xb3, 0x2b, 0x43, + 0xcd, 0x67, 0x8b, 0x72, 0x00, 0x6f, 0xe5, 0x85, + 0xe2, 0x2a, 0x4c, 0x8d, 0x02, 0x44, 0x6b, 0x7a, + 0x89, 0x7a, 0x18, 0x3b, 0xc8, 0x9c, 0x8d, 0x60, + 0xec, 0x79, 0x58, 0x15, 0x98, 0x71, 0x4b, 0x1a, + 0x34, 0x69, 0x96, 0xd0, 0x0f, 0x01, 0x27, 0x2e, + 0x19, 0x02, 0xf0, 0x17, 0x8c, 0x89, 0xbf, 0x05, + 0xf0, 0xfe, 0xc3, 0xe6, 0x90, 0x9d, 0xa2, 0xb1, + 0x40, 0x06, 0x7e, 0xcd, 0x20, 0x7e, 0x5f, 0x54, + 0x31, 0xfb, 0x79, 0x84, 0x47, 0x38, 0x71, 0x69, + 0xe1, 0xd5, 0x4e, 0x84, 0xa3, 0x2b, 0x4a, 0x86, + 0xc2, 0x21, 0x5b, 0x15, 0xc3, 0x63, 0xbb, 0xc5, + 0x5c, 0xc1, 0xfb, 0x31, 0x3a, 0x4d, 0xb1, 0x9e, + 0xe1, 0xd8, 0x67, 0x4b, 0x08, 0x42, 0xc4, 0xe8, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec1_ctxt[SECSIZE] = { + 0x1d, 0x65, 0xdf, 0x01, 0x9b, 0x24, 0xa5, 0x10, + 0x94, 0x9a, 0x5b, 0x81, 0x96, 0x4e, 0xa3, 0x42, + 0x42, 0xd5, 0x05, 0x52, 0xab, 0x3c, 0x67, 0x40, + 0x79, 0xf9, 0x4b, 0x58, 0x39, 0xf6, 0xd0, 0x97, + 0x48, 0xf4, 0x77, 0xb8, 0xac, 0xe2, 0x10, 0x66, + 0xa8, 0x04, 0x0a, 0x1e, 0xa6, 0xbb, 0x4c, 0xd9, + 0x5d, 0x0c, 0x11, 0xb5, 0xe0, 0x26, 0x84, 0x50, + 0x10, 0x80, 0xbf, 0xd6, 0xdc, 0x82, 0x53, 0x0a, + 0xcf, 0xf6, 0xd3, 0x07, 0x45, 0xb0, 0x8e, 0x36, + 0x2e, 0x60, 0x0f, 0xd0, 0xc1, 0xb9, 0xd8, 0x29, + 0x6e, 0x13, 0x8e, 0xc1, 0xa8, 0x63, 0x20, 0xe0, + 0x8d, 0x47, 0x8b, 0xf9, 0xa0, 0x60, 0x55, 0x53, + 0x1d, 0xaf, 0x43, 0x46, 0xe5, 0x10, 0xd5, 0xcd, + 0x91, 0x9e, 0x11, 0x4a, 0x6f, 0x6a, 0x13, 0xdf, + 0xee, 0x7a, 0x88, 0xbe, 0x59, 0x96, 0xdb, 0x65, + 0x25, 0x57, 0x9e, 0x82, 0xad, 0xc2, 0xd6, 0x28, + 0x96, 0xb3, 0x7f, 0x57, 0x5d, 0xb2, 0xfa, 0x60, + 0x43, 0x22, 0xa5, 0x33, 0x14, 0x99, 0x8f, 0x68, + 0x5a, 0x7f, 0xaf, 0x9e, 0xe9, 0x23, 0x57, 0x9b, + 0x52, 0xe9, 0x20, 0x59, 0x26, 0x89, 0x9b, 0x59, + 0xb0, 0xee, 0xe8, 0x6d, 0x06, 0x8c, 0x01, 0xc2, + 0xea, 0xbc, 0x7d, 0x93, 0x3f, 0x79, 0x7f, 0xeb, + 0x57, 0xc9, 0x0a, 0xca, 0x37, 0x81, 0xa7, 0x82, + 0xde, 0x37, 0x7d, 0x69, 0x01, 0xaa, 0x19, 0x98, + 0x26, 0xfe, 0x06, 0x83, 0xeb, 0x9d, 0x26, 0xdc, + 0x04, 0x5d, 0xc9, 0x05, 0xee, 0x1a, 0xd3, 0xeb, + 0x20, 0x8c, 0xb7, 0x99, 0x75, 0xe0, 0x19, 0x98, + 0xca, 0x83, 0xae, 0x94, 0x28, 0xbf, 0x47, 0x42, + 0x92, 0x05, 0x8c, 0xa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0xef, + 0x8b, 0x26, 0x76, 0x41, 0x28, 0x87, 0xf4, 0x51, + 0x14, 0x36, 0xad, 0x60, 0x8d, 0xe9, 0xe2, 0x9d, + 0x3c, 0xea, 0x09, 0x51, 0x3c, 0x81, 0xdf, 0x1a, + 0xc2, 0xc2, 0xf6, 0x45, 0xe1, 0x73, 0xac, 0xae, + 0x85, 0x74, 0x83, 0x8f, 0x56, 0x3c, 0x36, 0x1c, + 0xe0, 0x07, 0xc6, 0x6a, 0x48, 0xe4, 0x34, 0xe9, + 0x81, 0x53, 0xb7, 0x53, 0x95, 0xa7, 0x94, 0x21, + 0x7e, 0x32, 0x53, 0xda, 0x83, 0xd8, 0x57, 0x92, + 0xd1, 0x15, 0x45, 0x86, 0x40, 0xac, 0xf1, 0x6f, + 0x3c, 0x29, 0xef, 0x8d, 0x12, 0xe1, 0x9d, 0x04, + 0x17, 0x3a, 0xcc, 0xa6, 0xc5, 0xe4, 0x27, 0x41, + 0xcb, 0xfb, 0x5e, 0x77, 0x73, 0x5a, 0x2c, 0x03, + 0xe9, 0x2b, 0x76, 0x4e, 0x69, 0xea, 0xcb, 0xb3, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec2_ctxt[SECSIZE] = { + 0x87, 0xb1, 0x3c, 0xd6, 0x60, 0xa0, 0x5a, 0x35, + 0xf7, 0xe1, 0x6b, 0x87, 0xa0, 0x90, 0x2f, 0xc7, + 0x8c, 0xed, 0x53, 0xda, 0x93, 0x32, 0x78, 0x5d, + 0x24, 0x23, 0x42, 0xdd, 0x93, 0x5b, 0x2e, 0x40, + 0xa1, 0xb1, 0x3b, 0xbb, 0xf0, 0x50, 0xb4, 0x61, + 0xea, 0x15, 0x37, 0xf3, 0x49, 0xe1, 0xa0, 0x32, + 0x88, 0x85, 0x81, 0xfd, 0xb7, 0x96, 0xd7, 0x9d, + 0xd7, 0x29, 0x4b, 0x14, 0xf9, 0x18, 0x6a, 0xf6, + 0x46, 0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x80, 0xca, 0x2e, + 0xf3, 0xca, 0x1e, 0xa4, 0x62, 0x07, 0x22, 0x10, + 0x11, 0x6a, 0x57, 0x28, 0x45, 0x80, 0xdf, 0x34, + 0x88, 0xe5, 0xf1, 0x23, 0xe0, 0xb6, 0x44, 0x51, + 0x54, 0xd8, 0xb3, 0x66, 0xac, 0x46, 0x4d, 0xdf, + 0xa2, 0x8e, 0x72, 0x3a, 0x1c, 0x87, 0x2a, 0x43, + 0xfe, 0xdb, 0x00, 0xff, 0xb7, 0x1c, 0x13, 0xc3, + 0x18, 0xfc, 0x71, 0x13, 0xe3, 0xd1, 0x1f, 0xde, + 0x16, 0x63, 0x73, 0xf5, 0x0e, 0xf7, 0x18, 0xe5, + 0x48, 0x8d, 0x30, 0xd9, 0x26, 0x20, 0x6d, 0xa1, + 0xba, 0xde, 0xe8, 0x7d, 0x77, 0x02, 0x33, 0x0d, + 0x73, 0xb2, 0xab, 0x35, 0xfd, 0xa5, 0x6e, 0x4c, + 0x5c, 0x27, 0xc7, 0x7e, 0x4a, 0x28, 0xf8, 0xf5, + 0x00, 0xbe, 0x4c, 0xd7, 0x2c, 0x27, 0x83, 0x16, + 0x37, 0xda, 0x0c, 0xb1, 0xd7, 0x89, 0xd8, 0x8f, + 0x17, 0x69, 0x1b, 0x6b, 0x48, 0x2b, 0xce, 0x9c, + 0xbd, 0xf4, 0x0d, 0xb5, 0x4d, 0x12, 0x11, 0x36, + 0x49, 0xd3, 0x8b, 0x52, 0xce, 0x7e, 0x47, 0xb0, + 0xb5, 0x54, 0x77, 0xef, 0x90, 0xb8, 0x0e, 0xaf, + 0x6f, 0x97, 0x88, 0xde, 0x6b, 0x37, 0x24, 0xdd, + 0x91, 0x84, 0x00, 0x51, 0xab, 0x06, 0x96, 0x3c, + 0x82, 0x73, 0xcf, 0xae, 0x8d, 0x23, 0x86, 0x59, + 0x62, 0x5b, 0xeb, 0x2a, 0xaf, 0x40, 0x17, 0xed, + 0x2b, 0x60, 0x73, 0x7d, 0x99, 0x95, 0x3f, 0xd6, + 0x6c, 0xca, 0x1e, 0xf3, 0xb0, 0xcd, 0xd5, 0x1d, + 0x53, 0xe0, 0xd2, 0x8b, 0x57, 0x7b, 0xac, 0x67, + 0x5a, 0x5a, 0x0a, 0x64, 0x82, 0xab, 0x8f, 0x5a, + 0x36, 0xe2, 0x45, 0x50, 0xec, 0x3e, 0x14, 0x80, + 0x7c, 0xfd, 0x0c, 0xa9, 0x94, 0xfb, 0xfe, 0x72, + 0xec, 0x47, 0x71, 0x2e, 0x90, 0x97, 0xf6, 0x33, + 0xbd, 0x7d, 0x7e, 0x77, 0x8f, 0xad, 0xd4, 0x1d, + 0x1d, 0x53, 0x0f, 0x28, 0x39, 0x77, 0x06, 0x1a, + 0x75, 0xfc, 0x12, 0xe6, 0x45, 0xfc, 0x87, 0xe1, + 0x46, 0xac, 0xb0, 0x73, 0xca, 0x24, 0x7c, 0x71, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t c3des_cbc_192_encblkno1_vec3_ctxt[SECSIZE] = { + 0xb1, 0xef, 0x7c, 0xd0, 0xa0, 0x6b, 0xe4, 0x88, + 0x5c, 0xd7, 0xf1, 0xbf, 0x5f, 0xce, 0xda, 0x19, + 0x81, 0x32, 0xbb, 0x96, 0x7e, 0xb9, 0x6e, 0xa1, + 0x43, 0xde, 0x53, 0x66, 0x9c, 0x27, 0x94, 0x85, + 0xcb, 0x09, 0x4e, 0x16, 0xd8, 0x60, 0x7a, 0x38, + 0x27, 0x21, 0x4d, 0x08, 0xaa, 0xe2, 0x1e, 0x6e, + 0xa3, 0xcb, 0x9a, 0x7f, 0xd1, 0xbf, 0x18, 0x36, + 0x5a, 0x4d, 0x7a, 0x7f, 0xcf, 0x3f, 0xba, 0xa5, + 0x77, 0x5b, 0xb4, 0x79, 0xdc, 0xbf, 0x2a, 0x28, + 0x16, 0x27, 0x0f, 0x8b, 0xd7, 0x95, 0xc3, 0xcb, + 0xa1, 0x6a, 0x49, 0x53,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 0x0d, 0x6c, 0xf7, 0x5e, 0xe2, 0xf9, 0xb3, 0x80, + 0x8f, 0x03, 0x67, 0x68, 0x6e, 0x4b, 0x4d, 0x52, + 0xbc, 0x9b, 0xa2, 0xd8, 0x29, 0x1e, 0x5c, 0xd7, + 0x59, 0x67, 0x94, 0x40, 0x9e, 0x08, 0x15, 0x0d, + 0x7e, 0xc9, 0x14, 0x53, 0xa8, 0x67, 0xb3, 0xb8, + 0xaa, 0x21, 0x0f, 0x79, 0x69, 0x48, 0x52, 0xea, + 0x56, 0x03, 0x7b, 0x55, 0xb7, 0xf3, 0xfe, 0xb1, + 0x8a, 0x22, 0x7d, 0x75, 0x55, 0x31, 0xad, 0x20, + 0x6a, 0xc2, 0xa4, 0xd1, 0x1e, 0xab, 0xdd, 0x29, + 0xb5, 0xf8, 0xdd, 0x9b, 0x1a, 0xb8, 0xe7, 0xde, + 0xae, 0xa1, 0xab, 0xbb, 0xf6, 0x00, 0x87, 0xc4, + 0x29, 0xee, 0x2b, 0xa1, 0xa9, 0x1a, 0x46, 0x05, + 0x5a, 0x12, 0x3f, 0x32, 0x81, 0x25, 0x20, 0x71, + 0xb6, 0xfa, 0x1f, 0x27, 0x2a, 0x33, 0x49, 0xfc, + 0x95, 0x00, 0x72, 0x6b, 0x03, 0x53, 0x94, 0x57, + 0x2f, 0x47, 0x3d, 0x2d, 0x7c, 0xb4, 0xde, 0xa7, + 0x96, 0x81, 0x12, 0xff, 0x2c, 0xec, 0x5c, 0x03, + 0x2a, 0x8c, 0x76, 0xc4, 0xed, 0x09, 0xe6, 0x00, + 0x28, 0xdb, 0x9b, 0x44, 0xb0, 0xb4, 0x7b, 0x57, + 0x3b, 0xb6, 0x4f, 0x0b, 0xff, 0xf2, 0xf5, 0x02, + 0x56, 0xcf, 0xd5, 0xbf, 0x71, 0xe6, 0x66, 0xf3, + 0x08, 0x8e, 0x8b, 0x15, 0x57, 0x07, 0x41, 0xa3, + 0x91, 0xc1, 0xe4, 0x64, 0x92, 0x89, 0xed, 0x22, + 0x88, 0x8f, 0x17, 0x91, 0xde, 0xea, 0x0c, 0xa6, + 0x86, 0x8e, 0x4c, 0xd9, 0x63, 0xc9, 0xe5, 0xdc, + 0xd6, 0xd3, 0x7b, 0x2b, 0x65, 0xfa, 0x36, 0x47, + 0x20, 0xa4, 0xe7, 0x0b, 0x52, 0xfa, 0xa6, 0xeb, + 0x1d, 0x20, 0xd0, 0x4b, 0xfd, 0x88, 0x8c, 0xbb, + 0x52, 0x9c, 0x2f, 0xb7, 0xba, 0x8b, 0xdd, 0x10, + 0x2d, 0x7d, 0x77, 0x79, 0x40, 0xa7, 0xed, 0xf9, + 0xbd, 0x2a, 0x55, 0x1f, 0x87, 0x1e, 0x3c, 0xfc, +}; + +const struct testvec c3des_cbc_192_1_vectors[] = { + { + .blkno = 0, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec0_ctxt[SECSIZE] = { + 0x9e, 0x5d, 0x35, 0x56, 0xa7, 0xcc, 0xc0, 0x1c, + 0x60, 0x4c, 0x42, 0x90, 0x35, 0xf3, 0xc1, 0x20, + 0xf2, 0x07, 0x6f, 0xf8, 0x7c, 0x33, 0x6a, 0x74, + 0xdc, 0x85, 0xbc, 0x9c, 0xa2, 0x29, 0xc6, 0x69, + 0x0e, 0xef, 0x0f, 0xa9, 0x6e, 0xec, 0xf2, 0x23, + 0x2f, 0x9a, 0xbe, 0x1a, 0x89, 0x22, 0x00, 0xc4, + 0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80, 0xf8, 0xc5, 0x22, + 0x5f, 0x53, 0xed, 0x03, 0xfe, 0x09, 0x2c, 0x9d, + 0xb6, 0x61, 0x4a, 0xbb, 0x07, 0x5d, 0xbd, 0x68, + 0x74, 0xab, 0x02, 0x81, 0x64, 0x7b, 0x97, 0xa3, + 0xad, 0x15, 0x99, 0x7a, 0x04, 0x33, 0xbd, 0x50, + 0x94, 0x11, 0xcc, 0xf7, 0x8b, 0x77, 0x88, 0x78, + 0x80, 0xfe, 0x5f, 0xa1, 0x63, 0xbc, 0xb0, 0x65, + 0xcb, 0x9d, 0x4c, 0xfe, 0x66, 0x4e, 0xff, 0xe3, + 0x43, 0x61, 0x99, 0x88, 0x88, 0x4c, 0xbc, 0x8a, + 0xf1, 0x69, 0x00, 0xc2, 0xe5, 0xb9, 0x65, 0x8b, + 0x10, 0xdf, 0x38, 0x3e, 0x9e, 0x9f, 0x87, 0xed, + 0x84, 0x71, 0xe7, 0xf2, 0xb5, 0xb6, 0x11, 0xed, + 0x1e, 0xd4, 0xc0, 0x6d, 0x77, 0x08, 0x4b, 0xfd, + 0x95, 0xd5, 0xc0, 0xbe, 0xa6, 0xcc, 0x3b, 0xea, + 0x11, 0x38, 0xa5, 0x59, 0x36, 0x2a, 0xf4, 0x98, + 0x52, 0x9d, 0x3b, 0x8c, 0x8a, 0x19, 0xbd, 0xfb, + 0x49, 0xcb, 0xb0, 0x57, 0x91, 0xc7, 0xf8, 0x2a, + 0x89, 0xa8, 0x85, 0x03, 0xdf, 0x6e, 0xad, 0xf4, + 0x8a, 0x88, 0x9a, 0x2b, 0x5d, 0xe8, 0xca, 0xa9, + 0x8f, 0x18, 0xa3, 0x6a, 0x37, 0x84, 0xa9, 0x24, + 0x5b, 0xce, 0xd6, 0xbe, 0x7e, 0x40, 0x86, 0x6a, + 0xc3, 0x47, 0x28, 0x66, 0xf0, 0x8c, 0x2d, 0x69, + 0x22, 0x64, 0x61, 0x36, 0x6a, 0x0c, 0xc4, 0x18, + 0x5f, 0xd7, 0xff, 0xbc, 0xf1, 0x94, 0x16, 0xfb, + 0x26, 0xa7, 0x80, 0xa4, 0x2d, 0x72, 0xc6, 0x9d, + 0xa7, 0xed, 0x04, 0x13, 0x0f, 0xe7, 0xf8, 0x93, + 0x57, 0x6b, 0xd5, 0xa4, 0xad, 0x9a, 0x97, 0xeb, + 0x97, 0xe7, 0x60, 0x01, 0x89, 0x3f, 0x88, 0xf2, + 0xee, 0xf3, 0x79, 0xd6, 0x5a, 0x03, 0x94, 0x07, + 0xd3, 0x33, 0xc8, 0xda, 0x15, 0x17, 0x0a, 0x8f, + 0xbd, 0x58, 0x1b, 0xfe, 0x3d, 0x77, 0x5d, 0x8f, + 0x4e, 0x0e, 0x98, 0x7d, 0x02, 0x63, 0x94, 0x73, + 0x4a, 0x58, 0x47, 0xed, 0x52, 0xfc, 0x85, 0x19, + 0x5d, 0x2f, 0xfa, 0x07, 0x44, 0xbd, 0x8e, 0xcb, + 0x20, 0x63, 0x9d, 0x2b, 0x61, 0x5c, 0x19, 0x71, + 0x80, 0xe5, 0x25, 0x5b, 0x2e, 0xc5, 0xfe, 0x1a, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec1_ctxt[SECSIZE] = { + 0xf4, 0xb0, 0xb0, 0xcb, 0x79, 0xcc, 0x8c, 0x0a, + 0x3b, 0xc7, 0x43, 0x4e, 0x62, 0x9d, 0xde, 0xb4, + 0xab, 0xa5, 0x62, 0x63, 0x32, 0xa7, 0x18, 0x2b, + 0xe3, 0xee, 0x44, 0xc6, 0x6f, 0xb2, 0xdc, 0x21, + 0xc5, 0xc8, 0x9e, 0x32, 0x71, 0x4c, 0x7a, 0x82, + 0x8d, 0xe0, 0xad, 0x91, 0x88, 0x0c, 0x41, 0x83, + 0x28, 0x0d, 0xed, 0xa7, 0xeb, 0x48, 0xb1, 0x31, + 0xfa, 0x40, 0xd9, 0x44, 0x19, 0xee, 0x8d, 0x2c, + 0x7d, 0xe2, 0x39, 0xa0, 0x39, 0xaa, 0x86, 0xab, + 0xb5, 0x68, 0xe5, 0x83, 0x06, 0x61, 0xec, 0xe6, + 0xc2, 0x85, 0xb2, 0x46, 0xf4, 0x5b, 0x0e, 0x34, + 0x7e, 0x0c, 0xa0, 0xda, 0xef, 0x58, 0x9c, 0x39, + 0x95, 0xa2, 0xca, 0xd3, 0x3b, 0x4d, 0x76, 0xe3, + 0x34, 0x6d, 0x08, 0xa4, 0xba, 0x88, 0x58, 0x39, + 0xb4, 0xe4, 0x6b, 0xb6, 0x32, 0x50, 0x2c, 0xe2, + 0x0a, 0x37, 0xbc, 0x98, 0x38, 0x32, 0x17, 0x1b, + 0x12, 0xef, 0xdc, 0x9d, 0x91, 0x09, 0x8e, 0xd8, + 0xc3, 0xf8, 0x7b, 0x35, 0x41, 0x3b, 0xf8, 0xf5, + 0x37, 0x48, 0x04, 0xf7, 0x94, 0xbf, 0x54, 0x8d, + 0x79, 0x49, 0x8f, 0xf0, 0x3f, 0xb7, 0x90, 0x76, + 0x14, 0x09, 0xc6, 0x8c, 0xba, 0x1a, 0x30, 0x1b, + 0xbb, 0xd9, 0xe2, 0xb5, 0xe8, 0xd9, 0x9b, 0x68, + 0x60, 0x90, 0xd3, 0x4a, 0xe8, 0x65, 0x7b, 0xaa, + 0xb0, 0xda, 0x69, 0x1d, 0x45, 0x78, 0x2c, 0x3b, + 0x59, 0x29, 0x3c, 0x26, 0x9a, 0xd2, 0xa5, 0xfd, + 0xb7, 0x16, 0x59, 0x7c, 0x46, 0xea, 0x99, 0xd0, + 0x06, 0x01, 0x3f, 0xd2, 0x23, 0xcc, 0xde, 0xb8, + 0xaa, 0x88, 0x17, 0x03, 0xe1, 0x48, 0x2c, 0xdd, + 0xce, 0xd1, 0x2c, 0xce, 0x37, 0xee, 0xe6, 0xa6, + 0x47, 0x8c, 0x07, 0xe5, 0xfe, 0x01, 0xc6, 0x27, + 0xfe, 0x3f, 0x9d, 0x30, 0x18, 0x36, 0xe7,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, 0x76, 0xc1, 0x4e, 0x85, 0x77, + 0xbc, 0x30, 0x32, 0x56, 0x0a, 0x5b, 0x1c, 0xd0, + 0xf6, 0x47, 0x48, 0x22, 0xf4, 0x6e, 0x38, 0xc5, + 0xab, 0xe2, 0xd0, 0x4d, 0x40, 0x27, 0xab, 0x8f, + 0x43, 0xb1, 0x60, 0x29, 0x07, 0xd0, 0xf5, 0x25, + 0xe5, 0xfa, 0xe7, 0x46, 0x32, 0x37, 0xb9, 0xae, + 0x2e, 0x02, 0x8c, 0x94, 0x15, 0x69, 0xd6, 0x74, + 0xb4, 0x36, 0xdd, 0x94, 0x70, 0xa7, 0x16, 0x7b, + 0x4c, 0xd3, 0x48, 0x83, 0xc5, 0xb2, 0xb0, 0x6a, + 0xfe, 0x7e, 0xd4, 0xe5, 0x6d, 0xa5, 0x96, 0x20, + 0x08, 0x59, 0xbd, 0x0c, 0x3d, 0x55, 0xa5, 0x03, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec2_ctxt[SECSIZE] = { + 0xea, 0x7c, 0x8c, 0x8e, 0x3e, 0x61, 0x34, 0x3d, + 0xe0, 0x7f, 0xd3, 0xe1, 0x3a, 0xb9, 0xc8, 0xf2, + 0x98, 0xdc, 0x59, 0x26, 0xd2, 0xd8, 0xa7, 0x7f, + 0x41, 0x98, 0x24, 0xa8, 0x28, 0x0c, 0x88, 0x55, + 0x91, 0xdb, 0x29, 0x17, 0x70, 0xd7, 0x03, 0xff, + 0xbd, 0x0e, 0xbf, 0xf8, 0x73, 0x92, 0x19, 0xe9, + 0x92, 0x67, 0xdb, 0x08, 0x94, 0x77, 0x71, 0x2d, + 0x00, 0xad, 0x26, 0x42, 0x2d, 0xac, 0x8c, 0x67, + 0x6f, 0xb3, 0x8e, 0x36, 0x22, 0xeb, 0x1f, 0x8c, + 0xd4, 0x9b, 0x9f, 0xa6, 0xa9, 0xb1, 0x52, 0x65, + 0x9a, 0xfe, 0xcc, 0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d, + 0xae, 0x79, 0x28, 0x72, 0xe7, 0x54, 0xc4, 0x08, + 0xd3, 0xd2, 0xac, 0x96, 0xd0, 0x0f, 0x9b, 0x68, + 0x7d, 0x3f, 0xc2, 0xdd, 0x3d, 0xfc, 0xca, 0xcd, + 0x11, 0x71, 0xd9, 0x48, 0x53, 0x9f, 0xd3, 0x79, + 0x7d, 0x47, 0x71, 0x2a, 0x6d, 0x9e, 0xa9, 0x47, + 0xa1, 0xf7, 0x97, 0x80, 0x83, 0x70, 0x6b, 0xfe, + 0x10, 0x11, 0x6a, 0x0e, 0xdd, 0xde, 0x22, 0x3c, + 0x19, 0x30, 0x73, 0x73, 0x2e, 0x4b, 0x54, 0x17, + 0xc3, 0x2e, 0xe9, 0xce, 0xe0, 0xe3, 0xa0, 0x1a, + 0x28, 0xd1, 0x50, 0xa8, 0xd2, 0x40, 0xe2, 0x1b, + 0xfa, 0x49, 0x06, 0x49, 0x8b, 0x4b, 0xd9, 0xd5, + 0xf5, 0x50, 0xae, 0x64, 0x19, 0xe1, 0xd9, 0x4e, + 0xbb, 0x29, 0x70, 0x66, 0x46, 0xa8, 0x7e, 0x5b, + 0xdc, 0xe2, 0xd5, 0x9d, 0x56, 0x6d, 0x4c, 0xe6, + 0x0e, 0x6b, 0x71, 0x40, 0x82, 0xf7, 0xb3, 0xad, + 0x23, 0x17, 0xe3, 0x1c, 0x61, 0x1d, 0x3b, 0x71, + 0xfc, 0x06, 0x17, 0xec, 0x6c, 0x77, 0x98, 0x27, + 0xc7, 0x4b, 0x65, 0x17, 0x81, 0xe7, 0xcb, 0xce, + 0x09, 0x76, 0x82, 0x82, 0x4a, 0x53, 0x67, 0xa0, + 0x05, 0x25, 0x4c, 0xc4, 0xa7, 0xad, 0xa7, 0xaf, + 0xa0, 0x11, 0xd7, 0x73, 0x3b, 0x30, 0xbf, 0x53, + 0x50, 0x9b, 0xd8, 0xf3, 0x32, 0x15, 0xdd, 0x36, + 0x88, 0xc2, 0x39, 0x51, 0xb6, 0xb8, 0x0d, 0x5c, + 0x20, 0x4e, 0x24, 0xee, 0x95, 0x32, 0x61, 0x25, + 0xda, 0x73, 0x0d, 0x8a, 0x58, 0xe6, 0xcc, 0xad, + 0x79, 0x3d, 0xef, 0x29, 0x0c, 0x9f, 0xe1, 0xa7, + 0x22, 0x1e, 0xea, 0x7a, 0x4f, 0xfb, 0xc1, 0x1f, + 0x17, 0xca, 0x69, 0xd6, 0xa4, 0xce, 0x6e, 0xc0, + 0x70, 0xa3, 0x08, 0x32, 0x87, 0xb4, 0x6b, 0x80, + 0x5c, 0x7f, 0x88, 0x5c, 0xbf, 0x07, 0xd8, 0xe9, + 0xdd, 0xd2, 0x76, 0xa9, 0xaa, 0xd9, 0x55, 0x48, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t c3des_cbc_192_encblkno8_vec3_ctxt[SECSIZE] = { + 0xf3, 0x49, 0xda, 0x5c, 0xde, 0x9d, 0x3e, 0x9d, + 0xb9, 0xc2, 0x6e, 0x96, 0xa9, 0x93, 0x10, 0x73, + 0x0e, 0x26, 0x39, 0xd6, 0x9f, 0x04, 0x5f, 0x69, + 0x54, 0xa3, 0x7c, 0x46, 0x7b, 0x18, 0x93, 0xc0, + 0xbb, 0x0c, 0x96, 0x6f, 0xb0, 0xbf, 0xce, 0x67, + 0x33, 0x3e, 0x56, 0xe8, 0x6b, 0x4d, 0x3f, 0xc8, + 0x3c, 0xc6, 0x89, 0x2c, 0x0b, 0x95, 0x3a, 0xaf, + 0xc0, 0xf3, 0x1f, 0x0e, 0x07, 0x01, 0xa6, 0x35, + 0x19, 0x79, 0x91, 0x24, 0xaa, 0x0d, 0xf0, 0x53, + 0x27, 0x7d, 0xbb, 0xa6, 0xb6, 0x44, 0x31, 0x4b, + 0xd4, 0xcf, 0xf6, 0x6d, 0x18, 0xa2, 0x28, 0x8a, + 0xc1, 0x0a, 0xbe, 0x57, 0x0c, 0x61, 0x5f, 0xd9, + 0x12, 0x14, 0xfe, 0xe2, 0xc7, 0x10, 0x72, 0xee, + 0x19, 0xb8, 0x16, 0x0b, 0x88, 0x87, 0xce, 0xf3, + 0xfe, 0x57, 0x37, 0xd1, 0xa2, 0xf7, 0xd0, 0x5e, + 0x73, 0xde, 0x39, 0x35, 0xbc, 0xde, 0xed, 0x61, + 0x4b, 0x31, 0xdc, 0xfe, 0x3c, 0x4d, 0x98, 0xa9, + 0x36, 0xb0, 0x34, 0x5b, 0xb4, 0xb7, 0x79, 0x25, + 0x6e, 0x24, 0x7e, 0x10, 0xfe, 0x20, 0xd5, 0x16, + 0x86, 0xaf, 0xcd, 0x26, 0x34, 0xd3, 0x2e, 0xdc, + 0x7c, 0x69, 0xe3, 0xc5, 0x62, 0x0c, 0xba, 0x29, + 0x9c, 0x4b, 0x2f, 0x39, 0x45, 0xe1, 0xcf, 0xc5, + 0xfe, 0x35, 0xb6, 0x2f, 0xb1, 0x1a, 0x90, 0xe1, + 0xa7, 0x39, 0xe8, 0x1e, 0x5f, 0xac, 0xab, 0x1e, + 0x32, 0xba, 0xc5, 0x92, 0x39, 0x62, 0x37, 0x2c, + 0x49, 0xf1, 0x62, 0x90, 0xf7, 0x1e, 0x10, 0xce, + 0x8e, 0x95, 0xa3, 0xc6, 0xd8, 0xe5, 0xc8, 0xdf, + 0xcc, 0x94, 0x7d, 0x26, 0xab, 0x29, 0xbb, 0x9d, + 0xf3, 0x73, 0xce, 0xac, 0x76, 0xdf, 0x75, 0x2a, + 0x3e, 0x8f, 0x47, 0xff, 0x76, 0xfe, 0xea, 0xd4, + 0x4a, 0xa9, 0x36, 0x9d, 0x12, 0x45, 0xb7, 0x99, + 0x81, 0xb6, 0x77, 0x98, 0x13, 0xfb, 0x5a, 0xe5, + 0x40, 0x87, 0x61, 0x0d, 0x10, 0x76, 0xf6, 0x3e, + 0x48, 0xac, 0xc4, 0x27, 0x87, 0xcd, 0x07, 0xde, + 0x0b, 0x23, 0x97, 0x61, 0x3d, 0x18, 0x64, 0x7f, + 0xbf, 0xd6, 0x87, 0xc1, 0x11, 0xfb, 0xf9, 0xda, + 0x14, 0xa1, 0x01, 0xf8, 0x7e, 0xea, 0x5b, 0x5b, + 0xdd, 0x09, 0xf9, 0x31, 0x80, 0x3c, 0xee, 0x34, + 0x2d, 0xda, 0x71, 0xd9, 0x32, 0x7d, 0x45, 0xb2, + 0x53, 0xea, 0xd5, 0x7c, 0x85, 0x45, 0xce, 0x1d, + 0x2b, 0xe9, 0xd7, 0x95, 0xf8, 0x8c, 0x08, 0xe4, + 0xd0, 0x2f, 0x60, 0x75, 0x02, 0xf3, 0xde, 0xeb, + 0x46, 0x40, 0xa8, 0xd2, 0x37, 0xd6, 0xca, 0x5d, + 0xb9, 0xf4, 0x51, 0x31, 0x8a, 0x1a, 0x82, 0xbd, + 0x6f, 0x6d, 0x88, 0x2b, 0x63, 0x0f, 0xe1, 0xf0, + 0xcf, 0x13, 0x79, 0x1d, 0x78, 0x82, 0x66, 0xa1, + 0xef, 0xdb, 0x34, 0x50, 0xd2, 0x71, 0x47, 0x49, + 0x41, 0x74, 0xd9, 0x0b, 0x14, 0x38, 0x1f, 0xc3, + 0x09, 0x4d, 0xb3, 0xa6, 0x03, 0x3f, 0x56, 0x67, + 0xd7, 0x51, 0x4c, 0x8a, 0x1d, 0x37, 0x99, 0xfb, + 0xe1, 0x84, 0x57, 0x55, 0x9b, 0xf8, 0x73, 0x63, + 0x68, 0x73, 0x89, 0x52, 0x06, 0xe7, 0x34, 0xe7, + 0x1a, 0x15, 0x7e, 0xd9, 0x84, 0xa3, 0x0e, 0x68, + 0x14, 0x1c, 0xe8, 0x23, 0x9e, 0xe3, 0x8f, 0x71, + 0x02, 0x9b, 0x87, 0xd4, 0xd9, 0x1b, 0xd1, 0x9e, + 0x9e, 0xa0, 0x7e, 0x49, 0x8e, 0xaa, 0x89, 0xb5, + 0x16, 0x48, 0x07, 0xb3, 0x3d, 0x9e, 0x4c, 0x35, + 0x3e, 0x94, 0xa9, 0xf8, 0x82, 0x50, 0x6a, 0x41, + 0x28, 0x3e, 0x9f, 0x9a, 0x1a, 0x5d, 0x02, 0x7c, + 0xd0, 0x32, 0x52, 0xa5, 0xee, 0x09, 0x27, 0x2d, + 0x49, 0x17, 0xf7, 0x92, 0xa1, 0x63, 0x9d, 0x2a, + 0xfd, 0x53, 0x26, 0x14, 0x7c, 0x92, 0x72, 0xa6, + 0x38, 0x18, 0x8f, 0xb5, 0x54, 0xb3, 0x69, 0x63, + 0x6a, 0xdc, 0xb1, 0x5a, 0x12, 0x7a, 0x0b, 0xa3, +}; + +const struct testvec c3des_cbc_192_8_vectors[] = { + { + .blkno = 0, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = c3des_cbc_ptxt, + .ctxt = c3des_cbc_192_encblkno8_vec3_ctxt, + }, +}; + +static int +open_disk(const char *devpath, const char *imgpath, size_t size) +{ + int fd; + + fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600); + if (fd < 0) + return -1; + + if (ftruncate(fd, size) < 0) + goto fail; + + if (rump_pub_etfs_register_withsize(devpath, + imgpath, RUMP_ETFS_BLK, 0, size) < 0) { + goto fail; + } + + unlink(imgpath); + return fd; +fail: + close(fd); + unlink(imgpath); + return -1; +} + +static int +open_cgd(int devno) +{ + char devpath[32]; + + sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a'); + + return rump_sys_open(devpath, O_RDWR, 0); +} + +static int +configure_cgd(int fd, const char *dkpath, const char *alg, + const char *ivmethod, const char *key, size_t keylen) +{ + struct cgd_ioctl ci; + + memset(&ci, 0, sizeof(ci)); + ci.ci_disk = dkpath; + ci.ci_alg = alg; + ci.ci_ivmethod = ivmethod; + ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */ + ci.ci_key = key; + ci.ci_blocksize = 64; + + return rump_sys_ioctl(fd, CGDIOCSET, &ci); +} + +static int +unconfigure_cgd(int fd) +{ + struct cgd_ioctl ci; + + return rump_sys_ioctl(fd, CGDIOCCLR, &ci); +} + +static int +write_testvec(int cgdfd, const struct testvec *tv) +{ + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + return -1; + + if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE) + return -1; + + return 0; +} + +static int +read_testvec(int cgdfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ptxt, SECSIZE); +fail: + free(buf); + return res; +} + +static int +check_testvec(int dkfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (read(dkfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ctxt, SECSIZE); +fail: + free(buf); + return res; +} + +ATF_TC(cgd_3des_cbc_192_encblkno1); +ATF_TC_HEAD(cgd_3des_cbc_192_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test 3des-cbc with 192 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_3des_cbc_192_encblkno1, tc) +{ + const char imgpath[] = "3des-cbc-192-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno1", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_3des_cbc_192_encblkno8); +ATF_TC_HEAD(cgd_3des_cbc_192_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test 3des-cbc with 192 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_3des_cbc_192_encblkno8, tc) +{ + const char imgpath[] = "3des-cbc-192-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "3des-cbc", "encblkno8", + c3des_cbc_192_key, sizeof(c3des_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &c3des_cbc_192_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &c3des_cbc_192_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno1); + ATF_TP_ADD_TC(tp, cgd_3des_cbc_192_encblkno8); + + return atf_no_error(); +} diff --git a/dev/cgd/t_cgd_aes.c b/dev/cgd/t_cgd_aes.c new file mode 100644 index 000000000000..9416333a2d71 --- /dev/null +++ b/dev/cgd/t_cgd_aes.c @@ -0,0 +1,3606 @@ +/* $NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $ */ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alexander Nasonov. + * + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "../../h_macros.h" + +#define SECSIZE 512 + +struct testvec { + unsigned int blkno; + const uint8_t *ptxt; /* PlainText */ + const uint8_t *ctxt; /* CipherText */ +}; + +/* + * 128 bits CBC key, NUL terminated. + */ +static const char aes_cbc_128_key[17] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0 +}; + +/* + * 192 bits CBC key, NUL terminated. + */ +static const char aes_cbc_192_key[25] = { + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, /* ABCDEFGH */ + 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* IJKLMNOP */ + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* QRSTUVWX */ + 0 +}; + +/* + * 256 bits CBC key, NUL terminated. + */ +static const char aes_cbc_256_key[33] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, /* 89abcdef */ + 0 +}; + +static const uint8_t aes_cbc_ptxt[SECSIZE] = + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop"; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t aes_cbc_128_encblkno1_vec0_ctxt[SECSIZE] = { + 0x1e, 0x95, 0x12, 0x15, 0xf6, 0xe0, 0xa7, 0x56, + 0x95, 0xa0, 0xa7, 0x35, 0x77, 0xf4, 0xdd, 0xdc, + 0x37, 0xc0, 0x28, 0x20, 0x00, 0x79, 0xa0, 0x35, + 0xe0, 0x83, 0x23, 0x95, 0x4e, 0xea, 0x8d, 0xa2, + 0x11, 0xbf, 0x9a, 0xd5, 0x21, 0x1e, 0x15, 0xb9, + 0xd1, 0x2e, 0xd2, 0xd9, 0xa5, 0xcc, 0x26, 0x75, + 0xba, 0x3e, 0x30, 0x11, 0xb2, 0x40, 0xdd, 0x1d, + 0x07, 0x3b, 0xe6, 0x00, 0xa7, 0x31, 0x9e, 0x58, + 0x41, 0xf3, 0x02, 0xf5, 0xad, 0x35, 0x79, 0x9a, + 0x9e, 0x03, 0xc8, 0x7a, 0x9d, 0x1d, 0x58, 0x9f, + 0x98, 0x67, 0xe2, 0x49, 0x81, 0x0c, 0x23, 0x90, + 0xd8, 0xc6, 0xf0, 0xc5, 0x73, 0x46, 0xd5, 0x14, + 0x1d, 0x78, 0x24, 0x7c, 0x9f, 0x5c, 0x8c, 0xe6, + 0x5d, 0x85, 0x7a, 0x5f, 0x76, 0xcc, 0xd8, 0xe9, + 0x03, 0xff, 0xfd, 0xd4, 0x12, 0x3f, 0xcb, 0xb0, + 0xfe, 0xfd, 0x86, 0x00, 0x0c, 0xe3, 0xdd, 0xa6, + 0x89, 0x92, 0xfe, 0xc8, 0x07, 0x5a, 0x94, 0x55, + 0x75, 0xae, 0x68, 0x47, 0xba, 0x84, 0x75, 0x58, + 0x33, 0x30, 0x2c, 0x16, 0x5b, 0xe9, 0x3f, 0x2a, + 0x09, 0xf9, 0x69, 0x23, 0x77, 0xd7, 0x2b, 0x95, + 0x4b, 0x78, 0x59, 0xcc, 0xfa, 0xf5, 0x79, 0xd2, + 0x05, 0x87, 0x66, 0x57, 0x93, 0xbf, 0x05, 0x90, + 0x4d, 0x6d, 0xd2, 0x72, 0x92, 0x24, 0xec, 0x14, + 0xe7, 0xbf, 0x82, 0x57, 0xbb, 0x14, 0x51, 0xe6, + 0xce, 0x3f, 0xa1, 0xfc, 0x63, 0x75, 0xee, 0xde, + 0xf9, 0x31, 0xd3, 0xa0, 0x07, 0xcd, 0x4d, 0x8f, + 0x83, 0x7d, 0x65, 0xe1, 0xc6, 0x60, 0x9e, 0x5c, + 0x51, 0x76, 0xfa, 0x64, 0xdf, 0xdc, 0xaf, 0x38, + 0xee, 0xe9, 0x8f, 0x4b, 0xa0, 0x3a, 0x21, 0xdf, + 0x58, 0x3b, 0x73, 0xf5, 0x30, 0xbb, 0x29, 0xe0, + 0xff, 0x60, 0xf0, 0x05, 0x5e, 0x37, 0xbc, 0x78, + 0x95, 0x3f, 0xa8, 0xd4, 0xb4, 0x82, 0x0d, 0xe1, + 0x10, 0xe3, 0xa7, 0x61, 0x37, 0x58, 0x28, 0x14, + 0x22, 0x57, 0x32, 0x28, 0x80, 0x98, 0x3e, 0x5f, + 0x71, 0xcf, 0x34, 0xb8, 0x6d, 0x6b, 0xc0, 0x23, + 0xc1, 0x9e, 0x58, 0x4f, 0xd5, 0xa4, 0x14, 0x03, + 0x2a, 0xed, 0xc4, 0xa7, 0x77, 0x7c, 0x4f, 0x94, + 0x91, 0x1d, 0x47, 0x34, 0x82, 0xe8, 0x9d, 0x32, + 0x5c, 0xc7, 0x38, 0xe9, 0x92, 0xcd, 0x35, 0xfd, + 0x1c, 0xcc, 0x3c, 0x28, 0x75, 0x6f, 0xff, 0xd5, + 0xe8, 0xbf, 0x90, 0x92, 0x34, 0x13, 0x11, 0x89, + 0xe0, 0xa2, 0x25, 0xeb, 0x82, 0x63, 0x31, 0x80, + 0x50, 0x6c, 0x99, 0xaa, 0x97, 0x0e, 0x59, 0x45, + 0x64, 0xb8, 0x77, 0x78, 0x6b, 0x24, 0xac, 0xc0, + 0xc9, 0xa9, 0xbc, 0x13, 0xd1, 0x5e, 0x50, 0x9a, + 0x91, 0x1a, 0x08, 0xf7, 0xc5, 0x18, 0x9f, 0x87, + 0x97, 0x9c, 0x0a, 0x27, 0xf1, 0x66, 0xf8, 0x09, + 0x52, 0x09, 0x41, 0x07, 0xc1, 0xa1, 0x91, 0xa4, + 0x59, 0x09, 0x75, 0x57, 0x5b, 0x53, 0x79, 0x58, + 0xa2, 0x9e, 0x49, 0xa2, 0x5e, 0xf7, 0x28, 0x1c, + 0x43, 0xa6, 0xcb, 0x88, 0x46, 0x84, 0xc9, 0x7f, + 0x84, 0xdb, 0x45, 0x0c, 0xb3, 0x7f, 0x01, 0x40, + 0x71, 0x3e, 0x48, 0x12, 0x1f, 0xbc, 0x1e, 0xdf, + 0x41, 0x50, 0xb2, 0x11, 0x67, 0x83, 0x19, 0x04, + 0x0e, 0x21, 0xd5, 0xf2, 0x54, 0x99, 0xfb, 0x47, + 0xf2, 0x5e, 0x02, 0x4b, 0x61, 0x6d, 0xef, 0x78, + 0x29, 0xe4, 0x3a, 0x56, 0x14, 0x20, 0x6f, 0x70, + 0x82, 0xea, 0x5d, 0xbc, 0x48, 0x89, 0x34, 0x69, + 0xdb, 0x4a, 0x06, 0xa7, 0xd6, 0xc7, 0xb7, 0x06, + 0x8e, 0x64, 0x21, 0x3e, 0xa6, 0x32, 0x61, 0x59, + 0x03, 0xea, 0xc3, 0x71, 0xf0, 0x26, 0x02, 0xe0, + 0x71, 0x95, 0x38, 0x11, 0x32, 0xe6, 0x3b, 0x25, + 0x53, 0x14, 0x24, 0x34, 0xe8, 0x8c, 0xa8, 0xef, + 0x52, 0xfe, 0x06, 0x2c, 0x20, 0x88, 0x4f, 0xa6, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t aes_cbc_128_encblkno1_vec1_ctxt[SECSIZE] = { + 0x2f, 0x69, 0x3e, 0x95, 0x87, 0x91, 0x99, 0xd4, + 0xd9, 0x5d, 0xf2, 0x52, 0x32, 0x54, 0x2a, 0x80, + 0xa0, 0x77, 0x6e, 0x73, 0x15, 0xb4, 0xc9, 0x13, + 0x85, 0xed, 0x79, 0x9b, 0x84, 0x0a, 0x7e, 0xdb, + 0xee, 0x09, 0x78, 0x11, 0x28, 0xd5, 0x26, 0xec, + 0x1d, 0x52, 0xba, 0x33, 0x26, 0xeb, 0x91, 0xc6, + 0x4b, 0xf0, 0x38, 0xdf, 0x9f, 0x9d, 0x6c, 0xd8, + 0x49, 0x83, 0x88, 0xbe, 0x62, 0x2d, 0x5e, 0x88, + 0xc0, 0x35, 0xe4, 0xc3, 0xc9, 0x9f, 0x62, 0x59, + 0x16, 0xa7, 0x2e, 0xc0, 0xda, 0x3c, 0x2e, 0x10, + 0x53, 0xf0, 0x84, 0x27, 0x38, 0xd0, 0xf4, 0xb5, + 0x7c, 0x4a, 0x63, 0x04, 0x51, 0x22, 0xae, 0xf3, + 0xe7, 0x97, 0x53, 0xee, 0xe6, 0xaf, 0xc3, 0x49, + 0x3a, 0x5a, 0x74, 0x83, 0x18, 0xa3, 0x6b, 0xf3, + 0x6a, 0x3b, 0xe2, 0x1b, 0xd4, 0x64, 0x41, 0xdf, + 0xd1, 0xd2, 0xdd, 0x22, 0xa8, 0x66, 0xbd, 0x8e, + 0xc4, 0x9a, 0x6d, 0x15, 0x38, 0x5b, 0x50, 0x9a, + 0x65, 0x48, 0x97, 0xf1, 0x04, 0x85, 0x8b, 0x5c, + 0x44, 0x32, 0x15, 0xea, 0x28, 0x5f, 0x98, 0x53, + 0xb4, 0x80, 0xd0, 0x2c, 0x59, 0x04, 0x08, 0xaf, + 0xa4, 0xb7, 0x49, 0xd1, 0x98, 0x87, 0xb9, 0xb6, + 0x3d, 0x89, 0xd1, 0xbe, 0xf4, 0x89, 0xec, 0xf9, + 0x2d, 0xc7, 0xc6, 0xe9, 0xe6, 0xfa, 0x1e, 0x67, + 0x68, 0xe7, 0xb7, 0x91, 0x55, 0x77, 0xf3, 0x27, + 0x38, 0x23, 0xcf, 0x2e, 0x3e, 0x8b, 0xfd, 0xb3, + 0x90, 0xd8, 0x6b, 0x1e, 0x93, 0x8f, 0xb6, 0xc1, + 0x27, 0xc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x2e, 0x7f, 0xd4, + 0xe5, 0xd6, 0x95, 0xe8, 0x09, 0x3d, 0x4d, 0xdf, + 0xd9, 0xc0, 0x63, 0x17, 0xa5, 0x9c, 0xf6, 0xa3, + 0x59, 0x17, 0xc0, 0xf8, 0xa2, 0x11, 0x14, 0x88, + 0xf0, 0x1e, 0x4a, 0x4b, 0x13, 0xf6, 0xd6, 0x09, + 0xac, 0xf8, 0x39, 0x5d, 0x4c, 0x68, 0x69, 0x99, + 0x08, 0xd4, 0xf5, 0x39, 0x6d, 0x78, 0xde, 0xb5, + 0x6f, 0x34, 0xc4, 0x28, 0x73, 0x6c, 0x29, 0xa1, + 0xef, 0xfe, 0xed, 0x56, 0xb2, 0x70, 0x7b, 0xd5, + 0x5b, 0xd1, 0x09, 0x6a, 0x9a, 0x59, 0xe9, 0x79, + 0xe9, 0xee, 0xa4, 0x03, 0xc1, 0x67, 0xce, 0x62, + 0xf6, 0x4f, 0x04, 0xa5, 0x04, 0x71, 0x13, 0xeb, + 0x3d, 0x0a, 0x65, 0x2f, 0x57, 0xb0, 0xc0, 0xa4, + 0xf2, 0x8d, 0x78, 0x90, 0xeb, 0xc9, 0x5e, 0x8b, + 0xd8, 0xfb, 0xbc, 0x74, 0x1a, 0x70, 0x94, 0x2c, + 0xeb, 0xf2, 0x5e, 0x6d, 0xbb, 0x96, 0x7a, 0x2c, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t aes_cbc_128_encblkno1_vec2_ctxt[SECSIZE] = { + 0xbc, 0x49, 0x35, 0x2c, 0xe3, 0x10, 0x12, 0x65, + 0x7a, 0xf4, 0xde, 0xd3, 0xf8, 0xe1, 0x49, 0x97, + 0x0a, 0x07, 0x93, 0x6c, 0xf8, 0x0e, 0xb7, 0xdf, + 0x53, 0xba, 0x1e, 0x8e, 0x14, 0xbd, 0xf6, 0x81, + 0xd6, 0xf6, 0x3d, 0xb2, 0xe7, 0x6a, 0x9d, 0x50, + 0x68, 0xc2, 0x75, 0x8e,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, 0x50, 0x41, 0x58, 0xb2, 0x13, + 0x12, 0x44, 0xd2, 0x39, 0xf2, 0x76, 0x3c, 0x53, + 0x36, 0xfe, 0x17, 0x74, 0x91, 0x8d, 0xbe, 0xc5, + 0x40, 0xf7, 0xa2, 0xe9, 0x65, 0xd9, 0xdf, 0x80, + 0x7b, 0xd9, 0xc3, 0x1f, 0xb4, 0xfc, 0x9f, 0x8d, + 0x7a, 0x4e, 0x1e, 0x32, 0x6d, 0xb1, 0x82, 0x1e, + 0x0c, 0xb6, 0x0b, 0xe6, 0x15, 0x82, 0x5c, 0xcc, + 0xc8, 0x4a, 0x73, 0x56, 0x9d, 0x11, 0xfa, 0xcd, + 0x21, 0x95, 0x23, 0x71, 0xe8, 0xfe, 0x06, 0x43, + 0xf6, 0x17, 0x51, 0x28, 0x0d, 0xfb, 0x0a, 0x49, + 0x1b, 0x35, 0x1e, 0x4a, 0x38, 0x08, 0x6b, 0xcd, + 0x67, 0x21, 0x94, 0x09, 0x28, 0xca, 0x0a, 0x18, + 0xdf, 0x6c, 0x86, 0x47, 0x10, 0x29, 0x81, 0x9a, + 0x73, 0xba, 0x78, 0xbd, 0xc0, 0x61, 0xee, 0x23, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t aes_cbc_128_encblkno1_vec3_ctxt[SECSIZE] = { + 0x29, 0x9f, 0xb1, 0x0f, 0x7d, 0xb4, 0xd9, 0xbb, + 0xf9, 0x06, 0x60, 0xdc, 0xb9, 0xeb, 0x73, 0x6e, + 0xfe, 0xdb, 0x99, 0x29, 0xe8, 0x42, 0x46, 0xe7, + 0x49, 0xcf, 0x90, 0x2d, 0x08, 0xd7, 0xd5, 0xbf, + 0x0f, 0x4f, 0x66, 0xce, 0xcd, 0xb1, 0x8a, 0xc7, + 0x47, 0xc9, 0x8e, 0xe3, 0x9f, 0x80, 0x79, 0xc6, + 0xa8, 0xe5, 0x20, 0x66, 0x58, 0xde, 0xab, 0x87, + 0x5e, 0x7e, 0xcd, 0x55, 0x81, 0x09, 0x40, 0xd9, + 0x8b, 0x7e, 0xd3, 0xf9, 0x16, 0x55, 0x72, 0x7d, + 0xe8, 0x36, 0x76, 0x06, 0x77, 0x47, 0xa5, 0xdc, + 0x80, 0x33, 0x7d, 0x88, 0x5f, 0x56, 0x48, 0x0f, + 0x66, 0xb5, 0x91, 0x9d, 0xf8, 0xdb, 0x83, 0x0d, + 0xd4, 0xc6, 0x13, 0xfc, 0xd4, 0xe5, 0x34, 0x81, + 0x70, 0x4d, 0x96, 0x82, 0x5d, 0xb2, 0x36, 0x37, + 0xdf, 0xd2, 0x5e, 0x31, 0xf0, 0x9d, 0x6d, 0xb7, + 0xf9, 0x2d, 0xcb, 0x77, 0xb8, 0x59, 0xa0, 0xbb, + 0x4f, 0x8d, 0xa0, 0xd1, 0x49, 0x17, 0x93, 0x3c, + 0xf0, 0x4e, 0x72, 0xdd, 0x99, 0x9a, 0x87, 0xf1, + 0x01, 0x89, 0xdf, 0xef, 0xed, 0x04, 0x86, 0x3d, + 0x9b, 0xab, 0x6c, 0xa7, 0xef, 0x1b, 0xbb, 0x24, + 0xbc, 0x65, 0x01, 0x06, 0x12, 0x3f, 0x7e, 0x9f, + 0x83, 0xf3, 0xd4, 0x43, 0x18, 0x03, 0xa3, 0x07, + 0xbc, 0x85, 0xe8, 0xdb, 0x6c, 0x8f, 0xaf, 0x70, + 0x71, 0x5d, 0xbc, 0x6d, 0x14, 0x05, 0xdf, 0xce, + 0x9f, 0xe2, 0xa3, 0x51, 0x66, 0x92, 0x52, 0x19, + 0x98, 0xbd, 0xb2, 0x68, 0x79, 0xf4, 0x5d, 0x71, + 0xcb, 0xa0, 0x1b, 0x77, 0x34, 0x46, 0x69, 0x3c, + 0xa4, 0x0f, 0x72, 0xf5, 0x73, 0xf6, 0xa0, 0xe9, + 0x72, 0xef, 0xa1, 0xcc, 0x43, 0xfc, 0xb7, 0xf3, + 0x59, 0xeb, 0x40, 0x61, 0x02, 0x26, 0x9b, 0x71, + 0x57, 0x17, 0x36, 0xac, 0xc8, 0xd5, 0x9d, 0xcb, + 0x4d, 0x4f, 0xf7, 0xc1, 0x58, 0xce, 0xbf, 0x73, + 0xe7, 0xd0, 0x58, 0x0d, 0x08, 0x01, 0x8f, 0x68, + 0x1b, 0x3f, 0x3a, 0x7b, 0xdb, 0x9e, 0xa7, 0x33, + 0x59, 0x91, 0xa8, 0xe3, 0x58, 0x22, 0x3f, 0x97, + 0xe1, 0xdb, 0xd6, 0x99, 0x0e, 0xdd, 0x76, 0xcd, + 0x4d, 0x02, 0x28, 0x43, 0x8a, 0xdd, 0x10, 0xad, + 0x55, 0xe0, 0x62, 0xf7, 0x44, 0xbc, 0x3f, 0x99, + 0x3c, 0x09, 0x25, 0xfb, 0xfd, 0x1e, 0x4c, 0x45, + 0x0e, 0x6e, 0x75, 0x15, 0x48, 0x19, 0x08, 0xc3, + 0x2b, 0x81, 0x60, 0x5f, 0x19, 0x09, 0x74, 0x0a, + 0xbd, 0x0d, 0x8d, 0x94, 0x55, 0x04, 0x2b, 0x8e, + 0x0d, 0x10, 0x60, 0x64, 0x0d, 0x7f, 0x63, 0x2e, + 0x89, 0x0b, 0xfc, 0x1c, 0xbc, 0xf3, 0x66, 0xc5, + 0x80, 0x93, 0x3a, 0x74, 0x15, 0x11, 0xd5, 0xba, + 0xbc, 0x06, 0x3f, 0x85, 0xcc, 0x6c, 0xd3, 0xf2, + 0x74, 0xc6, 0x10, 0x15, 0x0a, 0x02, 0x66, 0xa4, + 0xa8, 0x93, 0x0b, 0x5c, 0xe7, 0x13, 0x96, 0x90, + 0xdd, 0xe3, 0x25, 0x22, 0x46, 0x7b, 0x49, 0xde, + 0x72, 0x55, 0xf3, 0x30, 0x62, 0x5f, 0x7a, 0x2a, + 0x37, 0x88, 0xea, 0x57, 0x99, 0x64, 0x50, 0x2d, + 0xd3, 0x6a, 0x09, 0x4b, 0xd6, 0x61, 0xf2, 0x22, + 0x53, 0x36, 0xf7, 0x42, 0x21, 0xde, 0xda, 0xcb, + 0x8b, 0x6f, 0xf3, 0x4e, 0x2c, 0x16, 0xfb, 0xfc, + 0x13, 0xa7, 0xd1, 0xd8, 0xfd, 0x16, 0x39, 0x20, + 0xe0, 0xb2, 0xb4, 0xd5, 0x40, 0x93, 0x30, 0xf3, + 0xab, 0x88, 0xe3, 0xfb, 0xbe, 0xb8, 0x02, 0x3a, + 0x78, 0x2d, 0x56, 0x4b, 0x92, 0x5b, 0x0a, 0x8d, + 0x18, 0xa4, 0x5b, 0x11, 0x60, 0x0b, 0x45, 0xad, + 0x0b, 0x64, 0x96, 0x7d, 0x84, 0xf2, 0x20, 0xa8, + 0x95, 0x78, 0xb3, 0xb5, 0x98, 0x1f, 0xa7, 0x3e, + 0x30, 0x77, 0x43, 0xd2, 0x8c, 0x20, 0xc5, 0x5e, + 0x76, 0xcd, 0x2c, 0x7c, 0xfa, 0x34, 0x36, 0xda, + 0x39, 0x00, 0x2e, 0x69, 0x4a, 0xb3, 0x0f, 0x6f, +}; + +const struct testvec aes_cbc_128_1_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t aes_cbc_128_encblkno8_vec0_ctxt[SECSIZE] = { + 0xa6, 0x64, 0xef, 0x0f, 0xc4, 0x45, 0xcc, 0x5e, + 0xf8, 0x27, 0x42, 0x5e, 0xbd, 0x93, 0x99, 0xcd, + 0x79, 0xa8, 0x7d, 0x72, 0xc4, 0x02, 0x99, 0xa6, + 0xe4, 0x69, 0x57, 0x82, 0x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b4, 0x3a, 0x15, 0xc5, 0xf9, + 0x5b, 0x85, 0x92, 0x94, 0xa8, 0x8f, 0x2c, 0x3a, + 0x7e, 0x22, 0x86, 0x88, 0x51, 0x03, 0xee, 0xf9, + 0x2e, 0x83, 0xce, 0x39, 0x0c, 0x76, 0x64, 0xe5, + 0x5a, 0x88, 0xef, 0xc5, 0x06, 0xb2, 0xe4, 0x13, + 0x82, 0xc9, 0xee, 0xba, 0x6d, 0x56, 0xa8, 0x87, + 0x51, 0x69, 0x3b, 0x86, 0x29, 0x8e, 0xe8, 0xb4, + 0x44, 0x42, 0x07, 0x5b, 0xff, 0x0e, 0x1e, 0x9f, + 0x42, 0xb1, 0xc8, 0x5f, 0xab, 0x3b, 0xc7, 0xba, + 0x75, 0x20, 0xe6, 0x9f, 0x93, 0xb5, 0xcf, 0x8f, + 0x7c, 0x1c, 0xf3, 0xdb, 0x6a, 0xf4, 0xde, 0x00, + 0xe9, 0xaf, 0xd5, 0xf4, 0x36, 0x98, 0x14, 0x2d, + 0x53, 0x20, 0x74, 0xab, 0x0c, 0xf6, 0xcd, 0x15, + 0x32, 0xa6, 0x01, 0x8d, 0x24, 0x1b, 0x4b, 0x1f, + 0xa3, 0xfc, 0x38, 0x82, 0x3a, 0xa1, 0xb5, 0x52, + 0x53, 0xc7, 0x2b, 0x30, 0x7c, 0x65, 0xb9, 0x7d, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t aes_cbc_128_encblkno8_vec1_ctxt[SECSIZE] = { + 0x63, 0x45, 0x16, 0x0c, 0xe4, 0x4f, 0x51, 0xde, + 0x74, 0xf8, 0x7b, 0xf5, 0x05, 0x17, 0x13, 0x1e, + 0xa5, 0x3d, 0x84, 0xfa, 0x35, 0x5a, 0x2d, 0x3c, + 0xb7, 0x61, 0x68, 0xff, 0xcd, 0x33, 0x1f, 0x0b, + 0x53, 0x79, 0xf2, 0x2f, 0xbc, 0x8d, 0xac, 0xb9, + 0xf9, 0xb7, 0x9c, 0x0a, 0x9d, 0xa1, 0x4d, 0x78, + 0x9e, 0x4e, 0xfa, 0xe8, 0xc8, 0x46, 0x4b, 0x99, + 0x91, 0x7e, 0x33, 0x6e, 0x18, 0x24, 0x01, 0xc3, + 0x9f, 0x8c, 0x43, 0xb5, 0x15, 0x7e, 0xdd, 0xf9, + 0x1b, 0xb0, 0xf2, 0xc3, 0x97, 0x1f, 0x7c, 0x3f, + 0x43, 0x4c, 0x9f, 0x93, 0x29, 0x83, 0x8f, 0xad, + 0xd1, 0x5e, 0x92, 0x1a, 0x17, 0xd1, 0xa0, 0x05, + 0x6e, 0x62, 0x59, 0x80, 0x50, 0x6d, 0xe3, 0x28, + 0x9a, 0x43, 0xdc, 0x81, 0x4f, 0x49, 0xc4, 0x98, + 0xcd, 0x6d, 0x28, 0xb4, 0x86, 0xe4, 0x83, 0x45, + 0xd4, 0x43, 0x52, 0x8a, 0xd6, 0xc8, 0x1c, 0x90, + 0xeb, 0xf0, 0xe7, 0x76, 0xb4, 0x43, 0x9b, 0x56, + 0x48, 0x73, 0xdd, 0x01, 0x50, 0x1c, 0x61, 0xfc, + 0x22, 0xac, 0xf4, 0x27, 0x94, 0x02, 0x54, 0xd3, + 0x7d, 0x25, 0xf6, 0x14, 0x29, 0xbb, 0x2b, 0x22, + 0xc8, 0xe8, 0x7f, 0xa1, 0xfe, 0x19, 0x79, 0x97, + 0xb6, 0xa6, 0xba, 0x5b, 0x89, 0xdf, 0x73, 0x6d, + 0x79, 0x38, 0x5b, 0xf8, 0x89, 0xa2, 0x95, 0x1d, + 0xda, 0x38, 0x17, 0x4b, 0x01, 0xf1, 0x7d, 0x0a, + 0xa2, 0x8f, 0x5a, 0x02, 0x51, 0xb0, 0x88, 0x10, + 0x16, 0xc8, 0x82, 0xb9, 0x06, 0x9f, 0x01, 0x94, + 0xf9, 0xe0, 0x2e, 0x86, 0x8a, 0xb1, 0x7f, 0x74, + 0x22, 0xce, 0xee, 0xa6, 0x66, 0xee, 0xe2, 0x1d, + 0x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, 0xf0, 0x03, 0x65, 0x18, + 0x93, 0x5b, 0x60, 0x2f, 0xb5, 0xfe, 0x82, 0xaf, + 0x85, 0xb7, 0x79, 0x7c, 0xee, 0xad, 0xea, 0xfa, + 0x9b, 0xad, 0xca, 0x38, 0x21, 0x3d, 0x46, 0x8a, + 0x5b, 0xa7, 0x55, 0x3d, 0x88, 0x4a, 0x52, 0xdb, + 0xf2, 0x07, 0xed, 0xd6, 0x3c, 0x9f, 0x1b, 0x42, + 0xb4, 0x14, 0x12, 0xb7, 0x00, 0xfc, 0x6a, 0x79, + 0x61, 0x0b, 0x43, 0xaa, 0x44, 0x48, 0x30, 0x15, + 0x48, 0x76, 0x27, 0x32, 0x7a, 0x2e, 0x25, 0x6a, + 0x8c, 0x8c, 0x64, 0x67, 0x86, 0x54, 0x4a, 0x93, + 0x14, 0xfe, 0x81, 0xf5, 0xcf, 0x98, 0x92, 0xd3, + 0x92, 0xf5, 0x6a, 0x74, 0x28, 0x10, 0x6b, 0xd4, + 0x1d, 0x64, 0x7e, 0x05, 0x32, 0xba, 0xf7, 0x4c, + 0xe9, 0xa8, 0xa9, 0xc5, 0x35, 0x34, 0x26, 0x41, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t aes_cbc_128_encblkno8_vec2_ctxt[SECSIZE] = { + 0x64, 0x7b, 0x62, 0x7a, 0xa6, 0xa9, 0xb3, 0x47, + 0xbc, 0x03, 0x14, 0x3d, 0x9b, 0x56, 0xfc, 0x13, + 0x08, 0x32, 0x81, 0xe3, 0x57, 0x3c, 0x0d, 0xbb, + 0x85, 0x44, 0x47, 0x12, 0xc4, 0x80, 0x35, 0x37, + 0xe1, 0xb4, 0x3f, 0x35, 0x98, 0x7c, 0xb0, 0x3b, + 0x85, 0xab, 0x3d, 0x0b, 0xd3, 0x6f, 0xf9, 0x92, + 0x00, 0x6b, 0x18, 0xe7, 0x31, 0x8b, 0x77, 0x4c, + 0xd0, 0x7b, 0x1d, 0xfc, 0x95, 0xe6,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9f, 0xa8, 0x95, 0x0b, 0xfb, 0x0c, 0xe8, + 0xdc, 0x12, 0x78, 0x4c, 0x52, 0xf4, 0xfc, 0x4a, + 0x77, 0xdd, 0x77, 0x34, 0xf7, 0x35, 0x94, 0x7a, + 0x31, 0x16, 0x86, 0x44, 0x50, 0x30, 0x1c, 0x6d, + 0x9f, 0x66, 0x49, 0xb5, 0xe6, 0x71, 0x00, 0x83, + 0xd1, 0xa0, 0x01, 0xff, 0xc3, 0x27, 0xaa, 0x9a, + 0xdb, 0xad, 0x24, 0xdb, 0xbd, 0xde, 0xfd, 0xa6, + 0xaa, 0x87, 0x98, 0x98, 0xde, 0x90, 0xd5, 0x40, + 0x20, 0x8f, 0xe9, 0xdd, 0xa8, 0xec, 0xd3, 0x18, + 0x20, 0x85, 0x5e, 0xd5, 0xe7, 0x50, 0x58, 0x15, + 0x69, 0x03, 0xa5, 0xe8, 0xa9, 0x7a, 0x0f, 0xd1, + 0x7d, 0x22, 0x8a, 0xe0, 0xc6, 0x17, 0x33, 0x00, + 0x57, 0xcb, 0xf6, 0x8d, 0xf0, 0xc1, 0x7b, 0xb5, + 0x96, 0x0f, 0x08, 0x84, 0x5b, 0x7e, 0xa6, 0x1e, + 0xd8, 0x5e, 0x0c, 0xca, 0x30, 0x4b, 0xe0, 0x87, + 0x2f, 0xbc, 0x07, 0x83, 0x35, 0x76, 0x36, 0x17, + 0xcf, 0xdb, 0x27, 0x53, 0x43, 0xf5, 0x07, 0xd0, + 0x91, 0x83, 0xa1, 0xaa, 0x8d, 0xdb, 0x00, 0x2b, + 0xd1, 0x88, 0xe5, 0x59, 0x47, 0x17, 0xf0, 0xe8, + 0xce, 0x3b, 0xa0, 0x73, 0x1f, 0x22, 0x9b, 0x1b, + 0x59, 0x02, 0xe6, 0xaf, 0x3f, 0xdd, 0xfe, 0xba, + 0xc3, 0x6b, 0xe5, 0x82, 0x02, 0x92, 0x0c, 0x5e, + 0x5a, 0x87, 0x88, 0x91, 0x00, 0xb5, 0x30, 0x37, + 0xf5, 0xc6, 0xdf, 0x0a, 0x7f, 0x03, 0x1c, 0x1f, + 0x20, 0xf1, 0xd4, 0x5f, 0x94, 0xc3, 0x6f, 0x21, + 0x5e, 0xf2, 0x77, 0x5a, 0x42, 0xfd, 0xd3, 0xc4, + 0x31, 0xaf, 0xd6, 0x6c, 0x6c, 0xde, 0x8c, 0x50, + 0x01, 0x8f, 0x57, 0x90, 0x88, 0x43, 0xf9, 0x44, + 0x09, 0x4d, 0x27, 0x58, 0x9f, 0xae, 0x50, 0x28, + 0x12, 0x47, 0x20, 0x79, 0x2b, 0xe4, 0x02, 0x97, + 0xcd, 0xab, 0x53, 0x28, 0x8f, 0x8f, 0xe3, 0x3b, + 0xd6, 0xc9, 0xc8, 0xff, 0xbf, 0x18, 0x3b, 0x75, + 0xdb, 0xcf, 0x07, 0x8c, 0xfe, 0x58, 0xee, 0x75, + 0x01, 0x98, 0x98, 0xe4, 0x60, 0xfe, 0xe6, 0x7f, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t aes_cbc_128_encblkno8_vec3_ctxt[SECSIZE] = { + 0x98, 0xae, 0x82, 0x1d, 0x76, 0x3a, 0xfe, 0x80, + 0x04, 0xa3, 0x43, 0xf0, 0x06, 0x45, 0x83, 0xb7, + 0xe2, 0xb5, 0x73, 0x46, 0x78, 0x01, 0x2f, 0xd6, + 0x0d, 0x49, 0x64, 0x4c, 0xeb, 0x8d, 0xdc, 0xa9, + 0xdc, 0xea, 0x22, 0x25, 0xd4, 0x8f, 0xba, 0x9f, + 0xd4, 0x7a, 0x3c, 0x9e, 0xd0, 0xd9, 0xcd, 0xa4, + 0x12, 0xdf, 0x8f, 0x50, 0x24, 0x18, 0xa2, 0x0b, + 0xd9, 0x7f, 0xda, 0x78, 0xd6, 0x11, 0xf3, 0x99, + 0xc4, 0xec, 0x95, 0xe2, 0x85, 0xe1, 0xa0, 0x0d, + 0x07, 0x22, 0x56, 0xaf, 0x2f, 0xf5, 0x7d,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xc3, 0xc8, 0x3e, 0x5a, + 0x9c, 0xa5, 0xb3, 0x9b, 0x8d, 0x46, 0xb9, 0xf5, + 0x4a, 0x4d, 0xbe, 0xc0, 0xc1, 0x24, 0x92, 0x09, + 0x7c, 0x9a, 0x21, 0x2c, 0x08, 0x8a, 0x0d, 0xfc, + 0xff, 0xda, 0xdc, 0xf1, 0x45, 0x66, 0xf9, 0xcd, + 0x64, 0x7c, 0x2f, 0x0e, 0x95, 0x5e, 0xec, 0x92, + 0xd1, 0x03, 0x03, 0xa0, 0xcc, 0x73, 0x92, 0x15, + 0x74, 0x42, 0x54, 0x48, 0x77, 0xbe, 0x96, 0xfb, + 0x1f, 0x0c, 0x7a, 0x25, 0x67, 0x6b, 0x85, 0x71, + 0x06, 0x15, 0xd3, 0x11, 0xfe, 0xf7, 0xa9, 0xb1, +}; + +const struct testvec aes_cbc_128_8_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_128_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t aes_cbc_192_encblkno1_vec0_ctxt[SECSIZE] = { + 0x7c, 0xc4, 0xec, 0x89, 0x7c, 0x13, 0xac, 0x99, + 0x49, 0xa9, 0x96, 0xe7, 0xb1, 0x1a, 0xd6, 0xb0, + 0xeb, 0x89, 0x27, 0x0f, 0x8b, 0x1b, 0xab, 0x8e, + 0x2c, 0xd4, 0x00, 0x66, 0x12, 0x3a, 0x9a, 0x03, + 0xc4, 0x49, 0xa4, 0xf0, 0xc1, 0x90, 0xf9, 0x38, + 0xb2, 0x5c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41, 0x54, 0xc8, + 0xe4, 0x25, 0x0e, 0x82, 0x5f, 0x81, 0xba, 0x5d, + 0x79, 0x8f, 0x9c, 0x17, 0x4b, 0x59, 0xf4, 0x5d, + 0xd6, 0x83, 0xfd, 0x44, 0xd0, 0xe1, 0x89, 0x09, + 0xf9, 0xe2, 0xb6, 0x9c, 0x1c, 0xbd, 0x13, 0xaa, + 0xa0, 0x43, 0xaa, 0xaf, 0x6d, 0x65, 0x73, 0xba, + 0x3a, 0x55, 0x69, 0x51, 0xb9, 0x52, 0x09, 0xaa, + 0x9f, 0x91, 0x3c, 0x65, 0xe2, 0x81, 0xdb, 0xe8, + 0x5a, 0xe3, 0x74, 0x11, 0x7b, 0xec, 0x2f, 0x18, + 0x8d, 0x4c, 0x8f, 0xf2, 0x06, 0x3d, 0x22, 0xc6, + 0x43, 0xef, 0x42, 0x7d, 0xe1, 0xe7, 0xde, 0x4c, + 0x58, 0xad, 0x40, 0xbb, 0x8b, 0xce, 0x1f, 0x57, + 0x8e, 0x6a, 0x27, 0x43, 0x46, 0x7f, 0x94, 0xe5, + 0x45, 0x67, 0x12, 0xc8, 0x99, 0x85, 0x08, 0x2a, + 0x37, 0x40, 0x0b, 0xb5, 0xd9, 0xa3, 0xf7, 0xc8, + 0x87, 0xb1, 0xe6, 0x87, 0x2f, 0x86, 0xd8, 0x9c, + 0x7b, 0xec, 0xcf, 0xa4, 0xe5, 0xd5, 0x50, 0x3f, + 0xdf, 0xc9, 0xb7, 0x29, 0x97, 0xd6, 0x33, 0xba, + 0xf0, 0x72, 0xf0, 0x76, 0x12, 0xd3, 0x99, 0x4f, + 0x1b, 0x36, 0xda, 0xa1, 0x83, 0xfe, 0xf5, 0x94, + 0x9e, 0x61, 0x82, 0x62, 0xe0, 0x08, 0x3a, 0xbd, + 0xba, 0x8b, 0x3d, 0xd6, 0xbd, 0x16, 0x5f, 0xd7, + 0x1d, 0x6c, 0x0e, 0x92, 0x89, 0x8c, 0x38, 0x62, + 0x80, 0xee, 0x7e, 0x63, 0x82, 0x88, 0x0b, 0xbf, + 0xdd, 0x9f, 0xbc, 0xba, 0xa7, 0x5a, 0xc6, 0x0d, + 0x87, 0x59, 0xbf, 0x0a, 0x85, 0x06, 0xa3, 0xb4, + 0x66, 0x63, 0xda, 0x12, 0x29, 0x5f, 0x2e, 0x4d, + 0x60, 0xfd, 0x85, 0x76, 0xaf, 0xf7, 0x87, 0xed, + 0x1f, 0x46, 0xc2, 0xd6, 0x6c, 0x98, 0x6b, 0x4b, + 0x60, 0x04, 0xed, 0x89, 0x3b, 0x85, 0x6c, 0xe9, + 0x46, 0xd9, 0xfa, 0x35, 0x61, 0xe8, 0x0c, 0x84, + 0x1b, 0x93, 0xc0, 0xfe, 0x5d, 0x29, 0x14, 0xe1, + 0x1c, 0x66, 0x73, 0xc8, 0x0b, 0x98, 0xff, 0x1a, + 0x78, 0x2b, 0x6a, 0x93, 0x7a, 0x29, 0xd8, 0x7b, + 0xb1, 0x39, 0xf0, 0xad, 0x93, 0x4d, 0x2d, 0xab, + 0x67, 0x3c, 0xa4, 0xa1, 0x08, 0x36, 0x0b, 0xe9, + 0x77, 0xd0, 0xe3, 0x45, 0x7d, 0x99, 0x75, 0xc3, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t aes_cbc_192_encblkno1_vec1_ctxt[SECSIZE] = { + 0xe6, 0x41, 0x75, 0xd6, 0x80, 0xdf, 0x44, 0x37, + 0xa7, 0xa2, 0xb2, 0x29, 0x0d, 0xf0, 0x02, 0x78, + 0x92, 0xb2, 0x06, 0x5f, 0x86, 0xd3, 0x9c, 0xa3, + 0xd0, 0xc5, 0x08, 0x03, 0x6d, 0x41, 0x9d, 0x61, + 0xb4, 0xb9, 0xa1, 0x69, 0x6e, 0x3a, 0x78, 0xd7, + 0x04, 0x94, 0xf2, 0x53, 0xed, 0xd1, 0xf6, 0xd8, + 0x98, 0xe2, 0x49, 0x75, 0x15, 0x85, 0xe0, 0x78, + 0x5b, 0x28, 0x5e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0xf9, + 0xf1, 0xff, 0x26, 0x7a, 0x66, 0x13, 0x1a, 0xa2, + 0xc6, 0xac, 0x84, 0xf6, 0x6b, 0x09, 0xbd, 0x32, + 0x6f, 0x26, 0x37, 0x7c, 0x7d, 0x74, 0xe4, 0xa0, + 0xeb, 0x85, 0x7a, 0xa1, 0x92, 0x19, 0x2e, 0x64, + 0x82, 0x7c, 0x89, 0x1b, 0x14, 0x92, 0xd1, 0xf4, + 0x1f, 0x29, 0x84, 0x04, 0x70, 0x09, 0x13, 0x4c, + 0x62, 0x9a, 0xb4, 0xf7, 0xc1, 0x7b, 0x83, 0xd1, + 0x2d, 0x1a, 0xbe, 0x83, 0x9b, 0x73, 0xba, 0x8d, + 0xbb, 0xb0, 0xf2, 0x5c, 0x72, 0x75, 0x01, 0x0b, + 0xa6, 0x43, 0x6b, 0x76, 0x56, 0x4e, 0x71, 0x1b, + 0xb2, 0x34, 0x1f, 0x70, 0x44, 0xe6, 0xfb, 0x67, + 0xd1, 0x4d, 0x63, 0xce, 0x17, 0x46, 0x9b, 0x11, + 0xda, 0x93, 0xf8, 0x03, 0x11, 0x8f, 0x90, 0xff, + 0x80, 0x85, 0x02, 0x1f, 0xb6, 0x6a, 0x28, 0x3f, + 0x01, 0xa8, 0x36, 0x2e, 0xc7, 0x42, 0xd4, 0x02, + 0x26, 0xea, 0xb5, 0x84, 0x6c, 0x9f, 0xa0, 0x4a, + 0x73, 0x49, 0xea, 0x91, 0x4d, 0x62, 0xf8, 0x23, + 0xe4, 0x3d, 0x91, 0xfb, 0x53, 0x2c, 0x8c, 0xa4, + 0xfe, 0x81, 0x05, 0x5d, 0x4b, 0x9a, 0x75, 0x29, + 0xf8, 0xbe, 0x3f, 0x05, 0xb4, 0x8f, 0xdc, 0xcc, + 0xfa, 0xcc, 0xd7, 0xb2, 0x06, 0x03, 0xd4, 0xf3, + 0x8e, 0x09, 0x09, 0x80, 0xf8, 0xc3, 0x3b, 0x66, + 0xe9, 0x9c, 0x5b, 0x16, 0xed, 0x2d, 0x35, 0x1c, + 0x99, 0x3b, 0x1f, 0x0e, 0x04, 0x30, 0x23, 0x3a, + 0x83, 0x0c, 0xec, 0x76, 0xf2, 0x5d, 0x13, 0x54, + 0x15, 0x62, 0x36, 0x26, 0x6b, 0x21, 0x62, 0xdd, + 0xb4, 0x1a, 0x57, 0x16, 0xfd, 0xa0, 0x9c, 0xfa, + 0x37, 0xb3, 0xda, 0xe0, 0x46, 0x91, 0xb3, 0x20, + 0xe7, 0xe2, 0xf3, 0x0e, 0x20, 0x3c, 0x98, 0x1b, + 0xe4, 0xc2, 0xd3, 0xa9, 0x97, 0xaf, 0x12, 0x69, + 0x23, 0x97, 0x62, 0x6e, 0xae, 0x54, 0x9c, 0x82, + 0x92, 0x50, 0x74, 0x07, 0x4a, 0xb1, 0xdc, 0xcf, + 0x53, 0x1d, 0xc8, 0x29, 0x1f, 0x6e, 0xf1, 0x13, + 0xec, 0xb6, 0x60, 0xb1, 0x4c, 0x9d, 0xd7, 0x77, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t aes_cbc_192_encblkno1_vec2_ctxt[SECSIZE] = { + 0x33, 0xfd, 0xfa, 0x44, 0x64, 0x75, 0x22, 0x7e, + 0xe3, 0xb3, 0xa0, 0x75, 0x99, 0x96, 0xc0, 0xec, + 0x56, 0x06, 0x7d, 0x19, 0x0b, 0x66, 0x89, 0xe0, + 0x69, 0x1d, 0x93, 0x91, 0xd7, 0x0f, 0xf8, 0xf5, + 0x5a, 0x39, 0x30, 0xad, 0x64, 0x42, 0x06, 0xa3, + 0xce, 0x3f, 0x67, 0xd6, 0x6e, 0xcd, 0x3b, 0xf5, + 0x03, 0x2b, 0x07, 0x83, 0x18, 0x1a, 0x4f, 0x4c, + 0xe7, 0x6b, 0xe8, 0xf9, 0x19, 0xa5, 0x23, 0x8f, + 0x46, 0x35, 0x13, 0x7b, 0x61, 0x05, 0xfc, 0x7d, + 0x17, 0x39, 0x03, 0xa8, 0xec, 0x7a, 0xd2, 0x5f, + 0x91, 0xa7, 0x26, 0x07, 0x9d, 0xd7, 0x0c, 0xd7, + 0xd4, 0x8e, 0x37, 0xf3, 0x1a, 0x3c, 0x04, 0x83, + 0x04, 0x71, 0x06, 0xa6, 0x5f, 0x82, 0xe0, 0x6d, + 0x87, 0x5c, 0x7c, 0x03, 0x25, 0x03, 0x4b, 0x24, + 0x07, 0x40, 0xad, 0xe4, 0x1d, 0x1d, 0xcb, 0x34, + 0xc2, 0x53, 0x1d, 0x13, 0xc5, 0x87, 0xab, 0xa7, + 0x95, 0x11, 0x8b, 0xbb, 0xf0, 0xc3, 0x00, 0xeb, + 0xe5, 0xb0, 0x9e, 0x88, 0x8b, 0xad, 0xca, 0xcb, + 0x17, 0xf8, 0x92, 0x4d, 0x00, 0xb0, 0x08, 0x74, + 0x08, 0xb9, 0x8b, 0x95, 0x96, 0xd9, 0x36, 0x35, + 0x31, 0x92, 0x89, 0xf6, 0x35, 0x33, 0xfb, 0x18, + 0x5b, 0x84, 0xa1, 0xfe, 0xe1, 0x62, 0x04, 0x6f, + 0x3c, 0xc1, 0xd2, 0xc2, 0x10, 0xd7, 0x97, 0xba, + 0x29, 0x7c, 0xe3, 0x85, 0xee, 0x59, 0x90, 0xaf, + 0x7f, 0x6f, 0x97, 0x97, 0xa2, 0x41, 0x18, 0x7f, + 0x2f, 0x06, 0x15, 0xb2, 0x46, 0x82, 0x49, 0x39, + 0xd0, 0xfb, 0xa8, 0x48, 0x44, 0x28, 0x58, 0xff, + 0xd8, 0xf2, 0x65, 0xf9, 0x4f, 0x2c, 0xbe, 0xec, + 0xb6, 0xdf, 0x27, 0x1a, 0xf2, 0x05, 0x15, 0x5e, + 0xe3, 0x2a, 0x98, 0x29, 0x92, 0x4a, 0x1b, 0x5d, + 0x5c, 0x2c, 0x70, 0xf6, 0x41, 0xd4, 0xbe, 0x64, + 0xa1, 0xd9, 0x79, 0xf1, 0x11, 0x16, 0xda, 0xa2, + 0xaf, 0xdd, 0x4d, 0xa8, 0xed, 0xec, 0xbe, 0x7d, + 0x49, 0x6c, 0x30, 0xf2, 0xf5, 0x36, 0x3c, 0xae, + 0x4b, 0xa7, 0x77, 0xa3, 0xca, 0x22, 0xa5, 0xe2, + 0x4d, 0x44, 0xcb, 0x36, 0xd5, 0x3f, 0x20, 0x13, + 0xb6, 0xfb, 0xcd, 0x79, 0xd7, 0x42, 0xf9, 0x75, + 0x09, 0x45, 0x28, 0x9e, 0xf2, 0xbd, 0x15, 0x57, + 0xf8, 0x4b, 0xc0, 0xd3, 0xb3, 0xb8, 0xde, 0x55, + 0x9e, 0x11, 0x67, 0xab, 0xc5, 0x5d, 0x58, 0xdb, + 0x4d, 0x20, 0x34, 0x77, 0x33, 0x9c, 0x46, 0x76, + 0x9b, 0x1e, 0x0e, 0x6b, 0x4e, 0xd9, 0x63, 0x68, + 0x78, 0x5e, 0x7c, 0x52, 0xa2, 0x64, 0xa9, 0xfc, + 0x21, 0x35, 0x17, 0x93, 0x18, 0x9e, 0x10, 0xcf, + 0x95, 0x6b, 0xf0, 0x55, 0x46, 0xc3, 0x4b, 0xfc, + 0x86, 0x8b, 0x0d, 0x3b, 0x5c, 0x30, 0xcc, 0xf1, + 0x4c, 0x43, 0xf0, 0xd6, 0xf6, 0x3b, 0x0b, 0x68, + 0x6f, 0x21, 0xd1, 0x61, 0xda, 0x35, 0x92, 0x94, + 0xa5, 0x5d, 0x47, 0x39, 0x96, 0x50, 0x5f, 0xbd, + 0x57, 0x22, 0xd2, 0x65, 0x73, 0x05, 0x8f, 0x2b, + 0xf2, 0x96, 0x53, 0x6b, 0x8e, 0xd3, 0x1e, 0xe7, + 0x92, 0xd4, 0xea, 0x41, 0xee, 0x92, 0x4d, 0x10, + 0x9f, 0x68, 0xd8, 0xe9, 0xac, 0x1f, 0x38, 0x0b, + 0x12, 0xa4, 0x1c, 0xb2, 0x63, 0x2b, 0x87, 0x07, + 0xb8, 0x1e, 0x02, 0x2b, 0x4d, 0xad, 0x99, 0xdf, + 0xe3, 0x98, 0x69, 0x29, 0x11, 0xe3, 0x77, 0x45, + 0x9a, 0xe9, 0x6c, 0x47, 0x4e, 0xc0, 0x85, 0x15, + 0x68, 0x58, 0x41, 0x37, 0xab, 0x96, 0x11, 0x94, + 0x9e, 0xbb, 0xa8, 0x5d, 0x51, 0x05, 0x93, 0xdd, + 0x2e, 0xb8, 0xdf, 0xcf, 0x83, 0xbc, 0xf6, 0x53, + 0x95, 0x93, 0x27, 0xda, 0xa5, 0x20, 0x1b, 0x7d, + 0x1d, 0xd9, 0x0c, 0xde, 0xe5, 0x3f, 0xc8, 0x60, + 0x16, 0x32, 0x95, 0x24, 0xa7, 0x2b, 0x74, 0xf1, + 0x67, 0xf9, 0xf2, 0x49, 0xda, 0x12, 0x97, 0xdd, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t aes_cbc_192_encblkno1_vec3_ctxt[SECSIZE] = { + 0xa5, 0x81, 0x86, 0x78, 0x4a, 0xd7, 0x5b, 0x83, + 0xcf, 0xbf, 0x7e, 0x3c, 0xd7, 0xcd, 0xaf, 0xfa, + 0x82, 0x18, 0xce, 0xbd, 0x8b, 0xe6, 0xd9, 0x39, + 0x22, 0x2d, 0x1e, 0x75, 0x65, 0xee, 0x61, 0xf2, + 0xc3, 0x8b, 0xf4, 0x40, 0x03, 0x73, 0x8a, 0x21, + 0x9f, 0xf3, 0xcc, 0x93, 0x08, 0x3d, 0xff, 0x8a, + 0xbc, 0x0f, 0x19, 0xa1, 0x9f, 0xc8, 0x73, 0xe8, + 0xa6, 0x14, 0x2e, 0x43, 0x19, 0x79, 0x61, 0x35, + 0x8d, 0x55, 0x06, 0xeb, 0x96, 0xe7, 0xf5, 0x4b, + 0x95, 0x5f, 0x9b, 0xb2, 0x18, 0x0d, 0x13, 0xc2, + 0x96, 0x79, 0x50, 0x78, 0x98, 0x50, 0x88, 0x2b, + 0xab, 0x05, 0x66, 0xa1, 0x3a, 0x25, 0x85, 0xe2, + 0xd0, 0xe2, 0xac, 0xb5, 0x26, 0xde, 0x95, 0x04, + 0x45, 0xe7, 0x22, 0x71, 0x02, 0xb3, 0x84, 0x4c, + 0xb5, 0xad, 0x64, 0x5c, 0x27, 0x5c, 0x71, 0xcd, + 0x0b, 0x62, 0x91, 0xd6, 0x84, 0x00, 0x62, 0x52, + 0x54, 0xbd, 0x22, 0xc8, 0x57, 0xa7, 0x41, 0xac, + 0xc7, 0xa8, 0x56, 0x6f, 0x1b, 0x7e, 0xce, 0x02, + 0x29, 0x3b, 0xc0, 0x5d, 0x8e, 0x11, 0xa9, 0x54, + 0xc2, 0xf2, 0xf0, 0x81, 0x6c, 0x9a, 0x24, 0x5b, + 0x81, 0x7d, 0xf3, 0x84, 0x93, 0xc6, 0x2a, 0xd4, + 0xd3, 0x1a, 0x2f, 0x97, 0x2e, 0x31, 0x8a, 0x62, + 0x43, 0xcb, 0xc7, 0x3d, 0x73, 0x8e, 0xd6, 0x86, + 0x17, 0x8f, 0x63, 0xd4, 0xb1, 0x50, 0x92, 0xce, + 0x90, 0x37, 0x91, 0xce, 0x37, 0x13, 0x8e, 0x61, + 0x21, 0xd8, 0x1a, 0xbf, 0x42, 0x65, 0x1d, 0x86, + 0x07, 0x04, 0x9b, 0xd1, 0xd3, 0x26, 0x6b, 0x7c, + 0xa1, 0x77, 0x54, 0x5b, 0x9f, 0x95, 0x62, 0x43, + 0xb3, 0x71, 0x1e, 0x4c, 0x32, 0xd1, 0x3e, 0xe8, + 0x60, 0x9c, 0x0c, 0x15, 0x55, 0xf0, 0x38, 0xb7, + 0x1e, 0x40, 0xe5, 0x26, 0x4e, 0x46, 0x49, 0x47, + 0x59, 0x3d, 0x49, 0x76, 0x28, 0xd3, 0xed, 0x03, + 0xdd, 0xf8, 0x1a, 0xf4, 0x1a, 0xfe, 0xe4, 0x03, + 0xb9, 0xa5, 0x8e, 0x7c, 0x91, 0x7a, 0xb2, 0x17, + 0x84, 0x97, 0x3f, 0x12, 0x68, 0xaa, 0xf5, 0x73,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, 0xa0, 0x9b, 0x17, 0x90, + 0x42, 0x40, 0x18, 0x35, 0x2e, 0x17, 0xa0, 0x6e, + 0x43, 0xe7, 0xac, 0x89, 0x96, 0x3c, 0x16, 0xe0, + 0xdb, 0x09, 0x51, 0x4a, 0x45, 0x33, 0x63, 0xe9, + 0x4e, 0x3f, 0x32, 0x34, 0x36, 0x43, 0xd5, 0x0c, + 0x5a, 0x2e, 0x0e, 0x8b, 0x80, 0xb7, 0xf4, 0xe4, + 0x99, 0x9b, 0x05, 0xf5, 0xb2, 0xe4, 0x03, 0xe4, +}; + +const struct testvec aes_cbc_192_1_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t aes_cbc_192_encblkno8_vec0_ctxt[SECSIZE] = { + 0x87, 0x9c, 0x05, 0xd6, 0x25, 0xb9, 0xe0, 0xbe, + 0x78, 0x21, 0x85, 0x81, 0x8e, 0x2f, 0x13, 0x5e, + 0xf2, 0x73, 0x11, 0xfa, 0x73, 0x77, 0x93, 0x5e, + 0x71, 0x16, 0x98, 0x68, 0x6f, 0xe8, 0x22, 0x34, + 0xf5, 0x11, 0xfa, 0x61, 0xe6, 0x1a, 0xfb, 0x42, + 0xa7, 0xa3, 0x2e, 0x0d, 0xc1, 0x9d, 0x7d, 0xd9, + 0xfb, 0xbb, 0xc5, 0x08, 0x9d, 0xc2, 0xab, 0x5c, + 0xdf, 0x9b, 0x3c, 0x1a, 0xbd, 0x66, 0x5a, 0x91, + 0x1c, 0x00, 0x59, 0x2e, 0x92, 0xe9, 0x23, 0xf6, + 0x90, 0x3d, 0x5b, 0x72, 0x76, 0x78, 0xd9, 0xa2, + 0x48, 0x33, 0x29, 0xe2, 0xfd, 0x77, 0x14, 0xda, + 0x01, 0x92, 0x63, 0xdd, 0x8c, 0x1c, 0x2e, 0xf7, + 0x61, 0xfb, 0xc5, 0x76, 0xec, 0x7f, 0xef, 0xdc, + 0xbe, 0x2d, 0x3b, 0x69, 0x30, 0xb9, 0x08, 0x00, + 0xe8, 0x37, 0x09, 0xaa, 0x2a, 0x02, 0x80, 0x11, + 0x91, 0x16, 0x94, 0x7d, 0xb5, 0xdc, 0x9f, 0xb3, + 0xb0, 0x26, 0x72, 0x85, 0x93, 0x85, 0x19, 0x08, + 0x97, 0xef, 0x97, 0x57, 0xa8, 0x76, 0x0e, 0x85, + 0xb1, 0x1d, 0x79, 0xe3, 0x7a, 0xe8, 0x06, 0x3b, + 0xc4, 0x00, 0xbd, 0xaa, 0xd9, 0x17, 0x81, 0x37, + 0x12, 0x86, 0x52, 0xea, 0x04, 0xb2, 0x11, 0x0f, + 0x5a, 0x08, 0x68, 0xcb, 0x48, 0xca, 0x2f, 0xda, + 0xa3, 0x0a, 0x60, 0x57, 0xc7, 0x80, 0x36, 0x60, + 0x05, 0xce, 0xd5, 0x43, 0xc9, 0xbc, 0x6c, 0xe6, + 0x63, 0x38, 0x2e, 0x81, 0x90, 0x34, 0x11, 0x2c, + 0x84, 0x0c, 0x62, 0x68, 0xde, 0x17, 0x57, 0x43, + 0x19, 0xa5, 0x92, 0x9d, 0x91, 0x2b, 0xa2, 0x95, + 0x7c, 0x20, 0x72, 0xaa, 0x83, 0x24, 0x54, 0x94, + 0x10, 0x80, 0xd4, 0x3f, 0x58, 0xb9, 0x7b, 0x74, + 0x68, 0xd5, 0xfb, 0x3e, 0xdd, 0xb4, 0xdf, 0x65, + 0x72, 0x88, 0x45, 0x8a, 0xd0, 0x93, 0x6e, 0x99, + 0x84, 0xad, 0x39, 0x73, 0x16, 0x88, 0xdc, 0x89, + 0x33, 0x34, 0xd7, 0xd8, 0x97, 0xfb, 0x90, 0xd2, + 0xc5, 0x8e, 0x94, 0xc4, 0xf1, 0xfe, 0xbe, 0x23, + 0xf1, 0x3a, 0x10, 0x1c, 0x42, 0x6b, 0xf5, 0xee, + 0xe4, 0x78, 0x8a, 0x7e, 0x13, 0x02, 0x25, 0xcb, + 0xd1, 0x61, 0x1f, 0xab, 0x45, 0x1f, 0x90, 0x88, + 0x0f, 0x6b, 0xff, 0x61, 0xba, 0xf3, 0xac, 0x8e, + 0x13, 0xc2, 0xfb, 0xca, 0x41, 0xed, 0xfe, 0x6c, + 0xcb, 0xdf, 0x97, 0x60, 0x29, 0x8a, 0x72, 0x8d, + 0x7d, 0xad, 0x6e, 0xe9, 0x7b, 0xc4, 0x92, 0x14, + 0x5e, 0x33, 0x27, 0xe2, 0xda, 0x2f, 0x95, 0x5f, + 0x40, 0x27, 0xeb, 0xdb, 0x0d, 0x1e, 0xc5, 0xd4, + 0x43, 0x50, 0x1a, 0x62, 0x82, 0xbe, 0x24, 0x7f, + 0xb7, 0x46, 0xa8, 0x70, 0x10, 0x33, 0xb6, 0x3f, + 0xbf, 0xa8, 0xa8, 0x85, 0xab, 0x1d, 0xb4, 0x3f, + 0x84, 0x06, 0x91, 0xd6, 0x18, 0x3d, 0xeb, 0x8b, + 0x3f, 0x9b, 0x37, 0x9e, 0x2e, 0xd2, 0xec, 0xe5, + 0x2d, 0xf0, 0x3f, 0x45, 0xd5, 0x9d, 0xb9, 0x28, + 0x89, 0xe4, 0x0c, 0xa9, 0x38, 0xca, 0x22, 0x56, + 0x53, 0xdf, 0x49, 0xba, 0x5d, 0x99, 0xd6, 0x4b, + 0x1d, 0x0d, 0x6d, 0xee, 0x7c, 0xf2, 0x6f, 0x50, + 0x04, 0xf1, 0xf8, 0x49, 0xd1, 0x2f, 0x50, 0x3e, + 0xf1, 0x08, 0x49, 0x17, 0x08, 0xd2, 0xac, 0x5d, + 0x58, 0xe7, 0x27, 0xe6, 0x59, 0x02, 0x9f, 0x1c, + 0x40, 0xff, 0x6c, 0x67, 0xae, 0x49, 0x1a, 0x2a, + 0xab, 0xd9, 0x63, 0x25, 0x2d, 0x9b, 0xd8, 0x1a, + 0x41, 0xa6, 0xea, 0x72, 0xfd, 0x56, 0xa1, 0x57, + 0x59, 0xdd, 0xf5, 0xa3, 0xb2, 0x2f, 0x64, 0xb1, + 0xc5, 0xfe, 0x8d, 0x9b, 0x93, 0xd1, 0x51, 0x77, + 0x13, 0x50, 0x74, 0x30, 0x28, 0xe4, 0x7a, 0x06, + 0x69, 0xd4, 0xa8, 0x0a, 0xae, 0x02, 0x4a, 0x61, + 0x24, 0xc2, 0xcd, 0xc8, 0xd3, 0x12, 0x2e, 0xac, + 0x9a, 0x0c, 0x24, 0x06, 0xb8, 0x1e, 0x3d, 0x29, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t aes_cbc_192_encblkno8_vec1_ctxt[SECSIZE] = { + 0x1e, 0x3b, 0x66, 0x76, 0xd9, 0x9e, 0xf7, 0x82, + 0x17, 0x76, 0x69, 0x4d, 0x64, 0x63, 0xf1, 0x01, + 0x81, 0x8a, 0xa4, 0x97, 0x05, 0x42, 0xdb, 0x8c, + 0x27, 0xc8, 0xfd, 0x08, 0x21, 0x17, 0x87, 0xa9, + 0x0c, 0x86, 0x2d, 0xda, 0x17, 0xd5, 0x5d, 0x67, + 0x12, 0x93, 0x8d, 0x34, 0x5a, 0xfc, 0x2a, 0x49, + 0x1a, 0x1a, 0x77, 0x20, 0xfb, 0x1d, 0x5d, 0xd8, + 0x99, 0xb0, 0x8f, 0x1c, 0x13, 0x4d, 0x28, 0x6d, + 0x2d, 0x79, 0xa9, 0x8e, 0x04, 0x0c, 0x5a, 0xd5, + 0x52, 0x09, 0x15, 0x4a, 0xfb, 0x7a, 0xf8, 0xdc, + 0x3b, 0x77, 0xaf, 0xe0, 0x80, 0x6b, 0xac, 0x5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0a, 0xe3, + 0xda, 0x07, 0xa6, 0x20, 0x7b, 0x49, 0x47, 0x87, + 0xff, 0xf0, 0xe8, 0x7e, 0xcf, 0xc4, 0x2c, 0x02, + 0xdd, 0x53, 0xe9, 0x79, 0xc7, 0x6d, 0x16, 0x9f, + 0x2b, 0xd7, 0x1a, 0x36, 0x25, 0x5c, 0xba, 0x5c, + 0xdb, 0x44, 0x88, 0x99, 0x32, 0x2e, 0xb6, 0x3f, + 0xb4, 0xdd, 0x15, 0xeb, 0xec, 0x2a, 0x9e, 0xc5, + 0x37, 0x30, 0x2a, 0xd5, 0xc4, 0x2a, 0x9b, 0x40, + 0x97, 0x83, 0x94, 0xe7, 0x79, 0x79, 0x63, 0x4b, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t aes_cbc_192_encblkno8_vec2_ctxt[SECSIZE] = { + 0x34, 0x07, 0x20, 0x14, 0x64, 0x0b, 0xa2, 0x2c, + 0xed, 0xba, 0x46, 0x24, 0xa0, 0xe6, 0x99, 0x8a, + 0x20, 0x75, 0x5f, 0x9f, 0x2a, 0x10, 0xa6, 0x1c, + 0x52, 0x60, 0x18, 0x67, 0xd6, 0x0d, 0x90, 0x4e, + 0xbc, 0x25, 0x5f, 0x81, 0xb4, 0x10, 0xdb, 0xd9, + 0xaf, 0x36, 0x84, 0x5c, 0x20, 0x25, 0x25, 0xbf, + 0x0d, 0xfa, 0xc5, 0x75, 0x2b, 0xec, 0xf2, 0xa6, + 0x69, 0x5c, 0xfe, 0xee, 0x21, 0xd8, 0x87, 0xdf, + 0xe3, 0x83, 0xeb, 0xb3, 0x3f, 0x5b, 0xda, 0x37, + 0x11, 0x05, 0xf7, 0xd8, 0xe0, 0x94, 0x08, 0x2b, + 0x75, 0x6b, 0xf3, 0x40, 0x53, 0x85, 0xde, 0x7a, + 0x64, 0xb1, 0x0e, 0x5f, 0x01, 0xb5, 0xfb, 0x74, + 0x48, 0x9a, 0xd4, 0x41, 0x33, 0x70, 0x9b, 0x08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xb3, + 0x48, 0x57, 0xbf, 0xd1, 0x77, 0xe8, 0x72, 0x31, + 0x4d, 0x2f, 0xe8, 0xa0, 0xf4, 0x7c, 0x25, 0x9c, + 0xcd, 0xa5, 0x7e, 0xd3, 0x30, 0xda, 0x46, 0xf5, + 0x48, 0x9e, 0x39, 0x34, 0x94, 0xd6, 0x24, 0x10, + 0xfc, 0x74, 0x2b, 0x6d, 0xcc, 0x00, 0x76, 0x3e, + 0x3b, 0x85, 0xfa, 0xef, 0x87, 0x70, 0x53, 0x4e, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t aes_cbc_192_encblkno8_vec3_ctxt[SECSIZE] = { + 0xfe, 0xad, 0xf3, 0x4a, 0x9d, 0x64, 0x4e, 0x5d, + 0xaf, 0xa8, 0x44, 0x7e, 0xc9, 0x75, 0xe8, 0xd0, + 0x87, 0x73, 0x66, 0x4c, 0x77, 0x00, 0xfb, 0x7b, + 0x04, 0xe7, 0xd8, 0x82, 0x75, 0xe3, 0xa5, 0xbc, + 0xf3, 0x80, 0xae, 0x7c, 0xc9, 0x75, 0x9a, 0xc1, + 0x73, 0x49, 0x69, 0xf6, 0xa0, 0x49, 0x6e, 0x77, + 0x5f, 0x9b, 0x95, 0x9b, 0x9f, 0x41, 0x54, 0x57, + 0x0e, 0x3c, 0xe5, 0x2c, 0xbb, 0xbf, 0xd5, 0x76, + 0xf6, 0xb6, 0x05, 0xaa, 0x20, 0x5b, 0xdb, 0xcb, + 0x81, 0xad, 0x0c, 0x8a, 0x68, 0x94, 0x7d, 0x88, + 0xdc, 0x15, 0x6c, 0x89, 0x97, 0x53, 0x30, 0x96, + 0x4a, 0x54, 0xf9, 0x88, 0x00, 0xf7, 0x3b, 0x99, + 0xfc, 0x82, 0xe3, 0x48, 0xd2, 0x16, 0x2b, 0xba, + 0xd4, 0xba, 0x24, 0xd0, 0xd1, 0xb0, 0x8e, 0xcd, + 0x77, 0xdc, 0x01, 0xdf, 0xb2, 0x20, 0xc5, 0x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0x5c, 0xa7, 0x8e, 0xc6, 0x4e, + 0x61, 0xe3, 0x83, 0xa1, 0xd4, 0x2c, 0xb2, 0x2c, + 0x46, 0x5a, 0xbf, 0x96, 0xeb, 0xda, 0x45, 0x2d, + 0x25, 0x37, 0x69, 0x1a, 0x6b, 0xd6, 0xbc, 0xe1, + 0x28, 0x65, 0xf9, 0xfc, 0xa7, 0xda, 0xf8, 0x79, + 0x87, 0x18, 0x99, 0x01, 0x74, 0x5a, 0x42, 0x79, + 0x8e, 0xe4, 0x23, 0x1a, 0x6c, 0xda, 0x93, 0x0f, + 0x19, 0xf0, 0xff, 0x0e, 0x25, 0x45, 0x1e, 0xbb, + 0x17, 0xca, 0x87, 0x6a, 0x9e, 0xd0, 0xd3, 0xd5, + 0x22, 0x5f, 0xce, 0x92, 0xeb, 0x82, 0x8e, 0x3e, + 0x4e, 0x99, 0x44, 0xa2, 0x9e, 0x78, 0x53, 0x89, + 0x4e, 0x45, 0x51, 0x41, 0x28, 0x91, 0xdb, 0x7e, + 0x8f, 0xac, 0xc2, 0xee, 0x09, 0xcb, 0xed, 0x04, + 0x7b, 0x37, 0xa1, 0x1d, 0x9c, 0x90, 0x19, 0xb1, + 0xdd, 0xc3, 0x22, 0xc8, 0x70, 0x07, 0x26, 0xce, + 0x4a, 0xc4, 0xde, 0xee, 0x87, 0xf3, 0x62, 0x69, + 0xed, 0xb2, 0x2d, 0x10, 0xc4, 0xfa, 0x86, 0x2e, + 0xd1, 0xb8, 0x58, 0xa3, 0xa4, 0x0b, 0x30, 0x87, + 0x23, 0x62, 0xed, 0xf3, 0x7b, 0x80, 0x7e, 0x4f, + 0xc2, 0xb3, 0xe8, 0xba, 0x25, 0x3e, 0xd3, 0x12, + 0x7e, 0x27, 0xd5, 0x72, 0x3b, 0x02, 0xf4, 0xfd, + 0x2f, 0x8b, 0xc2, 0x5f, 0x44, 0x40, 0x31, 0x88, + 0x73, 0x81, 0xa3, 0xcc, 0xc4, 0x78, 0x2b, 0xfc, + 0x41, 0x2e, 0xb2, 0xd0, 0xb4, 0x00, 0x29, 0xc1, + 0x46, 0xdf, 0xc1, 0xbd, 0x15, 0x59, 0xa3, 0x6a, + 0xc8, 0x2f, 0x29, 0x28, 0x12, 0x9b, 0x1e, 0xea, + 0x4e, 0xa9, 0x80, 0xa1, 0xb8, 0x89, 0x21, 0x3b, +}; + +const struct testvec aes_cbc_192_8_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_192_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t aes_cbc_256_encblkno1_vec0_ctxt[SECSIZE] = { + 0x1a, 0xa4, 0xe3, 0x09, 0x23, 0x2e, 0x91, 0x1b, + 0xa8, 0x3e, 0xda, 0x92, 0xb3, 0x22, 0xd2, 0xe8, + 0x8b, 0xed, 0x6c, 0xa7, 0x78, 0xe6, 0x32, 0x25, + 0xc4, 0x88, 0xd5, 0xb7, 0x6e, 0xef, 0xbf, 0x37, + 0x00, 0xd9, 0xb2, 0x55, 0x10, 0x4f, 0x7d, 0x84, + 0x3a, 0xae, 0xd2, 0xc6, 0x48, 0xdd, 0x3c, 0xd5, + 0x9b, 0xa7, 0xf8, 0xc2, 0xda, 0x6d, 0x14, 0xa2, + 0xdc, 0x54, 0x12, 0x8f, 0x1c, 0x22, 0x98, 0x6a, + 0xc0, 0x5f, 0x47, 0xa7, 0x78, 0xec, 0x79, 0x5d, + 0x04, 0xed, 0x5e, 0x20, 0x33, 0x53, 0x66, 0x40, + 0x83, 0x94, 0x5b, 0x34, 0x05, 0x25, 0x2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14, 0x0f, 0xaa, 0xd8, 0xc3, 0x02, + 0x64, 0xdc, 0xa0, 0x15, 0xc8, 0xf6, 0x17, 0x8b, + 0x9c, 0xb3, 0xf2, 0x27, 0xc1, 0x3f, 0x60, 0x94, + 0x33, 0x10, 0x89, 0x49, 0x5f, 0xd2, 0x0e, 0xfe, + 0x9e, 0x99, 0x68, 0x95, 0xe4, 0x12, 0xfc, 0xe3, + 0x7f, 0xc4, 0xb1, 0x88, 0x4f, 0x66, 0xcd, 0x24, + 0x89, 0x09, 0xbb, 0x01, 0xf6, 0x9a, 0xe4, 0x41, + 0xee, 0x83, 0xd2, 0x28, 0xf5, 0x28, 0x49, 0x13, + 0x78, 0xfb, 0xb2, 0x0d, 0x5c, 0x97, 0xf4, 0x9c, + 0xe0, 0xdf, 0xef, 0x84, 0x36, 0x7d, 0xe5, 0x45, + 0xe0, 0xf8, 0xce, 0x82, 0x39, 0xc4, 0x54, 0x69, + 0xf1, 0x62, 0x7d, 0x1a, 0xf6, 0x6c, 0x20, 0x86, + 0x72, 0x4b, 0xf9, 0x3d, 0x87, 0x68, 0xec, 0x74, + 0x67, 0xee, 0xbd, 0xb8, 0xc6, 0x12, 0x91, 0x0f, + 0xf6, 0xd9, 0x4f, 0x34, 0x96, 0xa9, 0xe7, 0x52, + 0x7b, 0xe0, 0x08, 0x57, 0x0a, 0x8b, 0x09, 0xcb, + 0xd3, 0x3e, 0x4e, 0x64, 0xca, 0x38, 0x50, 0x07, + 0x0e, 0x7b, 0x95, 0x69, 0x1b, 0x82, 0xba, 0x50, + 0x93, 0x4f, 0x9a, 0x8e, 0x11, 0x9b, 0x64, 0xf5, + 0x6a, 0xd4, 0x81, 0xf0, 0x1f, 0xb8, 0x85, 0x90, + 0x9c, 0x79, 0xde, 0xcb, 0x50, 0xba, 0xa9, 0x56, + 0x66, 0xd1, 0x1e, 0x78, 0xa8, 0x6a, 0xd5, 0xa5, + 0x83, 0x73, 0xe2, 0x88, 0xf2, 0x04, 0x33, 0x61, + 0xdf, 0x89, 0xd5, 0x3d, 0x03, 0x4e, 0x94, 0xb0, + 0x0f, 0x8d, 0x4d, 0xb4, 0x09, 0xb2, 0xf1, 0xb0, + 0xe7, 0xfe, 0xb0, 0x18, 0xe2, 0xfc, 0x92, 0xeb, + 0x2d, 0x7d, 0x56, 0x29, 0xbd, 0x34, 0x20, 0x7c, + 0xb6, 0xe7, 0x7b, 0xd7, 0x95, 0xa5, 0x0d, 0x10, + 0xbc, 0x7d, 0x9d, 0xd9, 0xbe, 0xc7, 0x23, 0x44, + 0x37, 0xb3, 0x98, 0x36, 0x33, 0x1a, 0x11, 0xfe, + 0x41, 0xea, 0x59, 0x48, 0x75, 0x34, 0xf6, 0xc4, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t aes_cbc_256_encblkno1_vec1_ctxt[SECSIZE] = { + 0x58, 0xfc, 0x1e, 0x48, 0x66, 0x7d, 0x91, 0xc7, + 0x56, 0xa3, 0x41, 0x89, 0xe8, 0x1e, 0x02, 0x77, + 0x93, 0x38, 0x12, 0x99, 0x06, 0x0d, 0xf3, 0x6d, + 0x2a, 0x5d, 0x3d, 0x7b, 0x4e, 0x05, 0x4f, 0x8f, + 0xe3, 0x86, 0x76, 0xfe, 0x11, 0x9d, 0xde, 0xd4, + 0x83, 0xd9, 0x47, 0x8d, 0x51, 0xdf, 0x4a, 0x24, + 0x2d, 0x11, 0xf0, 0xbd, 0xde, 0x17, 0x7e, 0x52, + 0x20, 0xc7, 0x17, 0x88, 0x2e, 0xa4, 0xd5, 0xa0, + 0x1e, 0xbc, 0x61, 0x15, 0x1e, 0x52, 0xa1, 0x8b, + 0xe9, 0xe4, 0x1f, 0x81, 0x49, 0x64, 0x17, 0xd4, + 0xef, 0xb6, 0x40, 0x05, 0x2f, 0x36, 0xf7, 0x39, + 0x03, 0x05, 0x80, 0xff, 0xf2, 0x1a, 0x15, 0xf1, + 0xfc, 0xaf, 0x71, 0x51, 0x73, 0xc5, 0x9e, 0x2f, + 0xd1, 0x7a, 0x2d, 0xd7, 0xed, 0x90, 0x11, 0xd2, + 0x80, 0x49, 0x46, 0x9f, 0x13, 0xa7, 0x32, 0x33, + 0x24, 0x39, 0x59, 0xf1, 0xed, 0x64, 0x75, 0x61, + 0xc3, 0x14, 0x68, 0x48, 0xf7, 0xc7, 0xbd, 0xe0, + 0x21, 0x59, 0x91, 0x07, 0x70, 0x83, 0x8f, 0xfc, + 0x59, 0x72, 0xca, 0xdd, 0x60, 0xa0, 0xbb, 0xb1, + 0x2f, 0xb8, 0x98, 0x8d, 0xf2, 0x4d, 0x3a, 0x19, + 0xbc, 0x6b, 0x37, 0xad, 0xd2, 0xb5, 0x7d, 0x1c, + 0x4a, 0x7b, 0x58, 0x76, 0x2e, 0xf5, 0x6b, 0xaf, + 0x4c, 0x92, 0x00, 0x8a, 0xb4, 0xa3, 0x86, 0x66, + 0x07, 0xc7, 0xfc, 0x57, 0x3c, 0x73, 0xf4, 0x8b, + 0xef, 0xb6, 0xae, 0x01, 0xfb, 0x88, 0x13, 0x04, + 0xa8, 0xc7, 0xec, 0xc4, 0xe0, 0x67, 0x3a, 0xfb, + 0x67, 0xce, 0x83, 0x9b, 0x8e, 0x66, 0xff, 0xa6, + 0x17, 0x1b, 0x66, 0x27, 0xdf, 0x2a, 0xfe, 0xf3, + 0x9a, 0xba, 0x59, 0xce, 0x28, 0xd4, 0xd2, 0x40, + 0x78, 0xb6, 0xe9, 0x7d, 0x8b, 0xcc, 0x47, 0x5c, + 0xf6, 0x5d, 0xc2, 0x5d, 0xe0, 0xa7, 0x61, 0x8b, + 0xe6, 0x7d, 0x38, 0xb6, 0xea, 0xfb, 0x13, 0x31, + 0x33, 0x2a, 0xb5, 0x45, 0x7b, 0xf6, 0x9f, 0x29, + 0x06, 0x2d, 0xd8, 0xab, 0x36, 0x27, 0xe4, 0x6c, + 0xf1, 0xab, 0xcd, 0xb9, 0x08, 0x0f, 0x4b, 0x8f, + 0x22, 0xea, 0xe4, 0x5d, 0x22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, + 0xa9, 0x48, 0x1d, 0x6f, 0xc2, 0xd3, 0x35, 0x65, + 0xd8, 0x67, 0xc2, 0x9d, 0xed, 0xf7, 0x9f, 0x7b, + 0x7c, 0xd4, 0x03, 0xe0, 0xa6, 0xf9, 0x3c, 0xd0, + 0x21, 0x98, 0x60, 0xa6, 0x59, 0x86, 0xbd, 0x40, + 0x17, 0x47, 0x82, 0xb9, 0xe1, 0x11, 0x8d, 0x4b, + 0xcd, 0x1f, 0x54, 0x96, 0x17, 0x42, 0x22, 0x44, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t aes_cbc_256_encblkno1_vec2_ctxt[SECSIZE] = { + 0x1d, 0x65, 0xb2, 0x4e, 0xfa, 0x3f, 0xdb, 0xab, + 0x34, 0x9d, 0x37, 0x03, 0x17, 0x44, 0xed, 0x5b, + 0xf7, 0x1b, 0x6b, 0xc0, 0x5c, 0xfe, 0x5b, 0xcd, + 0xf0, 0xaf, 0x26, 0x82, 0x97, 0x12, 0xb8, 0x4f, + 0x76, 0x3d, 0x07, 0xd8, 0x29, 0x56, 0x3c, 0xbd, + 0x0e, 0xac, 0xd1, 0x8f, 0x53, 0x1a, 0x8f, 0xcd, + 0x04, 0x5b, 0x49, 0xe0, 0xf0, 0xea, 0xc9, 0x8a, + 0x08, 0x3d, 0x1f, 0x2d, 0x8c, 0xec, 0xb8, 0xea, + 0xe9, 0x24, 0xd1, 0x93, 0xd7, 0x9a, 0x0f, 0xd7, + 0x0f, 0x6b, 0xa0, 0x08, 0x58, 0x81, 0x68, 0x2f, + 0xde, 0x36, 0xb5, 0x87, 0xd9, 0xcd, 0x82, 0x13, + 0x36, 0x16, 0x6a, 0x9a, 0x02, 0xca, 0xda, 0x6f, + 0x51, 0x87, 0x75, 0x47, 0x89, 0xa4, 0x10, 0x60, + 0xfb, 0x1a, 0x74, 0x55, 0x6d, 0x18, 0x8d, 0x42, + 0x74, 0x2d, 0x12, 0x56, 0xc0, 0xcd, 0xa2, 0x57, + 0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f, + 0xcf, 0xe7, 0xec, 0x23, 0x39, 0x6e, 0xc0, 0x37, + 0x31, 0x84, 0xff, 0xe2, 0x5a, 0xd6, 0x88, 0x74, + 0x15, 0x15, 0x46, 0x21, 0x00, 0xe4, 0x13, 0x9a, + 0xfa, 0xb2, 0x49, 0x7e, 0x79, 0xfb, 0x8a, 0x2a, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t aes_cbc_256_encblkno1_vec3_ctxt[SECSIZE] = { + 0xc1, 0x4a, 0x3c, 0x90, 0xba, 0xd4, 0x9c, 0xe7, + 0xf2, 0x5b, 0x3a, 0xc4, 0xce, 0x4a, 0x26, 0x4a, + 0x9c, 0x3f, 0xe5, 0x7a, 0x15, 0xbb, 0xbd, 0x3e, + 0xc6, 0x49, 0x47, 0x04, 0x4e, 0x8b, 0x73, 0xa6, + 0x02, 0x3a, 0xc1, 0xa3, 0xfa, 0x1a, 0xd0, 0x03, + 0xf7, 0x26, 0x9f, 0xad, 0x06, 0x8f, 0x86, 0xdc, + 0xb8, 0x73, 0x87, 0xa2, 0x82, 0xc6, 0x80, 0xe1, + 0xac, 0x3d, 0x16, 0x4c, 0xc3, 0x7c, 0x86, 0x01, + 0xa5, 0x7a, 0x1c, 0x4b, 0x56, 0x68, 0xf6, 0x06, + 0x99, 0x32, 0x42, 0x40, 0xf1, 0xb7, 0x44, 0x4b, + 0xd1, 0xdb, 0xad, 0x4e, 0xa6, 0xc2, 0x5f, 0xee, + 0x21, 0x1d, 0x58, 0xc6, 0xd5, 0x02, 0xef, 0xb2, + 0x38, 0xef, 0x29, 0x25, 0xfd, 0x28, 0x8a, 0x5b, + 0x8b, 0x36, 0x1a, 0xd6, 0x68, 0xf8, 0x77, 0xed, + 0xba, 0xb3, 0xa5, 0x6f, 0x76, 0x5e, 0xb5, 0xd4, + 0xc3, 0xb8, 0xf9, 0x67, 0x7a, 0x18, 0x43, 0xb6, + 0x65, 0x07, 0x48, 0x1d, 0x56, 0x20, 0x11, 0xe1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4, 0xea, 0x34, 0xee, 0x07, + 0xee, 0x77, 0xb1, 0x3f, 0x54, 0x05, 0xbe, 0x66, + 0x7f, 0xf2, 0x70, 0x34, 0x45, 0xa7, 0x4b, 0x27, + 0xef, 0xe6, 0x39, 0x2e, 0x13, 0x41, 0xdb, 0x2d, + 0x1f, 0x76, 0x11, 0x76, 0x33, 0xf3, 0x92, 0x33, + 0x69, 0x16, 0x34, 0x86, 0x23, 0xc5, 0xfa, 0xaf, + 0xff, 0xbf, 0xee, 0x84, 0x56, 0xf6, 0x1e, 0x54, + 0x37, 0x32, 0x79, 0x83, 0x45, 0x04, 0x6f, 0x0e, + 0x75, 0x75, 0xd9, 0xd6, 0x4a, 0x87, 0xfb, 0x3c, + 0xb1, 0xcf, 0x66, 0xab, 0xa4, 0xaa, 0xf6, 0x96, + 0xb0, 0xcd, 0xaf, 0xac, 0x2c, 0x6d, 0x72, 0xca, + 0x43, 0xef, 0xb7, 0xa0, 0x4c, 0x62, 0xba, 0x7e, + 0x59, 0x0b, 0xff, 0x90, 0x49, 0x63, 0xf6, 0x31, + 0x8b, 0x50, 0x20, 0x82, 0x7d, 0xf0, 0x2d, 0xe4, + 0x5b, 0xda, 0xdf, 0xb0, 0xfb, 0x07, 0x7b, 0xe3, + 0x5f, 0xac, 0xd8, 0xe5, 0xa0, 0x3e, 0xc5, 0x60, + 0x94, 0xbc, 0xf7, 0x7e, 0xdc, 0x18, 0x27, 0x20, + 0xb1, 0xdd, 0x51, 0x4a, 0xb2, 0xe0, 0xc0, 0xe7, + 0x5d, 0x0f, 0x88, 0xb2, 0xa0, 0x42, 0x73, 0xfb, + 0xc4, 0x24, 0xa7, 0x17, 0x8a, 0xc9, 0x6d, 0x34, + 0xe8, 0x7b, 0x51, 0x37, 0x32, 0x3f, 0xf8, 0x7e, + 0x92, 0xe4, 0x87, 0xd2, 0x89, 0x66, 0xb0, 0xf6, + 0xc2, 0xba, 0x2f, 0x42, 0x8f, 0x1d, 0x5d, 0x81, + 0xad, 0xfd, 0x00, 0xbc, 0xa9, 0x11, 0x96, 0xae, + 0x80, 0xf1, 0x27, 0xe0, 0xeb, 0x5b, 0x60, 0x39, +}; + +const struct testvec aes_cbc_256_1_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t aes_cbc_256_encblkno8_vec0_ctxt[SECSIZE] = { + 0xe5, 0x55, 0xd9, 0xae, 0xc0, 0x66, 0x2d, 0x2f, + 0x11, 0xb1, 0x27, 0xd2, 0xb2, 0x73, 0xe4, 0x0a, + 0x85, 0xb5, 0x3c, 0x79, 0x78, 0xd6, 0x35, 0x3d, + 0x46, 0xac, 0xa3, 0x81, 0x55, 0x76, 0x86, 0xfc, + 0x37, 0xa0, 0x95, 0xc2, 0x30, 0xc9, 0x19, 0xc2, + 0x5f, 0xb0, 0x13, 0xa2, 0xa8, 0xe1, 0xc7, 0xb7, + 0x61, 0x54, 0xd8, 0xe6, 0xca, 0x94, 0x6f, 0x47, + 0x87, 0x33, 0x58, 0xd9, 0xd5, 0xd2, 0x95, 0x73, + 0x87, 0x9a, 0x31, 0xe5, 0x2e, 0x95, 0x83, 0x7d, + 0xdc, 0x0f, 0xc5, 0x2f, 0x14, 0xbc, 0x80, 0xac, + 0x47, 0xd6, 0xd8, 0x17, 0x9e, 0xf7, 0xff, 0x5b, + 0x85, 0x05, 0x91, 0xe0, 0x73, 0xd2, 0x5c, 0xa7, + 0x41, 0xf8, 0xcb, 0x3d, 0x38, 0x14, 0x28, 0x3e,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73, 0xd4, 0x5f, 0x48, 0xa3, + 0x0e, 0x07, 0x69, 0x12, 0xc1, 0xbd, 0x13, 0xad, + 0xe2, 0xcf, 0x3d, 0x96, 0xd8, 0xaf, 0xed, 0xdc, + 0x4c, 0x72, 0xf6, 0xce, 0x15, 0x86, 0x88, 0x8c, + 0xbb, 0x60, 0xb3, 0xb9, 0xde, 0x42, 0x58, 0x6e, + 0xc4, 0x58, 0xac, 0x77, 0x8d, 0x35, 0x23, 0x5f, + 0xc3, 0xf9, 0x33, 0x46, 0x17, 0x80, 0x31, 0xfd, + 0xcd, 0x0a, 0x1e, 0x9b, 0xac, 0x42, 0xda, 0x70, + 0x54, 0x9a, 0xeb, 0x22, 0x27, 0x09, 0x0c, 0x6c, + 0x18, 0x1d, 0x1a, 0x5b, 0x86, 0x4d, 0x80, 0xca, + 0x4d, 0xda, 0x0e, 0x9a, 0x8e, 0x61, 0x04, 0x68, + 0x29, 0x08, 0x3b, 0xae, 0x14, 0x7d, 0x8e, 0x43, + 0x7a, 0xa7, 0x83, 0xcf, 0xb3, 0x95, 0xd3, 0x42, + 0x2d, 0x6b, 0xd8, 0x5c, 0x43, 0x31, 0x5b, 0x9c, + 0x18, 0x30, 0x0d, 0x61, 0x9c, 0xab, 0x29, 0x55, + 0xdd, 0x84, 0x24, 0x21, 0xec, 0x44, 0xad, 0xf3, + 0xb3, 0x70, 0x77, 0x2b, 0xfc, 0x3f, 0x99, 0xb8, + 0x50, 0x26, 0x8d, 0x96, 0xa2, 0x22, 0x99, 0x33, + 0x53, 0xa8, 0x5d, 0x84, 0x9b, 0x76, 0x26, 0x6e, + 0x75, 0x14, 0x7e, 0x63, 0xc6, 0x7a, 0x4f, 0x5c, + 0xfe, 0x4b, 0x80, 0xee, 0xb3, 0x32, 0x8d, 0x25, + 0x1c, 0x80, 0x7b, 0x3d, 0xd3, 0x84, 0x01, 0x1e, + 0x16, 0xa4, 0xca, 0x0d, 0x38, 0x40, 0x03, 0x6f, + 0x81, 0x8b, 0x5c, 0xad, 0x22, 0xfa, 0x6f, 0xeb, + 0x60, 0xa1, 0xcb, 0x2d, 0x97, 0xf8, 0xa6, 0x5e, + 0xbe, 0x93, 0xb7, 0xe6, 0x66, 0xbf, 0x9b, 0xd2, + 0x5c, 0x31, 0xcc, 0x70, 0x0c, 0xf1, 0xfb, 0x9f, + 0x09, 0x1b, 0xc2, 0x85, 0x2f, 0x22, 0x7c, 0x95, + 0x58, 0x09, 0xce, 0x9c, 0x7c, 0x50, 0xca, 0x89, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t aes_cbc_256_encblkno8_vec1_ctxt[SECSIZE] = { + 0x37, 0x4d, 0x25, 0xdb, 0x35, 0xe0, 0x8b, 0x82, + 0x5f, 0x77, 0xd2, 0x53, 0xd1, 0x1f, 0xf0, 0x91, + 0x5b, 0xd8, 0x93, 0x2f, 0xb2, 0x81, 0xbd, 0x75, + 0xf0, 0xd8, 0xff, 0x46, 0x8c, 0x9d, 0xf6, 0xe2, + 0x99, 0x1e, 0x76, 0x9d, 0x00, 0x3a, 0xe3, 0xcf, + 0x6d, 0x24, 0xa8, 0xe8, 0xb4, 0xa7, 0xa0, 0x87, + 0xa8, 0x43, 0x01, 0x21, 0x29, 0x70, 0x39, 0x2d, + 0x0b, 0x2a, 0xe9, 0x11, 0x57, 0x86, 0x13, 0xd4, + 0x1c, 0x1b, 0x59, 0x19, 0xc4, 0x7d, 0x2c, 0x94, + 0xc7, 0x01, 0xb8, 0x96, 0x01, 0xd2, 0x01, 0x17, + 0x97, 0x41, 0x68, 0xab, 0xba, 0x9c, 0xc8, 0xad, + 0x4e, 0xd7, 0xa8, 0x4c, 0x96, 0x3f, 0xf9, 0xfc, + 0x7e, 0xd7, 0x59, 0xe8, 0x25, 0x51, 0x4d, 0x1d, + 0x99, 0xfd, 0x0b, 0xe9, 0x88, 0x23, 0xd1, 0x4b, + 0x30, 0x6e, 0x18, 0x7c, 0xe3, 0x7a, 0x54, 0x2a, + 0x4f, 0x2a, 0x99, 0x8f, 0xaf, 0xd7, 0x5e, 0x25, + 0xfe, 0x9c, 0x47, 0x09, 0x63, 0x38, 0x0d, 0x5f, + 0xb3, 0x43, 0xa6, 0x66, 0x9b, 0xc5, 0x3d, 0x88, + 0x5e, 0xc7, 0x60, 0x99, 0x8e, 0xcb, 0x6a, 0x65, + 0x60, 0x92, 0x88, 0xe1, 0x2b, 0xfe, 0x83, 0x34, + 0x92, 0xa6, 0x6c, 0x22, 0x56, 0x5b, 0x75, 0x8a, + 0x93, 0xc3, 0x72, 0xca, 0xff, 0x59, 0x3b, 0xd8, + 0xa0, 0x80, 0x56, 0x98, 0x62, 0x8a, 0x70, 0xf2, + 0x5d, 0xd9, 0x40, 0x6b, 0xbf, 0x9f, 0x71, 0x8d, + 0x2e, 0x38, 0xe8, 0x06, 0x42, 0xa9, 0x95, 0x70, + 0x31, 0xd1, 0xe9, 0x6c, 0xab, 0xbb, 0xed, 0x25, + 0xe8, 0xca, 0xe8, 0xa4, 0x98, 0x82, 0xf5, 0xe3, + 0x11, 0x3c, 0xc4, 0xea, 0xea, 0x88, 0x56, 0x91, + 0xd6, 0x5d, 0xaa, 0xf7, 0xe9, 0x49, 0x2f, 0x42, + 0x5b, 0x76, 0xef, 0xed, 0x03, 0x9e, 0x5f, 0x4d, + 0x65, 0x25, 0xa5, 0xe8, 0x26, 0xba, 0x03, 0x4f, + 0x0e, 0x39, 0xd2, 0x53, 0x62, 0x98, 0x81, 0x9d, + 0x8e, 0xad, 0x50, 0x17, 0x9f, 0xcc, 0x34, 0x45, + 0x19, 0x5c, 0x1c, 0xd1, 0xbc, 0x71, 0x89, 0xaa, + 0x9a, 0x65, 0x55, 0x6f, 0x78, 0xd4, 0xd3, 0x5b, + 0x27, 0x8d, 0x94, 0x46, 0xd9, 0x95, 0xb3, 0x5f, + 0xc4, 0x35, 0x8d, 0xba, 0x1c, 0x40, 0x52, 0xd1, + 0x99, 0x27, 0x5d, 0x42, 0x28, 0xef, 0xcb, 0x9b, + 0x10, 0x7a, 0x19, 0xbf, 0x72, 0xa3, 0x4a, 0xb9, + 0x56, 0x83, 0x39, 0xa6, 0xb2, 0xcd, 0x48, 0x85, + 0xf9, 0xcc, 0x72, 0x88, 0xb3, 0x5a, 0x9b, 0x45, + 0xb2, 0xd3, 0x66, 0x2d, 0x24, 0x51, 0x68, 0x91, + 0x9d, 0x47, 0x6a, 0xb3, 0x9a, 0x60, 0xb3, 0xcd, + 0x6b, 0x43, 0x96, 0x21, 0xa0, 0x65, 0x43, 0xde, + 0x4f, 0x6e, 0xb5, 0x81, 0x50, 0x7e, 0xca, 0x4b, + 0xdb, 0x30, 0xf2, 0xcb, 0x28, 0x3b, 0x19, 0x6a, + 0x0a, 0xfa, 0x05, 0x5e, 0x61, 0xde, 0x76, 0x7e, + 0xdf, 0xd9, 0xa9, 0x1b, 0xd0, 0x8a, 0xb5, 0x04, + 0x51, 0xf5, 0x66, 0xa2, 0x32, 0x21, 0xb2, 0xa9, + 0x40, 0x78, 0x60, 0x9d, 0xdc, 0x45, 0xbe, 0xb4, + 0x3a, 0xba, 0xd1, 0xec, 0x31, 0x53, 0x24, 0x22, + 0x70, 0x99, 0xda, 0xc8, 0x17, 0x04, 0x87, 0x2c, + 0x89, 0x86, 0x24, 0xec, 0x52, 0x12, 0x6a, 0x51, + 0x1e, 0x2a, 0x5e, 0x96, 0xfb, 0xac, 0x95, 0x4a, + 0x1a, 0x06, 0x8f, 0xdf, 0xa7, 0x26, 0xeb, 0x6c, + 0x79, 0x4a, 0x77, 0xea, 0xb3, 0xb1, 0x3a, 0x19, + 0xe6, 0x5e, 0xe2, 0x26, 0x1b, 0x85, 0x3c, 0x9b, + 0x1d, 0x05, 0x1d, 0xbe, 0x5c, 0x25, 0x7f, 0x45, + 0x4c, 0x09, 0x4c, 0xc1, 0x47, 0xa5, 0x44, 0xfc, + 0x04, 0x2b, 0xad, 0x53, 0xac, 0x57, 0x22, 0x54, + 0x13, 0x7c, 0xc9, 0x96, 0x44, 0xda, 0x74, 0x95, + 0x6e, 0x8c, 0xe6, 0x6a, 0x05, 0x05, 0xf3, 0x8c, + 0x81, 0xaf, 0xbc, 0xb1, 0x91, 0xe7, 0xfd, 0x81, + 0x3f, 0x47, 0xc2, 0x6f, 0x0d, 0x62, 0xf6, 0x6e, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t aes_cbc_256_encblkno8_vec2_ctxt[SECSIZE] = { + 0x5a, 0x24, 0xfd, 0xee, 0x9a, 0x44, 0xfb, 0xac, + 0x3e, 0x46, 0x53, 0x95, 0x9e, 0xeb, 0x1f, 0xd9, + 0xfd, 0xc6, 0x4f, 0xae, 0x0b, 0xc8, 0xf2, 0xbd, + 0x77, 0x16, 0x7a, 0x2e, 0x8e, 0xec, 0x7a, 0x53, + 0xf4, 0xe0, 0x34, 0xba, 0x6e, 0xfa, 0xc4, 0x69, + 0xd7, 0x50, 0x13, 0x03, 0xfb, 0xb9, 0x66, 0x96, + 0xd4, 0x21, 0x67, 0xcc, 0x4c, 0x4d, 0x10, 0x2f, + 0x17, 0xeb, 0x41, 0xf4, 0x65, 0x80, 0x0b, 0x57, + 0x2d, 0xdf, 0xcf, 0x9f, 0xb9, 0xd8, 0x53, 0x36, + 0xbc, 0x1d, 0x9a, 0xe3, 0x17, 0xe7, 0x08, 0x23, + 0xb3, 0x60, 0xfe, 0xdf, 0x24, 0x06, 0xc5, 0x86, + 0x74, 0x89, 0xa3, 0xb2, 0xfc, 0x4a, 0x57, 0xf5, + 0xa6, 0x96, 0xfb, 0x56, 0xf0, 0xf4, 0xdc, 0xdc, + 0xb8, 0x53, 0x5f, 0xb2, 0xb0, 0x8d, 0x2d, 0x90, + 0x3d, 0x78, 0x4d, 0x42, 0x3a, 0x74, 0xa4, 0x8e, + 0x41, 0x7c, 0x2a, 0xff, 0xe4, 0x57, 0x1c, 0x9d, + 0x94, 0xc5, 0x5d, 0xd8, 0x8b, 0x88, 0x48, 0x15, + 0x16, 0x8a, 0xf3, 0x07, 0x3a, 0xee, 0x65, 0x24, + 0xbc, 0x7f, 0x58, 0xad, 0xed, 0xf2, 0xbd, 0x18, + 0x88, 0x1a, 0x80, 0x6e, 0xb7, 0x93, 0xe0, 0x45, + 0x04, 0xb0, 0xfc, 0xf9, 0x48, 0x76, 0xaf, 0xec, + 0x08, 0xca, 0x99, 0x64, 0x85, 0x98, 0x2c, 0xd8, + 0x85, 0x72, 0x32, 0xbe, 0x92, 0x18, 0xdd, 0xab, + 0x20, 0x8f, 0x8e, 0x11, 0xc6, 0x08, 0xf9, 0x8b, + 0xaf, 0x5f, 0xa9, 0xe5, 0x11, 0xc7, 0x45, 0x91, + 0x6e, 0x47, 0xaa, 0x0f, 0x4c, 0xf4, 0xc1, 0xb0, + 0x75, 0x4c, 0xba, 0x1d, 0xb3, 0x33, 0xf7, 0x47, + 0xbe, 0x94, 0x0b, 0x2e, 0xfa, 0x38, 0x5e, 0x5f, + 0x0a, 0xc2, 0x0c, 0x4e, 0x72, 0x29, 0x16, 0xc1, + 0x82, 0x70, 0xd4, 0xd3, 0x1b, 0x25, 0xbe, 0x0d, + 0x6b, 0x0a, 0x13, 0x9f, 0x4d, 0x3d, 0x7b, 0x10, + 0x9f, 0x93, 0x43, 0x50, 0xd1, 0x17, 0x08, 0x77, + 0x23, 0x58, 0x35, 0x41, 0x23, 0xf6, 0x9c, 0x6f, + 0x2e, 0x81, 0x6e, 0x75, 0x9b, 0x9f, 0x37, 0x4f, + 0xb7, 0xa1, 0xce, 0xde, 0x0c, 0x74, 0x99, 0x31, + 0x0e, 0x27, 0x42, 0x99, 0xdd, 0x93, 0x03, 0x6b, + 0x44, 0x22, 0xd4, 0xc8, 0x67, 0xb5, 0xb2, 0x4d, + 0x11, 0x2e, 0x80, 0x09, 0xa2, 0x5b, 0xcf, 0x0c, + 0xff, 0xfa, 0x51, 0xe5, 0x9b, 0xdd, 0x11, 0xa1, + 0x17, 0x04, 0x9e, 0xc8, 0xd8, 0x1d, 0xc1, 0x5c, + 0xc3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, 0x1e, 0xa9, 0xa1, + 0xc7, 0xf9, 0xf8, 0xa7, 0x3f, 0x85, 0xa1, 0xa4, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t aes_cbc_256_encblkno8_vec3_ctxt[SECSIZE] = { + 0x83, 0x77, 0xd8, 0xa8, 0x6a, 0x36, 0x41, 0x72, + 0xb6, 0x03, 0x4e, 0x5e, 0x39, 0x36, 0xe3, 0xf5, + 0xd0, 0x1b, 0x0d, 0x97, 0x78, 0x46, 0xee, 0xfd, + 0x34, 0x34, 0x16, 0xa0, 0x44, 0xcf, 0x0b, 0xdc, + 0xfb, 0x82, 0x98, 0xa2, 0x79, 0xc2, 0xe7, 0x1c, + 0x43, 0x43, 0x4c, 0x7f, 0xe7, 0xa6, 0xe6, 0x10, + 0x9e, 0x65, 0xb2, 0x09, 0xc7, 0x5f, 0xaa, 0xb7, + 0xb8, 0xad, 0x83, 0xd5, 0x9e, 0xd1, 0xb2, 0xce, + 0x4b, 0xa4, 0x5d, 0xbc, 0xd6, 0xf6, 0x0a, 0xe7, + 0x1b, 0xe9, 0x86, 0xbc, 0x72, 0xcc, 0x6f, 0xcc, + 0xf2, 0xde, 0x08, 0x48, 0xa2, 0x20, 0x31, 0x6a, + 0xdd, 0xbe, 0xc5, 0x36, 0x55, 0xff, 0xce, 0xfa, + 0xdf, 0x60, 0x26, 0x77, 0x7f, 0xd0, 0xfa, 0xd7, + 0x76, 0x70, 0x14, 0x11, 0xbf, 0x57, 0xc2, 0xdd, + 0x5f, 0xd3, 0x50, 0x49, 0xf8, 0xd1, 0xa7, 0xe2, + 0x8b, 0x89, 0xa0, 0xbc, 0x44, 0x42, 0x45, 0x10, + 0xfe, 0x66, 0x3d, 0x56, 0x09, 0x21, 0x7c, 0x49, + 0x30, 0xde, 0xe2, 0x4b, 0x26, 0x65, 0x8a, 0xe4, + 0x79, 0x08, 0x3a, 0xca, 0x36, 0x4f, 0x97, 0x3c, + 0xe4, 0x6a, 0xc3, 0xdb, 0xce, 0xac, 0x78, 0x76, + 0x25, 0x81, 0x7a, 0x01, 0x7b, 0xd8, 0xf1, 0x00, + 0x8d, 0x2e, 0xb7, 0x98, 0x3c, 0x86, 0x20, 0xa3, + 0x4c, 0x24, 0x2a, 0x78, 0x3a, 0x8d, 0xeb, 0xcd, + 0xae, 0xe1, 0x32, 0xf8, 0x21, 0x37, 0x30, 0x27, + 0xe1, 0xf3, 0x14, 0x60, 0x96, 0x77, 0x37, 0x50, + 0xa2, 0x92, 0xae, 0xe5, 0xd8, 0xea, 0x1a, 0x7e, + 0xa3, 0xd1, 0x04, 0x17, 0x03, 0x51, 0x2f, 0x21, + 0xa7, 0x00, 0x23, 0xb3, 0x24, 0xd8, 0x7d, 0xb7, + 0x4c, 0x51, 0xb1, 0xaf, 0xb0, 0x64, 0xe4, 0x62, + 0x91, 0x4c, 0xd5, 0x4b, 0xe8, 0xfb, 0x95, 0x61, + 0xa4, 0x6f, 0xf8, 0xb8, 0xea, 0xa9, 0xb2, 0x10, + 0xd3, 0x96, 0xcb, 0x1c, 0xdc, 0x86, 0x43, 0x26, + 0x2d, 0x39, 0xc2, 0xa7, 0x69, 0xfa, 0x8f, 0x3a, + 0xe7, 0xe0, 0x27, 0xbe, 0xc2, 0xe8, 0xd5, 0x05, + 0xbe, 0x5a, 0x96, 0xdc, 0x86, 0xcd, 0x93, 0x75, + 0x1b, 0x61, 0x40, 0x8c, 0x60, 0x64, 0x79, 0x85, + 0x6c, 0xed, 0x39, 0x72, 0x26, 0x69, 0xba, 0xb2, + 0xff, 0xa8, 0x68, 0x29, 0x03, 0xf7, 0x26, 0xe7, + 0x0f, 0x53, 0x1b, 0x5b, 0x37, 0x21, 0x68, 0x70, + 0x1c, 0x39, 0x7f, 0x5b, 0x31, 0xca, 0xde, 0xed, + 0x33, 0x8d, 0xaf, 0xe6, 0x01, 0xd5, 0x72, 0x5f, + 0x46, 0x44, 0x34, 0x1b, 0x4c, 0xd7, 0x75, 0xf0, + 0x47, 0x16, 0x6c, 0xd6, 0x65, 0x3c, 0xd3, 0xc2, + 0xb1, 0x46, 0x7d, 0xd5, 0x5c, 0x48, 0x5b, 0x61, + 0x3e, 0x88, 0xff, 0x24, 0x5c, 0x7b, 0xf7, 0xa9, + 0x44, 0xcb, 0x3b, 0x3e, 0x3b, 0x93, 0x24, 0x46, + 0x7e, 0x34, 0x8d, 0xc4, 0x2b, 0xb7, 0x8e, 0x22, + 0x9e, 0x87, 0x62, 0xca, 0xbc, 0x10, 0x09, 0x4a, + 0x4b, 0x0b, 0xdb, 0x57, 0x9b, 0xa9, 0x3e, 0xa8, + 0x99, 0x59, 0xa0, 0x12, 0xf3, 0xa5, 0xe4, 0x91, + 0xbb, 0xb9, 0x05, 0x8d, 0xcf, 0xb9, 0xcb, 0x36, + 0x97, 0xb2, 0x6a, 0x31, 0x8f, 0xcb, 0xf8, 0x5a, + 0x2f, 0x9e, 0xa1, 0xf9, 0x7a, 0xf4, 0x10, 0x0e, + 0xe7, 0x7f, 0x4c, 0xcb, 0xe3, 0x83, 0x17, 0x39, + 0x34, 0xef, 0x49, 0x35, 0x68, 0x50, 0x80, 0xf9, + 0xcd, 0x3a, 0x10, 0xf6, 0x71, 0x1a, 0x94, 0xc3, + 0xec, 0xb9, 0x36, 0x84, 0x36, 0xe7, 0x3f, 0x6f, + 0x9b, 0xa9, 0x2b, 0x5c, 0x96, 0x49, 0x26, 0xda, + 0xb3, 0x08, 0x3d, 0x5e, 0x9e, 0x59, 0xdf, 0x0f, + 0xfc, 0xbe, 0xa8, 0x0b, 0xbc, 0xaa, 0x32, 0xf0, + 0xa5, 0x21, 0x50, 0x15, 0x7e, 0x46, 0xb9, 0x76, + 0x09, 0x4e, 0x4b, 0x6f, 0x9f, 0xc7, 0x8c, 0x6d, + 0x80, 0x37, 0xf9, 0xaa, 0xd1, 0x5f, 0x12, 0xb9, + 0xb3, 0x15, 0xe4, 0x96, 0xa1, 0x01, 0xd5, 0xa0, +}; + +const struct testvec aes_cbc_256_8_vectors[] = { + { + .blkno = 0, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = aes_cbc_ptxt, + .ctxt = aes_cbc_256_encblkno8_vec3_ctxt, + }, +}; + +/* + * 256 bits key from IEEE 1619/D16, NUL terminated. + */ +static const char aes_xts_256_key[33] = { + 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, + 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, + 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, + 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, + 0 +}; + +/* + * 512 bits key from IEEE 1619/D16, NUL terminated. + */ +static const char aes_xts_512_key[65] = { + 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, + 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, + 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, + 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27, + 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, + 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, + 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, + 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92, + 0 +}; + +/* + * Vector 4 from IEEE 1619/D16, blkno 0. + */ +static const uint8_t aes_xts_256_vec4_ptxt[SECSIZE] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7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5, 0x43, 0x44, 0x5f, + 0x83, 0x33, 0xd8, 0xfa, 0x7f, 0x56, 0x00, 0x00, + 0x05, 0x27, 0x9f, 0xa5, 0xd8, 0xb5, 0xe4, 0xad, + 0x40, 0xe7, 0x36, 0xdd, 0xb4, 0xd3, 0x54, 0x12, + 0x32, 0x80, 0x63, 0xfd, 0x2a, 0xab, 0x53, 0xe5, + 0xea, 0x1e, 0x0a, 0x9f, 0x33, 0x25, 0x00, 0xa5, + 0xdf, 0x94, 0x87, 0xd0, 0x7a, 0x5c, 0x92, 0xcc, + 0x51, 0x2c, 0x88, 0x66, 0xc7, 0xe8, 0x60, 0xce, + 0x93, 0xfd, 0xf1, 0x66, 0xa2, 0x49, 0x12, 0xb4, + 0x22, 0x97, 0x61, 0x46, 0xae, 0x20, 0xce, 0x84, + 0x6b, 0xb7, 0xdc, 0x9b, 0xa9, 0x4a, 0x76, 0x7a, + 0xae, 0xf2, 0x0c, 0x0d, 0x61, 0xad, 0x02, 0x65, + 0x5e, 0xa9, 0x2d, 0xc4, 0xc4, 0xe4, 0x1a, 0x89, + 0x52, 0xc6, 0x51, 0xd3, 0x31, 0x74, 0xbe, 0x51, + 0xa1, 0x0c, 0x42, 0x11, 0x10, 0xe6, 0xd8, 0x15, + 0x88, 0xed, 0xe8, 0x21, 0x03, 0xa2, 0x52, 0xd8, + 0xa7, 0x50, 0xe8, 0x76, 0x8d, 0xef, 0xff, 0xed, + 0x91, 0x22, 0x81, 0x0a, 0xae, 0xb9, 0x9f, 0x91, + 0x72, 0xaf, 0x82, 0xb6, 0x04, 0xdc, 0x4b, 0x8e, + 0x51, 0xbc, 0xb0, 0x82, 0x35, 0xa6, 0xf4, 0x34, + 0x13, 0x32, 0xe4, 0xca, 0x60, 0x48, 0x2a, 0x4b, + 0xa1, 0xa0, 0x3b, 0x3e, 0x65, 0x00, 0x8f, 0xc5, + 0xda, 0x76, 0xb7, 0x0b, 0xf1, 0x69, 0x0d, 0xb4, + 0xea, 0xe2, 0x9c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xbe, 0xa7, + 0x18, 0x84, 0x69, 0x77, 0xae, 0x11, 0x9f, 0x7a, + 0x02, 0x3a, 0xb5, 0x8c, 0xca, 0x0a, 0xd7, 0x52, + 0xaf, 0xe6, 0x56, 0xbb, 0x3c, 0x17, 0x25, 0x6a, + 0x9f, 0x6e, 0x9b, 0xf1, 0x9f, 0xdd, 0x5a, 0x38, + 0xfc, 0x82, 0xbb, 0xe8, 0x72, 0xc5, 0x53, 0x9e, + 0xdb, 0x60, 0x9e, 0xf4, 0xf7, 0x9c, 0x20, 0x3e, + 0xbb, 0x14, 0x0f, 0x2e, 0x58, 0x3c, 0xb2, 0xad, + 0x15, 0xb4, 0xaa, 0x5b, 0x65, 0x50, 0x16, 0xa8, + 0x44, 0x92, 0x77, 0xdb, 0xd4, 0x77, 0xef, 0x2c, + 0x8d, 0x6c, 0x01, 0x7d, 0xb7, 0x38, 0xb1, 0x8d, + 0xeb, 0x4a, 0x42, 0x7d, 0x19, 0x23, 0xce, 0x3f, + 0xf2, 0x62, 0x73, 0x57, 0x79, 0xa4, 0x18, 0xf2, + 0x0a, 0x28, 0x2d, 0xf9, 0x20, 0x14, 0x7b, 0xea, + 0xbe, 0x42, 0x1e, 0xe5, 0x31, 0x9d, 0x05, 0x68, +}; + +/* + * Vector 5 from IEEE 1619/D16, blkno 1. + */ +static const uint8_t aes_xts_256_vec5_ptxt[SECSIZE] = { + 0x27, 0xa7, 0x47, 0x9b, 0xef, 0xa1, 0xd4, 0x76, + 0x48, 0x9f, 0x30, 0x8c, 0xd4, 0xcf, 0xa6, 0xe2, + 0xa9, 0x6e, 0x4b, 0xbe, 0x32, 0x08, 0xff, 0x25, + 0x28, 0x7d, 0xd3, 0x81, 0x96, 0x16, 0xe8, 0x9c, + 0xc7, 0x8c, 0xf7, 0xf5, 0xe5, 0x43, 0x44, 0x5f, + 0x83, 0x33, 0xd8, 0xfa, 0x7f, 0x56, 0x00, 0x00, + 0x05, 0x27, 0x9f, 0xa5, 0xd8, 0xb5, 0xe4, 0xad, + 0x40, 0xe7, 0x36, 0xdd, 0xb4, 0xd3, 0x54, 0x12, + 0x32, 0x80, 0x63, 0xfd, 0x2a, 0xab, 0x53, 0xe5, + 0xea, 0x1e, 0x0a, 0x9f, 0x33, 0x25, 0x00, 0xa5, + 0xdf, 0x94, 0x87, 0xd0, 0x7a, 0x5c, 0x92, 0xcc, + 0x51, 0x2c, 0x88, 0x66, 0xc7, 0xe8, 0x60, 0xce, + 0x93, 0xfd, 0xf1, 0x66, 0xa2, 0x49, 0x12, 0xb4, + 0x22, 0x97, 0x61, 0x46, 0xae, 0x20, 0xce, 0x84, + 0x6b, 0xb7, 0xdc, 0x9b, 0xa9, 0x4a, 0x76, 0x7a, + 0xae, 0xf2, 0x0c, 0x0d, 0x61, 0xad, 0x02, 0x65, + 0x5e, 0xa9, 0x2d, 0xc4, 0xc4, 0xe4, 0x1a, 0x89, + 0x52, 0xc6, 0x51, 0xd3, 0x31, 0x74, 0xbe, 0x51, + 0xa1, 0x0c, 0x42, 0x11, 0x10, 0xe6, 0xd8, 0x15, + 0x88, 0xed, 0xe8, 0x21, 0x03, 0xa2, 0x52, 0xd8, + 0xa7, 0x50, 0xe8, 0x76, 0x8d, 0xef, 0xff, 0xed, + 0x91, 0x22, 0x81, 0x0a, 0xae, 0xb9, 0x9f, 0x91, + 0x72, 0xaf, 0x82, 0xb6, 0x04, 0xdc, 0x4b, 0x8e, + 0x51, 0xbc, 0xb0, 0x82, 0x35, 0xa6, 0xf4, 0x34, + 0x13, 0x32, 0xe4, 0xca, 0x60, 0x48, 0x2a, 0x4b, + 0xa1, 0xa0, 0x3b, 0x3e, 0x65, 0x00, 0x8f, 0xc5, + 0xda, 0x76, 0xb7, 0x0b, 0xf1, 0x69, 0x0d, 0xb4, + 0xea, 0xe2, 0x9c, 0x5f, 0x1b, 0xad, 0xd0, 0x3c, + 0x5c, 0xcf, 0x2a, 0x55, 0xd7, 0x05, 0xdd, 0xcd, + 0x86, 0xd4, 0x49, 0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x52, + 0xaf, 0xe6, 0x56, 0xbb, 0x3c, 0x17, 0x25, 0x6a, + 0x9f, 0x6e, 0x9b, 0xf1, 0x9f, 0xdd, 0x5a, 0x38, + 0xfc, 0x82, 0xbb, 0xe8, 0x72, 0xc5, 0x53, 0x9e, + 0xdb, 0x60, 0x9e, 0xf4, 0xf7, 0x9c, 0x20, 0x3e, + 0xbb, 0x14, 0x0f, 0x2e, 0x58, 0x3c, 0xb2, 0xad, + 0x15, 0xb4, 0xaa, 0x5b, 0x65, 0x50, 0x16, 0xa8, + 0x44, 0x92, 0x77, 0xdb, 0xd4, 0x77, 0xef, 0x2c, + 0x8d, 0x6c, 0x01, 0x7d, 0xb7, 0x38, 0xb1, 0x8d, + 0xeb, 0x4a, 0x42, 0x7d, 0x19, 0x23, 0xce, 0x3f, + 0xf2, 0x62, 0x73, 0x57, 0x79, 0xa4, 0x18, 0xf2, + 0x0a, 0x28, 0x2d, 0xf9, 0x20, 0x14, 0x7b, 0xea, + 0xbe, 0x42, 0x1e, 0xe5, 0x31, 0x9d, 0x05, 0x68, +}; + +static const uint8_t aes_xts_256_vec5_ctxt[SECSIZE] = { + 0x26, 0x4d, 0x3c, 0xa8, 0x51, 0x21, 0x94, 0xfe, + 0xc3, 0x12, 0xc8, 0xc9, 0x89, 0x1f, 0x27, 0x9f, + 0xef, 0xdd, 0x60, 0x8d, 0x0c, 0x02, 0x7b, 0x60, + 0x48, 0x3a, 0x3f, 0xa8, 0x11, 0xd6, 0x5e, 0xe5, + 0x9d, 0x52, 0xd9, 0xe4, 0x0e, 0xc5, 0x67, 0x2d, + 0x81, 0x53, 0x2b, 0x38, 0xb6, 0xb0, 0x89, 0xce, + 0x95, 0x1f, 0x0f, 0x9c, 0x35, 0x59, 0x0b, 0x8b, + 0x97, 0x8d, 0x17, 0x52, 0x13, 0xf3, 0x29, 0xbb, + 0x1c, 0x2f, 0xd3, 0x0f, 0x2f, 0x7f, 0x30, 0x49, + 0x2a, 0x61, 0xa5, 0x32, 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, + 0xd7, 0x34, 0x6d, 0x1c, 0x77, 0x9a, 0x0d, 0xf5, + 0x0e, 0xdc, 0xde, 0x45, 0x31, 0xda, 0x07, 0xb0, + 0x99, 0xc6, 0x38, 0xe8, 0x3a, 0x75, 0x59, 0x44, + 0xdf, 0x2a, 0xef, 0x1a, 0xa3, 0x17, 0x52, 0xfd, + 0x32, 0x3d, 0xcb, 0x71, 0x0f, 0xb4, 0xbf, 0xbb, + 0x9d, 0x22, 0xb9, 0x25, 0xbc, 0x35, 0x77, 0xe1, + 0xb8, 0x94, 0x9e, 0x72, 0x9a, 0x90, 0xbb, 0xaf, + 0xea, 0xcf, 0x7f, 0x78, 0x79, 0xe7, 0xb1, 0x14, + 0x7e, 0x28, 0xba, 0x0b, 0xae, 0x94, 0x0d, 0xb7, + 0x95, 0xa6, 0x1b, 0x15, 0xec, 0xf4, 0xdf, 0x8d, + 0xb0, 0x7b, 0x82, 0x4b, 0xb0, 0x62, 0x80, 0x2c, + 0xc9, 0x8a, 0x95, 0x45, 0xbb, 0x2a, 0xae, 0xed, + 0x77, 0xcb, 0x3f, 0xc6, 0xdb, 0x15, 0xdc, 0xd7, + 0xd8, 0x0d, 0x7d, 0x5b, 0xc4, 0x06, 0xc4, 0x97, + 0x0a, 0x34, 0x78, 0xad, 0xa8, 0x89, 0x9b, 0x32, + 0x91, 0x98, 0xeb, 0x61, 0xc1, 0x93, 0xfb, 0x62, + 0x75, 0xaa, 0x8c, 0xa3, 0x40, 0x34, 0x4a, 0x75, + 0xa8, 0x62, 0xae, 0xbe, 0x92, 0xee, 0xe1, 0xce, + 0x03, 0x2f, 0xd9, 0x50, 0xb4, 0x7d, 0x77, 0x04, + 0xa3, 0x87, 0x69, 0x23, 0xb4, 0xad, 0x62, 0x84, + 0x4b, 0xf4, 0xa0, 0x9c, 0x4d, 0xbe, 0x8b, 0x43, + 0x97, 0x18, 0x4b, 0x74, 0x71, 0x36, 0x0c, 0x95, + 0x64, 0x88, 0x0a, 0xed, 0xdd, 0xb9, 0xba, 0xa4, + 0xaf, 0x2e, 0x75, 0x39, 0x4b, 0x08, 0xcd, 0x32, + 0xff, 0x47, 0x9c, 0x57, 0xa0, 0x7d, 0x3e, 0xab, + 0x5d, 0x54, 0xde, 0x5f, 0x97, 0x38, 0xb8, 0xd2, + 0x7f, 0x27, 0xa9, 0xf0, 0xab, 0x11, 0x79, 0x9d, + 0x7b, 0x7f, 0xfe, 0xfb, 0x27, 0x04, 0xc9, 0x5c, + 0x6a, 0xd1, 0x2c, 0x39, 0xf1, 0xe8, 0x67, 0xa4, + 0xb7, 0xb1, 0xd7, 0x81, 0x8a, 0x4b, 0x75, 0x3d, + 0xfd, 0x2a, 0x89, 0xcc, 0xb4, 0x5e, 0x00, 0x1a, + 0x03, 0xa8, 0x67, 0xb1, 0x87, 0xf2, 0x25, 0xdd, +}; + +/* + * Vector 6 from IEEE 1619/D16, blkno 2. + */ +static const uint8_t aes_xts_256_vec6_ptxt[SECSIZE] = { + 0x26, 0x4d, 0x3c, 0xa8, 0x51, 0x21, 0x94, 0xfe, + 0xc3, 0x12, 0xc8, 0xc9, 0x89, 0x1f, 0x27, 0x9f, + 0xef, 0xdd, 0x60, 0x8d, 0x0c, 0x02, 0x7b, 0x60, + 0x48, 0x3a, 0x3f, 0xa8, 0x11, 0xd6, 0x5e, 0xe5, + 0x9d, 0x52, 0xd9, 0xe4, 0x0e, 0xc5, 0x67, 0x2d, + 0x81, 0x53, 0x2b, 0x38, 0xb6, 0xb0, 0x89, 0xce, + 0x95, 0x1f, 0x0f, 0x9c, 0x35, 0x59, 0x0b, 0x8b, + 0x97, 0x8d, 0x17, 0x52, 0x13, 0xf3, 0x29, 0xbb, + 0x1c, 0x2f, 0xd3, 0x0f, 0x2f, 0x7f, 0x30, 0x49, + 0x2a, 0x61, 0xa5, 0x32, 0xa7, 0x9f, 0x51, 0xd3, + 0x6f, 0x5e, 0x31, 0xa7, 0xc9, 0xa1, 0x2c, 0x28, + 0x60, 0x82, 0xff, 0x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xb0, + 0x99, 0xc6, 0x38, 0xe8, 0x3a, 0x75, 0x59, 0x44, + 0xdf, 0x2a, 0xef, 0x1a, 0xa3, 0x17, 0x52, 0xfd, + 0x32, 0x3d, 0xcb, 0x71, 0x0f, 0xb4, 0xbf, 0xbb, + 0x9d, 0x22, 0xb9, 0x25, 0xbc, 0x35, 0x77, 0xe1, + 0xb8, 0x94, 0x9e, 0x72, 0x9a, 0x90, 0xbb, 0xaf, + 0xea, 0xcf, 0x7f, 0x78, 0x79, 0xe7, 0xb1, 0x14, + 0x7e, 0x28, 0xba, 0x0b, 0xae, 0x94, 0x0d, 0xb7, + 0x95, 0xa6, 0x1b, 0x15, 0xec, 0xf4, 0xdf, 0x8d, + 0xb0, 0x7b, 0x82, 0x4b, 0xb0, 0x62, 0x80, 0x2c, + 0xc9, 0x8a, 0x95, 0x45, 0xbb, 0x2a, 0xae, 0xed, + 0x77, 0xcb, 0x3f, 0xc6, 0xdb, 0x15, 0xdc, 0xd7, + 0xd8, 0x0d, 0x7d, 0x5b, 0xc4, 0x06, 0xc4, 0x97, + 0x0a, 0x34, 0x78, 0xad, 0xa8, 0x89, 0x9b, 0x32, + 0x91, 0x98, 0xeb, 0x61, 0xc1, 0x93, 0xfb, 0x62, + 0x75, 0xaa, 0x8c, 0xa3, 0x40, 0x34, 0x4a, 0x75, + 0xa8, 0x62, 0xae, 0xbe, 0x92, 0xee, 0xe1, 0xce, + 0x03, 0x2f, 0xd9, 0x50, 0xb4, 0x7d, 0x77, 0x04, + 0xa3, 0x87, 0x69, 0x23, 0xb4, 0xad, 0x62, 0x84, + 0x4b, 0xf4, 0xa0, 0x9c, 0x4d, 0xbe, 0x8b, 0x43, + 0x97, 0x18, 0x4b, 0x74, 0x71, 0x36, 0x0c, 0x95, + 0x64, 0x88, 0x0a, 0xed, 0xdd, 0xb9, 0xba, 0xa4, + 0xaf, 0x2e, 0x75, 0x39, 0x4b, 0x08, 0xcd, 0x32, + 0xff, 0x47, 0x9c, 0x57, 0xa0, 0x7d, 0x3e, 0xab, + 0x5d, 0x54, 0xde, 0x5f, 0x97, 0x38, 0xb8, 0xd2, + 0x7f, 0x27, 0xa9, 0xf0, 0xab, 0x11, 0x79, 0x9d, + 0x7b, 0x7f, 0xfe, 0xfb, 0x27, 0x04, 0xc9, 0x5c, + 0x6a, 0xd1, 0x2c, 0x39, 0xf1, 0xe8, 0x67, 0xa4, + 0xb7, 0xb1, 0xd7, 0x81, 0x8a, 0x4b, 0x75, 0x3d, + 0xfd, 0x2a, 0x89, 0xcc, 0xb4, 0x5e, 0x00, 0x1a, + 0x03, 0xa8, 0x67, 0xb1, 0x87, 0xf2, 0x25, 0xdd, +}; + +static const uint8_t aes_xts_256_vec6_ctxt[SECSIZE] = { + 0xfa, 0x76, 0x2a, 0x36, 0x80, 0xb7, 0x60, 0x07, + 0x92, 0x8e, 0xd4, 0xa4, 0xf4, 0x9a, 0x94, 0x56, + 0x03, 0x1b, 0x70, 0x47, 0x82, 0xe6, 0x5e, 0x16, + 0xce, 0xcb, 0x54, 0xed, 0x7d, 0x01, 0x7b, 0x5e, + 0x18, 0xab, 0xd6, 0x7b, 0x33, 0x8e, 0x81, 0x07, + 0x8f, 0x21, 0xed, 0xb7, 0x86, 0x8d, 0x90, 0x1e, + 0xbe, 0x9c, 0x73, 0x1a, 0x7c, 0x18, 0xb5, 0xe6, + 0xde, 0xc1, 0xd6, 0xa7, 0x2e, 0x07, 0x8a, 0xc9, + 0xa4, 0x26, 0x2f, 0x86, 0x0b, 0xee, 0xfa, 0x14, + 0xf4, 0xe8, 0x21, 0x01, 0x82, 0x72, 0xe4, 0x11, + 0xa9, 0x51, 0x50, 0x2b, 0x6e, 0x79, 0x06, 0x6e, + 0x84, 0x25, 0x2c, 0x33, 0x46, 0xf3, 0xaa, 0x62, + 0x34, 0x43, 0x51, 0xa2, 0x91, 0xd4, 0xbe, 0xdc, + 0x7a, 0x07, 0x61, 0x8b, 0xde, 0xa2, 0xaf, 0x63, + 0x14, 0x5c, 0xc7, 0xa4, 0xb8, 0xd4, 0x07, 0x06, + 0x91, 0xae, 0x89, 0x0c, 0xd6, 0x57, 0x33, 0xe7, + 0x94, 0x6e, 0x90, 0x21, 0xa1, 0xdf, 0xfc, 0x4c, + 0x59, 0xf1, 0x59, 0x42, 0x5e, 0xe6, 0xd5, 0x0c, + 0xa9, 0xb1, 0x35, 0xfa, 0x61, 0x62, 0xce, 0xa1, + 0x8a, 0x93, 0x98, 0x38, 0xdc, 0x00, 0x0f, 0xb3, + 0x86, 0xfa, 0xd0, 0x86, 0xac, 0xce, 0x5a, 0xc0, + 0x7c, 0xb2, 0xec, 0xe7, 0xfd, 0x58, 0x0b, 0x00, + 0xcf, 0xa5, 0xe9, 0x85, 0x89, 0x63, 0x1d, 0xc2, + 0x5e, 0x8e, 0x2a, 0x3d, 0xaf, 0x2f, 0xfd, 0xec, + 0x26, 0x53, 0x16, 0x59, 0x91, 0x2c, 0x9d, 0x8f, + 0x7a, 0x15, 0xe5, 0x86, 0x5e, 0xa8, 0xfb, 0x58, + 0x16, 0xd6, 0x20, 0x70, 0x52, 0xbd, 0x71, 0x28, + 0xcd, 0x74, 0x3c, 0x12, 0xc8, 0x11, 0x87, 0x91, + 0xa4, 0x73, 0x68, 0x11, 0x93, 0x5e, 0xb9, 0x82, + 0xa5, 0x32, 0x34, 0x9e, 0x31, 0xdd, 0x40, 0x1e, + 0x0b, 0x66, 0x0a, 0x56, 0x8c, 0xb1, 0xa4, 0x71, + 0x1f, 0x55, 0x2f, 0x55, 0xde, 0xd5, 0x9f, 0x1f, + 0x15, 0xbf, 0x71, 0x96, 0xb3, 0xca, 0x12, 0xa9, + 0x1e, 0x48, 0x8e, 0xf5, 0x9d, 0x64, 0xf3, 0xa0, + 0x2b, 0xf4, 0x52, 0x39, 0x49, 0x9a, 0xc6, 0x17, + 0x6a, 0xe3, 0x21, 0xc4, 0xa2, 0x11, 0xec, 0x54, + 0x53, 0x65, 0x97, 0x1c, 0x5d, 0x3f, 0x4f, 0x09, + 0xd4, 0xeb, 0x13, 0x9b, 0xfd, 0xf2, 0x07, 0x3d, + 0x33, 0x18, 0x0b, 0x21, 0x00, 0x2b, 0x65, 0xcc, + 0x98, 0x65, 0xe7, 0x6c, 0xb2, 0x4c, 0xd9, 0x2c, + 0x87, 0x4c, 0x24, 0xc1, 0x83, 0x50, 0x39, 0x9a, + 0x93, 0x6a, 0xb3, 0x63, 0x70, 0x79, 0x29, 0x5d, + 0x76, 0xc4, 0x17, 0x77, 0x6b, 0x94, 0xef, 0xce, + 0x3a, 0x0e, 0xf7, 0x20, 0x6b, 0x15, 0x11, 0x05, + 0x19, 0x65, 0x5c, 0x95, 0x6c, 0xbd, 0x8b, 0x24, + 0x89, 0x40, 0x5e, 0xe2, 0xb0, 0x9a, 0x6b, 0x6e, + 0xeb, 0xe0, 0xc5, 0x37, 0x90, 0xa1, 0x2a, 0x89, + 0x98, 0x37, 0x8b, 0x33, 0xa5, 0xb7, 0x11, 0x59, + 0x62, 0x5f, 0x4b, 0xa4, 0x9d, 0x2a, 0x2f, 0xdb, + 0xa5, 0x9f, 0xbf, 0x08, 0x97, 0xbc, 0x7a, 0xab, + 0xd8, 0xd7, 0x07, 0xdc, 0x14, 0x0a, 0x80, 0xf0, + 0xf3, 0x09, 0xf8, 0x35, 0xd3, 0xda, 0x54, 0xab, + 0x58, 0x4e, 0x50, 0x1d, 0xfa, 0x0e, 0xe9, 0x77, + 0xfe, 0xc5, 0x43, 0xf7, 0x41, 0x86, 0xa8, 0x02, + 0xb9, 0xa3, 0x7a, 0xdb, 0x3e, 0x82, 0x91, 0xec, + 0xa0, 0x4d, 0x66, 0x52, 0x0d, 0x22, 0x9e, 0x60, + 0x40, 0x1e, 0x72, 0x82, 0xbe, 0xf4, 0x86, 0xae, + 0x05, 0x9a, 0xa7, 0x06, 0x96, 0xe0, 0xe3, 0x05, + 0xd7, 0x77, 0x14, 0x0a, 0x7a, 0x88, 0x3e, 0xcd, + 0xcb, 0x69, 0xb9, 0xff, 0x93, 0x8e, 0x8a, 0x42, + 0x31, 0x86, 0x4c, 0x69, 0xca, 0x2c, 0x20, 0x43, + 0xbe, 0xd0, 0x07, 0xff, 0x3e, 0x60, 0x5e, 0x01, + 0x4b, 0xcf, 0x51, 0x81, 0x38, 0xdc, 0x3a, 0x25, + 0xc5, 0xe2, 0x36, 0x17, 0x1a, 0x2d, 0x01, 0xd6, +}; + +/* + * Vector 7 from IEEE 1619/D16, blkno 0xfd. + */ +static const uint8_t aes_xts_256_vec7_ptxt[SECSIZE] = { + 0x8e, 0x41, 0xb7, 0x8c, 0x39, 0x0b, 0x5a, 0xf9, + 0xd7, 0x58, 0xbb, 0x21, 0x4a, 0x67, 0xe9, 0xf6, + 0xbf, 0x77, 0x27, 0xb0, 0x9a, 0xc6, 0x12, 0x40, + 0x84, 0xc3, 0x76, 0x11, 0x39, 0x8f, 0xa4, 0x5d, + 0xaa, 0xd9, 0x48, 0x68, 0x60, 0x0e, 0xd3, 0x91, + 0xfb, 0x1a, 0xcd, 0x48, 0x57, 0xa9, 0x5b, 0x46, + 0x6e, 0x62, 0xef, 0x9f, 0x4b, 0x37, 0x72, 0x44, + 0xd1, 0xc1, 0x52, 0xe7, 0xb3, 0x0d, 0x73, 0x1a, + 0xad, 0x30, 0xc7, 0x16, 0xd2, 0x14, 0xb7, 0x07, + 0xae, 0xd9, 0x9e, 0xb5, 0xb5, 0xe5, 0x80, 0xb3, + 0xe8, 0x87, 0xcf, 0x74, 0x97, 0x46, 0x56, 0x51, + 0xd4, 0xb6, 0x0e, 0x60, 0x42, 0x05, 0x1d, 0xa3, + 0x69, 0x3c, 0x3b, 0x78, 0xc1, 0x44, 0x89, 0x54, + 0x3b, 0xe8, 0xb6, 0xad, 0x0b, 0xa6, 0x29, 0x56, + 0x5b, 0xba, 0x20, 0x23, 0x13, 0xba, 0x7b, 0x0d, + 0x0c, 0x94, 0xa3, 0x25, 0x2b, 0x67, 0x6f, 0x46, + 0xcc, 0x02, 0xce, 0x0f, 0x8a, 0x7d, 0x34, 0xc0, + 0xed, 0x22, 0x91, 0x29, 0x67, 0x3c, 0x1f, 0x61, + 0xae, 0xd5, 0x79, 0xd0, 0x8a, 0x92, 0x03, 0xa2, + 0x5a, 0xac, 0x3a, 0x77, 0xe9, 0xdb, 0x60, 0x26, + 0x79, 0x96, 0xdb, 0x38, 0xdf, 0x63, 0x73, 0x56, + 0xd9, 0xdc, 0xd1, 0x63, 0x2e, 0x36, 0x99, 0x39, + 0xf2, 0xa2, 0x9d, 0x89, 0x34, 0x5c, 0x66, 0xe0, + 0x50, 0x66, 0xf1, 0xa3, 0x67, 0x7a, 0xef, 0x18, + 0xde, 0xa4, 0x11, 0x3f, 0xae, 0xb6, 0x29, 0xe4, + 0x67, 0x21, 0xa6, 0x6d, 0x0a, 0x7e, 0x78, 0x5d, + 0x3e, 0x29, 0xaf, 0x25, 0x94, 0xeb, 0x67, 0xdf, + 0xa9, 0x82, 0xaf, 0xfe, 0x0a, 0xac, 0x05, 0x8f, + 0x6e, 0x15, 0x86, 0x42, 0x69, 0xb1, 0x35, 0x41, + 0x82, 0x61, 0xfc, 0x3a, 0xfb, 0x08, 0x94, 0x72, + 0xcf, 0x68, 0xc4, 0x5d, 0xd7, 0xf2, 0x31, 0xc6, + 0x24, 0x9b, 0xa0, 0x25, 0x5e, 0x1e, 0x03, 0x38, + 0x33, 0xfc, 0x4d, 0x00, 0xa3, 0xfe, 0x02, 0x13, + 0x2d, 0x7b, 0xc3, 0x87, 0x36, 0x14, 0xb8, 0xae, + 0xe3, 0x42, 0x73, 0x58, 0x1e, 0xa0, 0x32, 0x5c, + 0x81, 0xf0, 0x27, 0x0a, 0xff, 0xa1, 0x36, 0x41, + 0xd0, 0x52, 0xd3, 0x6f, 0x07, 0x57, 0xd4, 0x84, + 0x01, 0x43, 0x54, 0xd0, 0x2d, 0x68, 0x83, 0xca, + 0x15, 0xc2, 0x4d, 0x8c, 0x39, 0x56, 0xb1, 0xbd, + 0x02, 0x7b, 0xcf, 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, 0xaf, 0x61, + 0xd3, 0xe0, 0x35, 0x55, 0xfd, 0x42, 0x4e, 0xed, + 0xd6, 0x7e, 0x18, 0xa1, 0x80, 0x94, 0xf8, 0x88, +}; + +static const uint8_t aes_xts_256_vec7_ctxt[SECSIZE] = { + 0xd5, 0x5f, 0x68, 0x4f, 0x81, 0xf4, 0x42, 0x6e, + 0x9f, 0xde, 0x92, 0xa5, 0xff, 0x02, 0xdf, 0x2a, + 0xc8, 0x96, 0xaf, 0x63, 0x96, 0x28, 0x88, 0xa9, + 0x79, 0x10, 0xc1, 0x37, 0x9e, 0x20, 0xb0, 0xa3, + 0xb1, 0xdb, 0x61, 0x3f, 0xb7, 0xfe, 0x2e, 0x07, + 0x00, 0x43, 0x29, 0xea, 0x5c, 0x22, 0xbf, 0xd3, + 0x3e, 0x3d, 0xbe, 0x4c, 0xf5, 0x8c, 0xc6, 0x08, + 0xc2, 0xc2, 0x6c, 0x19, 0xa2, 0xe2, 0xfe, 0x22, + 0xf9, 0x87, 0x32, 0xc2, 0xb5, 0xcb, 0x84, 0x4c, + 0xc6, 0xc0, 0x70, 0x2d, 0x91, 0xe1, 0xd5, 0x0f, + 0xc4, 0x38, 0x2a, 0x7e, 0xba, 0x56, 0x35, 0xcd, + 0x60, 0x24, 0x32, 0xa2, 0x30, 0x6a, 0xc4, 0xce, + 0x82, 0xf8, 0xd7, 0x0c, 0x8d, 0x9b, 0xc1, 0x5f, + 0x91, 0x8f, 0xe7, 0x1e, 0x74, 0xc6, 0x22, 0xd5, + 0xcf, 0x71, 0x17, 0x8b, 0xf6, 0xe0, 0xb9, 0xcc, + 0x9f, 0x2b, 0x41, 0xdd, 0x8d, 0xbe, 0x44, 0x1c, + 0x41, 0xcd, 0x0c, 0x73, 0xa6, 0xdc, 0x47, 0xa3, + 0x48, 0xf6, 0x70, 0x2f, 0x9d, 0x0e, 0x9b, 0x1b, + 0x14, 0x31, 0xe9, 0x48, 0xe2, 0x99, 0xb9, 0xec, + 0x22, 0x72,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2a, 0x63, 0x45, + 0x3d, 0x97, 0xcc, 0xec, 0x1a, 0x32, 0x19, 0x54, + 0x88, 0x6b, 0x7a, 0x12, 0x99, 0xfa, 0xae, 0xec, + 0xae, 0x35, 0xc6, 0xea, 0xac, 0xa7, 0x53, 0xb0, + 0x41, 0xb5, 0xe5, 0xf0, 0x93, 0xbf, 0x83, 0x39, + 0x7f, 0xd2, 0x1d, 0xd6, 0xb3, 0x01, 0x20, 0x66, + 0xfc, 0xc0, 0x58, 0xcc, 0x32, 0xc3, 0xb0, 0x9d, + 0x75, 0x62, 0xde, 0xe2, 0x95, 0x09, 0xb5, 0x83, + 0x93, 0x92, 0xc9, 0xff, 0x05, 0xf5, 0x1f, 0x31, + 0x66, 0xaa, 0xac, 0x4a, 0xc5, 0xf2, 0x38, 0x03, + 0x8a, 0x30, 0x45, 0xe6, 0xf7, 0x2e, 0x48, 0xef, + 0x0f, 0xe8, 0xbc, 0x67, 0x5e, 0x82, 0xc3, 0x18, + 0xa2, 0x68, 0xe4, 0x39, 0x70, 0x27, 0x1b, 0xf1, + 0x19, 0xb8, 0x1b, 0xf6, 0xa9, 0x82, 0x74, 0x65, + 0x54, 0xf8, 0x4e, 0x72, 0xb9, 0xf0, 0x02, 0x80, + 0xa3, 0x20, 0xa0, 0x81, 0x42, 0x92, 0x3c, 0x23, + 0xc8, 0x83, 0x42, 0x3f, 0xf9, 0x49, 0x82, 0x7f, + 0x29, 0xbb, 0xac, 0xdc, 0x1c, 0xcd, 0xb0, 0x49, + 0x38, 0xce, 0x60, 0x98, 0xc9, 0x5b, 0xa6, 0xb3, + 0x25, 0x28, 0xf4, 0xef, 0x78, 0xee, 0xd7, 0x78, + 0xb2, 0xe1, 0x22, 0xdd, 0xfd, 0x1c, 0xbd, 0xd1, + 0x1d, 0x1c, 0x0a, 0x67, 0x83, 0xe0, 0x11, 0xfc, + 0x53, 0x6d, 0x63, 0xd0, 0x53, 0x26, 0x06, 0x37, +}; + +/* + * Vector 8 from IEEE 1619/D16, blkno 0xfe. + */ +static const uint8_t aes_xts_256_vec8_ptxt[SECSIZE] = { + 0xd5, 0x5f, 0x68, 0x4f, 0x81, 0xf4, 0x42, 0x6e, + 0x9f, 0xde, 0x92, 0xa5, 0xff, 0x02, 0xdf, 0x2a, + 0xc8, 0x96, 0xaf, 0x63, 0x96, 0x28, 0x88, 0xa9, + 0x79, 0x10, 0xc1, 0x37, 0x9e, 0x20, 0xb0, 0xa3, + 0xb1, 0xdb, 0x61, 0x3f, 0xb7, 0xfe, 0x2e, 0x07, + 0x00, 0x43, 0x29, 0xea, 0x5c, 0x22, 0xbf, 0xd3, + 0x3e, 0x3d, 0xbe, 0x4c, 0xf5, 0x8c, 0xc6, 0x08, + 0xc2, 0xc2, 0x6c, 0x19, 0xa2, 0xe2, 0xfe, 0x22, + 0xf9, 0x87, 0x32, 0xc2, 0xb5, 0xcb, 0x84, 0x4c, + 0xc6, 0xc0, 0x70, 0x2d, 0x91, 0xe1, 0xd5, 0x0f, + 0xc4, 0x38, 0x2a, 0x7e, 0xba, 0x56, 0x35, 0xcd, + 0x60, 0x24, 0x32, 0xa2, 0x30, 0x6a, 0xc4, 0xce, + 0x82, 0xf8, 0xd7, 0x0c, 0x8d, 0x9b, 0xc1, 0x5f, + 0x91, 0x8f, 0xe7, 0x1e, 0x74, 0xc6, 0x22, 0xd5, + 0xcf, 0x71, 0x17, 0x8b, 0xf6, 0xe0, 0xb9, 0xcc, + 0x9f, 0x2b, 0x41, 0xdd, 0x8d, 0xbe, 0x44, 0x1c, + 0x41, 0xcd, 0x0c, 0x73, 0xa6, 0xdc, 0x47, 0xa3, + 0x48, 0xf6, 0x70, 0x2f, 0x9d, 0x0e, 0x9b, 0x1b, + 0x14, 0x31, 0xe9, 0x48, 0xe2, 0x99, 0xb9, 0xec, + 0x22, 0x72, 0xab, 0x2c, 0x5f, 0x0c, 0x7b, 0xe8, + 0x6a, 0xff, 0xa5, 0xde, 0xc8, 0x7a, 0x0b, 0xee, + 0x81, 0x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, 0xae, 0xec, + 0xae, 0x35, 0xc6, 0xea, 0xac, 0xa7, 0x53, 0xb0, + 0x41, 0xb5, 0xe5, 0xf0, 0x93, 0xbf, 0x83, 0x39, + 0x7f, 0xd2, 0x1d, 0xd6, 0xb3, 0x01, 0x20, 0x66, + 0xfc, 0xc0, 0x58, 0xcc, 0x32, 0xc3, 0xb0, 0x9d, + 0x75, 0x62, 0xde, 0xe2, 0x95, 0x09, 0xb5, 0x83, + 0x93, 0x92, 0xc9, 0xff, 0x05, 0xf5, 0x1f, 0x31, + 0x66, 0xaa, 0xac, 0x4a, 0xc5, 0xf2, 0x38, 0x03, + 0x8a, 0x30, 0x45, 0xe6, 0xf7, 0x2e, 0x48, 0xef, + 0x0f, 0xe8, 0xbc, 0x67, 0x5e, 0x82, 0xc3, 0x18, + 0xa2, 0x68, 0xe4, 0x39, 0x70, 0x27, 0x1b, 0xf1, + 0x19, 0xb8, 0x1b, 0xf6, 0xa9, 0x82, 0x74, 0x65, + 0x54, 0xf8, 0x4e, 0x72, 0xb9, 0xf0, 0x02, 0x80, + 0xa3, 0x20, 0xa0, 0x81, 0x42, 0x92, 0x3c, 0x23, + 0xc8, 0x83, 0x42, 0x3f, 0xf9, 0x49, 0x82, 0x7f, + 0x29, 0xbb, 0xac, 0xdc, 0x1c, 0xcd, 0xb0, 0x49, + 0x38, 0xce, 0x60, 0x98, 0xc9, 0x5b, 0xa6, 0xb3, + 0x25, 0x28, 0xf4, 0xef, 0x78, 0xee, 0xd7, 0x78, + 0xb2, 0xe1, 0x22, 0xdd, 0xfd, 0x1c, 0xbd, 0xd1, + 0x1d, 0x1c, 0x0a, 0x67, 0x83, 0xe0, 0x11, 0xfc, + 0x53, 0x6d, 0x63, 0xd0, 0x53, 0x26, 0x06, 0x37, +}; + +static const uint8_t aes_xts_256_vec8_ctxt[SECSIZE] = { + 0x72, 0xef, 0xc1, 0xeb, 0xfe, 0x1e, 0xe2, 0x59, + 0x75, 0xa6, 0xeb, 0x3a, 0xa8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 0x4b, 0x53, 0x45, 0xbd, 0x27, 0xa5, 0xf6, 0xe6, + 0x53, 0xf7, 0x51, 0x69, 0x3e, 0x6b, 0x6a, 0x2b, + 0x8e, 0xad, 0x57, 0xd5, 0x11, 0xe0, 0x0e, 0x58, + 0xc4, 0x5b, 0x7b, 0x8d, 0x00, 0x5a, 0xf7, 0x92, + 0x88, 0xf5, 0xc7, 0xc2, 0x2f, 0xd4, 0xf1, 0xbf, + 0x7a, 0x89, 0x8b, 0x03, 0xa5, 0x63, 0x4c, 0x6a, + 0x1a, 0xe3, 0xf9, 0xfa, 0xe5, 0xde, 0x4f, 0x29, + 0x6a, 0x28, 0x96, 0xb2, 0x3e, 0x7e, 0xd4, 0x3e, + 0xd1, 0x4f, 0xa5, 0xa2, 0x80, 0x3f, 0x4d, 0x28, + 0xf0, 0xd3, 0xff, 0xcf, 0x24, 0x75, 0x76, 0x77, + 0xae, 0xbd, 0xb4, 0x7b, 0xb3, 0x88, 0x37, 0x87, + 0x08, 0x94, 0x8a, 0x8d, 0x41, 0x26, 0xed, 0x18, + 0x39, 0xe0, 0xda, 0x29, 0xa5, 0x37, 0xa8, 0xc1, + 0x98, 0xb3, 0xc6, 0x6a, 0xb0, 0x07, 0x12, 0xdd, + 0x26, 0x16, 0x74, 0xbf, 0x45, 0xa7, 0x3d, 0x67, + 0xf7, 0x69, 0x14, 0xf8, 0x30, 0xca, 0x01, 0x4b, + 0x65, 0x59, 0x6f, 0x27, 0xe4, 0xcf, 0x62, 0xde, + 0x66, 0x12, 0x5a, 0x55, 0x66, 0xdf, 0x99, 0x75, + 0x15, 0x56, 0x28, 0xb4, 0x00, 0xfb, 0xfb, 0x3a, + 0x29, 0x04, 0x0e, 0xd5, 0x0f, 0xaf, 0xfd, 0xbb, + 0x18, 0xae, 0xce, 0x7c, 0x5c, 0x44, 0x69, 0x32, + 0x60, 0xaa, 0xb3, 0x86, 0xc0, 0xa3, 0x7b, 0x11, + 0xb1, 0x14, 0xf1, 0xc4, 0x15, 0xae, 0xbb, 0x65, + 0x3b, 0xe4, 0x68, 0x17, 0x94, 0x28, 0xd4, 0x3a, + 0x4d, 0x8b, 0xc3, 0xec, 0x38, 0x81, 0x3e, 0xca, + 0x30, 0xa1, 0x3c, 0xf1, 0xbb, 0x18, 0xd5, 0x24, + 0xf1, 0x99, 0x2d, 0x44, 0xd8, 0xb1, 0xa4, 0x2e, + 0xa3, 0x0b, 0x22, 0xe6, 0xc9, 0x5b, 0x19, 0x9d, + 0x8d, 0x18, 0x2f, 0x88, 0x40, 0xb0, 0x9d, 0x05, + 0x95, 0x85, 0xc3, 0x1a, 0xd6, 0x91, 0xfa, 0x06, + 0x19, 0xff, 0x03, 0x8a, 0xca, 0x2c, 0x39, 0xa9, + 0x43, 0x42, 0x11, 0x57, 0x36, 0x17, 0x17, 0xc4, + 0x9d, 0x32, 0x20, 0x28, 0xa7, 0x46, 0x48, 0x11, + 0x3b, 0xd8, 0xc9, 0xd7, 0xec, 0x77, 0xcf, 0x3c, + 0x89, 0xc1, 0xec, 0x87, 0x18, 0xce, 0xff, 0x85, + 0x16, 0xd9, 0x6b, 0x34, 0xc3, 0xc6, 0x14, 0xf1, + 0x06, 0x99, 0xc9, 0xab, 0xc4, 0xed, 0x04, 0x11, + 0x50, 0x62, 0x23, 0xbe, 0xa1, 0x6a, 0xf3, 0x5c, + 0x88, 0x3a, 0xcc, 0xdb, 0xe1, 0x10, 0x4e, 0xef, + 0x0c, 0xfd, 0xb5, 0x4e, 0x12, 0xfb, 0x23, 0x0a, +}; + +/* + * Vector 9 from IEEE 1619/D16, blkno 0xff. + */ +static const uint8_t aes_xts_256_vec9_ptxt[SECSIZE] = { + 0x72, 0xef, 0xc1, 0xeb, 0xfe, 0x1e, 0xe2, 0x59, + 0x75, 0xa6, 0xeb, 0x3a, 0xa8, 0x58, 0x9d, 0xda, + 0x2b, 0x26, 0x1f, 0x1c, 0x85, 0xbd, 0xab, 0x44, + 0x2a, 0x9e, 0x5b, 0x2d, 0xd1,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0x8e, 0xad, 0x57, 0xd5, 0x11, 0xe0, 0x0e, 0x58, + 0xc4, 0x5b, 0x7b, 0x8d, 0x00, 0x5a, 0xf7, 0x92, + 0x88, 0xf5, 0xc7, 0xc2, 0x2f, 0xd4, 0xf1, 0xbf, + 0x7a, 0x89, 0x8b, 0x03, 0xa5, 0x63, 0x4c, 0x6a, + 0x1a, 0xe3, 0xf9, 0xfa, 0xe5, 0xde, 0x4f, 0x29, + 0x6a, 0x28, 0x96, 0xb2, 0x3e, 0x7e, 0xd4, 0x3e, + 0xd1, 0x4f, 0xa5, 0xa2, 0x80, 0x3f, 0x4d, 0x28, + 0xf0, 0xd3, 0xff, 0xcf, 0x24, 0x75, 0x76, 0x77, + 0xae, 0xbd, 0xb4, 0x7b, 0xb3, 0x88, 0x37, 0x87, + 0x08, 0x94, 0x8a, 0x8d, 0x41, 0x26, 0xed, 0x18, + 0x39, 0xe0, 0xda, 0x29, 0xa5, 0x37, 0xa8, 0xc1, + 0x98, 0xb3, 0xc6, 0x6a, 0xb0, 0x07, 0x12, 0xdd, + 0x26, 0x16, 0x74, 0xbf, 0x45, 0xa7, 0x3d, 0x67, + 0xf7, 0x69, 0x14, 0xf8, 0x30, 0xca, 0x01, 0x4b, + 0x65, 0x59, 0x6f, 0x27, 0xe4, 0xcf, 0x62, 0xde, + 0x66, 0x12, 0x5a, 0x55, 0x66, 0xdf, 0x99, 0x75, + 0x15, 0x56, 0x28, 0xb4, 0x00, 0xfb, 0xfb, 0x3a, + 0x29, 0x04, 0x0e, 0xd5, 0x0f, 0xaf, 0xfd, 0xbb, + 0x18, 0xae, 0xce, 0x7c, 0x5c, 0x44, 0x69, 0x32, + 0x60, 0xaa, 0xb3, 0x86, 0xc0, 0xa3, 0x7b, 0x11, + 0xb1, 0x14, 0xf1, 0xc4, 0x15, 0xae, 0xbb, 0x65, + 0x3b, 0xe4, 0x68, 0x17, 0x94, 0x28, 0xd4, 0x3a, + 0x4d, 0x8b, 0xc3, 0xec, 0x38, 0x81, 0x3e, 0xca, + 0x30, 0xa1, 0x3c, 0xf1, 0xbb, 0x18, 0xd5, 0x24, + 0xf1, 0x99, 0x2d, 0x44, 0xd8, 0xb1, 0xa4, 0x2e, + 0xa3, 0x0b, 0x22, 0xe6, 0xc9, 0x5b, 0x19, 0x9d, + 0x8d, 0x18, 0x2f, 0x88, 0x40, 0xb0, 0x9d, 0x05, + 0x95, 0x85, 0xc3, 0x1a, 0xd6, 0x91, 0xfa, 0x06, + 0x19, 0xff, 0x03, 0x8a, 0xca, 0x2c, 0x39, 0xa9, + 0x43, 0x42, 0x11, 0x57, 0x36, 0x17, 0x17, 0xc4, + 0x9d, 0x32, 0x20, 0x28, 0xa7, 0x46, 0x48, 0x11, + 0x3b, 0xd8, 0xc9, 0xd7, 0xec, 0x77, 0xcf, 0x3c, + 0x89, 0xc1, 0xec, 0x87, 0x18, 0xce, 0xff, 0x85, + 0x16, 0xd9, 0x6b, 0x34, 0xc3, 0xc6, 0x14, 0xf1, + 0x06, 0x99, 0xc9, 0xab, 0xc4, 0xed, 0x04, 0x11, + 0x50, 0x62, 0x23, 0xbe, 0xa1, 0x6a, 0xf3, 0x5c, + 0x88, 0x3a, 0xcc, 0xdb, 0xe1, 0x10, 0x4e, 0xef, + 0x0c, 0xfd, 0xb5, 0x4e, 0x12, 0xfb, 0x23, 0x0a, +}; + +static const uint8_t aes_xts_256_vec9_ctxt[SECSIZE] = { + 0x32, 0x60, 0xae, 0x8d, 0xad, 0x1f, 0x4a, 0x32, + 0xc5, 0xca, 0xfe, 0x3a, 0xb0, 0xeb, 0x95, 0x54, + 0x9d, 0x46, 0x1a, 0x67, 0xce, 0xb9, 0xe5, 0xaa, + 0x2d, 0x3a, 0xfb, 0x62, 0xde, 0xce, 0x05, 0x53, + 0x19, 0x3b, 0xa5, 0x0c, 0x75, 0xbe, 0x25, 0x1e, + 0x08, 0xd1, 0xd0, 0x8f, 0x10, 0x88, 0x57, 0x6c, + 0x7e, 0xfd, 0xfa, 0xaf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 0xcf, 0x20, 0x3b, 0xd7, 0x79, 0xfd, 0xd3, + 0x86, 0x75, 0x71, 0x3c, 0x8d, 0xaa, 0xdd, 0x17, + 0xe1, 0xca, 0xbe, 0xe4, 0x32, 0xb0, 0x97, 0x87, + 0xb6, 0xdd, 0xf3, 0x30, 0x4e, 0x38, 0xb7, 0x31, + 0xb4, 0x5d, 0xf5, 0xdf, 0x51, 0xb7, 0x8f, 0xcf, + 0xb3, 0xd3, 0x24, 0x66, 0x02, 0x8d, 0x0b, 0xa3, + 0x65, 0x55, 0xe7, 0xe1, 0x1a, 0xb0, 0xee, 0x06, + 0x66, 0x06, 0x1d, 0x16, 0x45, 0xd9, 0x62, 0x44, + 0x4b, 0xc4, 0x7a, 0x38, 0x18, 0x89, 0x30, 0xa8, + 0x4b, 0x4d, 0x56, 0x13, 0x95, 0xc7, 0x3c, 0x08, + 0x70, 0x21, 0x92, 0x7c, 0xa6, 0x38, 0xb7, 0xaf, + 0xc8, 0xa8, 0x67, 0x9c, 0xcb, 0x84, 0xc2, 0x65, + 0x55, 0x44, 0x0e, 0xc7, 0xf1, 0x04, 0x45, 0xcd, +}; + +const struct testvec aes_xts_256_vectors[] = { + { + .blkno = 0, + .ptxt = aes_xts_256_vec4_ptxt, + .ctxt = aes_xts_256_vec4_ctxt, + }, + { + .blkno = 1, + .ptxt = aes_xts_256_vec5_ptxt, + .ctxt = aes_xts_256_vec5_ctxt, + }, + { + .blkno = 2, + .ptxt = aes_xts_256_vec6_ptxt, + .ctxt = aes_xts_256_vec6_ctxt, + }, + { + .blkno = 0xfd, + .ptxt = aes_xts_256_vec7_ptxt, + .ctxt = aes_xts_256_vec7_ctxt, + }, + { + .blkno = 0xfe, + .ptxt = aes_xts_256_vec8_ptxt, + .ctxt = aes_xts_256_vec8_ctxt, + }, + { + .blkno = 0xff, + .ptxt = aes_xts_256_vec9_ptxt, + .ctxt = aes_xts_256_vec9_ctxt, + }, +}; + +/* + * Vector 10 from IEEE 1619/D16, blkno 0xff. + */ +static const uint8_t aes_xts_512_vec10_ptxt[SECSIZE] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1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65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, +}; + +static const uint8_t aes_xts_512_vec10_ctxt[SECSIZE] = { + 0x1c, 0x3b, 0x3a, 0x10, 0x2f, 0x77, 0x03, 0x86, + 0xe4, 0x83, 0x6c, 0x99, 0xe3, 0x70, 0xcf, 0x9b, + 0xea, 0x00, 0x80, 0x3f, 0x5e, 0x48, 0x23, 0x57, + 0xa4, 0xae, 0x12, 0xd4, 0x14, 0xa3, 0xe6, 0x3b, + 0x5d, 0x31, 0xe2, 0x76, 0xf8, 0xfe, 0x4a, 0x8d, + 0x66, 0xb3, 0x17, 0xf9, 0xac, 0x68, 0x3f, 0x44, + 0x68, 0x0a, 0x86, 0xac, 0x35, 0xad, 0xfc, 0x33, + 0x45, 0xbe, 0xfe, 0xcb, 0x4b, 0xb1, 0x88, 0xfd, + 0x57, 0x76, 0x92, 0x6c, 0x49, 0xa3, 0x09, 0x5e, + 0xb1, 0x08, 0xfd, 0x10, 0x98, 0xba, 0xec, 0x70, + 0xaa, 0xa6, 0x69, 0x99, 0xa7, 0x2a, 0x82, 0xf2, + 0x7d, 0x84, 0x8b, 0x21, 0xd4, 0xa7, 0x41, 0xb0, + 0xc5, 0xcd, 0x4d, 0x5f, 0xff, 0x9d, 0xac, 0x89, + 0xae, 0xba, 0x12, 0x29, 0x61, 0xd0, 0x3a, 0x75, + 0x71, 0x23, 0xe9, 0x87, 0x0f, 0x8a, 0xcf, 0x10, + 0x00, 0x02, 0x08, 0x87, 0x89, 0x14, 0x29, 0xca, + 0x2a, 0x3e, 0x7a, 0x7d, 0x7d, 0xf7, 0xb1, 0x03, + 0x55, 0x16, 0x5c, 0x8b, 0x9a, 0x6d, 0x0a, 0x7d, + 0xe8, 0xb0, 0x62, 0xc4, 0x50, 0x0d, 0xc4, 0xcd, + 0x12, 0x0c, 0x0f, 0x74, 0x18, 0xda, 0xe3, 0xd0, + 0xb5, 0x78, 0x1c, 0x34, 0x80, 0x3f, 0xa7, 0x54, + 0x21, 0xc7, 0x90, 0xdf, 0xe1, 0xde, 0x18, 0x34, + 0xf2, 0x80, 0xd7, 0x66, 0x7b, 0x32, 0x7f, 0x6c, + 0x8c, 0xd7, 0x55, 0x7e, 0x12, 0xac, 0x3a, 0x0f, + 0x93, 0xec, 0x05, 0xc5, 0x2e, 0x04, 0x93, 0xef, + 0x31, 0xa1, 0x2d, 0x3d, 0x92, 0x60, 0xf7, 0x9a, + 0x28, 0x9d, 0x6a, 0x37, 0x9b, 0xc7, 0x0c, 0x50, + 0x84, 0x14, 0x73, 0xd1, 0xa8, 0xcc, 0x81, 0xec, + 0x58, 0x3e, 0x96, 0x45, 0xe0, 0x7b, 0x8d, 0x96, + 0x70, 0x65, 0x5b, 0xa5, 0xbb, 0xcf, 0xec, 0xc6, + 0xdc, 0x39, 0x66, 0x38, 0x0a, 0xd8, 0xfe, 0xcb, + 0x17, 0xb6, 0xba, 0x02, 0x46, 0x9a, 0x02, 0x0a, + 0x84, 0xe1, 0x8e, 0x8f, 0x84, 0x25, 0x20, 0x70, + 0xc1, 0x3e, 0x9f, 0x1f, 0x28, 0x9b, 0xe5, 0x4f, + 0xbc, 0x48, 0x14, 0x57, 0x77, 0x8f, 0x61, 0x60, + 0x15, 0xe1, 0x32, 0x7a, 0x02, 0xb1, 0x40, 0xf1, + 0x50, 0x5e, 0xb3, 0x09, 0x32, 0x6d, 0x68, 0x37, + 0x8f, 0x83, 0x74, 0x59, 0x5c, 0x84, 0x9d, 0x84, + 0xf4, 0xc3, 0x33, 0xec, 0x44, 0x23, 0x88, 0x51, + 0x43, 0xcb, 0x47, 0xbd, 0x71, 0xc5, 0xed, 0xae, + 0x9b, 0xe6, 0x9a, 0x2f, 0xfe, 0xce, 0xb1, 0xbe, + 0xc9, 0xde, 0x24, 0x4f, 0xbe, 0x15, 0x99, 0x2b, + 0x11, 0xb7, 0x7c, 0x04, 0x0f, 0x12, 0xbd, 0x8f, + 0x6a, 0x97, 0x5a, 0x44, 0xa0, 0xf9, 0x0c, 0x29, + 0xa9, 0xab, 0xc3, 0xd4, 0xd8, 0x93, 0x92, 0x72, + 0x84, 0xc5, 0x87, 0x54, 0xcc, 0xe2, 0x94, 0x52, + 0x9f, 0x86, 0x14, 0xdc, 0xd2, 0xab, 0xa9, 0x91, + 0x92, 0x5f, 0xed, 0xc4, 0xae, 0x74, 0xff, 0xac, + 0x6e, 0x33, 0x3b, 0x93, 0xeb, 0x4a, 0xff, 0x04, + 0x79, 0xda, 0x9a, 0x41, 0x0e, 0x44, 0x50, 0xe0, + 0xdd, 0x7a, 0xe4, 0xc6, 0xe2, 0x91, 0x09, 0x00, + 0x57, 0x5d, 0xa4, 0x01, 0xfc, 0x07, 0x05, 0x9f, + 0x64, 0x5e, 0x8b, 0x7e, 0x9b, 0xfd, 0xef, 0x33, + 0x94, 0x30, 0x54, 0xff, 0x84, 0x01, 0x14, 0x93, + 0xc2, 0x7b, 0x34, 0x29, 0xea, 0xed, 0xb4, 0xed, + 0x53, 0x76, 0x44, 0x1a, 0x77, 0xed, 0x43, 0x85, + 0x1a, 0xd7, 0x7f, 0x16, 0xf5, 0x41, 0xdf, 0xd2, + 0x69, 0xd5, 0x0d, 0x6a, 0x5f, 0x14, 0xfb, 0x0a, + 0xab, 0x1c, 0xbb, 0x4c, 0x15, 0x50, 0xbe, 0x97, + 0xf7, 0xab, 0x40, 0x66, 0x19, 0x3c, 0x4c, 0xaa, + 0x77, 0x3d, 0xad, 0x38, 0x01, 0x4b, 0xd2, 0x09, + 0x2f, 0xa7, 0x55, 0xc8, 0x24, 0xbb, 0x5e, 0x54, + 0xc4, 0xf3, 0x6f, 0xfd, 0xa9, 0xfc, 0xea, 0x70, + 0xb9, 0xc6, 0xe6, 0x93, 0xe1, 0x48, 0xc1, 0x51, +}; + +/* + * Vector 11 from IEEE 1619/D16, blkno 0xffff. + */ +static const uint8_t aes_xts_512_vec11_ptxt[SECSIZE] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 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0x58, 0xe8, 0x37, 0xc2, + 0x46, 0x9e, 0xe4, 0xa4, 0xfa, 0x79, 0x4e, 0x4b, + 0xbc, 0x7f, 0x39, 0xbc, 0x02, 0x6e, 0x3c, 0xb7, + 0x2c, 0x33, 0xb0, 0x88, 0x8f, 0x25, 0xb4, 0xac, + 0xf5, 0x6a, 0x2a, 0x98, 0x04, 0xf1, 0xce, 0x6d, + 0x3d, 0x6e, 0x1d, 0xc6, 0xca, 0x18, 0x1d, 0x4b, + 0x54, 0x61, 0x79, 0xd5, 0x55, 0x44, 0xaa, 0x77, + 0x60, 0xc4, 0x0d, 0x06, 0x74, 0x15, 0x39, 0xc7, + 0xe3, 0xcd, 0x9d, 0x2f, 0x66, 0x50, 0xb2, 0x01, + 0x3f, 0xd0, 0xee, 0xb8, 0xc2, 0xb8, 0xe3, 0xd8, + 0xd2, 0x40, 0xcc, 0xae, 0x2d, 0x4c, 0x98, 0x32, + 0x0a, 0x74, 0x42, 0xe1, 0xc8, 0xd7, 0x5a, 0x42, + 0xd6, 0xe6, 0xcf, 0xa4, 0xc2, 0xec, 0xa1, 0x79, + 0x8d, 0x15, 0x8c, 0x7a, 0xec, 0xdf, 0x82, 0x49, + 0x0f, 0x24, 0xbb, 0x9b, 0x38, 0xe1, 0x08, 0xbc, + 0xda, 0x12, 0xc3, 0xfa, 0xf9, 0xa2, 0x11, 0x41, + 0xc3, 0x61, 0x3b, 0x58, 0x36, 0x7f, 0x92, 0x2a, + 0xaa, 0x26, 0xcd, 0x22, 0xf2, 0x3d, 0x70, 0x8d, + 0xae, 0x69, 0x9a, 0xd7, 0xcb, 0x40, 0xa8, 0xad, + 0x0b, 0x6e, 0x27, 0x84, 0x97, 0x3d, 0xcb, 0x60, + 0x56, 0x84, 0xc0, 0x8b, 0x8d, 0x69, 0x98, 0xc6, + 0x9a, 0xac, 0x04, 0x99, 0x21, 0x87, 0x1e, 0xbb, + 0x65, 0x30, 0x1a, 0x46, 0x19, 0xca, 0x80, 0xec, + 0xb4, 0x85, 0xa3, 0x1d, 0x74, 0x42, 0x23, 0xce, + 0x8d, 0xdc, 0x23, 0x94, 0x82, 0x8d, 0x6a, 0x80, + 0x47, 0x0c, 0x09, 0x2f, 0x5b, 0xa4, 0x13, 0xc3, + 0x37, 0x8f, 0xa6, 0x05, 0x42, 0x55, 0xc6, 0xf9, + 0xdf, 0x44, 0x95, 0x86, 0x2b, 0xbb, 0x32, 0x87, + 0x68, 0x1f, 0x93, 0x1b, 0x68, 0x7c, 0x88, 0x8a, + 0xbf, 0x84, 0x4d, 0xfc, 0x8f, 0xc2, 0x83, 0x31, + 0xe5, 0x79, 0x92, 0x8c, 0xd1, 0x2b, 0xd2, 0x39, + 0x0a, 0xe1, 0x23, 0xcf, 0x03, 0x81, 0x8d, 0x14, + 0xde, 0xdd, 0xe5, 0xc0, 0xc2, 0x4c, 0x8a, 0xb0, + 0x18, 0xbf, 0xca, 0x75, 0xca, 0x09, 0x6f, 0x2d, + 0x53, 0x1f, 0x3d, 0x16, 0x19, 0xe7, 0x85, 0xf1, + 0xad, 0xa4, 0x37, 0xca, 0xb9, 0x2e, 0x98, 0x05, + 0x58, 0xb3, 0xdc, 0xe1, 0x47, 0x4a, 0xfb, 0x75, + 0xbf, 0xed, 0xbf, 0x8f, 0xf5, 0x4c, 0xb2, 0x61, + 0x8e, 0x02, 0x44, 0xc9, 0xac, 0x0d, 0x3c, 0x66, + 0xfb, 0x51, 0x59, 0x8c, 0xd2, 0xdb, 0x11, 0xf9, + 0xbe, 0x39, 0x79, 0x1a, 0xbe, 0x44, 0x7c, 0x63, + 0x09, 0x4f, 0x7c, 0x45, 0x3b, 0x7f, 0xf8, 0x7c, + 0xb5, 0xbb, 0x36, 0xb7, 0xc7, 0x9e, 0xfb, 0x08, + 0x72, 0xd1, 0x70, 0x58, 0xb8, 0x3b, 0x15, 0xab, + 0x08, 0x66, 0xad, 0x8a, 0x58, 0x65, 0x6c, 0x5a, + 0x7e, 0x20, 0xdb, 0xdf, 0x30, 0x8b, 0x24, 0x61, + 0xd9, 0x7c, 0x0e, 0xc0, 0x02, 0x4a, 0x27, 0x15, + 0x05, 0x52, 0x49, 0xcf, 0x3b, 0x47, 0x8d, 0xdd, + 0x47, 0x40, 0xde, 0x65, 0x4f, 0x75, 0xca, 0x68, + 0x6e, 0x0d, 0x73, 0x45, 0xc6, 0x9e, 0xd5, 0x0c, + 0xdc, 0x2a, 0x8b, 0x33, 0x2b, 0x1f, 0x88, 0x24, + 0x10, 0x8a, 0xc9, 0x37, 0xeb, 0x05, 0x05, 0x85, + 0x60, 0x8e, 0xe7, 0x34, 0x09, 0x7f, 0xc0, 0x90, + 0x54, 0xfb, 0xff, 0x89, 0xee, 0xae, 0xea, 0x79, + 0x1f, 0x4a, 0x7a, 0xb1, 0xf9, 0x86, 0x82, 0x94, + 0xa4, 0xf9, 0xe2, 0x7b, 0x42, 0xaf, 0x81, 0x00, + 0xcb, 0x9d, 0x59, 0xce, 0xf9, 0x64, 0x58, 0x03, +}; + +const struct testvec aes_xts_512_vectors[] = { + { + .blkno = 0xff, + .ptxt = aes_xts_512_vec10_ptxt, + .ctxt = aes_xts_512_vec10_ctxt, + }, + { + .blkno = 0xffff, + .ptxt = aes_xts_512_vec11_ptxt, + .ctxt = aes_xts_512_vec11_ctxt, + }, +}; + +static int +open_disk(const char *devpath, const char *imgpath, size_t size) +{ + int fd; + + fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600); + if (fd < 0) + return -1; + + if (ftruncate(fd, size) < 0) + goto fail; + + if (rump_pub_etfs_register_withsize(devpath, + imgpath, RUMP_ETFS_BLK, 0, size) < 0) { + goto fail; + } + + unlink(imgpath); + return fd; +fail: + close(fd); + unlink(imgpath); + return -1; +} + +static int +open_cgd(int devno) +{ + char devpath[32]; + + sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a'); + + return rump_sys_open(devpath, O_RDWR, 0); +} + +static int +configure_cgd(int fd, const char *dkpath, const char *alg, + const char *ivmethod, const char *key, size_t keylen) +{ + struct cgd_ioctl ci; + + memset(&ci, 0, sizeof(ci)); + ci.ci_disk = dkpath; + ci.ci_alg = alg; + ci.ci_ivmethod = ivmethod; + ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */ + ci.ci_key = key; + ci.ci_blocksize = 128; + + return rump_sys_ioctl(fd, CGDIOCSET, &ci); +} + +static int +unconfigure_cgd(int fd) +{ + struct cgd_ioctl ci; + + return rump_sys_ioctl(fd, CGDIOCCLR, &ci); +} + +static int +write_testvec(int cgdfd, const struct testvec *tv) +{ + ssize_t written; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + return -1; + + written = rump_sys_write(cgdfd, tv->ptxt, SECSIZE); + if (written < 0) + return -1; + if (written != SECSIZE) { + errno = EDOM; /* Something distinct. */ + return -1; + } + + return 0; +} + +static int +read_testvec(int cgdfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ptxt, SECSIZE); +fail: + free(buf); + return res; +} + +static int +check_testvec(int dkfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (read(dkfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ctxt, SECSIZE); +fail: + free(buf); + return res; +} + +ATF_TC(cgd_aes_cbc_128_encblkno1); +ATF_TC_HEAD(cgd_aes_cbc_128_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 128 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_aes_cbc_128_encblkno1, tc) +{ + const char imgpath[] = "aes-cbc-128-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_1_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_128_encblkno8); +ATF_TC_HEAD(cgd_aes_cbc_128_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 128 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_aes_cbc_128_encblkno8, tc) +{ + const char imgpath[] = "aes-cbc-128-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_128_8_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_128_key, sizeof(aes_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_128_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_128_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_192_encblkno1); +ATF_TC_HEAD(cgd_aes_cbc_192_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 192 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_aes_cbc_192_encblkno1, tc) +{ + const char imgpath[] = "aes-cbc-192-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_1_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_192_encblkno8); +ATF_TC_HEAD(cgd_aes_cbc_192_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 192 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_aes_cbc_192_encblkno8, tc) +{ + const char imgpath[] = "aes-cbc-192-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_192_8_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_192_key, sizeof(aes_cbc_192_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_192_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_192_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_256_encblkno1); +ATF_TC_HEAD(cgd_aes_cbc_256_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 256 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_aes_cbc_256_encblkno1, tc) +{ + const char imgpath[] = "aes-cbc-256-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_1_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_cbc_256_encblkno8); +ATF_TC_HEAD(cgd_aes_cbc_256_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test aes-cbc with 256 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_aes_cbc_256_encblkno8, tc) +{ + const char imgpath[] = "aes-cbc-256-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_cbc_256_8_vectors[3]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8", + aes_cbc_256_key, sizeof(aes_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_cbc_256_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_cbc_256_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_xts_256); +ATF_TC_HEAD(cgd_aes_xts_256, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test aes-xts with 256 bits key"); +} + +ATF_TC_BODY(cgd_aes_xts_256, tc) +{ + const char imgpath[] = "aes-xts-256.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 256 * SECSIZE; /* Last blkno is 0xff. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_256_key, sizeof(aes_xts_256_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[1]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[2]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[3]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[4]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_256_vectors[5]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_256_key, sizeof(aes_xts_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[3]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[4]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_256_vectors[5]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[3]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[4]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_256_vectors[5]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_aes_xts_512); +ATF_TC_HEAD(cgd_aes_xts_512, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test aes-xts with 512 bits key"); +} + +ATF_TC_BODY(cgd_aes_xts_512, tc) +{ + const char imgpath[] = "aes-xts-512.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 65536 * SECSIZE; /* Last blkno is 0xffff. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_512_key, sizeof(aes_xts_512_key))); + + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_512_vectors[0]), -1); + CHECK_LIBC(write_testvec(cgdfd, &aes_xts_512_vectors[1]), -1); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1", + aes_xts_512_key, sizeof(aes_xts_512_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_512_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &aes_xts_512_vectors[1]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_512_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &aes_xts_512_vectors[1]), 0); + + RL(close(dkfd)); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, cgd_aes_cbc_128_encblkno1); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_128_encblkno8); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_192_encblkno1); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_192_encblkno8); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_256_encblkno1); + ATF_TP_ADD_TC(tp, cgd_aes_cbc_256_encblkno8); + ATF_TP_ADD_TC(tp, cgd_aes_xts_256); + ATF_TP_ADD_TC(tp, cgd_aes_xts_512); + + return atf_no_error(); +} diff --git a/dev/cgd/t_cgd_blowfish.c b/dev/cgd/t_cgd_blowfish.c new file mode 100644 index 000000000000..958ebaccf6ad --- /dev/null +++ b/dev/cgd/t_cgd_blowfish.c @@ -0,0 +1,2341 @@ +/* $NetBSD: t_cgd_blowfish.c,v 1.1 2016/11/10 23:44:36 alnsn Exp $ */ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alexander Nasonov. + * + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "../../h_macros.h" + +#define SECSIZE 512 + +struct testvec { + unsigned int blkno; + const uint8_t *ptxt; /* PlainText */ + const uint8_t *ctxt; /* CipherText */ +}; + +/* + * 128 bits Blowfish key, NUL terminated. + */ +static const char bf_cbc_128_key[17] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0 +}; + +/* + * 256 bits Blowfish key, NUL terminated. + */ +static const char bf_cbc_256_key[33] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, /* 89ABCDEF */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 01234567 */ + 0x38, 0x39, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, /* 89abcdef */ + 0 +}; + +/* + * 448 bits Blowfish key, NUL terminated. + */ +static const char bf_cbc_448_key[57] = { + 0x3a, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* :ABCDEFG */ + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* HIJKLMNO */ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* PQRSTUVW */ + 0x58, 0x59, 0x5a, 0x7e, 0x3a, 0x61, 0x62, 0x63, /* XYZ~:abc */ + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, /* defghijk */ + 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, /* lmnopqrs */ + 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x23, /* tuvwxyz# */ + 0 +}; + +static const uint8_t bf_cbc_ptxt[SECSIZE] = + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop" + " abcdefghijklmnop"; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t bf_cbc_128_encblkno1_vec0_ctxt[SECSIZE] = { + 0x78, 0x53, 0x43, 0x2a, 0x08, 0xe7, 0x84, 0x3f, + 0xb7, 0x61, 0x9c, 0x17, 0x81, 0xbe, 0x38, 0xb9, + 0x65, 0x51, 0x68, 0xa2, 0x29, 0xd7, 0x45, 0xc9, + 0xee, 0x0e, 0x9d, 0xe1, 0x69, 0xc6, 0x81, 0x81, + 0xf3, 0x93, 0xa6, 0x62, 0xc9, 0x05, 0x2c, 0x1b, + 0x0e, 0x05, 0xca, 0xbe, 0x12, 0x25, 0x37, 0xd8, + 0x98, 0x66, 0xa2, 0xd3, 0xd0, 0x8a, 0x89, 0x57, + 0x44, 0x91, 0x1e, 0xe9, 0x07, 0x03, 0x5c, 0xa6, + 0xb8, 0x30, 0xf1, 0xc7, 0x8c, 0x66, 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x5c, 0xd3, 0x07, 0xdf, 0x4e, 0x65, 0x65, 0x9d, + 0x2e, 0x26, 0x28, 0xfa, 0xcd, 0x53, 0x77, 0x6a, + 0x77, 0xad, 0x96, 0x0b, 0x1f, 0xea, 0x03, 0xc1, + 0xdd, 0xca, 0xe8, 0xfe, 0xe8, 0x36, 0x01, 0x61, + 0x72, 0xbb, 0xed, 0xfd, 0x8d, 0xa3, 0xc2, 0x15, + 0x25, 0x4f, 0xa6, 0x1a, 0x73, 0xbd, 0xcd, 0x45, + 0xdb, 0x08, 0x74, 0x7b, 0xa8, 0x23, 0xf5, 0x74, + 0x3a, 0x18, 0x6d, 0x90, 0xe0, 0xee, 0xae, 0xfe, + 0xc8, 0xac, 0x00, 0x57, 0xa0, 0xe1, 0xfe, 0x10, + 0xd4, 0xf3, 0xa8, 0x00, 0x21, 0x3e, 0x2d, 0xf9, + 0x63, 0xb8, 0xe9, 0xa4, 0x2e, 0xf4, 0x6b, 0xd7, + 0x5c, 0xfd, 0x32, 0x6c, 0x98, 0x05, 0x38, 0x0d, + 0x29, 0xb5, 0x5a, 0x5b, 0xbb, 0xad, 0xfd, 0x46, + 0x9b, 0x6a, 0x97, 0x4c, 0x24, 0xcc, 0x7d, 0x13, + 0x25, 0xe8, 0x2c, 0xb9, 0x13, 0x54, 0xb2, 0x8a, + 0x28, 0xa0, 0x8a, 0x3a, 0x4d, 0x7e, 0xf4, 0x29, + 0xff, 0xfb, 0x4f, 0xd6, 0x3d, 0xf7, 0xca, 0x89, + 0x2a, 0x58, 0x9e, 0x42, 0x00, 0x84, 0x61, 0x58, + 0x7c, 0x94, 0xf6, 0x50, 0x48, 0x2f, 0x34, 0x88, + 0xec, 0x97, 0xef, 0x8b, 0x2f, 0x84, 0xca, 0x23, + 0xe1, 0xb7, 0x63, 0x99, 0xdd, 0x4a, 0x76, 0xdd, + 0x20, 0xc1, 0xc2, 0x56, 0x45, 0xbe, 0x75, 0x9a, + 0x40, 0x72, 0xc8, 0xfb, 0x7e, 0x40, 0x6f, 0x38, + 0xfd, 0x76, 0xa4, 0x78, 0xf5, 0xde, 0x5f, 0xb7, + 0x4a, 0xa9, 0xaf, 0xad, 0xa1, 0x8b, 0x25, 0x8f, + 0xea, 0xb3, 0xeb, 0x54, 0x39, 0x5a, 0x91, 0xfe, + 0x86, 0x18, 0xea, 0x8c, 0xd6, 0x66, 0xd5, 0x85, + 0x02, 0x2b, 0x00, 0x5d, 0x7e, 0x13, 0xa0, 0x1f, + 0x73, 0x46, 0x6d, 0x5e, 0xcd, 0xe0, 0x82, 0x02, + 0x28, 0x88, 0xbf, 0x17, 0xfd, 0x9b, 0x83, 0x2c, + 0xa2, 0xf7, 0xde, 0x51, 0x98, 0x3f, 0xe2, 0x80, + 0x66, 0x14, 0x17, 0xce, 0x8e, 0x30, 0x2d, 0xe2, + 0x24, 0x68, 0x4b, 0xe5, 0xd1, 0x09, 0xfb, 0x6e, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t bf_cbc_128_encblkno1_vec1_ctxt[SECSIZE] = { + 0x87, 0xae, 0x01, 0x52, 0xe8, 0xe9, 0xd9, 0xba, + 0xa9, 0x18, 0x31, 0x2c, 0x1b, 0xab, 0x57, 0xad, + 0x45, 0x0e, 0x25, 0x5e, 0x0e, 0x04, 0xfa, 0xdd, + 0xf1, 0x59, 0xe6, 0xea, 0x78, 0x4b, 0x83, 0x07, + 0x8b, 0x46, 0x91, 0x09, 0x58, 0x5a, 0x11, 0x2e, + 0x54, 0x43, 0xa4, 0xc1, 0x04, 0x35, 0xd3, 0x3e, + 0xc9, 0xc8, 0xf5, 0xff, 0x69, 0x1e, 0x57, 0x85, + 0x6d, 0x91, 0x03, 0xeb, 0x8c, 0xa7, 0xe8, 0xcc, + 0x3f, 0xac, 0xf9, 0x14, 0x1e, 0x88, 0x50, 0xa5, + 0x38, 0x66, 0xa9, 0xf4, 0xf5, 0xc6, 0x30, 0x95, + 0xd6, 0x84, 0x0b, 0x81, 0xf9, 0x51, 0x05, 0x80, + 0x9a, 0x89, 0xbf, 0xd4, 0x7d, 0x6a, 0x26, 0x59, + 0x29, 0x44, 0xe7, 0x1d, 0x0e, 0xad, 0x8c, 0xa0, + 0x93, 0xe9, 0x4b, 0x4b, 0x51, 0x46, 0xa5, 0x07, + 0xe8, 0xcb, 0x59, 0xf4, 0x63, 0xb5, 0x36, 0xdb, + 0xbc, 0x54, 0x2d, 0xec, 0xf0, 0x90, 0x3a, 0xa5, + 0xed, 0xc8, 0x28, 0x0e, 0xd3, 0x79, 0xb8, 0x57, + 0xc6, 0x7f, 0x02, 0x22, 0x5e, 0x80, 0xe8, 0x7f, + 0xdf, 0xa0, 0x0f, 0xbc, 0x98, 0x79, 0x6f, 0xd2, + 0xb0, 0xb2, 0x4f, 0x9b, 0x1a, 0x21, 0x8f, 0x63, + 0xce, 0x54, 0x41, 0x64, 0xbf, 0xb9, 0xa7, 0x93, + 0xd6, 0x5b, 0x89, 0x86, 0xda, 0x90, 0x23, 0x2e, + 0x25, 0x35, 0x1a, 0x9a, 0xf5, 0x1e, 0x8f, 0xb4, + 0xe6, 0x66, 0x8e, 0x0e, 0x2d, 0x91, 0x06, 0x4b, + 0x3d, 0x4a, 0x97, 0xab, 0x9b, 0x92, 0x09, 0xaa, + 0x07, 0xbf, 0xc1, 0x7d, 0xe2, 0xbc, 0xd2, 0xf1, + 0x38, 0x8d, 0x02, 0x45, 0xc8, 0x13, 0x12, 0xda, + 0xaa, 0x53, 0xa2, 0x2c, 0x96, 0x69, 0x64, 0xce, + 0x86, 0xe4, 0x84, 0x56, 0xd0, 0xe5, 0x81, 0x99, + 0x27, 0xad, 0x86, 0x47, 0x5f, 0xaf, 0xa2, 0xa2, + 0x90, 0x7f, 0xe7, 0x86, 0xec, 0x7f, 0xf4, 0xa3, + 0xcd, 0x4f, 0x60, 0xcc, 0x1e, 0x35, 0x44, 0xe8, + 0xe9, 0x06, 0xaf, 0x5e, 0x53, 0x3d, 0x30, 0x91, + 0xfe, 0x44, 0x59, 0x66, 0x82, 0xc2, 0xea, 0x9f, + 0xc8, 0x3b, 0xe2, 0xe5, 0x58, 0xf7, 0x34, 0xd5, + 0x9e, 0xfc, 0x20, 0x84, 0x34, 0xaa, 0x4f, 0xe1, + 0xd4, 0x95, 0x76, 0x11, 0x59, 0x90, 0x90, 0xfd, + 0x4d, 0xf9, 0xb8, 0x41, 0xe1, 0xdb, 0x36, 0x05, + 0xe3, 0x0f, 0xa4, 0x4f, 0x0c, 0x61, 0x70, 0xa5, + 0x1b, 0xbf, 0xab, 0x65, 0x67, 0x75, 0x5c, 0x7d, + 0x46, 0x3b, 0x29, 0xd0, 0x3d, 0x06, 0x40, 0x25, + 0x47, 0x3e, 0x8d, 0x62, 0xf8, 0xd8, 0x08, 0xc1, + 0x03, 0x04, 0x4b, 0x5a, 0x40, 0x65, 0x84, 0x52, + 0x34, 0xa2, 0x4a, 0xcc, 0x3a, 0x9c, 0x1e, 0xbf, + 0x2d, 0xed, 0x08, 0x8b, 0xc3, 0x8f, 0x48, 0xba, + 0x06, 0x03, 0xea, 0x5b, 0xba, 0x6a, 0xac, 0x23, + 0x5a, 0x5e, 0x31, 0x08, 0x29, 0x69, 0x64, 0x44, + 0x1c, 0x31, 0xae, 0xb1, 0x86, 0x7b, 0x26, 0x89, + 0xa6, 0xbe, 0xef, 0x69, 0x81, 0xf7, 0x77, 0xd5, + 0x8e, 0x78, 0xa5, 0x11, 0x51, 0xca, 0xec, 0xd0, + 0x86, 0xa5, 0x33, 0xf3, 0x65, 0x5d, 0x04, 0xc5, + 0xd2, 0x17, 0x2a, 0xfe, 0x4a, 0x58, 0x0f, 0x98, + 0x61, 0xad, 0xc3, 0xb8, 0x5b, 0x45, 0xcc, 0x28, + 0x3d, 0x4d, 0x00, 0xf5, 0x4a, 0xe2, 0xbc, 0x6c, + 0x1b, 0x80, 0x7a, 0x2b, 0x40, 0xb8, 0x34, 0x0e, + 0x44, 0x53, 0x16, 0xda, 0x7c, 0x46, 0x8b, 0x42, + 0x5e, 0xa8, 0xe1, 0xb8, 0xf8, 0xcf, 0xff, 0x48, + 0xcf, 0x2c, 0x4c, 0x98, 0xdb, 0xe5, 0x55, 0xfe, + 0x45, 0xfa, 0xf8, 0xde, 0x72, 0xf9, 0x84, 0x3c, + 0xc0, 0x0c, 0x1f, 0x86, 0x97, 0x86, 0xb8, 0xfe, + 0x7d, 0xff, 0xa3, 0xaf, 0x68, 0x00, 0x66, 0x90, + 0xac, 0xb5, 0xd8, 0xde, 0x35, 0x01, 0xf7, 0xab, + 0xab, 0xe3, 0xe9, 0x85, 0x4c, 0x6f, 0xe6, 0xbc, + 0xce, 0x67, 0x4a, 0xbd, 0xad, 0x7b, 0xec, 0xa1, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t bf_cbc_128_encblkno1_vec2_ctxt[SECSIZE] = { + 0x17, 0xdd, 0x0f, 0x4b, 0x28, 0x33, 0x03, 0x89, + 0x21, 0x7b, 0x67, 0x15, 0x15, 0x65, 0x08, 0x4f, + 0x65, 0x18, 0xa6, 0x4b, 0x62, 0xdb, 0x1e, 0xc2, + 0xaa, 0x82, 0xb6, 0x1d, 0xf7, 0x12, 0x9e, 0x73, + 0xfe, 0xac, 0x2f, 0x1e, 0x2b, 0xea, 0x3a, 0x4f, + 0xc3, 0x0a, 0x59, 0x80, 0x0d, 0x3d, 0xbc, 0x62, + 0x8d, 0x70, 0xef, 0x1b, 0xfb, 0xdc, 0x4e, 0xc4, + 0x97, 0xf4, 0x77, 0xb7, 0x25, 0x94, 0x13, 0x48, + 0xf2, 0x3d, 0x4c, 0xa7, 0xb8, 0x8c, 0xf5, 0x26, + 0xa4, 0x35, 0xeb, 0xa0, 0xe7, 0x68, 0xb0, 0x69, + 0xf4, 0xf6, 0x13, 0x3a, 0x57, 0xa3, 0xd2, 0x26, + 0xe6, 0x70, 0xd8, 0xd4, 0x05, 0xb5, 0x01, 0xda, + 0xc7, 0x4a, 0x79, 0x1a, 0x6d, 0xb6, 0xf6, 0xb5, + 0x7d, 0x9a, 0x5c, 0xf1, 0x6a, 0xf8, 0xd1, 0x0a, + 0xbc, 0xe7, 0xea, 0xb4, 0x99, 0x72, 0x19, 0x97, + 0x41, 0x4f, 0x14, 0x5f, 0xa3, 0xb3, 0x9b, 0x36, + 0x00, 0x08, 0x88, 0x8c, 0xce, 0x7f, 0x3a, 0x9b, + 0xb0, 0x24, 0x17, 0x95, 0xc4, 0x59, 0x30, 0x5d, + 0xc6, 0x92, 0x19, 0x12, 0x99, 0xb0, 0x08, 0xa6, + 0x04, 0xdb, 0xc6, 0xd5, 0x61, 0xe4, 0xe1, 0x68, + 0xa8, 0xd7, 0x07, 0xfe, 0x2f, 0x47, 0xea, 0x14, + 0xe5, 0xf7, 0x61, 0x9b, 0xbb, 0x98, 0xcb, 0x3b, + 0x8c, 0x41, 0xd1, 0x55, 0x59, 0xb2, 0x41, 0x61, + 0x8e, 0x60, 0x17, 0xcd, 0xe8, 0xf7, 0x1d, 0xbd, + 0x28, 0x5d, 0x1e, 0x15, 0x28, 0x80, 0x8c, 0x29, + 0x34, 0x96, 0x31, 0xda, 0xe1, 0x19, 0x88, 0xd5, + 0xe0, 0xc8, 0xb4, 0xaa, 0x04, 0x21, 0xf5, 0xef, + 0xfa, 0x0e, 0xc9, 0xa5, 0x88, 0x77, 0x49, 0xf4, + 0x02, 0x22, 0x0b, 0x8b, 0x5e, 0xe1, 0xab, 0xd4, + 0xb1, 0xb6, 0x48, 0x54, 0x96, 0x08, 0xaf, 0xa1, + 0x0b, 0xc0, 0xfe, 0x2a, 0x12, 0x36, 0x56, 0x85, + 0x6a, 0xf7, 0x3d, 0x82, 0xe6, 0xda, 0x5d, 0xfe, + 0x4f, 0x4f, 0xc9, 0x43, 0xdc, 0x0f, 0x53, 0x05, + 0x09, 0xd4, 0x9c, 0x2e, 0x6e, 0xf3, 0x52, 0x6a, + 0x10, 0xc6, 0x48, 0xb1, 0x54, 0x70, 0xab, 0x7c, + 0x31, 0xf6, 0x47, 0xef, 0x64, 0x5f, 0xff, 0x45, + 0x8c, 0x3f, 0x87, 0x3a, 0x2d, 0xa6, 0xaf, 0xb2, + 0x44, 0xdf, 0x80, 0x2e, 0x89, 0x4c, 0x94, 0x67, + 0xfc, 0x20, 0x98, 0xb4, 0xcf, 0x58, 0x1e, 0x33, + 0x55, 0x6a, 0x7c, 0x67, 0x5c, 0x28, 0x2f, 0x19, + 0x02, 0x14, 0x06, 0x93, 0x8c, 0x84, 0xae, 0x62, + 0x14, 0xf9, 0x87, 0xae, 0x85, 0xa3, 0x60, 0x26, + 0xfc, 0x8d, 0x04, 0x92, 0x27, 0xfe, 0x35, 0x7b, + 0x45, 0x9d, 0x4a, 0x86, 0x75, 0xa6, 0xb3, 0xa1, + 0x59, 0xe4, 0x4b, 0x1c, 0xd2, 0x71, 0x36, 0xfe, + 0x73, 0xed, 0x54, 0x0d, 0x9d, 0xde, 0x63, 0xb2, + 0xc0, 0x7c, 0xf2, 0xb3, 0x36, 0x62, 0x06, 0x1f, + 0xcd, 0x41, 0x92, 0x73, 0xbc, 0x11, 0x68, 0xc9, + 0x69, 0x20, 0xf9, 0xbb, 0x9a, 0xe9, 0x6c, 0x05, + 0xcf, 0x01, 0x57, 0xc4, 0x1d, 0x95, 0x5e, 0xe3, + 0xb7, 0x15, 0xde, 0xa7, 0xb5, 0x1a, 0x4e, 0x78, + 0x44, 0x5b, 0x9a, 0xee, 0x29, 0xe2, 0x22, 0x8b, + 0xe9, 0xe3, 0xe6, 0x70, 0x3e, 0xcb, 0x9f, 0x7f, + 0xc3, 0xd0, 0x2c, 0xdc, 0x55, 0xb4, 0x0d, 0x67, + 0xf5, 0xd8, 0xff, 0xbb, 0xb1, 0x02, 0xbf, 0xf6, + 0x33, 0x4e, 0x7a, 0x3a, 0x50, 0xb1, 0x01, 0x77, + 0x51, 0xef, 0xb5, 0x75, 0xb3, 0x66, 0xe8, 0xe6, + 0xd6, 0x53, 0x7d, 0x33, 0x51, 0x62, 0x5d, 0xf2, + 0x77, 0x02, 0x34, 0x42, 0xda, 0xee, 0xd9, 0xee, + 0x0b, 0x4d, 0x71, 0x5c, 0xc0, 0xec, 0xdd, 0xc0, + 0x34, 0x6f, 0xf4, 0x65, 0x32, 0xde, 0xc5, 0xb2, + 0x97, 0x60, 0x89, 0x4e, 0x3b, 0x0c, 0xf2, 0xa7, + 0x74, 0x61, 0xd7, 0xe4, 0xa6, 0x80, 0x78, 0x76, + 0xe5, 0x7d, 0xab, 0x96, 0x04, 0x00, 0x76, 0x22, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t bf_cbc_128_encblkno1_vec3_ctxt[SECSIZE] = { + 0xdd, 0x8e, 0xce, 0x5b, 0xb8, 0x2a, 0xc8, 0x0e, + 0xd2, 0xbe, 0xcf, 0xa7, 0x2a, 0x5b, 0x0c, 0x1a, + 0xb2, 0x68, 0x5b, 0xe7, 0x53, 0xaf, 0xce, 0x56, + 0xfd, 0xbd, 0x73, 0x3c, 0x44, 0x02, 0x96, 0x57, + 0xaa, 0x47, 0x8d, 0xf1, 0x28, 0x59, 0xb6, 0xce, + 0xba, 0x1e, 0xc9, 0x78, 0x76, 0xdd, 0x43, 0x3a, + 0xbc, 0x43, 0x4c, 0x17, 0xd2, 0xba, 0xb1, 0xda, + 0xa8, 0xbf, 0x32, 0x25, 0xaa, 0xc0, 0xf7, 0xb6, + 0x72, 0x65, 0xe2, 0x67, 0xdb, 0xf0, 0xa8, 0x60, + 0xda, 0x9b, 0x70, 0xad, 0x8f, 0x1d, 0x34, 0x24, + 0x1a, 0xfd, 0x77, 0x2e, 0x1c, 0xb6, 0xc0, 0x6b, + 0xa0, 0x4b, 0x4a, 0xa0, 0xd5, 0x8b, 0xbb, 0xd4, + 0xcc, 0x7b, 0x4e, 0x4c, 0x71, 0x9a, 0x50, 0x12, + 0x36, 0xd4, 0xfd, 0x1f, 0xf1, 0xfc, 0x19, 0x31, + 0xec, 0x54, 0x24, 0xb4, 0x9f, 0xa9, 0xea, 0xd2, + 0x87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 0xe2, 0x34, 0xf7, + 0x8f, 0x30, 0xd5, 0xd5, 0x1f, 0x17, 0x0d, 0x00, + 0x6c, 0x50, 0xde, 0x56, 0x15, 0x33, 0x1b, 0x83, + 0x68, 0x7b, 0x24, 0xe3, 0xa0, 0xda, 0xd5, 0x7a, + 0x3e, 0x93, 0x6d, 0xe0, 0x02, 0x79, 0x62, 0x5d, + 0x71, 0xe3, 0x7b, 0xa9, 0x0b, 0x7a, 0xcd, 0xb3, + 0xb2, 0x6f, 0x96, 0x19, 0x8f, 0xf8, 0x8b, 0x26, + 0x7a, 0x40, 0xc8, 0xae, 0xfe, 0x0d, 0x6f, 0x67, + 0xce, 0x5e, 0xa0, 0x04, 0x7e, 0x93, 0x1d, 0x17, + 0x1c, 0x32, 0x82, 0xf4, 0x54, 0xb9, 0x80, 0xdd, + 0x82, 0xae, 0xf5, 0xc5, 0x1e, 0x15, 0xab, 0xc2, + 0x5c, 0x60, 0xd2, 0x08, 0xc2, 0xa1, 0x1f, 0x89, + 0x0b, 0x59, 0x36, 0x07, 0xdc, 0x57, 0xd3, 0xa0, + 0x32, 0x42, 0xac, 0xa6, 0x90, 0x0b, 0xc0, 0xe4, + 0x91, 0x45, 0x85, 0x27, 0xb9, 0x48, 0x2a, 0x88, + 0x0a, 0xbf, 0xf6, 0x2d, 0xef, 0x4d, 0x1b, 0x64, + 0x49, 0x23, 0x47, 0x30, 0x29, 0x25, 0xb2, 0xc9, + 0xaf, 0xcd, 0xae, 0x56, 0x43, 0x28, 0xcf, 0x81, + 0x95, 0xa7, 0x3e, 0x51, 0x5b, 0x3b, 0xf7, 0x87, + 0x13, 0xc6, 0xee, 0x50, 0x2f, 0x78, 0xdd, 0xcf, + 0x63, 0xef, 0x15, 0xb9, 0x4f, 0x21, 0x27, 0x5e, + 0x94, 0x78, 0xad, 0xcd, 0x9b, 0x3d, 0xf2, 0xdb, + 0xed, 0xf2, 0xa2, 0x39, 0xca, 0xa3, 0xa8, 0x2e, + 0x68, 0xd5, 0xc3, 0xcf, 0x71, 0xec, 0x92, 0xdc, + 0xce, 0xe7, 0x7d, 0x2b, 0xf7, 0xbc, 0xe9, 0x2b, + 0x2e, 0xae, 0xaf, 0x0b, 0x92, 0x72, 0xac, 0x6e, + 0x49, 0xe1, 0xb3, 0x1f, 0xe5, 0x43, 0x2f, 0xa7, +}; + +const struct testvec bf_cbc_128_1_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t bf_cbc_128_encblkno8_vec0_ctxt[SECSIZE] = { + 0xb8, 0x65, 0x67, 0x8e, 0xe4, 0xd8, 0xb4, 0x93, + 0xa5, 0xbb, 0x13, 0x92, 0x27, 0x4b, 0xdd, 0xeb, + 0x0d, 0xad, 0x80, 0x6a, 0x57, 0x37, 0xc0, 0x23, + 0x23, 0xbf, 0xed, 0x86, 0x0c, 0x18, 0x48, 0x19, + 0xcd, 0x84, 0x66, 0xa7, 0xd6, 0xa0, 0x44, 0xd3, + 0x05, 0x4e, 0xf4, 0xfe, 0x6a, 0x57, 0x69, 0x01, + 0xaa, 0x91, 0x9c, 0x6e, 0x4f, 0x79, 0xc9, 0x8f, + 0x4c, 0xdf, 0x5b, 0x9c, 0xc4, 0xf7, 0x63, 0x16, + 0x20, 0x09, 0x07, 0x3f, 0x5e, 0x31, 0xcc, 0x81, + 0x71, 0xe3, 0x7b, 0xb5, 0xea, 0x2c, 0xb5, 0x14, + 0x1e, 0xf9, 0x0d, 0xe0, 0x45, 0xbc, 0x9f, 0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x58, 0x6c, 0xcb, 0xe4, 0x29, 0x04, 0x69, + 0x4f, 0x45, 0xc2, 0x59, 0x98, 0x20, 0x91, 0x6e, + 0x95, 0x82, 0xb3, 0x47, 0x2c, 0xef, 0xdb, 0x96, + 0x38, 0xba, 0x01, 0x89, 0x84, 0x96, 0x71, 0xf9, + 0x2b, 0x23, 0xe0, 0x89, 0xb8, 0xb9, 0x80, 0xbf, + 0x0c, 0xdc, 0xf0, 0x5c, 0xd6, 0x4f, 0x18, 0x19, + 0xfe, 0x23, 0x5a, 0x1e, 0x20, 0x9a, 0x05, 0xf2, + 0x62, 0xd4, 0x04, 0x92, 0x24, 0xfc, 0xc0, 0x48, + 0xf0, 0x00, 0xb4, 0xbe, 0x2e, 0xea, 0x25, 0x17, + 0x5d, 0xab, 0x73, 0x26, 0x79, 0x77, 0xc5, 0x96, + 0xd3, 0xbf, 0x38, 0xda, 0x0f, 0xe1, 0x26, 0x9a, + 0x38, 0xfc, 0x43, 0x82, 0xd1, 0x4d, 0xf2, 0xae, + 0x98, 0x1e, 0xb0, 0x0d, 0xec, 0x7b, 0x56, 0x66, + 0xcb, 0x30, 0x57, 0x4f, 0xe7, 0x03, 0xe3, 0xa6, + 0x4a, 0x4a, 0xf9, 0xa3, 0xbf, 0x44, 0xac, 0x1a, + 0xe7, 0x4b, 0xc1, 0x5b, 0x03, 0x25, 0x4e, 0xc6, + 0x1f, 0x96, 0x4d, 0xf7, 0xbe, 0xa7, 0x5d, 0x60, + 0x20, 0x62, 0x10, 0xd7, 0xab, 0x64, 0xce, 0x22, + 0x8b, 0x52, 0x76, 0xa1, 0xa1, 0x8b, 0x1e, 0xb2, + 0x18, 0x29, 0x8f, 0xc5, 0x24, 0x39, 0xd4, 0xf8, + 0x75, 0x1e, 0x30, 0x57, 0x12, 0x01, 0x04, 0x78, + 0x68, 0x97, 0xa8, 0x65, 0x8c, 0xac, 0xb4, 0x3b, + 0x37, 0x45, 0x41, 0xbc, 0x7d, 0x4b, 0x09, 0xd7, + 0x46, 0x40, 0x99, 0x59, 0xa1, 0xb5, 0x9e, 0x84, + 0x24, 0x6d, 0xfb, 0x74, 0x22, 0xac, 0x4e, 0x5f, + 0x11, 0xd3, 0xa7, 0x9f, 0xa5, 0xca, 0x38, 0x54, + 0xe2, 0x65, 0x52, 0x02, 0x69, 0xe9, 0xa8, 0xf1, + 0xd7, 0x9d, 0x9a, 0x17, 0x54, 0xa0, 0xda, 0xbb, + 0x37, 0xb4, 0x0c, 0xb6, 0x00, 0xad, 0x6f, 0x88, + 0x84, 0xa7, 0x69, 0xd7, 0x0b, 0xbe, 0xb4, 0xbe, + 0x96, 0xbc, 0xcd, 0x08, 0xf1, 0x28, 0xe0, 0x6f, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t bf_cbc_128_encblkno8_vec1_ctxt[SECSIZE] = { + 0x7d, 0x95, 0x5a, 0x66, 0x23, 0x98, 0xa8, 0xbe, + 0x53, 0x63, 0x0d, 0x46, 0x4e, 0x38, 0x1b, 0x1d, + 0x36, 0xdd, 0x2a, 0x57, 0x3c, 0x17, 0x01, 0xba, + 0x4e, 0xf8, 0xaa, 0x22, 0x74, 0x05, 0xa2, 0x40, + 0xd0, 0x30, 0x61, 0x6c, 0x65, 0x5e, 0xfb, 0x21, + 0x63, 0xef, 0x62, 0x01, 0x74, 0x15, 0xf6, 0x87, + 0x92, 0xc1, 0x4e, 0x46, 0xdd, 0x76, 0xdb, 0x8b, + 0x20, 0x44, 0xc4, 0xfa, 0x7c, 0xd2, 0x07, 0x32, + 0x11, 0xeb, 0x5b, 0x38, 0x44, 0x32, 0xa1, 0xe7, + 0xcb, 0xa6, 0x1a, 0x12, 0xb9, 0x53, 0x13, 0x6f, + 0xc2, 0x0e, 0x6a, 0x77, 0x8b, 0x96, 0x14, 0x0a, + 0x23, 0x48, 0x65, 0xa5, 0xcd, 0x39, 0x38, 0x03, + 0xc8, 0x3a, 0x98, 0x69, 0x3d, 0x14, 0xae, 0xad, + 0x54, 0x57, 0xf6, 0x5a, 0xdd, 0x46, 0x4c, 0x3a, + 0x68, 0xa8, 0xb7, 0x57, 0xdd, 0x1e, 0x66, 0x0e, + 0xc2, 0x4c, 0x17, 0xba, 0xa4, 0x7e, 0x83, 0x45, + 0xc6, 0xf2, 0x34, 0x3b, 0x4e, 0xab, 0x67, 0x0c, + 0x73, 0xbf, 0x87, 0x7e, 0x93, 0x2b, 0x14, 0x33, + 0xd6, 0x24, 0x8d, 0xc7, 0x90, 0x11, 0xd2, 0x38, + 0xe6, 0xe0, 0x39, 0x1f, 0x00, 0x74, 0x40, 0xab, + 0xdc, 0xdd, 0x46, 0xe8, 0x85, 0x14, 0xb1, 0x78, + 0x34, 0x24, 0x04, 0x97, 0xde, 0xf9, 0x04, 0x69, + 0x0b, 0x15, 0x72, 0x37, 0xf4, 0x0d, 0xf4, 0x76, + 0x6f, 0xd8, 0x05, 0x75, 0x8f, 0x7e, 0x6b, 0xca, + 0x55, 0x20, 0x4a, 0x29, 0x16, 0xc1, 0x6e, 0x91, + 0x22, 0x01, 0x0d, 0x39, 0x5d, 0xb9, 0x09, 0xa4, + 0xe8, 0xc7, 0xff, 0x60, 0x39, 0xc6, 0xe4, 0x2a, + 0x1c, 0xf2, 0x3c, 0xf7, 0xf9, 0xd7, 0xde, 0x0b, + 0x0e, 0x30, 0xf1, 0x20, 0x7c, 0x93, 0x2f, 0x74, + 0x72, 0x40, 0x47, 0x2d, 0xeb, 0x8a, 0x5f, 0x69, + 0x60, 0xdf, 0xe9, 0x4d, 0x06, 0x24, 0x9c, 0x79, + 0xe7, 0x61, 0xd3, 0xa7, 0x57, 0x44, 0x49, 0x97, + 0x3a, 0xa3, 0x11, 0xc4, 0x70, 0xf4, 0x3d, 0xb5, + 0x4b, 0xb7, 0xae, 0x77, 0x36, 0xcf, 0x65, 0x3e, + 0xb6, 0x51, 0x83, 0xcb, 0x43, 0x5f, 0xd0, 0xfb, + 0x69, 0xc4, 0x1b, 0x77, 0x71, 0xcc, 0x72, 0xf4, + 0x5f, 0xc2, 0xda, 0xea, 0xa4, 0x33, 0xec, 0x8e, + 0x92, 0x22, 0x6a, 0x55, 0x34, 0x6a, 0x10, 0xb8, + 0x62, 0x66, 0xc1, 0x6f, 0x65, 0xdd, 0x9a, 0x40, + 0xa0, 0xbf, 0x88, 0xbb, 0x79, 0x1c, 0xa4, 0xaa, + 0xdf, 0xe8, 0xe7, 0x40, 0x88, 0xc6, 0x0f, 0xa2, + 0x2c, 0xee, 0xe7, 0x41, 0x32, 0x46, 0xa2, 0x46, + 0x85, 0xbf, 0x4c, 0xca, 0x4d, 0xd3, 0x9b, 0x49, + 0x43, 0x98, 0xae, 0xfc, 0x93, 0xa7, 0x94, 0x98, + 0x86, 0xa1, 0x0a, 0x85, 0x77, 0x67, 0xa6, 0x16, + 0x94, 0x76, 0xe5, 0x2f, 0x88, 0x5f, 0x24, 0x16, + 0xe5, 0x84, 0x4c, 0xd2, 0x58, 0x59, 0x82, 0x59, + 0x2c, 0xe2, 0x8d, 0xba, 0x08, 0x01, 0x67, 0x1f, + 0x2a, 0x9e, 0x4d, 0x53, 0x57, 0x2d, 0x6e, 0x35, + 0x38, 0xd5, 0x50, 0xa7, 0x0c, 0xe6, 0x77, 0x71, + 0xbe, 0x45, 0x2e, 0xf4, 0x7a, 0x3a, 0x51, 0x03, + 0x04, 0x2b, 0xd7, 0x42, 0x6c, 0x5b, 0x82, 0xba, + 0xb4, 0x09, 0xee, 0x9d, 0xea, 0x8f, 0xf0, 0xb3, + 0xb2, 0x9d, 0x0e, 0x09, 0x72, 0x8c, 0xd9, 0x1e, + 0x6d, 0x78, 0x57, 0x10, 0x1f, 0xeb, 0x4e, 0x53, + 0x57, 0x65, 0xe5, 0x43, 0xe8, 0xb4, 0xb6, 0xb8, + 0x25, 0x8a, 0xe2, 0xb3, 0x99, 0x95, 0x2c, 0xd0, + 0xc7, 0x89, 0xad, 0xdb, 0x72, 0xf0, 0x83, 0xe3, + 0x2f, 0x30, 0x33, 0xf4, 0x03, 0x14, 0x86, 0xa0, + 0xe0, 0x57, 0x15, 0x53, 0x26, 0xd0, 0x6d, 0x12, + 0x51, 0x96, 0x9b, 0x00, 0x8e, 0x41, 0xea, 0x05, + 0x75, 0x5d, 0xb3, 0x8d, 0x44, 0x7f, 0x41, 0x7f, + 0xd1, 0xed, 0x7c, 0xf7, 0xac, 0x6b, 0x21, 0xc7, + 0x0c, 0x49, 0xa1, 0x2e, 0x57, 0xa1, 0x21, 0xe2, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t bf_cbc_128_encblkno8_vec2_ctxt[SECSIZE] = { + 0x28, 0x0c, 0x49, 0x08, 0x84, 0xcb, 0xba, 0x4a, + 0xa5, 0xb6, 0x12, 0x4c, 0x14, 0x11, 0x1f, 0x88, + 0x57, 0x78, 0x1e, 0x51, 0x7c, 0x9d, 0xba, 0x31, + 0x80, 0x14, 0xeb, 0x4a, 0x98, 0x8a, 0xb5, 0x4d, + 0xc5, 0xbd, 0xd2, 0x48, 0x1e, 0x19, 0x43, 0x54, + 0x48, 0x1d, 0x24, 0x76, 0x7d, 0xd8, 0xcc, 0xe9, + 0xd9, 0x7b, 0xa9, 0xdf, 0xe3, 0x65, 0x85, 0x10, + 0xb8, 0x11, 0xce, 0xa3, 0x07, 0x4d, 0x87, 0x3f, + 0x95, 0xfb, 0xa5, 0x06, 0xa4, 0x37, 0xb0, 0x89, + 0x03, 0xa9, 0xef, 0x62, 0x98, 0xd3, 0x85, 0xe8, + 0xb3, 0x21, 0xab, 0xe9, 0xdc, 0x03, 0x2a, 0x20, + 0xf7, 0xb1, 0xa4, 0x7a, 0xd5, 0xdc, 0x61, 0x2e, + 0x15, 0x81, 0x3e, 0xcf, 0x8d, 0x8d, 0x54, 0x19, + 0x70, 0xde, 0xa9, 0x57, 0x93, 0x87, 0xc7, 0x16, + 0x06, 0x25, 0xf3, 0x93, 0x8f, 0x73, 0x92, 0x29, + 0x1e, 0xcd, 0x5a, 0x9d, 0x8f, 0x8d, 0x44, 0x15, + 0x8d, 0x92, 0x44, 0x95, 0x7a, 0x5e, 0x1b, 0xfd, + 0x31, 0xa5, 0x8c, 0x22, 0x89, 0xbb, 0x91, 0x15, + 0xad, 0x0a, 0x73, 0x94, 0x65, 0xae, 0xca, 0xfc, + 0x7e, 0xae, 0x85, 0x45, 0xe7, 0xd7, 0x8f, 0x89, + 0x8e, 0x44, 0x62, 0x7a, 0xe0, 0xee, 0x78, 0xbd, + 0x88, 0x62, 0x8e, 0xb8, 0x35, 0x7a, 0xa9, 0x12, + 0x56, 0x2d, 0xe4, 0xbb, 0x2d, 0xc8, 0x98, 0x0e, + 0x35, 0x9e, 0xea, 0x14, 0x43, 0x80, 0xde, 0x9e, + 0x2e, 0xf8, 0xf9, 0xcd, 0x61, 0xa6, 0x22, 0xc8, + 0x77, 0xfc, 0x32, 0x71, 0x4b, 0xcb, 0x00, 0x9b, + 0x9f, 0x85, 0x02, 0x92, 0xfa, 0x84, 0xd8, 0xd8, + 0x09, 0xa4, 0x08, 0xc1, 0x96, 0xd3, 0x9a, 0x27, + 0xa3, 0x82, 0x05, 0xd0, 0x78, 0x18, 0x0a, 0x7d, + 0xb6, 0x95, 0xc0, 0x27, 0x3e, 0x76, 0x77, 0xf3, + 0xd9, 0x62, 0x8e, 0x77, 0xa0, 0x1f, 0x9e, 0x41, + 0xdb, 0x24, 0xaa, 0xdd, 0x8f, 0x94, 0x7b, 0x1f, + 0xff, 0xaa, 0xfd, 0xe2, 0x19, 0xc2, 0x71, 0x80, + 0x0a, 0xda, 0xc5, 0x98, 0x57, 0xde, 0x4e, 0xfb, + 0x38, 0xe6, 0x9b, 0xe5, 0xa6, 0x1f, 0x7d, 0x2c, + 0x41, 0x5f, 0x4d, 0x13, 0xb8, 0x0c, 0xac, 0x9a, + 0x7d, 0xc0, 0x7c, 0x44, 0x64, 0x1e, 0xbc, 0x7d, + 0x16, 0xaa, 0x45, 0xda, 0x62, 0x4e, 0x64, 0x69, + 0xd6, 0x71, 0xd9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f, 0x83, + 0xd5, 0xc2, 0x7f, 0xe8, 0x5f, 0x4a, 0x36, 0x0a, + 0x6d, 0x3c, 0x91, 0x8e, 0x52, 0xf3, 0xdd, 0x62, + 0xff, 0x78, 0x87, 0xd9, 0x4c, 0xad, 0x5c, 0x9f, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t bf_cbc_128_encblkno8_vec3_ctxt[SECSIZE] = { + 0xa3, 0x9a, 0x21, 0xbd, 0x1c, 0x97, 0x4f, 0xe2, + 0x7d, 0x63, 0xfe, 0x52, 0x07, 0xac, 0x81, 0x75, + 0x15, 0x04, 0x8c, 0xc7, 0x7c, 0x11, 0x8d, 0x53, + 0x17, 0x87, 0xe8, 0x5d, 0xb1, 0xe8, 0xcb, 0x43, + 0xe2, 0x4b, 0xce, 0x9b, 0xf7, 0x51, 0x0a, 0xee, + 0x0a, 0x49, 0xae, 0x9a, 0xbd, 0x33, 0x3f, 0x0b, + 0xd4, 0xe8, 0x57, 0x77, 0xb1, 0xe1, 0xa5, 0x22, + 0x83, 0xbf, 0x7c, 0x63, 0x6c, 0x3b, 0x25, 0xde, + 0x2c, 0x6a, 0x28, 0x66, 0x0e, 0xc4, 0x8d, 0x66, + 0x66, 0xb6, 0xc6, 0xb5, 0x38, 0x40, 0x84, 0x81, + 0xec, 0x03, 0xdb, 0xbf, 0xe1, 0x8f, 0xf4, 0xb3, + 0xc4, 0x50, 0x24, 0xa2, 0x48, 0x66, 0x73, 0xed, + 0x4b, 0x00, 0x12, 0xd5, 0x15, 0x5f, 0xfb, 0xd9, + 0x6c, 0x76, 0x3b, 0xa2, 0x68, 0x41, 0xc1, 0x96, + 0x50, 0xff, 0x8a, 0x83, 0xac, 0x02, 0x42, 0xcb, + 0xed, 0x93, 0xbf, 0xd9, 0x51, 0x46, 0x50, 0xd1, + 0xeb, 0x02, 0x61, 0x64, 0xa7, 0x0e, 0x95, 0xc2, + 0x95, 0x5a, 0x93, 0xd9, 0x77, 0x17, 0xa4, 0xc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, 0xed, + 0xfc, 0x85, 0x53, 0x01, 0x87, 0xa7, 0xa0, 0x1f, +}; + +const struct testvec bf_cbc_128_8_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_128_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t bf_cbc_256_encblkno1_vec0_ctxt[SECSIZE] = { + 0x14, 0xec, 0xa9, 0xa0, 0x51, 0x9f, 0x5e, 0xb5, + 0x81, 0x6f, 0xa2, 0xbf, 0x5e, 0xf7, 0x91, 0xad, + 0xc5, 0x1a, 0x7e, 0xe6, 0x7a, 0x82, 0x4a, 0xba, + 0x54, 0x60, 0xcb, 0xc3, 0x2f, 0x69, 0x5c, 0xd9, + 0x1e, 0x58, 0xa1, 0x88, 0xa1, 0xe5, 0xa8, 0x52, + 0xdf, 0xf3, 0x8d, 0x5e, 0x2f, 0x81, 0x54, 0xab, + 0x67, 0xb5, 0x05, 0x63, 0x20, 0x10, 0x98, 0xf5, + 0xa5, 0xc3, 0x9e, 0x6d, 0x80, 0x4d, 0xb6, 0x82, + 0x80, 0x5e, 0xb3, 0xc5, 0xd8, 0x77, 0x94, 0xa0, + 0xb8, 0x67, 0xb8, 0x2d, 0x9b, 0x11, 0x3c, 0x24, + 0xbd, 0xb7, 0x0b, 0x1d, 0xeb, 0x1d, 0x6c, 0xab, + 0x3f, 0x8c, 0x91, 0xa0, 0x3a, 0xa6, 0x0c, 0x5a, + 0x88, 0xa0, 0xb5, 0xea, 0x49, 0x58, 0xfb, 0x37, + 0x7c, 0x94, 0xc4, 0x22, 0x35, 0x84, 0xda, 0xd1, + 0x1b, 0x4a, 0x42, 0xa1, 0xd4, 0x90, 0xcd, 0xfb, + 0x77, 0x29, 0xd2, 0xe3, 0x89, 0xec, 0x9e, 0x6a, + 0x4b, 0xbc, 0xc0, 0xfa, 0xb8, 0xdd, 0x5c, 0x2b, + 0xc5, 0x49, 0xb1, 0x6d, 0x6f, 0x2c, 0xb5, 0x50, + 0xd1, 0xd4, 0x9b, 0x15, 0x1c, 0xd7, 0x44, 0xf3, + 0x2e, 0x1f, 0x46, 0xee, 0x38, 0x40, 0xaa, 0x73, + 0xca, 0xf2, 0xc3, 0x83, 0xe2, 0xff, 0xd6, 0xc7, + 0x20, 0xea, 0x70, 0x95, 0x48, 0x58, 0x29, 0x6e, + 0xac, 0x10, 0x75, 0x69, 0x1d, 0xb2, 0x08, 0x3e, + 0x68, 0x43, 0xff, 0x69, 0x1e, 0x88, 0x0a, 0x34, + 0x40, 0xae, 0xb9, 0xf4, 0xb9, 0x3f, 0xa5, 0xd2, + 0xfb, 0xa0, 0xfd, 0x10, 0xa5, 0xbb, 0xd7, 0x22, + 0x8c, 0xd1, 0xf5, 0xc4, 0x11, 0xc6, 0x1e, 0xb5, + 0xfc, 0x90, 0x84, 0xa2, 0x49, 0x38, 0x64, 0x92, + 0x6e, 0xf2, 0xaa, 0xed, 0xe8, 0x9d, 0xac, 0x86, + 0xb7, 0xb3, 0xd9, 0x98, 0x11, 0x8f, 0x51, 0x33, + 0x84, 0x06, 0x40, 0x26, 0x3f, 0xe1, 0xb3, 0x4a, + 0x76, 0x53, 0x68, 0x8b, 0xfe, 0x6f, 0xcd, 0x66, + 0x92, 0x24, 0x42, 0xf4, 0x11, 0x02, 0x01, 0x00, + 0xaa, 0x15, 0x35, 0x42, 0xab, 0x6f, 0x2b, 0x3b, + 0x9a, 0x23, 0x73, 0x18, 0xa8, 0x9b, 0x43, 0x4b, + 0xfb, 0xef, 0x07, 0x75, 0xd7, 0xd6, 0x08, 0x94, + 0xe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 0x55, 0x12, 0xbf, + 0xe1, 0xd2, 0x7c, 0x51, 0x65, 0x8c, 0xc3, 0x8a, + 0x73, 0x2f, 0x1c, 0xd8, 0x13, 0x4a, 0xd1, 0x78, + 0xb2, 0xc8, 0x19, 0x09, 0xce, 0x7b, 0xb6, 0x77, + 0xcc, 0xc3, 0xe6, 0xee, 0x3a, 0x82, 0xf9, 0xc6, + 0x5a, 0x36, 0x46, 0xc0, 0x25, 0xee, 0xaf, 0x78, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t bf_cbc_256_encblkno1_vec1_ctxt[SECSIZE] = { + 0x0b, 0xb6, 0x26, 0x92, 0x1d, 0x74, 0xc2, 0x10, + 0xb5, 0x99, 0x5f, 0x62, 0x7f, 0x3b, 0x49, 0x10, + 0xc1, 0x20, 0x9f, 0x38, 0x25, 0x0f, 0x59, 0xde, + 0xe4, 0xc8, 0xb5, 0x27, 0xb1, 0xec, 0x96, 0x40, + 0xe8, 0x05, 0x15, 0x40, 0x96, 0xe0, 0xff, 0xaf, + 0x53, 0x73, 0xa1, 0xa6, 0x73, 0x03, 0xcf, 0x1f, + 0x87, 0x48, 0x7d, 0x81, 0x0e, 0x35, 0x23, 0x7b, + 0xde, 0x12, 0xd8, 0xcd, 0x0a, 0xcb, 0x03, 0xc5, + 0x07, 0xf7, 0x7a, 0x04, 0xf3, 0xda, 0x7d, 0x3b, + 0x73, 0xc6, 0x31, 0xbc, 0x24, 0xde, 0x23, 0x05, + 0x3a, 0xdc, 0xe2, 0x96, 0x85, 0x06, 0xeb, 0x89, + 0xb0, 0x49, 0x3c, 0x79, 0x8e, 0xcf, 0x49, 0x0e, + 0x34, 0x04, 0xa5, 0xcf, 0x45, 0x56, 0xb6, 0xc2, + 0xf1, 0xf1, 0xab, 0x7c, 0x8a, 0xfc, 0xeb, 0xa0, + 0x8a, 0xe6, 0x73, 0xb4, 0xc3, 0x0c, 0x03, 0x5f, + 0x03, 0x53, 0x6f, 0x69, 0xa2, 0xd0, 0xa7, 0x48, + 0xc4, 0x11, 0x88, 0x75, 0xe1, 0xf3, 0xd0, 0x72, + 0x98, 0x6f, 0x84, 0xa6, 0xa8, 0x35, 0xbb, 0xac, + 0x4d, 0xac, 0x55, 0x88, 0x85, 0x86, 0x5a, 0xd9, + 0xb6, 0x57, 0xf9, 0x40, 0xf6, 0x7f, 0x1b, 0x4e, + 0x87, 0xc0, 0x56, 0x8a, 0x2f, 0x3a, 0xe5, 0xa6, + 0x67, 0x68, 0x21, 0x2b, 0xea, 0xfa, 0xee, 0x47, + 0xa0, 0x34, 0x56, 0x7d, 0xa0, 0x3d, 0x58, 0xd7, + 0xff, 0xa2, 0xb6, 0x03, 0x52, 0x16, 0xa5, 0x15, + 0x65, 0xdb, 0xe1, 0x1b, 0xdf, 0x69, 0xb1, 0x48, + 0x6a, 0xdf, 0xc1, 0x00, 0x07, 0xdc, 0x46, 0x4b, + 0x59, 0xcf, 0x15, 0x6b, 0xee, 0x4f, 0x72, 0x77, + 0x6e, 0xbf, 0x47, 0x0e, 0x84, 0x0b, 0xb1, 0xac, + 0x85, 0xce, 0x2b, 0x47, 0x7a, 0xcc, 0x30, 0x0c, + 0x2f, 0x10, 0x27, 0xaa, 0x83, 0x3f, 0x17, 0x39, + 0x84, 0x45, 0x8c, 0xb7, 0x31, 0xb3, 0x7c, 0xcd, + 0xed, 0x86, 0x7d, 0xa9, 0x06, 0x25, 0x1f, 0xe3, + 0x9a, 0x9b, 0x92, 0xdd, 0x07, 0x63, 0x3b, 0x51, + 0x32, 0x2e, 0xae, 0xdf, 0xad, 0xd4, 0x54, 0x5d, + 0x71, 0x36, 0xe9, 0xda, 0x70, 0xe9, 0xec, 0x75, + 0x0b, 0xbb, 0xcc, 0x5d, 0xc5, 0x45, 0x8e, 0x56, + 0x12, 0x87, 0x95, 0x0f, 0x0f, 0x5b, 0x22, 0xc2, + 0xe9, 0x71, 0xf2, 0x7e, 0x7b, 0xc2, 0xce, 0x1f, + 0xb4, 0x43, 0xa5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0x50, + 0xe8, 0x9e, 0xc2, 0x51, 0x4f, 0x03, 0xcd, 0x9f, + 0x36, 0x27, 0xca, 0xa2, 0x98, 0x87, 0x5a, 0xae, + 0xd8, 0x87, 0x76, 0xb6, 0xb6, 0x19, 0x7d, 0x75, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t bf_cbc_256_encblkno1_vec2_ctxt[SECSIZE] = { + 0x91, 0x45, 0x4e, 0xe8, 0xad, 0xe3, 0x95, 0x0f, + 0x40, 0x35, 0x21, 0x21, 0x77, 0x62, 0x1d, 0x65, + 0xe4, 0x93, 0x11, 0xd2, 0x20, 0xa4, 0xe4, 0x53, + 0x44, 0xff, 0x60, 0xe9, 0x34, 0xb2, 0x33, 0x87, + 0x3d, 0xb0, 0xd8, 0x37, 0x7e, 0x0e, 0x9a, 0x53, + 0x92, 0xeb, 0xee, 0x16, 0x41, 0x25, 0xe3, 0x80, + 0x0c, 0x53, 0xd8, 0x1f, 0xf0, 0x99, 0xcb, 0x31, + 0xd1, 0x00, 0x82, 0x03, 0xcc, 0xa9, 0x5c, 0x8d, + 0x1a, 0xbb, 0x03, 0x81, 0x80, 0x0d, 0x5d, 0x4a, + 0x96, 0x74, 0x79, 0xf4, 0xa7, 0x46, 0x97, 0x42, + 0x5e, 0xb6, 0x8d, 0xc1, 0x95, 0x1d, 0x98, 0x4d, + 0xe5, 0xe9, 0x70, 0x1a, 0x5a, 0xad, 0xf4, 0x3d, + 0xe1, 0xa7, 0x25, 0xc7, 0xfa, 0x0a, 0x75, 0x98, + 0x2f, 0xef, 0x16, 0x2e, 0xf2, 0x02, 0x8a, 0x4c, + 0x1f, 0x5a, 0xbb, 0x06, 0x1b, 0x4e, 0x50, 0xfb, + 0x03, 0xed, 0x2a, 0x53, 0xdc, 0x2a, 0x65, 0xad, + 0x57, 0x84, 0x48, 0xdb, 0xd2, 0x9b, 0xc0, 0x01, + 0x5f, 0x7d, 0x3e, 0x84, 0xe5, 0x15, 0x7d, 0xc5, + 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07, 0xde, 0x46, 0x28, 0xc1, + 0x2c, 0x15, 0xa2, 0x34, 0xea, 0xe7, 0xc3, 0x36, + 0xe6, 0x18, 0x20, 0x4e, 0x20, 0x3f, 0x32, 0xa8, + 0x29, 0x05, 0xf6, 0xa5, 0xf2, 0xa3, 0xeb, 0x7a, + 0x25, 0x5e, 0x14, 0x1f, 0xd0, 0xe1, 0x8e, 0xfb, + 0x28, 0xc5, 0xa2, 0x42, 0xed, 0x4c, 0x12, 0x15, + 0x2a, 0x08, 0xfb, 0x0b, 0xfb, 0x94, 0x64, 0xc0, + 0x8b, 0xbb, 0xbb, 0x2c, 0xef, 0xab, 0x0b, 0x4c, + 0x27, 0x40, 0x94, 0x3e, 0x93, 0x77, 0x98, 0xcc, + 0x64, 0xe3, 0xba, 0x22, 0x95, 0xd7, 0xc1, 0xe3, + 0xa7, 0xcd, 0xf9, 0x25, 0xdc, 0xc4, 0xd2, 0xee, + 0x5b, 0x53, 0x72, 0x59, 0x8b, 0xea, 0xbf, 0xde, + 0x2b, 0x35, 0xd5, 0x27, 0x57, 0x2e, 0x13, 0xa7, + 0x50, 0x2d, 0xa5, 0xd5, 0x43, 0x0b, 0x49, 0x87, + 0xd0, 0xbd, 0xdd, 0xec, 0x4b, 0xd1, 0x8b, 0xf6, + 0xf6, 0xd0, 0x97, 0xcb, 0x8d, 0x58, 0x35, 0x27, + 0xa5, 0x7e, 0x4a, 0xda, 0x93, 0xa4, 0x1e, 0x39, + 0x53, 0x59, 0x87, 0xfe, 0x82, 0x09, 0xda, 0x03, + 0x33, 0xcf, 0x94, 0x60, 0xb1, 0x0c, 0xa1, 0x0e, + 0xd6, 0xaa, 0xb0, 0x09, 0x96, 0x8b, 0x72, 0x15, + 0xfb, 0xb0, 0x7d, 0x06, 0xf5, 0x2d, 0x64, 0xcd, + 0x03, 0xf0, 0xfa, 0xed, 0x6f, 0x43, 0xe3, 0xf3, + 0x33, 0xaf, 0x65, 0x82, 0x1d, 0xad, 0x03, 0x62, + 0xbe, 0x12, 0x14, 0x85, 0x66, 0x45, 0x03, 0x79, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t bf_cbc_256_encblkno1_vec3_ctxt[SECSIZE] = { + 0x65, 0xbb, 0x30, 0x13, 0x9a, 0x26, 0xe9, 0x3d, + 0x54, 0x28, 0x77, 0xf1, 0x3f, 0x9b, 0xe1, 0x3e, + 0x70, 0x90, 0x6f, 0x16, 0xfc, 0x2f, 0x27, 0xb3, + 0xc6, 0x3c, 0x38, 0x31, 0x11, 0xe1, 0x3b, 0x72, + 0x22, 0x1c, 0x01, 0xc5, 0xa6, 0x70, 0x16, 0x4d, + 0xd2, 0xbd, 0xcb, 0x15, 0x00, 0x22, 0xab, 0x65, + 0x6a, 0x96, 0x5e, 0x45, 0x7f, 0xfd, 0x76, 0x18, + 0x43, 0x25, 0x75, 0x73, 0xa4, 0x24, 0xe4, 0x5b, + 0xca, 0xf7, 0x6f, 0xfe, 0xc6, 0x4c, 0x81, 0x77, + 0xe5, 0x1b, 0xb4, 0x7b, 0x64, 0xc2, 0x0d, 0x2b, + 0xa9, 0x76, 0xae, 0x5d, 0xab, 0x81, 0x77, 0xa6, + 0x48, 0xe9, 0x0c, 0x6d, 0x93, 0xbd, 0x7e, 0xdc, + 0x39, 0x89, 0x72, 0xd2, 0x07, 0x87, 0x44, 0xa6, + 0x7d, 0x08, 0x54, 0xc6, 0x90, 0x1d, 0xa2, 0xd7, + 0xfd, 0xd5, 0x59, 0x67, 0xd9, 0x5f, 0x5c, 0xbc, + 0x60, 0xc7, 0xf6, 0x98, 0xad, 0x21, 0xdf, 0xde, + 0x27, 0xca, 0x73, 0x2f, 0x56, 0xb7, 0xd7, 0x54, + 0x6e, 0xc3, 0x09, 0x6f, 0x1b, 0x82, 0x6f, 0xf8, + 0x1b, 0xb2, 0x54, 0x47, 0x54, 0x55, 0x67, 0x1c, + 0x4a, 0x10, 0x44, 0xb8, 0x8e, 0x85, 0x71, 0x70, + 0x02, 0x49, 0x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, 0x3b, + 0x88, 0x9a, 0x33, 0x5d, 0x68, 0x82, 0x29, 0x53, + 0x94, 0x18, 0x0d, 0x14, 0x9e, 0x5f, 0xc1, 0x32, + 0x0a, 0x95, 0x6e, 0xa3, 0x82, 0x4b, 0x58, 0x0f, + 0x9c, 0xf0, 0x26, 0x4b, 0x2f, 0x02, 0x60, 0x85, + 0xdd, 0x2c, 0xb8, 0x87, 0x8b, 0x14, 0x9c, 0x54, + 0x0a, 0x5a, 0x02, 0xbe, 0xe2, 0x71, 0xcc, 0x07, + 0xae, 0x67, 0x00, 0xa8, 0xd4, 0x09, 0x7c, 0xee, + 0x0d, 0x29, 0x17, 0x67, 0x96, 0x68, 0x41, 0xfa, + 0x72, 0x29, 0x98, 0x2b, 0x23, 0xd1, 0xa9, 0x89, + 0x1c, 0xcc, 0xaf, 0x88, 0xdb, 0xb5, 0x1e, 0xb1, + 0xae, 0x17, 0x5f, 0x29, 0x8d, 0x1c, 0x0a, 0x5c, + 0xb9, 0xa7, 0x59, 0x8b, 0x91, 0x41, 0xee, 0x89, + 0xe1, 0x0e, 0x7e, 0x0a, 0xee, 0xbc, 0x35, 0xab, + 0xf1, 0x5a, 0x58, 0x03, 0xa2, 0xcf, 0x33, 0xa3, + 0x74, 0x82, 0xd3, 0xa0, 0x32, 0xfc, 0x3b, 0x9c, + 0xdf, 0xc0, 0x3a, 0x76, 0xe1, 0xea, 0xf0, 0x6d, + 0xc8, 0xe7, 0x97, 0xec, 0x03, 0xc1, 0x72, 0x94, + 0xe5, 0xc4, 0x04, 0x2a, 0x38, 0xb4, 0xef, 0x47, + 0x1d, 0xf9, 0xb8, 0x0a, 0xa9, 0x45, 0xc1, 0x63, + 0xf8, 0x32, 0xdb, 0x5d, 0xb1, 0xa2, 0x80, 0x8c, + 0x23, 0xd3, 0x60, 0xfb, 0xf8, 0x84, 0x57, 0x8b, +}; + +const struct testvec bf_cbc_256_1_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t bf_cbc_256_encblkno8_vec0_ctxt[SECSIZE] = { + 0x90, 0x3d, 0xd2, 0xc0, 0xd3, 0x75, 0xe8, 0x04, + 0x34, 0x66, 0x76, 0x25, 0x70, 0xde, 0x41, 0xf1, + 0x35, 0x63, 0x5c, 0xac, 0x8f, 0x28, 0x17, 0xd3, + 0xae, 0x43, 0xfd, 0x8a, 0xb8, 0xc2, 0xd3, 0x88, + 0xef, 0xfa, 0x21, 0xeb, 0xb4, 0x33, 0x75, 0x69, + 0x7d, 0xe9, 0x27, 0x1c, 0x03, 0xcf, 0x90, 0xcf, + 0xf0, 0xaa, 0x3e, 0x01, 0x41, 0x24, 0xdc, 0x01, + 0x5a, 0xe8, 0x92, 0xea, 0xde, 0x87, 0xbf, 0x75, + 0xe4, 0x0b, 0xf7, 0xa3, 0x42, 0x27, 0xc4, 0xde, + 0x01, 0x6f, 0x5c, 0xec, 0x6d, 0x37, 0x38, 0xd7, + 0x4f, 0x85, 0xc0, 0xc2, 0x3a, 0xa7, 0x2d, 0x15, + 0xd5, 0x1c, 0xee, 0x15, 0x13, 0x7a, 0x4e, 0x33, + 0xc7, 0x59, 0x93, 0x73, 0xe9, 0xf5, 0x39, 0xb0, + 0xad, 0x8b, 0x61, 0xca, 0x4d, 0x31, 0xaa, 0x44, + 0xf6, 0x5c, 0xb7, 0x99, 0xe5, 0x92, 0x3d, 0x47, + 0x79, 0x9b, 0x29, 0x16, 0xe1, 0x2c, 0x30, 0x8b, + 0x1e, 0x17, 0xf0, 0x91, 0x59, 0x00, 0xab, 0x6d, + 0x4d, 0xa7, 0x4d, 0x96, 0xc3, 0xe4, 0x3d, 0x17, + 0x5c, 0x8e, 0xfc, 0x59, 0x48, 0xd4, 0xdd, 0xf4, + 0xea, 0x3a, 0x68, 0xc8, 0xb1, 0x74, 0x69, 0xcb, + 0x49, 0x1a, 0xec, 0x24, 0x4e, 0x7e, 0xe9, 0xba, + 0x75, 0xfb, 0x52, 0x85, 0x75, 0xe9, 0x41, 0x9a, + 0xc6, 0x40, 0x9c, 0x92, 0x3f, 0xe8, 0x99, 0x81, + 0x84, 0x14, 0x2b, 0x62, 0x94, 0xba, 0x56, 0x00, + 0xde, 0x88, 0xe1, 0x35, 0xea, 0x25, 0x88, 0xd1, + 0xce, 0xd4, 0xfc, 0xde, 0xee, 0x1a, 0xfd, 0xb1, + 0xa7, 0x46, 0x9d, 0x0c, 0x99, 0xa6, 0xab, 0x23, + 0x55, 0x2f, 0x46, 0xd7, 0xb3, 0xcd, 0x2c, 0xab, + 0x93, 0x3e, 0xdb, 0xe2, 0x34, 0x69, 0x1a, 0x56, + 0x21, 0x92, 0x56, 0xf4, 0x05, 0xe1, 0x24, 0xee, + 0x4d, 0x5e, 0x89, 0xeb, 0x23, 0x26, 0xdc, 0x14, + 0xde, 0x56, 0x3f, 0x0c, 0x15, 0x3e, 0x42, 0x71, + 0x9b, 0xe8, 0xc5, 0xfd, 0x5e, 0x4a, 0xb6, 0xd9, + 0xa0, 0x18, 0x5d, 0xbd, 0xef, 0x80, 0xb4, 0xf6, + 0x1e, 0x56, 0x2a, 0x57, 0x13, 0xba, 0x24, 0xa4, + 0x6f, 0x4c, 0xd4, 0xaa, 0x31, 0x5e, 0x69, 0x26, + 0xd2, 0xee, 0xef, 0x7f, 0x83, 0x9c, 0x8e, 0x6a, + 0x17, 0xe3, 0xda, 0xf4, 0x59, 0xad, 0x26, 0x83, + 0x53, 0x4c, 0x0d, 0x62, 0xe5, 0x9a, 0x30, 0xc5, + 0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 0xbc, 0xa8, 0x2f, 0xd6, + 0xc1, 0x5f, 0xa4, 0x57, 0x62, 0x83, 0x82, 0x8e, + 0x1e, 0xbb, 0x85, 0xf7, 0x1b, 0x2e, 0xe2, 0xb0, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t bf_cbc_256_encblkno8_vec1_ctxt[SECSIZE] = { + 0x2b, 0xf6, 0xd4, 0x61, 0x3b, 0x1f, 0x5b, 0xe9, + 0x32, 0xab, 0x27, 0xa1, 0xaf, 0x5e, 0xf4, 0xa7, + 0xaa, 0xc5, 0x2a, 0x3c, 0x0d, 0x34, 0xd8, 0xb3, + 0xfd, 0xb2, 0xca, 0xfb, 0x3c, 0x38, 0x96, 0x71, + 0x47, 0xaa, 0xa7, 0x2f, 0x48, 0x2c, 0x39, 0x88, + 0x2d, 0xc6, 0xb1, 0xf7, 0xc7, 0x2d, 0xda, 0xe9, + 0xfb, 0x4f, 0x9b, 0x1f, 0xe1, 0x0c, 0x24, 0x89, + 0xfe, 0x70, 0xe0, 0xb2, 0x51, 0x89, 0x51, 0xa9, + 0xae, 0xd1, 0x92, 0x4f, 0x56, 0x5c, 0x2a, 0xf4, + 0xbc, 0x4e, 0x77, 0x4a, 0xb8, 0xab, 0x02, 0x76, + 0xef, 0x69, 0xfb, 0x5e, 0x06, 0xb5, 0xff, 0x31, + 0xce, 0x2b, 0xfc, 0x48, 0x4c, 0x82, 0xe9, 0x3c, + 0x61, 0x69, 0x68, 0x1d, 0xb1, 0xc6, 0x40, 0x10, + 0xd7, 0x0e, 0xd2, 0x26, 0x33, 0x5b, 0x0b, 0xe7, + 0xc2, 0xbe, 0xf4, 0x24, 0x1a, 0xa6, 0x70, 0x31, + 0xa7, 0x15, 0x76, 0xc7, 0x90, 0x8d, 0x60, 0xe0, + 0xee, 0x5b, 0x73, 0xa9, 0xe1, 0xe1, 0xaf, 0xf0, + 0x5e, 0x6f, 0x32, 0x98, 0x92, 0xbe, 0x24, 0x81, + 0x26, 0x9f, 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0x70, 0xe6, 0x8f, 0x35, 0x96, 0xe0, 0x11, 0x00, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t bf_cbc_256_encblkno8_vec2_ctxt[SECSIZE] = { + 0x28, 0x93, 0x0f, 0x23, 0xfb, 0xa4, 0x9e, 0xe5, + 0x11, 0x38, 0x2b, 0xbd, 0x8d, 0x2d, 0xdb, 0x11, + 0xfa, 0xac, 0x74, 0x28, 0x95, 0x29, 0xf2, 0x92, + 0x8d, 0x00, 0x8a, 0x8a, 0x04, 0x92, 0x92, 0x33, + 0x8c, 0x4b, 0x29, 0x8e, 0xde, 0x59, 0xf4, 0x72, + 0xae, 0x2f, 0xe4, 0xe9, 0xd4, 0xe4, 0xb6, 0x69, + 0xc5, 0x1b, 0xbe, 0x02, 0x85, 0x4b, 0x24, 0x1e, + 0x79, 0xb9, 0x22, 0x29, 0x4c, 0x60, 0x8c, 0xc5, + 0x03, 0x1d, 0x79, 0xfe, 0x3d, 0x9e, 0x47, 0xb6, + 0xf7, 0x17, 0x65, 0x24, 0x15, 0x5d, 0x75, 0x4d, + 0xdb, 0xbc, 0x68, 0x67, 0x3b, 0xc3, 0x5a, 0x7e, + 0x9d, 0x98, 0x67, 0xe4, 0x8f, 0x9a, 0xd1, 0x31, + 0xe0, 0x26, 0xa1, 0x68, 0xbe, 0x53, 0x73, 0x7c, + 0xfd, 0xce, 0x6c, 0xd6, 0x1f, 0x51, 0xe6, 0x84, + 0x54, 0x7a, 0xe3, 0x7f, 0x7c, 0x8f, 0x2f, 0x88, + 0x58, 0xfe, 0x5e, 0x82, 0x11, 0xc9, 0xa5, 0x89, + 0xa4, 0x49, 0x92, 0x21, 0x0f, 0x03, 0xdb, 0x16, + 0xc4, 0xc0, 0x80, 0xb7, 0x16, 0x4c, 0x29, 0xbe, + 0x18, 0xfa, 0x2d, 0xdf, 0x4a, 0x23, 0x34, 0x9a, + 0x27, 0xea, 0xed, 0x95, 0x25, 0x14, 0xa8, 0x2e, + 0x17, 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49, 0x4a, 0xfe, 0x8f, + 0xaa, 0x57, 0x3a, 0x0c, 0x59, 0x69, 0xe7, 0xb8, + 0xfc, 0x71, 0x5c, 0x4f, 0x18, 0x12, 0xe5, 0xef, + 0xdb, 0x1f, 0x66, 0x9a, 0xe2, 0x1a, 0x92, 0x1f, + 0xfe, 0x20, 0x81, 0xe5, 0x83, 0x97, 0xfb, 0xaf, + 0xeb, 0x31, 0x6c, 0x81, 0xf2, 0x2f, 0xf4, 0x41, + 0xf1, 0xd9, 0x61, 0xfb, 0x36, 0x4e, 0xab, 0xc5, + 0x8b, 0x9c, 0x37, 0xea, 0x88, 0xeb, 0x1e, 0x4c, + 0x84, 0x1a, 0xac, 0x4c, 0x19, 0x39, 0x51, 0x53, + 0xe0, 0x50, 0xb0, 0xdf, 0xe6, 0xc5, 0xbb, 0x80, + 0x06, 0x30, 0x14, 0xf5, 0x0e, 0x73, 0xd2, 0xdb, + 0x19, 0x45, 0x30, 0xdc, 0xd0, 0x4d, 0xe6, 0xd6, + 0x0e, 0x2d, 0x77, 0xa3, 0xb3, 0x27, 0xda, 0x99, + 0x62, 0x88, 0x35, 0xba, 0x64, 0x15, 0xec, 0xaf, + 0x70, 0x97, 0x94, 0x81, 0x30, 0x6d, 0x63, 0x42, + 0x71, 0x3e, 0x06, 0xec, 0x50, 0x96, 0x87, 0x59, + 0xe7, 0x26, 0x9c, 0xcf, 0xc7, 0xe7, 0x62, 0x82, + 0x3b, 0xd7, 0xfe, 0xb4, 0x48, 0x45, 0x9d, 0x54, + 0x18, 0x15, 0x13, 0x74, 0x92, 0x6f, 0x43, 0xb3, + 0xa9, 0x82, 0xd4, 0xc2, 0xef, 0x61, 0x9d, 0x5e, + 0x1d, 0xc6, 0x80, 0xd3, 0xe9, 0xdd, 0x52, 0x9c, + 0x4d, 0x04, 0x05, 0xa0, 0x43, 0x36, 0xb6, 0x89, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t bf_cbc_256_encblkno8_vec3_ctxt[SECSIZE] = { + 0x60, 0x91, 0x19, 0x89, 0xee, 0xac, 0x12, 0xe5, + 0x60, 0x6c, 0xfd, 0xf9, 0xe4, 0xc6, 0xc9, 0xbd, + 0x75, 0xe1, 0xa5, 0xe6, 0xf4, 0xed, 0x4b, 0xf4, + 0x16, 0xf4, 0x57, 0xa4, 0xe6, 0x60, 0x8e, 0x1b, + 0x97, 0x0e, 0xd5, 0x09, 0xa1, 0x3c, 0x6c, 0xe8, + 0x91, 0xaf, 0x19, 0x96, 0x2a, 0x7b, 0x77, 0x30, + 0xc7, 0x99, 0xe6, 0xaa, 0xb0, 0xe2, 0x29, 0x1c, + 0x39, 0x54, 0x1c, 0x0a, 0x4a, 0x51, 0xa2, 0xa2, + 0x22, 0x96, 0x05, 0x8b, 0x12, 0x80, 0x16, 0x28, + 0xdc, 0xfa, 0x22, 0x90, 0xa4, 0x33, 0xb1, 0x84, + 0x13, 0x52, 0x5d, 0xb5, 0xd4, 0xe8, 0x60, 0x18, + 0x6a, 0xb8, 0x1b, 0xdb, 0xb4, 0x69, 0xf6, 0x09, + 0x95, 0x71, 0xdd, 0x43, 0x21, 0xad, 0x7e, 0xf7, + 0x8e, 0x7a, 0x0d, 0xf0, 0x52, 0x54, 0xb8, 0xdc, + 0x7d, 0x72, 0x29, 0x97, 0x2b, 0x9c, 0x2c, 0xef, + 0xc3, 0x26, 0x68, 0x72, 0xae, 0x29, 0x0f, 0x67, + 0xbf, 0xea, 0x92, 0x27, 0xd1, 0xba, 0x8d, 0x32, + 0x8b, 0x26, 0x91, 0x30, 0x88, 0xcc, 0x47, 0xaf, + 0x54, 0x8c, 0x88, 0x88, 0x2f, 0x59, 0x76, 0x34, + 0x43, 0x35, 0x44, 0xc3, 0x16, 0x28, 0x62, 0x4b, + 0xbb, 0x47, 0x99, 0x7c, 0x26, 0x51, 0xe2, 0x7d, + 0xd8, 0x2c, 0x35, 0xf4, 0x24, 0xf1, 0x5b, 0x01, + 0xcc, 0x9a, 0x54, 0xd8, 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, + 0x92, 0x2b, 0x23, 0xc6, 0x59, 0x19, 0xda, 0x9a, + 0x01, 0x9c, 0x5c, 0xc1, 0xaa, 0xcf, 0x6d, 0xd0, + 0xa5, 0x06, 0xc7, 0x5e, 0x6b, 0x60, 0x64, 0x9f, + 0xfe, 0xa8, 0x3f, 0x64, 0xa8, 0xed, 0xf8, 0x62, + 0xd7, 0x6d, 0x34, 0x41, 0x3e, 0x5e, 0x74, 0xc7, + 0xe6, 0x62, 0xb1, 0x5a, 0xec, 0x6a, 0xc1, 0x71, + 0x19, 0xf3, 0xf1, 0xe7, 0x46, 0x13, 0xd6, 0xb6, + 0x5a, 0xf4, 0xca, 0x3f, 0xe3, 0xa1, 0x1f, 0xe4, + 0xda, 0xd6, 0x0c, 0x62, 0x6a, 0x33, 0x42, 0x99, + 0x6f, 0x5d, 0x3a, 0xe0, 0xe7, 0xfa, 0x2d, 0x47, + 0x4a, 0xec, 0xaa, 0x71, 0xb5, 0xeb, 0x62, 0xb8, + 0x31, 0x34, 0x07, 0x44, 0xa2, 0x18, 0xec, 0x76, + 0xf7, 0x77, 0x56, 0x86, 0xc7, 0xe0, 0x1e, 0x8e, + 0xec, 0x16, 0x2b, 0xeb, 0xff, 0xaa, 0xba, 0x83, + 0x1f, 0xdc, 0x32, 0x23, 0x27, 0xea, 0xea, 0x0c, + 0x3a, 0x5f, 0x2b, 0xb4, 0xee, 0x0c, 0xf2, 0x73, + 0xbb, 0x59, 0x9b, 0x73, 0xf7, 0xfa, 0xe1, 0x1f, + 0x3b, 0xdb, 0x40, 0x29, 0xf0, 0x6c, 0xbe, 0x8f, + 0x2e, 0xd0, 0x83, 0xf7, 0xe8, 0x2a, 0x81, 0x82, +}; + +const struct testvec bf_cbc_256_8_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_256_encblkno8_vec3_ctxt, + }, +}; + +/* + * IV method encblkno1, blkno 0. + */ +static const uint8_t bf_cbc_448_encblkno1_vec0_ctxt[SECSIZE] = { + 0xb0, 0x1b, 0x43, 0xc9, 0x84, 0x53, 0x51, 0x72, + 0x1f, 0x93, 0x62, 0x94, 0x13, 0x1f, 0xe3, 0xc1, + 0x30, 0xee, 0xc4, 0x35, 0x98, 0xb8, 0x11, 0x9b, + 0xd1, 0x23, 0xfa, 0x2d, 0xc1, 0xe6, 0xf3, 0x8f, + 0x8b, 0x05, 0x8d, 0xc5, 0x1d, 0xc3, 0x29, 0x1a, + 0xff, 0x08, 0xb0, 0x97, 0x88, 0x50, 0x8f, 0x41, + 0x66, 0xc6, 0x70, 0x37, 0xca, 0xb2, 0xcd, 0x91, + 0x89, 0x41, 0x1b, 0x42, 0xce, 0x02, 0xec, 0xe8, + 0x9b, 0xf3, 0x50, 0x95, 0x5f, 0xba, 0xda, 0xd5, + 0x0c, 0x2f, 0x29, 0x2a, 0x14, 0x96, 0x4a, 0x60, + 0x04, 0x43, 0x62, 0x80, 0x89, 0xcf, 0xfd, 0xb6, + 0xc7, 0x2d, 0xb2, 0xac, 0xce, 0x51, 0xf5, 0xd1, + 0xcd, 0x41, 0x59, 0x8b, 0xf5, 0x02, 0x2d, 0xe8, + 0xc4, 0xee, 0xe9, 0x40, 0x6f, 0xcd, 0xbe, 0x3b, + 0xd0, 0x8d, 0x3e, 0x6c, 0x42, 0x2a, 0x17, 0xfd, + 0x78, 0xf6, 0xb2, 0xde, 0x69, 0x81, 0xbb, 0xae, + 0xd9, 0x1f, 0x49, 0xa6, 0x4c, 0x5a, 0xe9, 0x94, + 0x49, 0x9b, 0x7e, 0x32, 0x6d, 0x11, 0xea, 0x88, + 0xda, 0xf0, 0xc7, 0x8d, 0x07, 0x98, 0xab, 0xc7, + 0xf3, 0xcf, 0x2e, 0xda, 0x27, 0x44, 0x68, 0xc7, + 0xdc, 0xda, 0x00, 0xd0, 0x6d, 0x64, 0x5b, 0x39, + 0x46, 0x3d, 0x98, 0x24, 0xee, 0x3b, 0x36, 0x23, + 0x62, 0xf6, 0x8e, 0xb9, 0x8d, 0xc1, 0x9a, 0x7b, + 0xd7, 0x03, 0x6b, 0xb7, 0x81, 0x19, 0xec, 0x2f, + 0x0c, 0x0b, 0x32, 0x5a, 0xb3, 0x25, 0xf5, 0xcc, + 0xa3, 0x60, 0xe6, 0x4e, 0x03, 0xcd, 0xdc, 0x67, + 0xe5, 0x26, 0xda, 0xe0, 0x1f, 0x33, 0x99, 0xc3, + 0x43, 0x8c, 0x9c, 0x1a, 0x85, 0xb1, 0x15, 0x04, + 0xc1, 0x06, 0xd1, 0x2d, 0xc9, 0x67, 0x72, 0xe7, + 0xd6, 0x6d, 0x1f, 0x22, 0x56, 0x56, 0xfa, 0x8a, + 0xd7, 0x16, 0x37, 0x3f, 0x3e, 0x67, 0xa5, 0xb7, + 0xee, 0x3e, 0xd2, 0x38, 0xd5, 0xce, 0xa9, 0x62, + 0x82, 0x17, 0xae, 0xae, 0x62, 0xe6, 0xb7, 0xf2, + 0x73, 0xf1, 0xc1, 0xb7, 0xe9, 0x62, 0x79, 0x3b, + 0x3b, 0x3f, 0xaa, 0x0d, 0x42, 0x03, 0x35, 0x3f, + 0x5d, 0xa4, 0xba, 0x02, 0x23, 0x65, 0x40, 0x0e, + 0x61, 0x31, 0xc9, 0xd5, 0x79, 0x36, 0x76, 0x7c, + 0x21, 0x4a, 0x75, 0xb2, 0xa0, 0x2b, 0xc1, 0xb8, + 0xba, 0xf8, 0x10, 0x7a, 0x85, 0x32, 0x81, 0xbf, + 0x2d, 0x58, 0x3c, 0x22, 0x2f, 0x0b, 0xce, 0x03, + 0x12, 0xce, 0x13, 0xce, 0x4a, 0x81, 0x77, 0x1d, + 0x68, 0x99, 0xc0, 0x25, 0xeb, 0xd9, 0x80, 0x0d, + 0xe7, 0x17, 0xc8, 0x41, 0xbd, 0x4b, 0x9c, 0xdd, + 0x41, 0x74, 0x90, 0x2a, 0x65, 0x92, 0x05, 0xff, + 0x06, 0x24, 0xeb, 0x89, 0xd8, 0x41, 0xaa, 0x41, + 0xac, 0x8a, 0x31, 0xc6, 0x82, 0x44, 0x12, 0x5a, + 0xd9, 0x1c, 0xca, 0x76, 0x2b, 0x4e, 0xe8, 0x18, + 0x7e, 0x50, 0xf5, 0x8c, 0x7c, 0x11, 0xe7, 0x0e, + 0xfd, 0x08, 0x5e, 0x64, 0x8b, 0x5b, 0x9f, 0x94, + 0x8b, 0x0d, 0x83, 0x7e, 0xef, 0x89, 0x30, 0x4a, + 0x55, 0xce, 0x10, 0x5f, 0x15, 0xd2, 0xe7, 0x07, + 0x0c, 0x34, 0x92, 0xda, 0xae, 0x84, 0x26, 0x28, + 0x36, 0x1a, 0x96, 0xc6, 0xf1, 0x41, 0x2b, 0xb6, + 0x01, 0xfe, 0x20, 0x05, 0x43, 0x80, 0x45, 0xdf, + 0x5c, 0xc2, 0x96, 0xc8, 0x41, 0x68, 0x87, 0x78, + 0xbc, 0xf8, 0x34, 0xfb, 0x19, 0x61, 0xab, 0x7f, + 0x15, 0x56, 0x7f, 0x1a, 0xf5, 0x08, 0xf1, 0x1c, + 0x59, 0x70, 0x92, 0x3a, 0xda, 0x1a, 0xfd, 0xfc, + 0x4d, 0xe1, 0x12, 0x61, 0xc1, 0xd8, 0xdb, 0x63, + 0x6e, 0x6b, 0x19, 0x96, 0x68, 0x17, 0x9b, 0xf5, + 0xa9, 0x5d, 0x2c, 0xaf, 0xad, 0xc6, 0x26, 0x9e, + 0x09, 0xcb, 0x67, 0x4e, 0x50, 0x7d, 0x2f, 0xae, + 0x4e, 0x73, 0xd9, 0x5a, 0xaa, 0x5d, 0x54, 0x20, + 0x7b, 0x77, 0xcf, 0xf8, 0xad, 0x88, 0x6b, 0xc8, +}; + +/* + * IV method encblkno1, blkno 1. + */ +static const uint8_t bf_cbc_448_encblkno1_vec1_ctxt[SECSIZE] = { + 0x8b, 0x2a, 0xcf, 0x7d, 0x38, 0x1b, 0xaa, 0x33, + 0x1c, 0xe6, 0xa1, 0x37, 0x6e, 0x9e, 0xb3, 0x48, + 0x2a, 0xb8, 0x61, 0x11, 0x00, 0xe5, 0x48, 0xea, + 0xb5, 0x9f, 0x6c, 0xa4, 0xdf, 0x8d, 0x5a, 0xd8, + 0x03, 0x55, 0x4d, 0x07, 0x7d, 0x5f, 0x1b, 0x18, + 0xd1, 0x86, 0x52, 0xc1, 0x13, 0xda, 0x99, 0x23, + 0xeb, 0xab, 0xb2, 0x93, 0x40, 0x7c, 0x6a, 0x8a, + 0xaa, 0xf8, 0xf1, 0x66, 0xf1, 0x10, 0x1d, 0xcd, + 0x25, 0xc7, 0x84, 0x55, 0x02, 0x1d, 0xc0, 0x3c, + 0xba, 0xf4, 0xbf, 0xe2, 0xe4, 0xc3, 0x57, 0xdc, + 0x0d, 0xfd, 0xeb, 0xb3, 0x7d, 0x31, 0x82, 0x6b, + 0x5c, 0x0e, 0x92, 0xa5, 0x42, 0x8b, 0x7f, 0x36, + 0x74, 0x4d, 0xfd, 0x2f, 0xd7, 0x19, 0x0d, 0x23, + 0xa7, 0x36, 0xe8, 0xe4, 0xe5, 0xff, 0xc8, 0x0d, + 0xe1, 0x48, 0x25, 0x79, 0xa9, 0x22, 0xac, 0x72, + 0x86, 0x28, 0xcb, 0x63, 0xa6, 0xa0, 0x46, 0x08, + 0x53, 0xb8, 0x59, 0xab, 0x0f, 0x8f, 0xb1, 0x78, + 0xf8, 0x4e, 0x6d, 0x1a, 0xb5, 0xdd, 0x12, 0x02, + 0x57, 0x55, 0xf8, 0xab, 0x78, 0x7d, 0x75, 0x61, + 0x81, 0x20, 0xd6, 0x4b, 0x7d, 0x76, 0x05, 0xc9, + 0x56, 0xf2, 0xe9, 0x3f, 0xb6, 0xb5, 0x02, 0x2b, + 0x1c, 0x29, 0xbf, 0x07, 0xe9, 0x5f, 0x9b, 0x18, + 0x38, 0x26, 0xa0, 0x09, 0xde, 0x24, 0x5b, 0x37, + 0x72, 0x74, 0xf4, 0x9f, 0x86, 0x28, 0x89, 0xb6, + 0x0c, 0x95, 0x24, 0x2f, 0x88, 0x80, 0x6a, 0xc7, + 0x3a, 0xdc, 0x89, 0xb0, 0xa3, 0xfe, 0x6e, 0x38, + 0xec, 0x0b, 0x1d, 0xbc, 0xd5, 0x90, 0x48, 0xfb, + 0xb1, 0x54, 0xac, 0x6e, 0x35, 0xb0, 0x71, 0x9e, + 0x57, 0x07, 0x81, 0x90, 0xcb, 0x63, 0xb2, 0x7f, + 0x4c, 0x81, 0xe1, 0x58, 0xda, 0x27, 0xef, 0x77, + 0xe7, 0xde, 0x96, 0x83, 0x2a, 0xb1, 0x6b, 0x08, + 0x62, 0x89, 0xdc, 0x3a, 0x3f, 0x08, 0xff, 0xdc, + 0x50, 0x3e, 0xc1, 0xe4, 0x33, 0x8b, 0xad, 0x19, + 0x90, 0x0b, 0x8e, 0xc3, 0x55, 0x77, 0xf0, 0xc2, + 0x24, 0xf9, 0x0c, 0x99, 0x84, 0xb2, 0xcc, 0x23, + 0x8c, 0xab, 0x79, 0x0d, 0xff, 0x75, 0x3a, 0xe0, + 0xc9, 0xe8, 0x1e, 0x15, 0x02, 0xd5, 0x67, 0x8e, + 0x32, 0xe3, 0x1f, 0xda, 0xfb, 0x88, 0xeb, 0xa5, + 0x23, 0xea, 0x1d, 0xaa, 0xc3, 0x62, 0x7f, 0x27, + 0x38, 0x2a, 0xf6, 0xa2, 0x6a, 0x0e, 0x05, 0xff, + 0xe4, 0x63, 0x70, 0xec, 0xf8, 0x25, 0x96, 0x08, + 0xcb, 0x22, 0x2a, 0xaa, 0xbc, 0x45, 0x04, 0xb9, + 0xbc, 0x64, 0x07, 0x09, 0x31, 0xee, 0x5f, 0x9a, + 0xb1, 0x71, 0x85, 0x10, 0x60, 0xfb, 0x3c, 0x56, + 0xeb, 0xfe, 0x91, 0xab, 0x3f, 0x09, 0x76, 0xba, + 0x3c, 0xfc, 0xa6, 0x0d, 0xce, 0x9f, 0x59, 0xd4, + 0x83, 0x8d, 0x98, 0xf5, 0x0d, 0x60, 0x1f, 0xd1, + 0x10, 0x61, 0x77, 0x0d, 0xd1, 0xcd, 0xc2, 0xc2, + 0x2c, 0x7d, 0xf6, 0x15, 0x16, 0x90, 0xc9, 0xc5, + 0x1e, 0xe9, 0xf5, 0x7b, 0xb4, 0x49, 0x47, 0x91, + 0x6a, 0x94, 0x26, 0x94, 0xb3, 0xb5, 0xa7, 0x9e, + 0xcb, 0xb1, 0x9c, 0xb7, 0x5d, 0x25, 0x3c, 0x2d, + 0x8c, 0xa8, 0xa1, 0xb1, 0x79, 0x8e, 0x60, 0xa2, + 0x3e, 0x04, 0xfa, 0x3f, 0xb4, 0x43, 0xde, 0x0a, + 0xde, 0xf4, 0x58, 0xe7, 0xd1, 0x04, 0x1d, 0xb7, + 0x1d, 0xa6, 0xcb, 0x49, 0x41, 0x30, 0xb5, 0x41, + 0xb5, 0x14, 0x19, 0xe4, 0xeb, 0x2c, 0xe2, 0xf0, + 0x66, 0x59, 0xe3, 0xc6, 0xb0, 0xd0, 0x1e, 0xaa, + 0x9f, 0xa5, 0x0b, 0xb8, 0xfd, 0xae, 0x62, 0xcf, + 0x3e, 0xe2, 0xea, 0x79, 0xc5, 0x3e, 0xcf, 0xf0, + 0x40, 0x00, 0x8c, 0x81, 0x97, 0xed, 0xac, 0xf9, + 0x61, 0x75, 0x4e, 0xd7, 0xb7, 0xb2, 0x02, 0x14, + 0x04, 0xf6, 0xbf, 0x25, 0xbe, 0x78, 0x2a, 0xea, + 0xd2, 0x61, 0xf2, 0x7e, 0x45, 0x6b, 0x20, 0xca, +}; + +/* + * IV method encblkno1, blkno 2. + */ +static const uint8_t bf_cbc_448_encblkno1_vec2_ctxt[SECSIZE] = { + 0x35, 0x34, 0x49, 0x29, 0x12, 0x3f, 0xc6, 0x2f, + 0xc9, 0x3d, 0xc9, 0x54, 0x46, 0xf3, 0x26, 0xf9, + 0x5e, 0x45, 0xb4, 0xba, 0x6d, 0x0f, 0x98, 0x53, + 0x8b, 0x7a, 0x00, 0x47, 0xb6, 0xbd, 0x70, 0x89, + 0x60, 0x8e, 0x52, 0x0b, 0xe3, 0x0a, 0xd8, 0x0e, + 0x48, 0xf3, 0xcc, 0x66, 0x8d, 0x71, 0xaa, 0x0e, + 0xc2, 0x68, 0x03, 0x05, 0xf9, 0xef, 0x1d, 0x14, + 0x5a, 0x85, 0x88, 0x70, 0x77, 0xcf, 0xe3, 0xdf, + 0x18, 0xe5, 0xfb, 0xea, 0xe1, 0xe8, 0xe0, 0x25, + 0xb2, 0x14, 0x61, 0x5d, 0x2f, 0xce, 0x61, 0xec, + 0x68, 0xc8, 0x06, 0x60, 0x41, 0xc1, 0xe3, 0x0a, + 0x5e, 0x96, 0x15, 0x9b, 0x2c, 0x5b, 0xfd, 0xba, + 0x17, 0x2e, 0x50, 0xb6, 0x68, 0x39, 0x21, 0x56, + 0x31, 0x2e, 0xb5, 0x29, 0xff, 0x4a, 0x12, 0x34, + 0x02, 0x54, 0xb1, 0x7f, 0xd8, 0x35, 0xec, 0x79, + 0x9e, 0xef, 0x62, 0xf3, 0x4b, 0x58, 0x96, 0xf1, + 0x83, 0x26, 0x57, 0x3d, 0x55, 0xb9, 0xb0, 0xa7, + 0x48, 0x65, 0x06, 0xee, 0x14, 0x88, 0xb5, 0x58, + 0xc8, 0x4d, 0x6e, 0xd8, 0x44, 0x76, 0x21, 0x16, + 0xa4, 0xdf, 0x68, 0x4b, 0xff, 0x69, 0x23, 0x66, + 0x18, 0x75, 0xe6, 0x29, 0xea, 0x95, 0x87, 0x1c, + 0xed, 0x2d, 0xbd, 0xbf, 0x22, 0x56, 0x11, 0xd5, + 0x59, 0x90, 0x24, 0xd7, 0xae, 0xda, 0x99, 0x49, + 0xe3, 0x23, 0x03, 0x24, 0x3b, 0x02, 0x49, 0x1d, + 0xa5, 0x57, 0x2f, 0xea, 0xd1, 0x6a, 0x17, 0x53, + 0x0f, 0xb3, 0xa9, 0x64, 0x8a, 0xdb, 0x62, 0x17, + 0xad, 0x5c, 0x7d, 0x56, 0x14, 0x0f, 0xfb, 0x14, + 0xbe, 0x7e, 0xa1, 0xa8, 0x27, 0xf0, 0xf0, 0x3a, + 0xe7, 0xc5, 0x26, 0x98, 0x9d, 0x29, 0xf7, 0xfd, + 0x43, 0x13, 0x34, 0xe2, 0xb8, 0x0b, 0x14, 0xe9, + 0x79, 0x66, 0x7a, 0xf2, 0xed, 0x79, 0x37, 0x16, + 0x75, 0x2b, 0xf2, 0x99, 0xa1, 0xba, 0xf1, 0xc1, + 0x61, 0x8d, 0x78, 0x46, 0x3a, 0x67, 0x58, 0x6a, + 0x55, 0x0d, 0x2e, 0x08, 0x47, 0xfc, 0x94, 0x2f, + 0x65, 0xa1, 0x1a, 0xfe, 0x05, 0xfa, 0x41, 0x00, + 0x6c, 0x42, 0xbc, 0x65, 0x37, 0xd9, 0x25, 0x9c, + 0xf4, 0x83, 0x8a, 0xdb, 0x91, 0x96, 0xc5, 0xa9, + 0x02, 0x44, 0xbc, 0x9a, 0x26, 0x9c, 0xd1, 0xfa, + 0x06, 0x8b, 0xd6, 0x40, 0x8f, 0x0a, 0xd2, 0x5b, + 0xd8, 0x57, 0xd5, 0x61, 0x1b, 0x86, 0xa6, 0x49, + 0x15, 0xe4, 0x06, 0x6c, 0x48, 0x24, 0xb8, 0xe3, + 0x23, 0xed, 0xcf, 0x39, 0x44, 0x4d, 0xf0, 0x4e, + 0x89, 0x44, 0x0d, 0x3a, 0xe6, 0x1b, 0x7c, 0x39, + 0xfd, 0x79, 0x0e, 0x78, 0xc7, 0xf6, 0xa3, 0x91, + 0x18, 0x2a, 0xfb, 0x92, 0x48, 0xcc, 0x8b, 0xbb, + 0x33, 0x07, 0x42, 0xf5, 0xd0, 0x01, 0x8b, 0x12, + 0xd9, 0x5e, 0x9d, 0xe4, 0x13, 0x99, 0x11, 0x18, + 0x86, 0x8a, 0xb7, 0xa6, 0xe2, 0x38, 0x34, 0x12, + 0x67, 0xd6, 0x4b, 0xc0, 0x23, 0x56, 0xba, 0x53, + 0xbe, 0x20, 0xe5, 0xec, 0x16, 0xf9, 0x74, 0x92, + 0x62, 0xfc, 0xb9, 0xe8, 0xa3, 0xbf, 0x3b, 0x06, + 0x76, 0xa5, 0xf5, 0x56, 0x81, 0x72, 0x50, 0xc8, + 0x55, 0x80, 0x7d, 0xe1, 0x46, 0x92, 0xa1, 0xeb, + 0x41, 0xaf, 0xce, 0x52, 0xb1, 0xb3, 0x51, 0xf2, + 0xba, 0x03, 0xb4, 0xcb, 0x16, 0xd2, 0x92, 0x3d, + 0x0c, 0x9b, 0xe9, 0xd9, 0x5d, 0xcf, 0x79, 0x05, + 0xbd, 0xe0, 0x44, 0x39, 0xf0, 0x35, 0x2d, 0x7a, + 0x31, 0x3b, 0x24, 0xb3, 0xb4, 0xa5, 0x08, 0xf5, + 0xac, 0x51, 0xf1, 0x09, 0x52, 0x14, 0xc7, 0xb5, + 0xe0, 0x65, 0x47, 0x30, 0xdd, 0xa4, 0xfd, 0x71, + 0x68, 0xa5, 0x4b, 0x00, 0x72, 0xe2, 0xc4, 0xa9, + 0x5d, 0x21, 0x6d, 0x83, 0x4e, 0x88, 0xaa, 0x76, + 0x07, 0xf0, 0xf7, 0x36, 0xa2, 0x5e, 0xd5, 0x4c, + 0x7f, 0x9b, 0x74, 0x89, 0x0a, 0x18, 0xdc, 0x9a, +}; + +/* + * IV method encblkno1, blkno 3. + */ +static const uint8_t bf_cbc_448_encblkno1_vec3_ctxt[SECSIZE] = { + 0xc3, 0xd3, 0xae, 0x7e, 0x4f, 0xbe, 0x0d, 0x50, + 0xd6, 0x63, 0x2c, 0xa2, 0xfd, 0x07, 0xf1, 0x33, + 0x2a, 0x15, 0x8f, 0xd7, 0x63, 0x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0x0d, 0x79, 0xc6, 0x14, 0x52, 0x14, 0x4b, + 0xd1, 0x8c, 0x18, 0xef, 0x1f, 0xd8, 0xe7, 0x60, + 0xf3, 0x28, 0xce, 0xf1, 0x59, 0xc8, 0x43, 0x02, + 0x0e, 0x08, 0x72, 0xe5, 0x7d, 0x5b, 0xc5, 0x80, + 0xfb, 0xca, 0x2a, 0x63, 0x8d, 0x3c, 0x54, 0x04, + 0x1e, 0xdf, 0x94, 0x53, 0xf8, 0x44, 0xe5, 0xc2, + 0x5c, 0x36, 0xc9, 0x75, 0x1c, 0xa2, 0x98, 0x3d, + 0xd6, 0xee, 0x38, 0xf9, 0xab, 0x2d, 0x1a, 0xdb, + 0x87, 0x2c, 0x86, 0xfd, 0xf9, 0xb2, 0x4d, 0x21, + 0xb7, 0xc0, 0x8f, 0x75, 0x21, 0x53, 0xc7, 0xd7, + 0x3e, 0xc6, 0x6c, 0x98, 0x2c, 0x6d, 0x44, 0x13, + 0x40, 0xea, 0xaa, 0x84, 0xd9, 0x47, 0xfd, 0x65, + 0x2c, 0x3d, 0xb0, 0x76, 0xe7, 0xdd, 0xd7, 0x06, + 0x8a, 0x79, 0xa7, 0x6c, 0x3a, 0x2d, 0x32, 0xf7, + 0xae, 0xe7, 0xd2, 0xb1, 0xf2, 0xe0, 0x3a, 0x10, + 0x19, 0xa1, 0x79, 0x7b, 0x76, 0x0b, 0xeb, 0xf3, + 0x01, 0x6e, 0x9f, 0xa1, 0x5d, 0x16, 0x09, 0xec, + 0x6b, 0x64, 0xe3, 0x96, 0xb8, 0x89, 0x99, 0x8c, + 0x77, 0xcf, 0x3f, 0x37, 0x42, 0x51, 0x82, 0x5a, + 0x63, 0x89, 0x12, 0x12, 0x59, 0x38, 0xe3, 0xcf, + 0xa0, 0xda, 0xbc, 0x69, 0x75, 0x48, 0x7c, 0x3e, + 0x56, 0x75, 0x12, 0x10, 0xc5, 0x96, 0x5b, 0x34, + 0x52, 0x2e, 0xce, 0xba, 0xd2, 0x7f, 0x8f, 0x1c, + 0xbd, 0x35, 0x3b, 0x74, 0x5b, 0x6c, 0xfe, 0xa7, + 0xf1, 0x4a, 0x07, 0x95, 0xff, 0xa8, 0xa0, 0x2a, + 0x85, 0xec, 0xd7, 0x56, 0x3b, 0x28, 0x2e, 0x09, + 0x50, 0x43, 0xbd, 0x49, 0x22, 0xdc, 0x78, 0x0e, + 0x7e, 0x68, 0x78, 0xd5, 0x57, 0xc2, 0xd6, 0x7c, + 0x2f, 0xd0, 0x4a, 0x62, 0x16, 0x38, 0x04, 0x23, + 0x43, 0x21, 0xaa, 0xe1, 0x96, 0x0e, 0xa9, 0x22, + 0xe7, 0x2c, 0xb8, 0x5e, 0x8f, 0xc6, 0x2d, 0xbd, + 0x99, 0x25, 0x33, 0xb8, 0x47, 0x99, 0x8d, 0xf5, + 0x22, 0x08, 0x9b, 0xd5, 0xad, 0x83, 0x67, 0xec, + 0x05, 0x89, 0xda, 0xd6, 0xe4, 0xe2, 0xd5, 0xef, + 0x7f, 0x61, 0x1e, 0x03, 0x81, 0x03, 0xb1, 0x98, + 0x5a, 0x29, 0x69, 0x13, 0xb2, 0xe6, 0xe1, 0x2c, + 0x66, 0x88, 0x39, 0x90, 0xf9, 0xae, 0x5d, 0x71, + 0xfe, 0x07, 0x30, 0x7d, 0xba, 0xa9, 0x37, 0xb5, + 0xff, 0x2c, 0xa9, 0xe6, 0x95, 0x48, 0xb2, 0xc8, +}; + +const struct testvec bf_cbc_448_1_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno1_vec3_ctxt, + }, +}; + +/* + * IV method encblkno8, blkno 0. + */ +static const uint8_t bf_cbc_448_encblkno8_vec0_ctxt[SECSIZE] = { + 0x91, 0xb4, 0x8f, 0x78, 0x34, 0xbe, 0x03, 0xe9, + 0x4b, 0xca, 0xf4, 0xfa, 0x27, 0x99, 0xa0, 0xd0, + 0xa0, 0x85, 0xf9, 0xca, 0xcc, 0x2e, 0x0d, 0x41, + 0x91, 0xdb, 0xf9, 0x71, 0xcd, 0x49, 0xf7, 0x66, + 0x9b, 0x0c, 0x70, 0x49, 0x36, 0x72, 0xf4, 0xc0, + 0x17, 0xdd, 0xd8, 0x6a, 0xd2, 0x17, 0xfe, 0x50, + 0xa3, 0x2b, 0xa8, 0x7c, 0x9c, 0x12, 0x8c, 0x08, + 0x3d, 0xb5, 0x20, 0xc0, 0x83, 0xc1, 0xf5, 0x34, + 0x4b, 0xa5, 0xcc, 0x7c, 0xc6, 0x9f, 0x4b, 0x7f, + 0x09, 0x0c, 0x04, 0xe3, 0x02, 0xfe, 0xe2, 0x5a, + 0x45, 0xee, 0x4a, 0xcb, 0xc0, 0xe1, 0xf1, 0xae, + 0x1a, 0x22, 0x95, 0xb9, 0x30, 0xe8, 0x2d, 0x90, + 0xe5, 0x6a, 0x2f, 0x0a, 0x59, 0x15, 0xfc, 0x60, + 0xa5, 0x91, 0x95, 0x1a, 0xa2, 0xf5, 0x87, 0xa3, + 0x97, 0x45, 0x1b, 0xfb, 0x78, 0x62, 0x8b, 0xb6, + 0x86, 0xc6, 0x94, 0x9a, 0x9d, 0x09, 0x46, 0xc9, + 0x1f, 0x5f, 0x2e, 0x6c, 0xed, 0x5e, 0xe2, 0xab, + 0xca, 0x30, 0xdb, 0x13, 0x37, 0x8d, 0xb7, 0xc6, + 0xce, 0x74, 0xe3, 0xe2, 0x64, 0x7b, 0x74, 0x3e, + 0x9f, 0x18, 0x4e, 0xe2, 0x2b, 0x52, 0x08, 0x60, + 0x2b, 0x6d, 0x17, 0x1a, 0xff, 0xae, 0xfb, 0xea, + 0x59, 0x1d, 0x45, 0xe8, 0xf9, 0x0c, 0x56, 0xb8, + 0xb5, 0xc7, 0x8f, 0xa7, 0x9e, 0x67, 0x87, 0xbb, + 0xe2, 0x37, 0x56, 0x49, 0xed, 0x75, 0x27, 0x54, + 0xb5, 0x16, 0x34, 0xb6, 0xa6, 0xe0, 0x27, 0x48, + 0x91, 0xfb, 0x80, 0x4f, 0x5e, 0xef, 0x40, 0x6d, + 0x28, 0x8f, 0x2e, 0x56, 0xab, 0x6c, 0x7d, 0xde, + 0xbd, 0xa5, 0xa6, 0x47, 0xe2, 0xc9, 0xb0, 0xc5, + 0x69, 0x5d, 0x57, 0x18, 0x59, 0x08, 0x66, 0x1b, + 0xdc, 0x4f, 0xa4, 0xe2, 0xb5, 0xff, 0x72, 0x4d, + 0x25, 0x79, 0x38, 0x8f, 0xca, 0x23, 0x81, 0x31, + 0x1d, 0xeb, 0x7b, 0x7e, 0x04, 0xc3, 0xa6, 0xac, + 0x12, 0x92, 0x95, 0x44, 0x08, 0xae, 0x25, 0xb5, + 0xc2, 0x39, 0x88, 0x28, 0xc5, 0xc7, 0x3c, 0xfe, + 0x95, 0xe1, 0x1a, 0x27, 0xbe, 0xfd, 0x0a, 0xc7, + 0xd1, 0x02, 0x1a, 0xae, 0x03, 0xfb, 0xce, 0x79, + 0xe6, 0xea, 0x4a, 0xa1, 0x0e, 0x68, 0x61, 0x2f, + 0xfa, 0x7a, 0xb8, 0xda, 0xd1, 0x4a, 0xbe, 0x88, + 0xd2, 0xa0, 0x6b, 0x90, 0xc3, 0x37, 0x18, 0x77, + 0x2e, 0xc8, 0x44, 0x2e, 0x9d, 0xa2, 0x4a, 0xc7, + 0x54, 0xb2, 0x38, 0x9b, 0x60, 0x5e, 0x5b, 0xb0, + 0x31, 0x4c, 0x10, 0xf0, 0x1d, 0x8c, 0xab, 0x9b, + 0x25, 0x86, 0x05, 0xfc, 0xd9, 0x39, 0x11, 0x2b, + 0x7e, 0x07, 0xfd, 0x6b, 0xb3, 0x28, 0x57, 0x66, + 0x94, 0xc6, 0xfc, 0x48, 0x71, 0xeb, 0x7b, 0x9a, + 0x26, 0x8f, 0x9f, 0x97, 0xb6, 0x83, 0x9a, 0xdc, + 0x5d, 0x84, 0x96, 0x9d, 0xe3, 0xa5, 0x12, 0x97, + 0x8c, 0x87, 0xa6, 0x2a, 0xa8, 0x15, 0x9a, 0xb0, + 0x0e, 0x31, 0x55, 0xf7, 0x1b, 0x5c, 0x9c, 0xaf, + 0x13, 0x20, 0x13, 0x50, 0xaf, 0xc9, 0xf4, 0xd9, + 0x47, 0x16, 0xcc, 0x9d, 0xec, 0xa9, 0x2d, 0xfc, + 0x3d, 0x5d, 0x48, 0x89, 0x86, 0x91, 0x6f, 0x1a, + 0xa5, 0xf0, 0xb6, 0x9b, 0xa9, 0x08, 0xf2, 0x05, + 0xad, 0xe5, 0xe0, 0xd8, 0x2e, 0x09, 0xbe, 0x3a, + 0xf2, 0xdc, 0xeb, 0x14, 0xe6, 0x8c, 0x21, 0x20, + 0xbb, 0x42, 0x6a, 0xba, 0x55, 0x79, 0x54, 0x8b, + 0xa8, 0x43, 0x14, 0x28, 0x66, 0xd2, 0x44, 0x65, + 0x9c, 0xa9, 0xdc, 0x3b, 0x3f, 0xab, 0x36, 0xb4, + 0xbc, 0x9d, 0x22, 0x92, 0x24, 0xa8, 0x29, 0x18, + 0x98, 0x3a, 0xbe, 0xa1, 0xb4, 0xf8, 0x7f, 0xea, + 0x2f, 0x58, 0x69, 0xce, 0xee, 0x99, 0x76, 0x2c, + 0x53, 0x84, 0xf5, 0x9e, 0xa3, 0x98, 0xe6, 0x94, + 0x39, 0xfa, 0xfa, 0x6d, 0x66, 0xe2, 0x39, 0x2b, + 0x4b, 0x84, 0x14, 0x89, 0x18, 0xa2, 0x03, 0xdd, +}; + +/* + * IV method encblkno8, blkno 1. + */ +static const uint8_t bf_cbc_448_encblkno8_vec1_ctxt[SECSIZE] = { + 0x90, 0x3d, 0xee, 0x58, 0xf7,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3e, 0xa2, 0x48, 0xe7, 0x6c, 0x86, 0x65, 0x78, + 0x97, 0x0b, 0x97, 0xc1, 0x70, 0x91, 0x12, 0x79, + 0xae, 0xf0, 0x2b, 0x44, 0xe9, 0x84, 0x8d, 0x78, + 0x53, 0xf8, 0x3a, 0xf5, 0x9f, 0x27, 0x3d, 0x49, + 0x69, 0xd1, 0x18, 0xa4, 0xb2, 0xd0, 0xbb, 0xf2, + 0x57, 0x76, 0xb7, 0x77, 0x16, 0x2f, 0xf8, 0x0c, + 0xa5, 0x86, 0x43, 0x0d, 0x2d, 0xfe, 0x84, 0xc6, + 0xbb, 0x58, 0x81, 0x47, 0x3d, 0xa3, 0x93, 0xb0, + 0x50, 0xfc, 0x25, 0xf7, 0xc5, 0x05, 0xe5, 0xf2, + 0xb3, 0x79, 0x12, 0xe4, 0x37, 0x71, 0x2d, 0xe8, + 0xa5, 0x0b, 0xce, 0x67, 0x51, 0x4f, 0xab, 0xc7, + 0x7b, 0x3b, 0xac, 0x78, 0x97, 0x82, 0x02, 0xf4, + 0x62, 0x20, 0x1b, 0x8b, 0xac, 0x07, 0x3b, 0xd7, + 0x0b, 0x99, 0x27, 0x85, 0x52, 0x7a, 0x79, 0x18, + 0xfb, 0x81, 0x3a, 0x05, 0x76, 0x6c, 0x3c, 0x6a, + 0x35, 0xe1, 0x2b, 0x03, 0x48, 0x70, 0x1a, 0xa8, + 0x30, 0x33, 0x61, 0xe2, 0xd8, 0x99, 0x86, 0x7f, + 0xfd, 0xe0, 0x4a, 0xe4, 0x62, 0xa1, 0xac, 0xcb, + 0xb8, 0x8a, 0xf3, 0xaa, 0xd6, 0x61, 0x9d, 0xc5, + 0xdb, 0xf5, 0x53, 0x39, 0x1d, 0xd7, 0xf8, 0x96, + 0xc6, 0x2b, 0xca, 0xbf, 0x83, 0x4e, 0x89, 0x63, + 0x53, 0x6f, 0x17, 0xaa, 0xf3, 0x61, 0x9b, 0x75, + 0x8c, 0x5a, 0xf8, 0x21, 0x84, 0x52, 0xb8, 0x76, + 0xbc, 0xf5, 0x9b, 0xd6, 0x98, 0x26, 0x58, 0xec, + 0xdd, 0xa8, 0xf1, 0xee, 0x9e, 0x14, 0x24, 0x94, + 0x7c, 0xb6, 0x45, 0x8b, 0xc7, 0x85, 0x50, 0x4e, + 0x30, 0xd7, 0x51, 0x8c, 0x33, 0xeb, 0xeb, 0x5d, + 0x52, 0x58, 0x43, 0xcb, 0x25, 0x4a, 0x77, 0x34, + 0xe6, 0x70, 0x5b, 0x6f, 0x8f, 0xe8, 0x07, 0xee, + 0x76, 0x4a, 0xad, 0xab, 0x11, 0x8a, 0x1b, 0x92, + 0x60, 0x79, 0xb8, 0xe0, 0x88, 0xa7, 0x3a, 0xe0, + 0x15, 0xf6, 0x57, 0xf0, 0xe8, 0x87, 0xda, 0xf8, + 0x90, 0x4e, 0xe7, 0xb3, 0xb4, 0xe7, 0x73, 0x5c, + 0xd3, 0x69, 0xfb, 0x23, 0x4f, 0x4f, 0xc8, 0xd2, + 0xfb, 0xf5, 0xf5, 0x76, 0x80, 0xb6, 0xb7, 0xe2, + 0xb7, 0x96, 0x1a, 0x97, 0x12, 0x40, 0x16, 0x86, + 0xd6, 0x66, 0xf5, 0x46, 0x9e, 0x04, 0x62, 0xaa, + 0x9c, 0xc9, 0x45, 0x39, 0x5c, 0xd3, 0x58, 0x40, + 0xb4, 0x32, 0xd8, 0x6c, 0x19, 0xfa, 0xa5, 0x5f, + 0x1e, 0x83, 0x5a, 0x32, 0x5e, 0x1d, 0xab, 0xa9, + 0x48, 0x1b, 0x1b, 0x37, 0x66, 0xf8, 0x67, 0xd7, +}; + +/* + * IV method encblkno8, blkno 2. + */ +static const uint8_t bf_cbc_448_encblkno8_vec2_ctxt[SECSIZE] = { + 0xb3, 0x2d, 0x0d, 0x90, 0x7a, 0x50, 0xb6, 0x29, + 0x9d, 0xd4, 0x12, 0x1a, 0xc9, 0x71, 0x56, 0xc4, + 0xce, 0x3d, 0x74, 0xf9, 0x91, 0xe4, 0x79, 0x8a, + 0x42, 0x34, 0x1a, 0xd4, 0x84, 0xaa, 0x01, 0x85, + 0x13, 0xe8, 0xab, 0xaa, 0xb6, 0x81, 0x82, 0xd6, + 0x32, 0xd6, 0x9f, 0x63, 0x69, 0x55, 0x10, 0x5f, + 0x2e, 0xb3, 0x51, 0x74, 0x80, 0x5c, 0xe9, 0x8d, + 0x27, 0xd8, 0x41, 0x2d, 0x27, 0x07, 0xb4, 0x13, + 0xcd, 0xc0, 0xb3, 0x96, 0xaa, 0x59, 0x9c, 0x3e, + 0x16, 0x9e, 0x18, 0xa5, 0x92, 0x52, 0x59, 0x19, + 0x19, 0x62, 0xeb, 0xd9, 0xdf, 0x9d, 0x10, 0x77, + 0xfb, 0x3c, 0xf1, 0xeb, 0x70, 0xf6, 0x6a, 0x9b, + 0xad, 0x99, 0x35, 0xd7, 0xf8, 0xde, 0x2b, 0x52, + 0x85, 0xdd, 0x36, 0x07, 0x3a, 0x88, 0xa6, 0xbb, + 0x98, 0x7a, 0xe3, 0xb0, 0xe6, 0xae, 0x33, 0x5d, + 0x47, 0x0c, 0x6c, 0xd4, 0x84, 0x33, 0x7e, 0xf4, + 0xea, 0xfd, 0xf1, 0x1c, 0xdb, 0x8b, 0xfe, 0x01, + 0x77, 0xa3, 0x07, 0x21, 0x09, 0xac, 0x0c, 0xe4, + 0x63, 0xaa, 0x3d, 0xb3, 0x05, 0xf8, 0x73, 0x03, + 0x69, 0x53, 0x2f, 0xd3, 0x53, 0x29, 0xf2, 0x02, + 0x60, 0x41, 0xed, 0xc7, 0xe9, 0x2e, 0xba, 0x54, + 0xa4, 0xfe, 0x26, 0xf0, 0xd9, 0x2c, 0x58, 0x2d, + 0x90, 0x94, 0x19, 0xf9, 0xe5, 0xaa, 0xe2, 0x13, + 0x9a, 0x67, 0x90, 0x44, 0x61, 0x36, 0xd0, 0x3f, + 0xe7, 0xe8, 0x7e, 0x47, 0x2b, 0x84, 0x97, 0xe2, + 0x0b, 0x8a, 0xfa, 0x2f, 0xbc, 0x1a, 0x70, 0xed, + 0xb2, 0x93, 0x36, 0x0e, 0xe6, 0xb1, 0xa2, 0x5a, + 0x04, 0x04, 0x8d, 0x2f, 0x82, 0xdb, 0x49, 0x5e, + 0x1b, 0x90, 0xc1, 0x27, 0x2a, 0x2f, 0x64, 0x5b, + 0xce, 0x35, 0x06, 0x0d, 0xb6, 0x05, 0x50, 0x5a, + 0x90, 0xc8, 0x21, 0xd0, 0xf0, 0xb9, 0xf3, 0x43, + 0x25, 0xd8, 0xb9, 0x86, 0xb7, 0xd0, 0x29, 0x75, + 0xdc, 0xf6, 0xf6, 0x14, 0x5e, 0x1f, 0xad, 0x54, + 0x28, 0x63, 0x92, 0xcd, 0xcd, 0x75, 0xb2, 0xe8, + 0xf3, 0x1f, 0xfd, 0x88, 0x72, 0x04, 0xab, 0xe2, + 0x77, 0x21, 0xc1, 0xb4, 0x87, 0xa7, 0x98, 0x86, + 0x2d, 0x7f, 0x01, 0x24, 0xed, 0x3a, 0x23, 0x83, + 0xb7, 0xa4, 0xb7, 0x08, 0x4e, 0xee, 0x10, 0x77, + 0x29, 0x22, 0xab, 0xea, 0x4a, 0x68, 0x1f, 0x7f, + 0xd6, 0xe6, 0x90, 0x11, 0xbc, 0x23, 0x2e, 0x47, + 0x78, 0xea, 0x1d, 0x33, 0x7c, 0x02, 0x09, 0x55, + 0x7a, 0xbc, 0xa7, 0x3d, 0x9a, 0xd0, 0x4d, 0x40, + 0x6c, 0xc2, 0x99, 0xc2, 0xe9, 0x0e, 0xcf, 0x06, + 0x82, 0x61, 0x5c, 0x76, 0xca, 0xef, 0x8f, 0xd3, + 0x78, 0x2a, 0xae, 0x39, 0x29, 0x4e, 0xc1, 0x2c, + 0xb1, 0xbc, 0xcd, 0x76, 0x4f, 0x25, 0xf0, 0x5b, + 0x78, 0x3a, 0xa4, 0x39, 0x52, 0x5a, 0xc7, 0xcf, + 0x17, 0x3d, 0xb0, 0x39, 0x63, 0xf9, 0xf9, 0xfb, + 0x6f, 0x35, 0xb7, 0xf1, 0x49, 0x10, 0xd8, 0x12, + 0x8d, 0xa2, 0xdf, 0xc5, 0x26, 0x37, 0xd1, 0xb8, + 0xef, 0xdc, 0x04, 0x1b, 0x0d, 0x60, 0xbf, 0xbc, + 0xc0, 0xff, 0x56, 0x8b, 0xd3, 0x6e, 0x71, 0xfc, + 0x87, 0x00, 0x86, 0x10, 0x78, 0x3b, 0xce, 0x8b, + 0xe8, 0x5f, 0x8c, 0xce, 0x03, 0xa2, 0x89, 0x8c, + 0x16, 0x00, 0x0e, 0xd8, 0x53, 0xaf, 0x7f, 0x77, + 0x78, 0x40, 0x5e, 0x5e, 0xd1, 0x7d, 0xf8, 0x41, + 0xa8, 0x1e, 0xa5, 0xe5, 0xe9, 0xd6, 0x17, 0x2c, + 0x2f, 0x1b, 0xff, 0xef, 0xf5, 0x53, 0x31, 0xf3, + 0x5b, 0xe4, 0x84, 0x7c, 0xe2, 0x45, 0x3c, 0x82, + 0x5b, 0xf6, 0x03, 0x35, 0xdd, 0x03, 0x22, 0xbe, + 0x77, 0x9c, 0x6a, 0x7d, 0xc8, 0x29, 0x41, 0x53, + 0xbb, 0xab, 0x6e, 0xa5, 0x00, 0xaf, 0x3b, 0x1d, + 0x76, 0x12, 0xac, 0x44, 0x5c, 0x7d, 0xd2, 0x3b, + 0x3a, 0x95, 0xb0, 0xa9, 0x4f, 0x27, 0x76, 0x17, +}; + +/* + * IV method encblkno8, blkno 3. + */ +static const uint8_t bf_cbc_448_encblkno8_vec3_ctxt[SECSIZE] = { + 0x8e, 0xc4, 0x56, 0x64, 0x1e, 0x2a, 0x0d, 0x60, + 0x54, 0x5c, 0xcd, 0xe0, 0x6d, 0xa7, 0x4c, 0x30, + 0x7e, 0x85, 0x21, 0xdf, 0xaa, 0xb2, 0x32, 0xde, + 0xc0, 0xc6, 0x56, 0xe0, 0x43, 0xc2, 0x3e, 0x6c, + 0x8c, 0x62, 0x35, 0xaa, 0xf9, 0xba, 0xc9,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x76, 0xb4, + 0xd7, 0xc3, 0x1b, 0x65, 0x99, 0xc6, 0xa3, 0xe8, + 0x96, 0x5e, 0xc1, 0x0c, 0xd2, 0xf8, 0x65, 0xcf, + 0x42, 0xc5, 0x8f, 0x52, 0x5d, 0x90, 0x21, 0x55, + 0xec, 0x9d, 0x93, 0x81, 0xb7, 0x9a, 0xa4, 0x35, + 0xe7, 0xef, 0xef, 0x2d, 0x4c, 0x02, 0xf7, 0x2b, + 0x26, 0xe0, 0x9e, 0x3a, 0x31, 0xfd, 0x94, 0xb3, + 0xa7, 0x8a, 0x93, 0xf3, 0xe1, 0x77, 0x79, 0xdf, + 0xcf, 0x1f, 0x99, 0x55, 0x20, 0xc3, 0x7d, 0x8a, + 0xbc, 0xff, 0x63, 0x64, 0x87, 0xa9, 0x42, 0x63, + 0xc9, 0x67, 0x7e, 0x51, 0x99, 0x9c, 0xcb, 0x47, + 0xa9, 0xc8, 0x5e, 0x83, 0x87, 0x55, 0x7c, 0x45, + 0x3a, 0xb4, 0xfe, 0x97, 0x24, 0x17, 0x1d, 0x5e, + 0xdf, 0xe0, 0xe8, 0x17, 0xa6, 0x31, 0x99, 0xeb, + 0xb7, 0xb5, 0xd5, 0xd7, 0x7c, 0x2f, 0x22, 0x26, +}; + +const struct testvec bf_cbc_448_8_vectors[] = { + { + .blkno = 0, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec0_ctxt, + }, + { + .blkno = 1, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec1_ctxt, + }, + { + .blkno = 2, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec2_ctxt, + }, + { + .blkno = 3, + .ptxt = bf_cbc_ptxt, + .ctxt = bf_cbc_448_encblkno8_vec3_ctxt, + }, +}; + +static int +open_disk(const char *devpath, const char *imgpath, size_t size) +{ + int fd; + + fd = open(imgpath, O_CREAT | O_RDWR | O_TRUNC, 0600); + if (fd < 0) + return -1; + + if (ftruncate(fd, size) < 0) + goto fail; + + if (rump_pub_etfs_register_withsize(devpath, + imgpath, RUMP_ETFS_BLK, 0, size) < 0) { + goto fail; + } + + unlink(imgpath); + return fd; +fail: + close(fd); + unlink(imgpath); + return -1; +} + +static int +open_cgd(int devno) +{ + char devpath[32]; + + sprintf(devpath, "/dev/rcgd%d%c", devno, getrawpartition() + 'a'); + + return rump_sys_open(devpath, O_RDWR, 0); +} + +static int +configure_cgd(int fd, const char *dkpath, const char *alg, + const char *ivmethod, const char *key, size_t keylen) +{ + struct cgd_ioctl ci; + + memset(&ci, 0, sizeof(ci)); + ci.ci_disk = dkpath; + ci.ci_alg = alg; + ci.ci_ivmethod = ivmethod; + ci.ci_keylen = 8 * keylen - 8; /* Exclude the NUL terminator. */ + ci.ci_key = key; + ci.ci_blocksize = 64; + + return rump_sys_ioctl(fd, CGDIOCSET, &ci); +} + +static int +unconfigure_cgd(int fd) +{ + struct cgd_ioctl ci; + + return rump_sys_ioctl(fd, CGDIOCCLR, &ci); +} + +static int +write_testvec(int cgdfd, const struct testvec *tv) +{ + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + return -1; + + if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE) + return -1; + + return 0; +} + +static int +read_testvec(int cgdfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (rump_sys_read(cgdfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ptxt, SECSIZE); +fail: + free(buf); + return res; +} + +static int +check_testvec(int dkfd, const struct testvec *tv) +{ + char *buf; + int res = -1; + + buf = malloc(SECSIZE); + if (buf == NULL) + return -1; + + if (lseek(dkfd, tv->blkno * SECSIZE, SEEK_SET) < 0) + goto fail; + + if (read(dkfd, buf, SECSIZE) != SECSIZE) + goto fail; + + res = memcmp(buf, tv->ctxt, SECSIZE); +fail: + free(buf); + return res; +} + +ATF_TC(cgd_bf_cbc_128_encblkno1); +ATF_TC_HEAD(cgd_bf_cbc_128_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 128 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_bf_cbc_128_encblkno1, tc) +{ + const char imgpath[] = "blowfish-cbc-128-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_128_encblkno8); +ATF_TC_HEAD(cgd_bf_cbc_128_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 128 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_bf_cbc_128_encblkno8, tc) +{ + const char imgpath[] = "blowfish-cbc-128-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_128_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_128_key, sizeof(bf_cbc_128_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_128_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_128_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_256_encblkno1); +ATF_TC_HEAD(cgd_bf_cbc_256_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 256 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_bf_cbc_256_encblkno1, tc) +{ + const char imgpath[] = "blowfish-cbc-256-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_256_encblkno8); +ATF_TC_HEAD(cgd_bf_cbc_256_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 256 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_bf_cbc_256_encblkno8, tc) +{ + const char imgpath[] = "blowfish-cbc-256-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_256_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_256_key, sizeof(bf_cbc_256_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_256_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_256_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_448_encblkno1); +ATF_TC_HEAD(cgd_bf_cbc_448_encblkno1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 448 bits key, ivmethod encblkno1"); +} + +ATF_TC_BODY(cgd_bf_cbc_448_encblkno1, tc) +{ + const char imgpath[] = "blowfish-cbc-448-encblkno1.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno1", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_1_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_1_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TC(cgd_bf_cbc_448_encblkno8); +ATF_TC_HEAD(cgd_bf_cbc_448_encblkno8, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test blowfish-cbc with 448 bits key, ivmethod encblkno8"); +} + +ATF_TC_BODY(cgd_bf_cbc_448_encblkno8, tc) +{ + const char imgpath[] = "blowfish-cbc-448-encblkno8.img"; + const char *dkpath = "/dev/dk"; + const size_t dksize = 4 * SECSIZE; /* Last blkno is 3. */ + int dkfd, cgdfd; + + rump_init(); + + RL(dkfd = open_disk(dkpath, imgpath, dksize)); + + RL(cgdfd = open_cgd(0)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[0]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[1]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[2]), 0); + ATF_CHECK_EQ(write_testvec(cgdfd, &bf_cbc_448_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(configure_cgd(cgdfd, dkpath, "blowfish-cbc", "encblkno8", + bf_cbc_448_key, sizeof(bf_cbc_448_key))); + + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[0]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[1]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[2]), 0); + ATF_CHECK_EQ(read_testvec(cgdfd, &bf_cbc_448_8_vectors[3]), 0); + + RL(unconfigure_cgd(cgdfd)); + RL(rump_sys_close(cgdfd)); + + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[0]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[1]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[2]), 0); + ATF_CHECK_EQ(check_testvec(dkfd, &bf_cbc_448_8_vectors[3]), 0); + + RL(close(dkfd)); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, cgd_bf_cbc_128_encblkno1); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_128_encblkno8); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_256_encblkno1); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_256_encblkno8); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_448_encblkno1); + ATF_TP_ADD_TC(tp, cgd_bf_cbc_448_encblkno8); + + return atf_no_error(); +} diff --git a/fs/ffs/ffs_common.sh b/fs/ffs/ffs_common.sh index eaf7142808a1..ee94a15f994a 100755 --- a/fs/ffs/ffs_common.sh +++ b/fs/ffs/ffs_common.sh @@ -1,4 +1,4 @@ -# $NetBSD: ffs_common.sh,v 1.2 2013/07/29 13:15:24 skrll Exp $ +# $NetBSD: ffs_common.sh,v 1.3 2016/10/08 13:23:53 gson Exp $ create_ffs() { @@ -45,7 +45,7 @@ test_case() eval "${name}_head() { \ atf_set "descr" "${descr}" - atf_set "timeout" "60" + atf_set "timeout" "120" }" eval "${name}_body() { \ RUMP_SOCKETS_LIST=\${RUMP_SOCKET}; \ diff --git a/fs/fifofs/t_fifo.c b/fs/fifofs/t_fifo.c index c4a2060a6ebc..4b37bb85b8c2 100644 --- a/fs/fifofs/t_fifo.c +++ b/fs/fifofs/t_fifo.c @@ -1,9 +1,10 @@ /* Test case written by Bharat Joshi */ #include -__RCSID("$NetBSD: t_fifo.c,v 1.1 2011/12/21 00:17:07 christos Exp $"); +__RCSID("$NetBSD: t_fifo.c,v 1.2 2017/01/10 22:36:29 christos Exp $"); #include #include +#include #include #include diff --git a/fs/nfs/nfsservice/Makefile b/fs/nfs/nfsservice/Makefile index 307b01c54223..3385ae4cc36b 100644 --- a/fs/nfs/nfsservice/Makefile +++ b/fs/nfs/nfsservice/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2015/12/23 18:42:23 christos Exp $ +# $NetBSD: Makefile,v 1.12 2016/08/13 11:20:00 christos Exp $ # NOMAN= 1 @@ -18,10 +18,11 @@ TESTS_C=rumpnfsd SRCS.rumpnfsd= rumpnfsd.c nfsd.c mountd.c getmntinfo.c get_net.c +LDADD+= -lrumpnet -lrumpnet_net -lrumpnet_local +LDADD+= -lrumpnet_netinet6 -lrumpnet_netinet # TCP/IP LDADD+= -lrumpfs_nfsserver -lrumpfs_nfs # NFS support LDADD+= -lrumpdev_disk -lrumpdev # disk devices LDADD+= -lrumpfs_ffs -lrumpvfs # FFS -LDADD+= -lrumpnet_netinet -lrumpnet_net -lrumpnet_local # TCP/IP LDADD+= -lrumpnet_shmif # shmif LDADD+= -lrumpnet -lrumpkern_sysproxy -lrump -lrumpuser # base LDADD+= -lpthread -lutil diff --git a/fs/psshfs/t_psshfs.sh b/fs/psshfs/t_psshfs.sh index 241d46d5d040..4d8fede15494 100755 --- a/fs/psshfs/t_psshfs.sh +++ b/fs/psshfs/t_psshfs.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_psshfs.sh,v 1.7 2013/03/16 07:54:04 jmmv Exp $ +# $NetBSD: t_psshfs.sh,v 1.8 2016/09/05 08:53:57 christos Exp $ # # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -262,6 +262,26 @@ setattr_cache_cleanup() { stop_ssh } +atf_test_case read_empty_file cleanup +read_empty_file_head() { + atf_set "descr" "Checks whether an empty file can be read" + # This test is supposed to make sure psshfs does not hang + # when reading from an empty file, hence the timeout. + atf_set "timeout" 8 +} +read_empty_file_body() { + require_puffs + start_ssh + atf_check mkdir root mnt + atf_check -x ': > root/empty' + mount_psshfs root mnt + atf_check cat mnt/empty +} +read_empty_file_cleanup() { + umount mnt + stop_ssh +} + # ------------------------------------------------------------------------- # Initialization. # ------------------------------------------------------------------------- @@ -271,4 +291,5 @@ atf_init_test_cases() { atf_add_test_case pwd atf_add_test_case ls #atf_add_test_case setattr_cache + atf_add_test_case read_empty_file } diff --git a/fs/puffs/t_basic.c b/fs/puffs/t_basic.c index ce5e4ea15f83..735108d64f44 100644 --- a/fs/puffs/t_basic.c +++ b/fs/puffs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.12 2013/10/19 17:45:00 christos Exp $ */ +/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */ #include #include @@ -286,7 +286,7 @@ ATF_TC_BODY(inactive_reclaim, tc) rump_sys_close(fd); syncbar(FSTEST_MNTNAME); - ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE], 1); + ATF_REQUIRE(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE] > 0); ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_RECLAIM], 1); FSTEST_EXIT(); @@ -383,7 +383,7 @@ ATF_TC_BODY(unlink_accessible, tc) syncbar(FSTEST_MNTNAME); ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_RECLAIM], 1); - ATF_REQUIRE_EQ(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE], ianow+1); + ATF_REQUIRE(pargs->pta_vn_toserv_ops[PUFFS_VN_INACTIVE] > ianow); ATF_REQUIRE_STREQ(buf, MAGICSTR); diff --git a/fs/vfs/Makefile b/fs/vfs/Makefile index 55c4dc86a91f..48bca611f95c 100644 --- a/fs/vfs/Makefile +++ b/fs/vfs/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.20 2015/01/07 22:24:03 pooka Exp $ +# $NetBSD: Makefile,v 1.22 2016/08/27 08:38:58 christos Exp $ # .include @@ -16,6 +16,8 @@ TESTS_C+= t_unpriv TESTS_C+= t_vfsops TESTS_C+= t_vnops +LDADD+=-lrumpnet_shmif -lrumpnet -lrumpnet_net -lrumpnet_netinet# TCP/IP +LDADD+=-lrumpfs_nfs # NFS LDADD+=-lrumpfs_ext2fs # ext2fs LDADD+=-lrumpfs_ffs # ffs LDADD+=-lrumpfs_lfs # lfs @@ -33,9 +35,8 @@ LDADD+=-lrumpdev_disk -lrumpdev # disk device VFSTESTDIR != cd ${.CURDIR}/../common && ${PRINTOBJDIR} LDADD+=-L${VFSTESTDIR} -lvfstest -LDADD+=-lrumpfs_nfs # NFS -LDADD+=-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet LDADD+=-lrumpvfs -lrumpkern_sysproxy -lrump -lrumpuser # base +LDADD+=-lrumpnet # static linking LDADD+=-lpthread LDADD+=-lutil diff --git a/fs/vfs/t_vnops.c b/fs/vfs/t_vnops.c index 08203dde0cfa..978fadb04c26 100644 --- a/fs/vfs/t_vnops.c +++ b/fs/vfs/t_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.55 2016/01/28 10:10:09 martin Exp $ */ +/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -55,10 +56,10 @@ atf_tc_skip("symlinks not supported by file system") static char * -md(char *buf, const char *base, const char *tail) +md(char *buf, size_t buflen, const char *base, const char *tail) { - sprintf(buf, "%s/%s", base, tail); + snprintf(buf, buflen, "%s/%s", base, tail); return buf; } @@ -69,11 +70,11 @@ lookup_simple(const atf_tc_t *tc, const char *mountpath) struct stat sb1, sb2; strcpy(final, mountpath); - sprintf(pb, "%s/../%s", mountpath, basename(final)); + snprintf(pb, sizeof(pb), "%s/../%s", mountpath, basename(final)); if (rump_sys_stat(pb, &sb1) == -1) atf_tc_fail_errno("stat 1"); - sprintf(pb, "%s/./../%s", mountpath, basename(final)); + snprintf(pb, sizeof(pb), "%s/./../%s", mountpath, basename(final)); if (rump_sys_stat(pb, &sb2) == -1) atf_tc_fail_errno("stat 2"); @@ -85,22 +86,38 @@ lookup_complex(const atf_tc_t *tc, const char *mountpath) { char pb[MAXPATHLEN]; struct stat sb1, sb2; + struct timespec atplus1, onesec; USES_DIRS; - if (FSTYPE_UDF(tc)) - atf_tc_expect_fail("PR kern/49033"); - - sprintf(pb, "%s/dir", mountpath); + snprintf(pb, sizeof(pb), "%s/dir", mountpath); if (rump_sys_mkdir(pb, 0777) == -1) atf_tc_fail_errno("mkdir"); if (rump_sys_stat(pb, &sb1) == -1) atf_tc_fail_errno("stat 1"); - sprintf(pb, "%s/./dir/../././dir/.", mountpath); + snprintf(pb, sizeof(pb), "%s/./dir/../././dir/.", mountpath); if (rump_sys_stat(pb, &sb2) == -1) atf_tc_fail_errno("stat 2"); + /* + * The lookup is permitted to modify the access time of + * any directories searched - such a directory is the + * subject of this test. Any difference should cause + * the 2nd lookup atime tp be >= the first, if it is ==, all is + * OK (atime is not required to be modified by the search, or + * both references may happen within the came clock tick), if the + * 2nd lookup atime is > the first, but not "too much" greater, + * just set it back, so the memcmp just below succeeds + * (assuming all else is OK). + */ + onesec.tv_sec = 1; + onesec.tv_nsec = 0; + timespecadd(&sb1.st_atimespec, &onesec, &atplus1); + if (timespeccmp(&sb2.st_atimespec, &sb1.st_atimespec, >) && + timespeccmp(&sb2.st_atimespec, &atplus1, <)) + sb2.st_atimespec = sb1.st_atimespec; + if (memcmp(&sb1, &sb2, sizeof(sb1)) != 0) { printf("what\tsb1\t\tsb2\n"); @@ -133,9 +150,6 @@ lookup_complex(const atf_tc_t *tc, const char *mountpath) atf_tc_fail("stat results differ, see ouput for more details"); } - if (FSTYPE_UDF(tc)) - atf_tc_fail("random failure of PR kern/49033 " - "did not happen this time"); } static void @@ -147,7 +161,7 @@ dir_simple(const atf_tc_t *tc, const char *mountpath) USES_DIRS; /* check we can create directories */ - sprintf(pb, "%s/dir", mountpath); + snprintf(pb, sizeof(pb), "%s/dir", mountpath); if (rump_sys_mkdir(pb, 0777) == -1) atf_tc_fail_errno("mkdir"); if (rump_sys_stat(pb, &sb) == -1) @@ -169,11 +183,11 @@ dir_notempty(const atf_tc_t *tc, const char *mountpath) USES_DIRS; /* check we can create directories */ - sprintf(pb, "%s/dir", mountpath); + snprintf(pb, sizeof(pb), "%s/dir", mountpath); if (rump_sys_mkdir(pb, 0777) == -1) atf_tc_fail_errno("mkdir"); - sprintf(pb2, "%s/dir/file", mountpath); + snprintf(pb2, sizeof(pb2), "%s/dir/file", mountpath); fd = rump_sys_open(pb2, O_RDWR | O_CREAT, 0777); if (fd == -1) atf_tc_fail_errno("create file"); @@ -205,9 +219,9 @@ dir_rmdirdotdot(const atf_tc_t *tc, const char *mp) RL(rump_sys_mkdir("subtest", 0777)); RL(rump_sys_chdir("subtest")); - md(pb, mp, "test/subtest"); + md(pb, sizeof(pb), mp, "test/subtest"); RL(rump_sys_rmdir(pb)); - md(pb, mp, "test"); + md(pb, sizeof(pb), mp, "test"); RL(rump_sys_rmdir(pb)); if (FSTYPE_NFS(tc)) @@ -225,7 +239,7 @@ checkfile(const char *path, struct stat *refp) struct stat sb; static int n = 1; - md(buf, path, "file"); + md(buf, sizeof(buf), path, "file"); if (rump_sys_stat(buf, &sb) == -1) atf_tc_fail_errno("cannot stat file %d (%s)", n, buf); if (memcmp(&sb, refp, sizeof(sb)) != 0) @@ -244,18 +258,18 @@ rename_dir(const atf_tc_t *tc, const char *mp) USES_DIRS; - md(pb1, mp, "dir1"); + md(pb1, sizeof(pb1), mp, "dir1"); if (rump_sys_mkdir(pb1, 0777) == -1) atf_tc_fail_errno("mkdir 1"); - md(pb2, mp, "dir2"); + md(pb2, sizeof(pb2), mp, "dir2"); if (rump_sys_mkdir(pb2, 0777) == -1) atf_tc_fail_errno("mkdir 2"); - md(pb2, mp, "dir2/subdir"); + md(pb2, sizeof(pb2), mp, "dir2/subdir"); if (rump_sys_mkdir(pb2, 0777) == -1) atf_tc_fail_errno("mkdir 3"); - md(pb3, mp, "dir1/file"); + md(pb3, sizeof(pb3), mp, "dir1/file"); if (rump_sys_mknod(pb3, S_IFREG | 0777, -1) == -1) atf_tc_fail_errno("create file"); if (rump_sys_stat(pb3, &ref) == -1) @@ -266,13 +280,13 @@ rename_dir(const atf_tc_t *tc, const char *mp) */ /* rename within directory */ - md(pb3, mp, "dir3"); + md(pb3, sizeof(pb3), mp, "dir3"); if (rump_sys_rename(pb1, pb3) == -1) atf_tc_fail_errno("rename 1"); checkfile(pb3, &ref); /* rename directory onto itself (two ways, should fail) */ - md(pb1, mp, "dir3/."); + md(pb1, sizeof(pb1), mp, "dir3/."); if (rump_sys_rename(pb1, pb3) != -1 || errno != EINVAL) atf_tc_fail_errno("rename 2"); if (rump_sys_rename(pb3, pb1) != -1 || errno != EISDIR) @@ -281,13 +295,13 @@ rename_dir(const atf_tc_t *tc, const char *mp) checkfile(pb3, &ref); /* rename father of directory into directory */ - md(pb1, mp, "dir2/dir"); - md(pb2, mp, "dir2"); + md(pb1, sizeof(pb1), mp, "dir2/dir"); + md(pb2, sizeof(pb2), mp, "dir2"); if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL) atf_tc_fail_errno("rename 4"); /* same for grandfather */ - md(pb1, mp, "dir2/subdir/dir2"); + md(pb1, sizeof(pb1), mp, "dir2/subdir/dir2"); if (rump_sys_rename(pb2, pb1) != -1 || errno != EINVAL) atf_tc_fail("rename 5"); @@ -298,29 +312,29 @@ rename_dir(const atf_tc_t *tc, const char *mp) atf_tc_fail("rename 6"); /* cross-directory rename */ - md(pb1, mp, "dir3"); - md(pb2, mp, "dir2/somedir"); + md(pb1, sizeof(pb1), mp, "dir3"); + md(pb2, sizeof(pb2), mp, "dir2/somedir"); if (rump_sys_rename(pb1, pb2) == -1) atf_tc_fail_errno("rename 7"); checkfile(pb2, &ref); /* move to parent directory */ - md(pb1, mp, "dir2/somedir/../../dir3"); + md(pb1, sizeof(pb1), mp, "dir2/somedir/../../dir3"); if (rump_sys_rename(pb2, pb1) == -1) atf_tc_fail_errno("rename 8"); - md(pb1, mp, "dir2/../dir3"); + md(pb1, sizeof(pb1), mp, "dir2/../dir3"); checkfile(pb1, &ref); /* atomic cross-directory rename */ - md(pb3, mp, "dir2/subdir"); + md(pb3, sizeof(pb3), mp, "dir2/subdir"); if (rump_sys_rename(pb1, pb3) == -1) atf_tc_fail_errno("rename 9"); checkfile(pb3, &ref); /* rename directory over an empty directory */ - md(pb1, mp, "parent"); - md(pb2, mp, "parent/dir1"); - md(pb3, mp, "parent/dir2"); + md(pb1, sizeof(pb1), mp, "parent"); + md(pb2, sizeof(pb2), mp, "parent/dir1"); + md(pb3, sizeof(pb3), mp, "parent/dir2"); RL(rump_sys_mkdir(pb1, 0777)); RL(rump_sys_mkdir(pb2, 0777)); RL(rump_sys_mkdir(pb3, 0777)); @@ -467,15 +481,15 @@ create_many(const atf_tc_t *tc, const char *mp) for (i = 0; i < nfiles; i++) { int fd; - sprintf(buf, TESTFN "%d", i); + snprintf(buf, sizeof(buf), TESTFN "%d", i); RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666)); RL(rump_sys_close(fd)); } /* wipe them out */ for (i = 0; i < nfiles; i++) { - sprintf(buf, TESTFN "%d", i); - RL(rump_sys_unlink(buf)); + snprintf(buf, sizeof(buf), TESTFN "%d", i); + RLF(rump_sys_unlink(buf), "%s", buf); } #undef TESTFN @@ -499,12 +513,12 @@ create_nonalphanum(const atf_tc_t *tc, const char *mp) for (i = 0; i < 256; i++) { int fd; - sprintf(buf, "%c", i); + snprintf(buf, sizeof(buf), "%c", i); fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666); if (fd == -1) continue; - RL(rump_sys_close(fd)); - RL(rump_sys_unlink(buf)); + RLF(rump_sys_close(fd), "%d", fd); + RLF(rump_sys_unlink(buf), "%s", buf); } printf("\n"); @@ -632,7 +646,7 @@ symlink_len(const atf_tc_t *tc, const char *mp, size_t len) USES_SYMLINKS; - RL(rump_sys_chdir(mp)); + RLF(rump_sys_chdir(mp), "%s", mp); buf = malloc(len + 1); ATF_REQUIRE(buf); diff --git a/h_macros.h b/h_macros.h index 29b4e9901042..dd730c9efe4d 100644 --- a/h_macros.h +++ b/h_macros.h @@ -1,4 +1,4 @@ -/* $NetBSD: h_macros.h,v 1.12 2016/08/04 11:49:07 jakllsch Exp $ */ +/* $NetBSD: h_macros.h,v 1.13 2016/08/20 15:49:08 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -45,6 +45,8 @@ ATF_CHECK_MSG((x) != (v), "%s: %s", #x, strerror(errno)) #define RL(x) REQUIRE_LIBC(x, -1) +#define RLF(x, fmt, arg) \ + ATF_CHECK_MSG((x) != -1, "%s [" fmt "]: %s", #x, arg, strerror(errno)) #define RZ(x) \ do { \ int RZ_rv = x; \ diff --git a/kernel/Makefile b/kernel/Makefile index 5df392d9e499..be79f1615116 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.39 2016/02/15 14:59:38 christos Exp $ +# $NetBSD: Makefile,v 1.44 2016/12/14 06:19:59 kamil Exp $ NOMAN= # defined @@ -6,9 +6,17 @@ NOMAN= # defined TESTSDIR= ${TESTSBASE}/kernel -TESTS_SUBDIRS= kqueue +TESTS_SUBDIRS= arch +TESTS_SUBDIRS+= kqueue TESTS_C= t_lock TESTS_C+= t_lockf +TESTS_C+= t_ptrace +TESTS_C+= t_ptrace_wait +TESTS_C+= t_ptrace_wait3 +TESTS_C+= t_ptrace_wait4 +TESTS_C+= t_ptrace_wait6 +TESTS_C+= t_ptrace_waitid +TESTS_C+= t_ptrace_waitpid TESTS_C+= t_pty TESTS_C+= t_mqueue TESTS_C+= t_sysv @@ -38,10 +46,10 @@ LDADD.t_extattrctl+= -lrump -lpthread LDADD.t_filedesc+= ${LDADD.t_rnd} LDADD.t_rnd+= -lrumpvfs -lrumpdev_rnd -lrumpdev -lrump -lrumpuser LDADD.t_rnd+= -lrump -lpthread -CPPFLAGS+= -D_KERNTYPES .endif +CPPFLAGS+= -D_KERNTYPES .PATH: ${NETBSDSRCDIR}/sys/kern TESTS_C+= t_extent diff --git a/kernel/msg.h b/kernel/msg.h new file mode 100644 index 000000000000..547400ee73a6 --- /dev/null +++ b/kernel/msg.h @@ -0,0 +1,136 @@ +/* $NetBSD: msg.h,v 1.1 2016/12/05 20:10:10 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +struct msg_fds { + int pfd[2]; + int cfd[2]; +}; + +#define CLOSEFD(fd) do { \ + if (fd != -1) { \ + close(fd); \ + fd = -1; \ + } \ +} while (/*CONSTCOND*/ 0) + +static int +msg_open(struct msg_fds *fds) +{ + if (pipe(fds->pfd) == -1) + return -1; + if (pipe(fds->cfd) == -1) { + close(fds->pfd[0]); + close(fds->pfd[1]); + return -1; + } + return 0; +} + +static void +msg_close(struct msg_fds *fds) +{ + CLOSEFD(fds->pfd[0]); + CLOSEFD(fds->pfd[1]); + CLOSEFD(fds->cfd[0]); + CLOSEFD(fds->cfd[1]); +} + +static int +msg_write_child(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->cfd[1]); + CLOSEFD(fds->pfd[0]); + + printf("Send %s\n", info); + rv = write(fds->pfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Wait %s\n", info); + rv = read(fds->cfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} + +static int +msg_write_parent(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->pfd[1]); + CLOSEFD(fds->cfd[0]); + + printf("Send %s\n", info); + rv = write(fds->cfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Wait %s\n", info); + rv = read(fds->pfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} + +static int +msg_read_parent(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->pfd[1]); + CLOSEFD(fds->cfd[0]); + + printf("Wait %s\n", info); + rv = read(fds->pfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Send %s\n", info); + rv = write(fds->cfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} + +static int +msg_read_child(const char *info, struct msg_fds *fds, void *msg, size_t len) +{ + ssize_t rv; + CLOSEFD(fds->cfd[1]); + CLOSEFD(fds->pfd[0]); + + printf("Wait %s\n", info); + rv = read(fds->cfd[0], msg, len); + if (rv != (ssize_t)len) + return 1; +// printf("Send %s\n", info); + rv = write(fds->pfd[1], msg, len); + if (rv != (ssize_t)len) + return 1; + return 0; +} diff --git a/kernel/t_mqueue.c b/kernel/t_mqueue.c index 2a0310116207..7206bc6ef917 100644 --- a/kernel/t_mqueue.c +++ b/kernel/t_mqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mqueue.c,v 1.4 2014/03/02 19:56:48 jmmv Exp $ */ +/* $NetBSD: t_mqueue.c,v 1.5 2017/01/10 22:10:22 christos Exp $ */ /* * Test for POSIX message queue priority handling. @@ -7,6 +7,7 @@ */ #include +#include #include #include diff --git a/kernel/t_ptrace.c b/kernel/t_ptrace.c new file mode 100644 index 000000000000..074a953a93e7 --- /dev/null +++ b/kernel/t_ptrace.c @@ -0,0 +1,208 @@ +/* $NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "../h_macros.h" + +/* + * A child process cannot call atf functions and expect them to magically + * work like in the parent. + * The printf(3) messaging from a child will not work out of the box as well + * without estabilishing a communication protocol with its parent. To not + * overcomplicate the tests - do not log from a child and use err(3)/errx(3) + * wrapped with FORKEE_ASSERT()/FORKEE_ASSERTX() as that is guaranteed to work. + */ +#define FORKEE_ASSERTX(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + errx(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s", \ + __FILE__, __LINE__, __func__, #x); \ +} while (0) + +#define FORKEE_ASSERT(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + err(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s", \ + __FILE__, __LINE__, __func__, #x); \ +} while (0) + +ATF_TC(attach_pid0); +ATF_TC_HEAD(attach_pid0, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to PID 0"); +} + +ATF_TC_BODY(attach_pid0, tc) +{ + errno = 0; + ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 0, NULL, 0) == -1); +} + +ATF_TC(attach_pid1); +ATF_TC_HEAD(attach_pid1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to PID 1 (as non-root)"); + + atf_tc_set_md_var(tc, "require.user", "unprivileged"); +} + +ATF_TC_BODY(attach_pid1, tc) +{ + ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1); +} + +ATF_TC(attach_pid1_securelevel); +ATF_TC_HEAD(attach_pid1_securelevel, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to PID 1 with " + "securelevel >= 1 (as root)"); + + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(attach_pid1_securelevel, tc) +{ + int level; + size_t len = sizeof(level); + + ATF_REQUIRE(sysctlbyname("kern.securelevel", &level, &len, NULL, 0) + != -1); + + if (level < 1) { + atf_tc_skip("Test must be run with securelevel >= 1"); + } + + ATF_REQUIRE_ERRNO(EPERM, ptrace(PT_ATTACH, 1, NULL, 0) == -1); +} + +ATF_TC(attach_self); +ATF_TC_HEAD(attach_self, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot attach to self (as it's nonsense)"); +} + +ATF_TC_BODY(attach_self, tc) +{ + ATF_REQUIRE_ERRNO(EINVAL, ptrace(PT_ATTACH, getpid(), NULL, 0) == -1); +} + +ATF_TC(attach_chroot); +ATF_TC_HEAD(attach_chroot, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that a debugger cannot trace another process unless the " + "process's root directory is at or below the tracing process's " + "root"); + + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(attach_chroot, tc) +{ + char buf[PATH_MAX]; + pid_t child; + int fds_toparent[2], fds_fromparent[2]; + int rv; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ + + (void)memset(buf, '\0', sizeof(buf)); + ATF_REQUIRE(getcwd(buf, sizeof(buf)) != NULL); + (void)strlcat(buf, "/dir", sizeof(buf)); + + ATF_REQUIRE(mkdir(buf, 0500) == 0); + ATF_REQUIRE(chdir(buf) == 0); + + ATF_REQUIRE(pipe(fds_toparent) == 0); + ATF_REQUIRE(pipe(fds_fromparent) == 0); + child = atf_utils_fork(); + if (child == 0) { + FORKEE_ASSERT(close(fds_toparent[0]) == 0); + FORKEE_ASSERT(close(fds_fromparent[1]) == 0); + + FORKEE_ASSERT(chroot(buf) == 0); + + rv = write(fds_toparent[1], &msg, sizeof(msg)); + FORKEE_ASSERTX(rv == sizeof(msg)); + + ATF_REQUIRE_ERRNO(EPERM, + ptrace(PT_ATTACH, getppid(), NULL, 0) == -1); + + rv = read(fds_fromparent[0], &msg, sizeof(msg)); + FORKEE_ASSERTX(rv == sizeof(msg)); + + _exit(0); + } + ATF_REQUIRE(close(fds_toparent[1]) == 0); + ATF_REQUIRE(close(fds_fromparent[0]) == 0); + + printf("Waiting for chrooting of the child PID %d", child); + rv = read(fds_toparent[0], &msg, sizeof(msg)); + ATF_REQUIRE(rv == sizeof(msg)); + + printf("Child is ready, it will try to PT_ATTACH to parent\n"); + rv = write(fds_fromparent[1], &msg, sizeof(msg)); + ATF_REQUIRE(rv == sizeof(msg)); + + printf("fds_fromparent is no longer needed - close it\n"); + ATF_REQUIRE(close(fds_fromparent[1]) == 0); + + printf("fds_toparent is no longer needed - close it\n"); + ATF_REQUIRE(close(fds_toparent[0]) == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + ATF_TP_ADD_TC(tp, attach_pid0); + ATF_TP_ADD_TC(tp, attach_pid1); + ATF_TP_ADD_TC(tp, attach_pid1_securelevel); + ATF_TP_ADD_TC(tp, attach_self); + ATF_TP_ADD_TC(tp, attach_chroot); + + return atf_no_error(); +} diff --git a/kernel/t_ptrace_wait.c b/kernel/t_ptrace_wait.c new file mode 100644 index 000000000000..e502a034eb1b --- /dev/null +++ b/kernel/t_ptrace_wait.c @@ -0,0 +1,5082 @@ +/* $NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "../h_macros.h" + +#include "t_ptrace_wait.h" +#include "msg.h" + +#define PARENT_TO_CHILD(info, fds, msg) \ + ATF_REQUIRE(msg_write_child(info " to child " # fds, &fds, &msg, sizeof(msg)) == 0) + +#define CHILD_FROM_PARENT(info, fds, msg) \ + FORKEE_ASSERT(msg_read_parent(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0) + +#define CHILD_TO_PARENT(info, fds, msg) \ + FORKEE_ASSERT(msg_write_parent(info " to parent " # fds, &fds, &msg, sizeof(msg)) == 0) + +#define PARENT_FROM_CHILD(info, fds, msg) \ + ATF_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0) + +ATF_TC(traceme1); +ATF_TC_HEAD(traceme1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by _exit(2) in a child"); +} + +ATF_TC_BODY(traceme1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(traceme2); +ATF_TC_HEAD(traceme2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by _exit(2) in a child"); +} + +static int traceme2_caught = 0; + +static void +traceme2_sighandler(int sig) +{ + FORKEE_ASSERT_EQ(sig, SIGINT); + + ++traceme2_caught; +} + +ATF_TC_BODY(traceme2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP, sigsent = SIGINT; + pid_t child, wpid; + struct sigaction sa; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + sa.sa_handler = traceme2_sighandler; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + + FORKEE_ASSERT(sigaction(sigsent, &sa, NULL) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(traceme2_caught, 1); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and with " + "signal %s to be sent\n", strsignal(sigsent)); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the exited child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(traceme3); +ATF_TC_HEAD(traceme3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by termination by a signal in a child"); +} + +ATF_TC_BODY(traceme3, tc) +{ + const int sigval = SIGSTOP, sigsent = SIGINT /* Without core-dump */; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && + "Child should be terminated by a signal from its parent"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and with " + "signal %s to be sent\n", strsignal(sigsent)); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_signaled(status, sigsent, 0); + + printf("Before calling %s() for the exited child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(traceme4); +ATF_TC_HEAD(traceme4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify SIGSTOP followed by SIGCONT and _exit(2) in a child"); +} + +ATF_TC_BODY(traceme4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP, sigsent = SIGCONT; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before raising %s from child\n", strsignal(sigsent)); + FORKEE_ASSERT(raise(sigsent) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(),child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigsent); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the exited child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach1); +ATF_TC_HEAD(attach1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees process termination before the parent"); +} + +ATF_TC_BODY(attach1, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + // Wait for parent to let us exit + CHILD_FROM_PARENT("exit tracee", parent_tracee, msg); + _exit(exitval_tracee); + } + + printf("Spawn debugger\n"); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracer = atf_utils_fork(); + if (tracer == 0) { + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + + /* Wait for parent to tell use that tracee should have exited */ + CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + printf("Tracee %d exited with %d\n", tracee, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("exit tracee", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + + printf("Assert that there is no status about tracee %d - " + "Tracer must detect zombie first - calling %s()\n", tracee, + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Tell the tracer child should have exited\n"); + PARENT_TO_CHILD("wait for tracee exit", parent_tracer, msg); + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + + printf("Wait from tracer child to complete waiting for tracee\n"); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); +} +#endif + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach2); +ATF_TC_HEAD(attach2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that any tracer sees process termination before its " + "parent"); +} + +ATF_TC_BODY(attach2, tc) +{ + struct msg_fds parent_tracer, parent_tracee; + const int exitval_tracee = 5; + const int exitval_tracer1 = 10, exitval_tracer2 = 20; + pid_t tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + /* Wait for message from the parent */ + CHILD_FROM_PARENT("Message 1", parent_tracee, msg); + _exit(exitval_tracee); + } + + printf("Spawn debugger\n"); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* Fork again and drop parent to reattach to PID 1 */ + tracer = atf_utils_fork(); + if (tracer != 0) + _exit(exitval_tracer1); + + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("Message 1", parent_tracer, msg); + CHILD_FROM_PARENT("Message 2", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer2); + } + printf("Wait for the tracer process (direct child) to exit calling " + "%s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracer, &status, 0), tracer); + + validate_status_exited(status, exitval_tracer1); + + printf("Wait for the non-exited tracee process with %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, NULL, WNOHANG), 0); + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("Message 1", parent_tracer, msg); + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("Message 2", parent_tracer, msg); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); + +} +#endif + +ATF_TC(attach3); +ATF_TC_HEAD(attach3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer parent can PT_ATTACH to its child"); +} + +ATF_TC_BODY(attach3, tc) +{ + struct msg_fds parent_tracee; + const int exitval_tracee = 5; + pid_t tracee, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + CHILD_FROM_PARENT("Message 1", parent_tracee, msg); + printf("Parent should now attach to tracee\n"); + + CHILD_FROM_PARENT("Message 2", parent_tracee, msg); + /* Wait for message from the parent */ + _exit(exitval_tracee); + } + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + + printf("Before calling PT_ATTACH for tracee %d\n", tracee); + ATF_REQUIRE(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + printf("Wait for the stopped tracee process with %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + validate_status_stopped(status, SIGSTOP); + + printf("Resume tracee with PT_CONTINUE\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + printf("Let the tracee exit now\n"); + PARENT_TO_CHILD("Message 2", parent_tracee, msg); + + printf("Wait for tracee to exit with %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + validate_status_exited(status, exitval_tracee); + + printf("Before calling %s() for tracee\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(tracee, &status, 0)); + + msg_close(&parent_tracee); +} + +ATF_TC(attach4); +ATF_TC_HEAD(attach4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer child can PT_ATTACH to its parent"); +} + +ATF_TC_BODY(attach4, tc) +{ + struct msg_fds parent_tracee; + const int exitval_tracer = 5; + pid_t tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracer\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracer = atf_utils_fork(); + if (tracer == 0) { + + /* Wait for message from the parent */ + CHILD_FROM_PARENT("Message 1", parent_tracee, msg); + + printf("Attach to parent PID %d with PT_ATTACH from child\n", + getppid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, getppid(), NULL, 0) != -1); + + printf("Wait for the stopped parent process with %s()\n", + TWAIT_FNAME); + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(getppid(), &status, 0), getppid()); + + forkee_status_stopped(status, SIGSTOP); + + printf("Resume parent with PT_DETACH\n"); + FORKEE_ASSERT(ptrace(PT_DETACH, getppid(), (void *)1, 0) + != -1); + + /* Tell parent we are ready */ + CHILD_TO_PARENT("Message 1", parent_tracee, msg); + + _exit(exitval_tracer); + } + + printf("Wait for the tracer to become ready\n"); + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + printf("Allow the tracer to exit now\n"); + PARENT_FROM_CHILD("Message 1", parent_tracee, msg); + + printf("Wait for tracer to exit with %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracer, &status, 0), tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Before calling %s() for tracer\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(tracer, &status, 0)); + + msg_close(&parent_tracee); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach5); +ATF_TC_HEAD(attach5, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees its parent when attached to tracer " + "(check getppid(2))"); +} + +ATF_TC_BODY(attach5, tc) +{ + struct msg_fds parent_tracer, parent_tracee; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t parent, tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + parent = getppid(); + + /* Emit message to the parent */ + CHILD_TO_PARENT("tracee ready", parent_tracee, msg); + CHILD_FROM_PARENT("exit tracee", parent_tracee, msg); + + FORKEE_ASSERT_EQ(parent, getppid()); + + _exit(exitval_tracee); + } + printf("Wait for child to record its parent identifier (pid)\n"); + PARENT_FROM_CHILD("tracee ready", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* No IPC to communicate with the child */ + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + + /* Wait for parent to tell use that tracee should have exited */ + CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("exit tracee", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Tell the tracer child should have exited\n"); + PARENT_TO_CHILD("wait for tracee exit", parent_tracer, msg); + + printf("Wait from tracer child to complete waiting for tracee\n"); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); +} +#endif + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach6); +ATF_TC_HEAD(attach6, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees its parent when attached to tracer " + "(check sysctl(7) and struct kinfo_proc2)"); +} + +ATF_TC_BODY(attach6, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t parent, tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int name[CTL_MAXNAME]; + struct kinfo_proc2 kp; + size_t len = sizeof(kp); + unsigned int namelen; + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + parent = getppid(); + + /* Emit message to the parent */ + CHILD_TO_PARENT("Message 1", parent_tracee, msg); + CHILD_FROM_PARENT("Message 2", parent_tracee, msg); + + namelen = 0; + name[namelen++] = CTL_KERN; + name[namelen++] = KERN_PROC2; + name[namelen++] = KERN_PROC_PID; + name[namelen++] = getpid(); + name[namelen++] = len; + name[namelen++] = 1; + + FORKEE_ASSERT(sysctl(name, namelen, &kp, &len, NULL, 0) == 0); + FORKEE_ASSERT_EQ(parent, kp.p_ppid); + + _exit(exitval_tracee); + } + + printf("Wait for child to record its parent identifier (pid)\n"); + PARENT_FROM_CHILD("Message 1", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* No IPC to communicate with the child */ + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("Message 1", parent_tracer, msg); + + CHILD_FROM_PARENT("Message 2", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("Message 1", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("Message 1", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("Message 2", parent_tracer, msg); + + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracee); + msg_close(&parent_tracer); +} +#endif + +#if defined(TWAIT_HAVE_PID) +ATF_TC(attach7); +ATF_TC_HEAD(attach7, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Assert that tracer sees its parent when attached to tracer " + "(check /proc/curproc/status 3rd column)"); +} + +ATF_TC_BODY(attach7, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + int rv; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t parent, tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + FILE *fp; + struct stat st; + const char *fname = "/proc/curproc/status"; + char s_executable[MAXPATHLEN]; + int s_pid, s_ppid; + /* + * Format: + * EXECUTABLE PID PPID ... + */ + + ATF_REQUIRE((rv = stat(fname, &st)) == 0 || (errno == ENOENT)); + if (rv != 0) { + atf_tc_skip("/proc/curproc/status not found"); + } + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + parent = getppid(); + + // Wait for parent to let us exit + CHILD_TO_PARENT("tracee ready", parent_tracee, msg); + CHILD_FROM_PARENT("tracee exit", parent_tracee, msg); + + FORKEE_ASSERT((fp = fopen(fname, "r")) != NULL); + fscanf(fp, "%s %d %d", s_executable, &s_pid, &s_ppid); + FORKEE_ASSERT(fclose(fp) == 0); + FORKEE_ASSERT_EQ(parent, s_ppid); + + _exit(exitval_tracee); + } + + printf("Wait for child to record its parent identifier (pid)\n"); + PARENT_FROM_CHILD("tracee ready", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + + /* Wait for parent to tell use that tracee should have exited */ + CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("tracee exit", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("Message 2", parent_tracer, msg); + + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracee); + msg_close(&parent_tracer); +} +#endif + +ATF_TC(eventmask1); +ATF_TC_HEAD(eventmask1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that empty EVENT_MASK is preserved"); +} + +ATF_TC_BODY(eventmask1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t set_event, get_event; + const int len = sizeof(ptrace_event_t); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + set_event.pe_set_event = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); + ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(eventmask2); +ATF_TC_HEAD(eventmask2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PTRACE_FORK in EVENT_MASK is preserved"); +} + +ATF_TC_BODY(eventmask2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t set_event, get_event; + const int len = sizeof(ptrace_event_t); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + set_event.pe_set_event = PTRACE_FORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); + ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(fork1); +ATF_TC_HEAD(fork1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that fork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_FORK"); +} + +ATF_TC_BODY(fork1, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = fork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Enable PTRACE_FORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_FORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_FORK event with forkee %d\n", child2); + + printf("Before calling %s() for the forkee %d of the child %d\n", + TWAIT_FNAME, child2, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + ATF_REQUIRE_EQ(state.pe_other_pid, child); + + printf("Before resuming the forkee process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the forkee - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_exited(status, exitval2); + + printf("Before calling %s() for the forkee - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(child2, &status, 0)); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TC(fork2); +ATF_TC_HEAD(fork2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that fork(2) is not intercepted by ptrace(2) with empty " + "EVENT_MASK"); +} + +ATF_TC_BODY(fork2, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = fork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Set empty EVENT_MASK for the child %d\n", child); + event.pe_set_event = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(vfork1); +ATF_TC_HEAD(vfork1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_VFORK"); +} + +ATF_TC_BODY(vfork1, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + + /* + * ptrace(2) command PT_SET_EVENT_MASK: option PTRACE_VFORK unsupported + */ +#ifndef PTRACE_VFORK +#define PTRACE_VFORK 0 +#endif + atf_tc_expect_fail("PR kern/51630"); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = vfork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Enable PTRACE_VFORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_VFORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_VFORK event with forkee %d\n", child2); + + printf("Before calling %s() for the forkee %d of the child %d\n", + TWAIT_FNAME, child2, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK); + ATF_REQUIRE_EQ(state.pe_other_pid, child); + + printf("Before resuming the forkee process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the forkee - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_exited(status, exitval2); + + printf("Before calling %s() for the forkee - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(child2, &status, 0)); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TC(vfork2); +ATF_TC_HEAD(vfork2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that vfork(2) is not intercepted by ptrace(2) with empty " + "EVENT_MASK"); +} + +ATF_TC_BODY(vfork2, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = vfork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Set empty EVENT_MASK for the child %d\n", child); + event.pe_set_event = 0; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d1); +ATF_TC_HEAD(io_read_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint8_t)"); +} + +ATF_TC_BODY(io_read_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me = 0; + const uint8_t magic = 0xab; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d2); +ATF_TC_HEAD(io_read_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint16_t)"); +} + +ATF_TC_BODY(io_read_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint16_t lookup_me = 0; + const uint16_t magic = 0x1234; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx16 " != expected %" PRIx16, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d3); +ATF_TC_HEAD(io_read_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint32_t)"); +} + +ATF_TC_BODY(io_read_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint32_t lookup_me = 0; + const uint32_t magic = 0x1234abcd; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx32 " != expected %" PRIx32, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d4); +ATF_TC_HEAD(io_read_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and len = sizeof(uint64_t)"); +} + +ATF_TC_BODY(io_read_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint64_t lookup_me = 0; + const uint64_t magic = 0x1234abcd9876dcfa; + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx64 " != expected %" PRIx64, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d1); +ATF_TC_HEAD(io_write_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint8_t)"); +} + +ATF_TC_BODY(io_write_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me = 0; + const uint8_t magic = 0xab; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d2); +ATF_TC_HEAD(io_write_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint16_t)"); +} + +ATF_TC_BODY(io_write_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint16_t lookup_me = 0; + const uint16_t magic = 0xab12; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d3); +ATF_TC_HEAD(io_write_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint32_t)"); +} + +ATF_TC_BODY(io_write_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint32_t lookup_me = 0; + const uint32_t magic = 0xab127643; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_write_d4); +ATF_TC_HEAD(io_write_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and len = sizeof(uint64_t)"); +} + +ATF_TC_BODY(io_write_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint64_t lookup_me = 0; + const uint64_t magic = 0xab12764376490123; + struct ptrace_io_desc io = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me = magic; + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d1); +ATF_TC_HEAD(read_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called once"); +} + +ATF_TC_BODY(read_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me = 0; + const int magic = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me = magic; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me = ptrace(PT_READ_D, child, &lookup_me, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %#x != expected %#x", lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d2); +ATF_TC_HEAD(read_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called twice"); +} + +ATF_TC_BODY(read_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me1 = magic1; + lookup_me2 = magic2; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d3); +ATF_TC_HEAD(read_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called three times"); +} + +ATF_TC_BODY(read_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me1 = magic1; + lookup_me2 = magic2; + lookup_me3 = magic3; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_D, child, &lookup_me3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d4); +ATF_TC_HEAD(read_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D called four times"); +} + +ATF_TC_BODY(read_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int lookup_me4 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); + const int magic4 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me1 = magic1; + lookup_me2 = magic2; + lookup_me3 = magic3; + lookup_me4 = magic4; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_D, child, &lookup_me1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_D, child, &lookup_me2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_D, child, &lookup_me3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Read new lookup_me4 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me4 = ptrace(PT_READ_D, child, &lookup_me4, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me4, magic4, + "got value %#x != expected %#x", lookup_me4, magic4); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d1); +ATF_TC_HEAD(write_d1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called once"); +} + +ATF_TC_BODY(write_d1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me = 0; + const int magic = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me, magic); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me, magic) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d2); +ATF_TC_HEAD(write_d2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called twice"); +} + +ATF_TC_BODY(write_d2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me1, magic1); + FORKEE_ASSERT_EQ(lookup_me2, magic2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me1 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me1, magic1) != -1); + + printf("Write new lookup_me2 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me2, magic2) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d3); +ATF_TC_HEAD(write_d3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called three times"); +} + +ATF_TC_BODY(write_d3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me1, magic1); + FORKEE_ASSERT_EQ(lookup_me2, magic2); + FORKEE_ASSERT_EQ(lookup_me3, magic3); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me1 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me1, magic1) != -1); + + printf("Write new lookup_me2 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me2, magic2) != -1); + + printf("Write new lookup_me3 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me3, magic3) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(write_d4); +ATF_TC_HEAD(write_d4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D called four times"); +} + +ATF_TC_BODY(write_d4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int lookup_me4 = 0; + const int magic1 = (int)random(); + const int magic2 = (int)random(); + const int magic3 = (int)random(); + const int magic4 = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me1, magic1); + FORKEE_ASSERT_EQ(lookup_me2, magic2); + FORKEE_ASSERT_EQ(lookup_me3, magic3); + FORKEE_ASSERT_EQ(lookup_me4, magic4); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me1 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me1, magic1) != -1); + + printf("Write new lookup_me2 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me2, magic2) != -1); + + printf("Write new lookup_me3 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me3, magic3) != -1); + + printf("Write new lookup_me4 to tracee (PID=%d) from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_WRITE_D, child, &lookup_me4, magic4) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d_write_d_handshake1); +ATF_TC_HEAD(io_read_d_write_d_handshake1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_D and PIOD_WRITE_D handshake"); +} + +ATF_TC_BODY(io_read_d_write_d_handshake1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me_fromtracee = 0; + const uint8_t magic_fromtracee = (uint8_t)random(); + uint8_t lookup_me_totracee = 0; + const uint8_t magic_totracee = (uint8_t)random(); + struct ptrace_io_desc io_fromtracee = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me_fromtracee, + .piod_addr = &lookup_me_fromtracee, + .piod_len = sizeof(lookup_me_fromtracee) + }; + struct ptrace_io_desc io_totracee = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me_totracee, + .piod_addr = &lookup_me_totracee, + .piod_len = sizeof(lookup_me_totracee) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_fromtracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_fromtracee, + magic_fromtracee); + + lookup_me_totracee = magic_totracee; + + printf("Write lookup_me_totracee to PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_totracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_totracee, magic_totracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_totracee, + magic_totracee); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_d_write_d_handshake2); +ATF_TC_HEAD(io_read_d_write_d_handshake2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_WRITE_D and PIOD_READ_D handshake"); +} + +ATF_TC_BODY(io_read_d_write_d_handshake2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me_fromtracee = 0; + const uint8_t magic_fromtracee = (uint8_t)random(); + uint8_t lookup_me_totracee = 0; + const uint8_t magic_totracee = (uint8_t)random(); + struct ptrace_io_desc io_fromtracee = { + .piod_op = PIOD_READ_D, + .piod_offs = &lookup_me_fromtracee, + .piod_addr = &lookup_me_fromtracee, + .piod_len = sizeof(lookup_me_fromtracee) + }; + struct ptrace_io_desc io_totracee = { + .piod_op = PIOD_WRITE_D, + .piod_offs = &lookup_me_totracee, + .piod_addr = &lookup_me_totracee, + .piod_len = sizeof(lookup_me_totracee) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + lookup_me_totracee = magic_totracee; + + printf("Write lookup_me_totracee to PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_totracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_totracee, magic_totracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_totracee, + magic_totracee); + + printf("Read lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io_fromtracee, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me_fromtracee, + magic_fromtracee); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d_write_d_handshake1); +ATF_TC_HEAD(read_d_write_d_handshake1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_D with PT_WRITE_D handshake"); +} + +ATF_TC_BODY(read_d_write_d_handshake1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me_fromtracee = 0; + const int magic_fromtracee = (int)random(); + int lookup_me_totracee = 0; + const int magic_totracee = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me_fromtracee = + ptrace(PT_READ_D, child, &lookup_me_fromtracee, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %#x != expected %#x", lookup_me_fromtracee, + magic_fromtracee); + + printf("Write new lookup_me_totracee to PID=%d from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE + (ptrace(PT_WRITE_D, child, &lookup_me_totracee, magic_totracee) + != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_d_write_d_handshake2); +ATF_TC_HEAD(read_d_write_d_handshake2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_WRITE_D with PT_READ_D handshake"); +} + +ATF_TC_BODY(read_d_write_d_handshake2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me_fromtracee = 0; + const int magic_fromtracee = (int)random(); + int lookup_me_totracee = 0; + const int magic_totracee = (int)random(); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + lookup_me_fromtracee = magic_fromtracee; + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(lookup_me_totracee, magic_totracee); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Write new lookup_me_totracee to PID=%d from tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE + (ptrace(PT_WRITE_D, child, &lookup_me_totracee, magic_totracee) + != -1); + + printf("Read new lookup_me_fromtracee PID=%d by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me_fromtracee = + ptrace(PT_READ_D, child, &lookup_me_fromtracee, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me_fromtracee, magic_fromtracee, + "got value %#x != expected %#x", lookup_me_fromtracee, + magic_fromtracee); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +/* These dummy functions are used to be copied with ptrace(2) calls */ +static int __used +dummy_fn1(int a, int b, int c, int d) +{ + + a *= 1; + b += 2; + c -= 3; + d /= 4; + + return a + b * c - d; +} + +static int __used +dummy_fn2(int a, int b, int c, int d) +{ + + a *= 4; + b += 3; + c -= 2; + d /= 1; + + return a + b * c - d; +} + +static int __used +dummy_fn3(int a, int b, int c, int d) +{ + + a *= 10; + b += 20; + c -= 30; + d /= 40; + + return a + b * c - d; +} + +static int __used +dummy_fn4(int a, int b, int c, int d) +{ + + a *= 40; + b += 30; + c -= 20; + d /= 10; + + return a + b * c - d; +} + +ATF_TC(io_read_i1); +ATF_TC_HEAD(io_read_i1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint8_t)"); +} + +ATF_TC_BODY(io_read_i1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint8_t lookup_me = 0; + uint8_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx8 " != expected %" PRIx8, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_i2); +ATF_TC_HEAD(io_read_i2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint16_t)"); +} + +ATF_TC_BODY(io_read_i2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint16_t lookup_me = 0; + uint16_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx16 " != expected %" PRIx16, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_i3); +ATF_TC_HEAD(io_read_i3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint32_t)"); +} + +ATF_TC_BODY(io_read_i3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint32_t lookup_me = 0; + uint32_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx32 " != expected %" PRIx32, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(io_read_i4); +ATF_TC_HEAD(io_read_i4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_IO with PIOD_READ_I and len = sizeof(uint64_t)"); +} + +ATF_TC_BODY(io_read_i4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + uint64_t lookup_me = 0; + uint64_t magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); + struct ptrace_io_desc io = { + .piod_op = PIOD_READ_I, + .piod_offs = dummy_fn1, + .piod_addr = &lookup_me, + .piod_len = sizeof(lookup_me) + }; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + ATF_REQUIRE(ptrace(PT_IO, child, &io, 0) != -1); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %" PRIx64 " != expected %" PRIx64, lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i1); +ATF_TC_HEAD(read_i1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called once"); +} + +ATF_TC_BODY(read_i1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me = 0; + int magic; + memcpy(&magic, dummy_fn1, sizeof(magic)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me, magic, + "got value %#x != expected %#x", lookup_me, magic); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i2); +ATF_TC_HEAD(read_i2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called twice"); +} + +ATF_TC_BODY(read_i2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int magic1; + int magic2; + memcpy(&magic1, dummy_fn1, sizeof(magic1)); + memcpy(&magic2, dummy_fn2, sizeof(magic2)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i3); +ATF_TC_HEAD(read_i3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called three times"); +} + +ATF_TC_BODY(read_i3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int magic1; + int magic2; + int magic3; + memcpy(&magic1, dummy_fn1, sizeof(magic1)); + memcpy(&magic2, dummy_fn2, sizeof(magic2)); + memcpy(&magic3, dummy_fn3, sizeof(magic3)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_I, child, dummy_fn3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(read_i4); +ATF_TC_HEAD(read_i4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_READ_I called four times"); +} + +ATF_TC_BODY(read_i4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; + int lookup_me1 = 0; + int lookup_me2 = 0; + int lookup_me3 = 0; + int lookup_me4 = 0; + int magic1; + int magic2; + int magic3; + int magic4; + memcpy(&magic1, dummy_fn1, sizeof(magic1)); + memcpy(&magic2, dummy_fn2, sizeof(magic2)); + memcpy(&magic3, dummy_fn3, sizeof(magic3)); + memcpy(&magic4, dummy_fn4, sizeof(magic4)); +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Read new lookup_me1 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me1 = ptrace(PT_READ_I, child, dummy_fn1, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me1, magic1, + "got value %#x != expected %#x", lookup_me1, magic1); + + printf("Read new lookup_me2 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me2 = ptrace(PT_READ_I, child, dummy_fn2, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me2, magic2, + "got value %#x != expected %#x", lookup_me2, magic2); + + printf("Read new lookup_me3 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me3 = ptrace(PT_READ_I, child, dummy_fn3, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me3, magic3, + "got value %#x != expected %#x", lookup_me3, magic3); + + printf("Read new lookup_me4 from tracee (PID=%d) by tracer (PID=%d)\n", + child, getpid()); + errno = 0; + lookup_me4 = ptrace(PT_READ_I, child, dummy_fn4, 0); + ATF_REQUIRE_EQ(errno, 0); + + ATF_REQUIRE_EQ_MSG(lookup_me4, magic4, + "got value %#x != expected %#x", lookup_me4, magic4); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(HAVE_GPREGS) +ATF_TC(regs1); +ATF_TC_HEAD(regs1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call without further steps"); +} + +ATF_TC_BODY(regs1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs2); +ATF_TC_HEAD(regs2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call and retrieve PC"); +} + +ATF_TC_BODY(regs2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Retrieved PC=%" PRIxREGISTER "\n", PTRACE_REG_PC(&r)); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs3); +ATF_TC_HEAD(regs3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call and retrieve SP"); +} + +ATF_TC_BODY(regs3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Retrieved SP=%" PRIxREGISTER "\n", PTRACE_REG_SP(&r)); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs4); +ATF_TC_HEAD(regs4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETREGS call and retrieve INTRV"); +} + +ATF_TC_BODY(regs4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Retrieved INTRV=%" PRIxREGISTER "\n", PTRACE_REG_INTRV(&r)); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_GPREGS) +ATF_TC(regs5); +ATF_TC_HEAD(regs5, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_GETREGS and PT_SETREGS calls without changing regs"); +} + +ATF_TC_BODY(regs5, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Call SETREGS for the child process (without changed regs)\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_FPREGS) +ATF_TC(fpregs1); +ATF_TC_HEAD(fpregs1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify plain PT_GETFPREGS call without further steps"); +} + +ATF_TC_BODY(fpregs1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct fpreg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETFPREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETFPREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(HAVE_FPREGS) +ATF_TC(fpregs2); +ATF_TC_HEAD(fpregs2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_GETFPREGS and PT_SETFPREGS calls without changing " + "regs"); +} + +ATF_TC_BODY(fpregs2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct fpreg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETFPREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETFPREGS, child, &r, 0) != -1); + + printf("Call SETFPREGS for the child (without changed regs)\n"); + ATF_REQUIRE(ptrace(PT_SETFPREGS, child, &r, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step1); +ATF_TC_HEAD(step1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify single PT_STEP call"); +} + +ATF_TC_BODY(step1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(100); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(100)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step2); +ATF_TC_HEAD(step2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_STEP called twice"); +} + +ATF_TC_BODY(step2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + int N = 2; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(999); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(999)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + while (N --> 0) { + printf("Before resuming the child process where it left off " + "and without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), + child); + + validate_status_stopped(status, SIGTRAP); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step3); +ATF_TC_HEAD(step3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_STEP called three times"); +} + +ATF_TC_BODY(step3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + int N = 3; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(999); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(999)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + while (N --> 0) { + printf("Before resuming the child process where it left off " + "and without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), + child); + + validate_status_stopped(status, SIGTRAP); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(step4); +ATF_TC_HEAD(step4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify PT_STEP called four times"); +} + +ATF_TC_BODY(step4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + int N = 4; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(999); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(999)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + while (N --> 0) { + printf("Before resuming the child process where it left off " + "and without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), + child); + + validate_status_stopped(status, SIGTRAP); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TC(kill1); +ATF_TC_HEAD(kill1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PT_CONTINUE with SIGKILL terminates child"); +} + +ATF_TC_BODY(kill1, tc) +{ + const int sigval = SIGSTOP, sigsent = SIGKILL; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && + "Child should be terminated by a signal from its parent"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_signaled(status, sigsent, 0); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(kill2); +ATF_TC_HEAD(kill2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PT_KILL terminates child"); +} + +ATF_TC_BODY(kill2, tc) +{ + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + /* NOTREACHED */ + FORKEE_ASSERTX(0 && + "Child should be terminated by a signal from its parent"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_KILL, child, (void*)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_signaled(status, SIGKILL, 0); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(lwpinfo1); +ATF_TC_HEAD(lwpinfo1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic LWPINFO call for single thread (PT_TRACE_ME)"); +} + +ATF_TC_BODY(lwpinfo1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_lwpinfo info = {0, 0}; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + ATF_REQUIRE(ptrace(PT_LWPINFO, child, &info, sizeof(info)) != -1); + + printf("Assert that there exists a thread\n"); + ATF_REQUIRE(info.pl_lwpid > 0); + + printf("Assert that lwp thread %d received event PL_EVENT_SIGNAL\n", + info.pl_lwpid); + ATF_REQUIRE_EQ_MSG(info.pl_event, PL_EVENT_SIGNAL, + "Received event %d != expected event %d", + info.pl_event, PL_EVENT_SIGNAL); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + ATF_REQUIRE(ptrace(PT_LWPINFO, child, &info, sizeof(info)) != -1); + + printf("Assert that there are no more lwp threads in child\n"); + ATF_REQUIRE_EQ(info.pl_lwpid, 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(lwpinfo2); +ATF_TC_HEAD(lwpinfo2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic LWPINFO call for single thread (PT_ATTACH from " + "tracer)"); +} + +ATF_TC_BODY(lwpinfo2, tc) +{ + struct msg_fds parent_tracee, parent_tracer; + const int exitval_tracee = 5; + const int exitval_tracer = 10; + pid_t tracee, tracer, wpid; + uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_lwpinfo info = {0, 0}; + + printf("Spawn tracee\n"); + ATF_REQUIRE(msg_open(&parent_tracee) == 0); + ATF_REQUIRE(msg_open(&parent_tracer) == 0); + tracee = atf_utils_fork(); + if (tracee == 0) { + + /* Wait for message from the parent */ + CHILD_TO_PARENT("tracee ready", parent_tracee, msg); + CHILD_FROM_PARENT("tracee exit", parent_tracee, msg); + + _exit(exitval_tracee); + } + PARENT_FROM_CHILD("tracee ready", parent_tracee, msg); + + printf("Spawn debugger\n"); + tracer = atf_utils_fork(); + if (tracer == 0) { + /* No IPC to communicate with the child */ + printf("Before calling PT_ATTACH from tracee %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1); + + /* Wait for tracee and assert that it was stopped w/ SIGSTOP */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_stopped(status, SIGSTOP); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + FORKEE_ASSERT(ptrace(PT_LWPINFO, tracee, &info, sizeof(info)) + != -1); + + printf("Assert that there exists a thread\n"); + FORKEE_ASSERTX(info.pl_lwpid > 0); + + printf("Assert that lwp thread %d received event " + "PL_EVENT_SIGNAL\n", info.pl_lwpid); + FORKEE_ASSERT_EQ(info.pl_event, PL_EVENT_SIGNAL); + + printf("Before calling ptrace(2) with PT_LWPINFO for child\n"); + FORKEE_ASSERT(ptrace(PT_LWPINFO, tracee, &info, sizeof(info)) + != -1); + + printf("Assert that there are no more lwp threads in child\n"); + FORKEE_ASSERTX(info.pl_lwpid == 0); + + /* Resume tracee with PT_CONTINUE */ + FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1); + + /* Inform parent that tracer has attached to tracee */ + CHILD_TO_PARENT("tracer ready", parent_tracer, msg); + /* Wait for parent */ + CHILD_FROM_PARENT("tracer wait", parent_tracer, msg); + + /* Wait for tracee and assert that it exited */ + FORKEE_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, 0), tracee); + + forkee_status_exited(status, exitval_tracee); + + printf("Before exiting of the tracer process\n"); + _exit(exitval_tracer); + } + + printf("Wait for the tracer to attach to the tracee\n"); + PARENT_FROM_CHILD("tracer ready", parent_tracer, msg); + + printf("Resume the tracee and let it exit\n"); + PARENT_TO_CHILD("tracee exit", parent_tracee, msg); + + printf("Detect that tracee is zombie\n"); + await_zombie(tracee); + + printf("Assert that there is no status about tracee - " + "Tracer must detect zombie first - calling %s()\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS( + wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), 0); + + printf("Resume the tracer and let it detect exited tracee\n"); + PARENT_TO_CHILD("tracer wait", parent_tracer, msg); + + printf("Wait for tracer to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracer, &status, 0), + tracer); + + validate_status_exited(status, exitval_tracer); + + printf("Wait for tracee to finish its job and exit - calling %s()\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, &status, WNOHANG), + tracee); + + validate_status_exited(status, exitval_tracee); + + msg_close(&parent_tracer); + msg_close(&parent_tracee); +} +#endif + +ATF_TC(siginfo1); +ATF_TC_HEAD(siginfo1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic PT_GET_SIGINFO call for SIGTRAP from tracee"); +} + +ATF_TC_BODY(siginfo1, tc) +{ + const int exitval = 5; + const int sigval = SIGTRAP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(siginfo2); +ATF_TC_HEAD(siginfo2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls without " + "modification of SIGINT from tracee"); +} + +static int siginfo2_caught = 0; + +static void +siginfo2_sighandler(int sig) +{ + FORKEE_ASSERT_EQ(sig, SIGINT); + + ++siginfo2_caught; +} + +ATF_TC_BODY(siginfo2, tc) +{ + const int exitval = 5; + const int sigval = SIGINT; + pid_t child, wpid; + struct sigaction sa; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + sa.sa_handler = siginfo2_sighandler; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + + FORKEE_ASSERT(sigaction(sigval, &sa, NULL) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(siginfo2_caught, 1); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + printf("Before calling ptrace(2) with PT_SET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_SET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigval) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(siginfo3); +ATF_TC_HEAD(siginfo3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls with " + "setting signal to new value"); +} + +static int siginfo3_caught = 0; + +static void +siginfo3_sigaction(int sig, siginfo_t *info, void *ctx) +{ + FORKEE_ASSERT_EQ(sig, SIGTRAP); + + FORKEE_ASSERT_EQ(info->si_signo, SIGTRAP); + FORKEE_ASSERT_EQ(info->si_code, TRAP_BRKPT); + + ++siginfo3_caught; +} + +ATF_TC_BODY(siginfo3, tc) +{ + const int exitval = 5; + const int sigval = SIGINT; + const int sigfaked = SIGTRAP; + const int sicodefaked = TRAP_BRKPT; + pid_t child, wpid; + struct sigaction sa; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + sa.sa_sigaction = siginfo3_sigaction; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + + FORKEE_ASSERT(sigaction(sigfaked, &sa, NULL) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(siginfo3_caught, 1); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + printf("Before setting new faked signal to signo=%d si_code=%d\n", + sigfaked, sicodefaked); + info.psi_siginfo.si_signo = sigfaked; + info.psi_siginfo.si_code = sicodefaked; + + printf("Before calling ptrace(2) with PT_SET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_SET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigfaked); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, sicodefaked); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigfaked) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(siginfo4); +ATF_TC_HEAD(siginfo4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Detect SIGTRAP TRAP_EXEC from tracee"); +} + +ATF_TC_BODY(siginfo4, tc) +{ + const int sigval = SIGTRAP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + + struct ptrace_siginfo info; + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before calling execve(2) from child\n"); + execlp("/bin/echo", "/bin/echo", NULL); + + FORKEE_ASSERT(0 && "Not reached"); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Signal traced to lwpid=%d\n", info.psi_lwpid); + printf("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", + info.psi_siginfo.si_signo, info.psi_siginfo.si_code, + info.psi_siginfo.si_errno); + + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_EXEC); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +#if defined(TWAIT_HAVE_PID) +ATF_TC(siginfo5); +ATF_TC_HEAD(siginfo5, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that fork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_FORK and reports correct signal information"); +} + +ATF_TC_BODY(siginfo5, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + struct ptrace_siginfo info; + + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = fork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); + + printf("Enable PTRACE_FORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_FORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_CHLD); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_FORK event with forkee %d\n", child2); + + printf("Before calling %s() for the forkee %d of the child %d\n", + TWAIT_FNAME, child2, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_stopped(status, SIGTRAP); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_CHLD); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child2, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_FORK); + ATF_REQUIRE_EQ(state.pe_other_pid, child); + + printf("Before resuming the forkee process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child2, (void *)1, 0) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the forkee - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), + child2); + + validate_status_exited(status, exitval2); + + printf("Before calling %s() for the forkee - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, + wpid = TWAIT_GENERIC(child2, &status, 0)); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGCHLD); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, CLD_EXITED); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(PT_STEP) +ATF_TC(siginfo6); +ATF_TC_HEAD(siginfo6, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify single PT_STEP call with signal information check"); +} + +ATF_TC_BODY(siginfo6, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int happy; + struct ptrace_siginfo info; + + memset(&info, 0, sizeof(info)); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + happy = check_happy(100); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT_EQ(happy, check_happy(100)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent (use PT_STEP)\n"); + ATF_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); + ATF_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); + + printf("Before checking siginfo_t\n"); + ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); + ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_TRACE); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TP_ADD_TCS(tp) +{ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + ATF_TP_ADD_TC(tp, traceme1); + ATF_TP_ADD_TC(tp, traceme2); + ATF_TP_ADD_TC(tp, traceme3); + ATF_TP_ADD_TC(tp, traceme4); + + ATF_TP_ADD_TC_HAVE_PID(tp, attach1); + ATF_TP_ADD_TC_HAVE_PID(tp, attach2); + ATF_TP_ADD_TC(tp, attach3); + ATF_TP_ADD_TC(tp, attach4); + ATF_TP_ADD_TC_HAVE_PID(tp, attach5); + ATF_TP_ADD_TC_HAVE_PID(tp, attach6); + ATF_TP_ADD_TC_HAVE_PID(tp, attach7); + + ATF_TP_ADD_TC(tp, eventmask1); + ATF_TP_ADD_TC(tp, eventmask2); + + ATF_TP_ADD_TC_HAVE_PID(tp, fork1); + ATF_TP_ADD_TC(tp, fork2); + + ATF_TP_ADD_TC_HAVE_PID(tp, vfork1); + ATF_TP_ADD_TC(tp, vfork2); + + ATF_TP_ADD_TC(tp, io_read_d1); + ATF_TP_ADD_TC(tp, io_read_d2); + ATF_TP_ADD_TC(tp, io_read_d3); + ATF_TP_ADD_TC(tp, io_read_d4); + + ATF_TP_ADD_TC(tp, io_write_d1); + ATF_TP_ADD_TC(tp, io_write_d2); + ATF_TP_ADD_TC(tp, io_write_d3); + ATF_TP_ADD_TC(tp, io_write_d4); + + ATF_TP_ADD_TC(tp, read_d1); + ATF_TP_ADD_TC(tp, read_d2); + ATF_TP_ADD_TC(tp, read_d3); + ATF_TP_ADD_TC(tp, read_d4); + + ATF_TP_ADD_TC(tp, write_d1); + ATF_TP_ADD_TC(tp, write_d2); + ATF_TP_ADD_TC(tp, write_d3); + ATF_TP_ADD_TC(tp, write_d4); + + ATF_TP_ADD_TC(tp, io_read_d_write_d_handshake1); + ATF_TP_ADD_TC(tp, io_read_d_write_d_handshake2); + + ATF_TP_ADD_TC(tp, read_d_write_d_handshake1); + ATF_TP_ADD_TC(tp, read_d_write_d_handshake2); + + ATF_TP_ADD_TC(tp, io_read_i1); + ATF_TP_ADD_TC(tp, io_read_i2); + ATF_TP_ADD_TC(tp, io_read_i3); + ATF_TP_ADD_TC(tp, io_read_i4); + + ATF_TP_ADD_TC(tp, read_i1); + ATF_TP_ADD_TC(tp, read_i2); + ATF_TP_ADD_TC(tp, read_i3); + ATF_TP_ADD_TC(tp, read_i4); + + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs2); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs3); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs4); + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs5); + + ATF_TP_ADD_TC_HAVE_FPREGS(tp, fpregs1); + ATF_TP_ADD_TC_HAVE_FPREGS(tp, fpregs2); + + ATF_TP_ADD_TC_PT_STEP(tp, step1); + ATF_TP_ADD_TC_PT_STEP(tp, step2); + ATF_TP_ADD_TC_PT_STEP(tp, step3); + ATF_TP_ADD_TC_PT_STEP(tp, step4); + + ATF_TP_ADD_TC(tp, kill1); + ATF_TP_ADD_TC(tp, kill2); + + ATF_TP_ADD_TC(tp, lwpinfo1); + ATF_TP_ADD_TC_HAVE_PID(tp, lwpinfo2); + + ATF_TP_ADD_TC(tp, siginfo1); + ATF_TP_ADD_TC(tp, siginfo2); + ATF_TP_ADD_TC(tp, siginfo3); + ATF_TP_ADD_TC(tp, siginfo4); + ATF_TP_ADD_TC_HAVE_PID(tp, siginfo5); + ATF_TP_ADD_TC_PT_STEP(tp, siginfo6); + + return atf_no_error(); +} diff --git a/kernel/t_ptrace_wait.h b/kernel/t_ptrace_wait.h new file mode 100644 index 000000000000..9c6921c70683 --- /dev/null +++ b/kernel/t_ptrace_wait.h @@ -0,0 +1,431 @@ +/* $NetBSD: t_ptrace_wait.h,v 1.7 2017/01/09 22:09:20 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* Detect plain wait(2) use-case */ +#if !defined(TWAIT_WAITPID) && \ + !defined(TWAIT_WAITID) && \ + !defined(TWAIT_WAIT3) && \ + !defined(TWAIT_WAIT4) && \ + !defined(TWAIT_WAIT6) +#define TWAIT_WAIT +#endif + +/* + * There are two classes of wait(2)-like functions: + * - wait4(2)-like accepting pid_t, optional options parameter, struct rusage* + * - wait6(2)-like accepting idtype_t, id_t, struct wrusage, mandatory options + * + * The TWAIT_FNAME value is to be used for convenience in debug messages. + * + * The TWAIT_GENERIC() macro is designed to reuse the same unmodified + * code with as many wait(2)-like functions as possible. + * + * In a common use-case wait4(2) and wait6(2)-like function can work the almost + * the same way, however there are few important differences: + * wait6(2) must specify P_PID for idtype to match wpid from wait4(2). + * To behave like wait4(2), wait6(2) the 'options' to wait must include + * WEXITED|WTRUNCATED. + * + * There are two helper macros (they purpose it to mach more than one + * wait(2)-like function): + * The TWAIT_HAVE_STATUS - specifies whether a function can retrieve + * status (as integer value). + * The TWAIT_HAVE_PID - specifies whether a function can request + * exact process identifier + * The TWAIT_HAVE_RUSAGE - specifies whether a function can request + * the struct rusage value + * + */ + +#if defined(TWAIT_WAIT) +# define TWAIT_FNAME "wait" +# define TWAIT_WAIT4TYPE(a,b,c,d) wait((b)) +# define TWAIT_GENERIC(a,b,c) wait((b)) +# define TWAIT_HAVE_STATUS 1 +#elif defined(TWAIT_WAITPID) +# define TWAIT_FNAME "waitpid" +# define TWAIT_WAIT4TYPE(a,b,c,d) waitpid((a),(b),(c)) +# define TWAIT_GENERIC(a,b,c) waitpid((a),(b),(c)) +# define TWAIT_HAVE_PID 1 +# define TWAIT_HAVE_STATUS 1 +#elif defined(TWAIT_WAITID) +# define TWAIT_FNAME "waitid" +# define TWAIT_GENERIC(a,b,c) \ + waitid(P_PID,(a),NULL,(c)|WEXITED|WTRAPPED) +# define TWAIT_WAIT6TYPE(a,b,c,d,e,f) waitid((a),(b),(f),(d)) +# define TWAIT_HAVE_PID 1 +#elif defined(TWAIT_WAIT3) +# define TWAIT_FNAME "wait3" +# define TWAIT_WAIT4TYPE(a,b,c,d) wait3((b),(c),(d)) +# define TWAIT_GENERIC(a,b,c) wait3((b),(c),NULL) +# define TWAIT_HAVE_STATUS 1 +# define TWAIT_HAVE_RUSAGE 1 +#elif defined(TWAIT_WAIT4) +# define TWAIT_FNAME "wait4" +# define TWAIT_WAIT4TYPE(a,b,c,d) wait4((a),(b),(c),(d)) +# define TWAIT_GENERIC(a,b,c) wait4((a),(b),(c),NULL) +# define TWAIT_HAVE_PID 1 +# define TWAIT_HAVE_STATUS 1 +# define TWAIT_HAVE_RUSAGE 1 +#elif defined(TWAIT_WAIT6) +# define TWAIT_FNAME "wait6" +# define TWAIT_WAIT6TYPE(a,b,c,d,e,f) wait6((a),(b),(c),(d),(e),(f)) +# define TWAIT_GENERIC(a,b,c) \ + wait6(P_PID,(a),(b),(c)|WEXITED|WTRAPPED,NULL,NULL) +# define TWAIT_HAVE_PID 1 +# define TWAIT_HAVE_STATUS 1 +#endif + +/* + * There are 3 groups of tests: + * - TWAIT_GENERIC() (wait, wait2, waitpid, wait3, wait4, wait6) + * - TWAIT_WAIT4TYPE() (wait2, waitpid, wait3, wait4) + * - TWAIT_WAIT6TYPE() (waitid, wait6) + * + * Tests only in the above categories are allowed. However some tests are not + * possible in the context requested functionality to be verified, therefore + * there are helper macros: + * - TWAIT_HAVE_PID (wait2, waitpid, waitid, wait4, wait6) + * - TWAIT_HAVE_STATUS (wait, wait2, waitpid, wait3, wait4, wait6) + * - TWAIT_HAVE_RUSAGE (wait3, wait4) + * - TWAIT_HAVE_RETPID (wait, wait2, waitpid, wait3, wait4, wait6) + * + * If there is an intention to test e.g. wait6(2) specific features in the + * ptrace(2) context, find the most matching group and with #ifdefs reduce + * functionality of less featured than wait6(2) interface (TWAIT_WAIT6TYPE). + * + * For clarity never use negative preprocessor checks, like: + * #if !defined(TWAIT_WAIT4) + * always refer to checks for positive values. + */ + +#define TEST_REQUIRE_EQ(x, y) \ +do { \ + uintmax_t vx = (x); \ + uintmax_t vy = (y); \ + int ret = vx == vy; \ + if (!ret) \ + ATF_REQUIRE_EQ_MSG(vx, vy, "%s(%ju) == %s(%ju)", \ + #x, vx, #y, vy); \ +} while (/*CONSTCOND*/0) + +/* + * A child process cannot call atf functions and expect them to magically + * work like in the parent. + * The printf(3) messaging from a child will not work out of the box as well + * without estabilishing a communication protocol with its parent. To not + * overcomplicate the tests - do not log from a child and use err(3)/errx(3) + * wrapped with FORKEE_ASSERT()/FORKEE_ASSERTX() as that is guaranteed to work. + */ +#define FORKEE_ASSERT_EQ(x, y) \ +do { \ + uintmax_t vx = (x); \ + uintmax_t vy = (y); \ + int ret = vx == vy; \ + if (!ret) \ + errx(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: " \ + "%s(%ju) == %s(%ju)", __FILE__, __LINE__, __func__, \ + #x, vx, #y, vy); \ +} while (/*CONSTCOND*/0) + +#define FORKEE_ASSERTX(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + errx(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s",\ + __FILE__, __LINE__, __func__, #x); \ +} while (/*CONSTCOND*/0) + +#define FORKEE_ASSERT(x) \ +do { \ + int ret = (x); \ + if (!ret) \ + err(EXIT_FAILURE, "%s:%d %s(): Assertion failed for: %s",\ + __FILE__, __LINE__, __func__, #x); \ +} while (/*CONSTCOND*/0) + +/* + * Simplify logic for functions using general purpose registers add HAVE_GPREGS + * + * For platforms that do not implement all needed calls for simplicity assume + * that they are unsupported at all. + */ +#if defined(PT_GETREGS) \ + && defined(PT_SETREGS) \ + && defined(PTRACE_REG_PC) \ + && defined(PTRACE_REG_SET_PC) \ + && defined(PTRACE_REG_SP) \ + && defined(PTRACE_REG_INTRV) +#define HAVE_GPREGS +#endif + +/* Add guards for floating point registers */ +#if defined(PT_GETFPREGS) \ + && defined(PT_SETFPREGS) +#define HAVE_FPREGS +#endif + +/* Add guards for cpu debug registers */ +#if defined(PT_GETDBREGS) \ + && defined(PT_SETDBREGS) +#define HAVE_DBREGS +#endif + +/* + * If waitid(2) returns because one or more processes have a state change to + * report, 0 is returned. If an error is detected, a value of -1 is returned + * and errno is set to indicate the error. If WNOHANG is specified and there + * are no stopped, continued or exited children, 0 is returned. + */ +#if defined(TWAIT_WAITID) +#define TWAIT_REQUIRE_SUCCESS(a,b) TEST_REQUIRE_EQ((a), 0) +#define TWAIT_REQUIRE_FAILURE(a,b) ATF_REQUIRE_ERRNO((a),(b) == -1) +#define FORKEE_REQUIRE_SUCCESS(a,b) FORKEE_ASSERT_EQ(a, 0) +#define FORKEE_REQUIRE_FAILURE(a,b) \ + FORKEE_ASSERTX(((a) == errno) && ((b) == -1)) +#else +#define TWAIT_REQUIRE_SUCCESS(a,b) TEST_REQUIRE_EQ((a), (b)) +#define TWAIT_REQUIRE_FAILURE(a,b) ATF_REQUIRE_ERRNO((a),(b) == -1) +#define FORKEE_REQUIRE_SUCCESS(a,b) FORKEE_ASSERT_EQ(a, b) +#define FORKEE_REQUIRE_FAILURE(a,b) \ + FORKEE_ASSERTX(((a) == errno) && ((b) == -1)) +#endif + +/* + * Helper tools to verify whether status reports exited value + */ +#if TWAIT_HAVE_STATUS +static void __used +validate_status_exited(int status, int expected) +{ + ATF_REQUIRE_MSG(WIFEXITED(status), "Reported !exited process"); + ATF_REQUIRE_MSG(!WIFCONTINUED(status), "Reported continued process"); + ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process"); + ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process"); + + ATF_REQUIRE_EQ_MSG(WEXITSTATUS(status), expected, + "The process has exited with invalid value %d != %d", + WEXITSTATUS(status), expected); +} + +static void __used +forkee_status_exited(int status, int expected) +{ + FORKEE_ASSERTX(WIFEXITED(status)); + FORKEE_ASSERTX(!WIFCONTINUED(status)); + FORKEE_ASSERTX(!WIFSIGNALED(status)); + FORKEE_ASSERTX(!WIFSTOPPED(status)); + + FORKEE_ASSERT_EQ(WEXITSTATUS(status), expected); +} + +static void __used +validate_status_continued(int status) +{ + ATF_REQUIRE_MSG(!WIFEXITED(status), "Reported exited process"); + ATF_REQUIRE_MSG(WIFCONTINUED(status), "Reported !continued process"); + ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process"); + ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process"); +} + +static void __used +forkee_status_continued(int status) +{ + FORKEE_ASSERTX(!WIFEXITED(status)); + FORKEE_ASSERTX(WIFCONTINUED(status)); + FORKEE_ASSERTX(!WIFSIGNALED(status)); + FORKEE_ASSERTX(!WIFSTOPPED(status)); +} + +static void __used +validate_status_signaled(int status, int expected_termsig, int expected_core) +{ + ATF_REQUIRE_MSG(!WIFEXITED(status), "Reported exited process"); + ATF_REQUIRE_MSG(!WIFCONTINUED(status), "Reported continued process"); + ATF_REQUIRE_MSG(WIFSIGNALED(status), "Reported !signaled process"); + ATF_REQUIRE_MSG(!WIFSTOPPED(status), "Reported stopped process"); + + ATF_REQUIRE_EQ_MSG(WTERMSIG(status), expected_termsig, + "Unexpected signal received"); + + ATF_REQUIRE_EQ_MSG(WCOREDUMP(status), expected_core, + "Unexpectedly core file %s generated", expected_core ? "not" : ""); +} + +static void __used +forkee_status_signaled(int status, int expected_termsig, int expected_core) +{ + FORKEE_ASSERTX(!WIFEXITED(status)); + FORKEE_ASSERTX(!WIFCONTINUED(status)); + FORKEE_ASSERTX(WIFSIGNALED(status)); + FORKEE_ASSERTX(!WIFSTOPPED(status)); + + FORKEE_ASSERT_EQ(WTERMSIG(status), expected_termsig); + FORKEE_ASSERT_EQ(WCOREDUMP(status), expected_core); +} + +static void __used +validate_status_stopped(int status, int expected) +{ + ATF_REQUIRE_MSG(!WIFEXITED(status), "Reported exited process"); + ATF_REQUIRE_MSG(!WIFCONTINUED(status), "Reported continued process"); + ATF_REQUIRE_MSG(!WIFSIGNALED(status), "Reported signaled process"); + ATF_REQUIRE_MSG(WIFSTOPPED(status), "Reported !stopped process"); + + char st[128], ex[128]; + strlcpy(st, strsignal(WSTOPSIG(status)), sizeof(st)); + strlcpy(ex, strsignal(expected), sizeof(ex)); + + ATF_REQUIRE_EQ_MSG(WSTOPSIG(status), expected, + "Unexpected stop signal received [%s] != [%s]", st, ex); +} + +static void __used +forkee_status_stopped(int status, int expected) +{ + FORKEE_ASSERTX(!WIFEXITED(status)); + FORKEE_ASSERTX(!WIFCONTINUED(status)); + FORKEE_ASSERTX(!WIFSIGNALED(status)); + FORKEE_ASSERTX(WIFSTOPPED(status)); + + FORKEE_ASSERT_EQ(WSTOPSIG(status), expected); +} +#else +#define validate_status_exited(a,b) +#define forkee_status_exited(a,b) +#define validate_status_continued(a,b) +#define forkee_status_continued(a,b) +#define validate_status_signaled(a,b,c) +#define forkee_status_signaled(a,b,c) +#define validate_status_stopped(a,b) +#define forkee_status_stopped(a,b) +#endif + +/* This function is currently designed to be run in the main/parent process */ +static void __used +await_zombie(pid_t process) +{ + struct kinfo_proc2 p; + size_t len = sizeof(p); + + const int name[] = { + [0] = CTL_KERN, + [1] = KERN_PROC2, + [2] = KERN_PROC_PID, + [3] = process, + [4] = sizeof(p), + [5] = 1 + }; + + const size_t namelen = __arraycount(name); + + /* Await the process becoming a zombie */ + while(1) { + ATF_REQUIRE(sysctl(name, namelen, &p, &len, NULL, 0) == 0); + + if (p.p_stat == LSZOMB) + break; + + ATF_REQUIRE(usleep(1000) == 0); + } +} + +/* Happy number sequence -- this function is used to just consume cpu cycles */ +#define HAPPY_NUMBER 1 + +/* If n is not happy then its sequence ends in the cycle: + * 4, 16, 37, 58, 89, 145, 42, 20, 4, ... */ +#define SAD_NUMBER 4 + +/* Calculate the sum of the squares of the digits of n */ +static unsigned __used +dsum(unsigned n) +{ + unsigned sum, x; + for (sum = 0; n; n /= 10) { + x = n % 10; + sum += x * x; + } + return sum; +} + +/* + * XXX: Disabled optimization is required to make tests for hardware assisted + * traps in .text functional + * + * Tested with GCC 5.4 on NetBSD 7.99.47 amd64 + */ +static int __used +#ifdef __clang__ +__attribute__((__optnone__)) +#else +__attribute__((__optimize__("O0"))) +#endif +check_happy(unsigned n) +{ + for (;;) { + unsigned total = dsum(n); + + if (total == HAPPY_NUMBER) + return 1; + if (total == SAD_NUMBER) + return 0; + + n = total; + } +} + +#if defined(TWAIT_HAVE_PID) +#define ATF_TP_ADD_TC_HAVE_PID(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_PID(a,b) +#endif + +#if defined(HAVE_GPREGS) +#define ATF_TP_ADD_TC_HAVE_GPREGS(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_GPREGS(a,b) +#endif + +#if defined(HAVE_FPREGS) +#define ATF_TP_ADD_TC_HAVE_FPREGS(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_FPREGS(a,b) +#endif + +#if defined(PT_STEP) +#define ATF_TP_ADD_TC_PT_STEP(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_PT_STEP(a,b) +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b) ATF_TP_ADD_TC(a,b) +#else +#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b) +#endif diff --git a/kernel/t_ptrace_wait3.c b/kernel/t_ptrace_wait3.c new file mode 100644 index 000000000000..c136431af818 --- /dev/null +++ b/kernel/t_ptrace_wait3.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT3 +#include "t_ptrace_wait.c" diff --git a/kernel/t_ptrace_wait4.c b/kernel/t_ptrace_wait4.c new file mode 100644 index 000000000000..7ae771bb7075 --- /dev/null +++ b/kernel/t_ptrace_wait4.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT4 +#include "t_ptrace_wait.c" diff --git a/kernel/t_ptrace_wait6.c b/kernel/t_ptrace_wait6.c new file mode 100644 index 000000000000..122cb1d9a1cc --- /dev/null +++ b/kernel/t_ptrace_wait6.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT6 +#include "t_ptrace_wait.c" diff --git a/kernel/t_ptrace_waitid.c b/kernel/t_ptrace_waitid.c new file mode 100644 index 000000000000..1c09be70d8a5 --- /dev/null +++ b/kernel/t_ptrace_waitid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAITID +#include "t_ptrace_wait.c" diff --git a/kernel/t_ptrace_waitpid.c b/kernel/t_ptrace_waitpid.c new file mode 100644 index 000000000000..c8f107dbda51 --- /dev/null +++ b/kernel/t_ptrace_waitpid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/11/07 21:09:03 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAITPID +#include "t_ptrace_wait.c" diff --git a/lib/Makefile b/lib/Makefile index b8008636accd..1fef36a12ac5 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.25 2016/01/01 21:38:54 jakllsch Exp $ +# $NetBSD: Makefile,v 1.27 2016/11/16 21:36:23 kamil Exp $ .include TESTS_SUBDIRS= csu libbluetooth libc libcrypt libcurses libevent libexecinfo \ libm libobjc libposix libppath libprop libpthread \ - librt libtre libusbhid libutil semaphore + libpthread_dbg librefuse librt libtre libusbhid libutil \ + semaphore .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_SUBDIRS+= librumpclient librumphijack diff --git a/lib/libc/arch/sparc64/exec_prot_support.c b/lib/libc/arch/sparc64/exec_prot_support.c index 474cfc742f69..8ca38b4fb209 100644 --- a/lib/libc/arch/sparc64/exec_prot_support.c +++ b/lib/libc/arch/sparc64/exec_prot_support.c @@ -1,4 +1,4 @@ -/* $NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $ */ +/* $NetBSD: exec_prot_support.c,v 1.2 2016/12/31 11:51:20 martin Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,12 +30,13 @@ */ #include -__RCSID("$NetBSD: exec_prot_support.c,v 1.1 2011/07/18 23:16:10 jym Exp $"); +__RCSID("$NetBSD: exec_prot_support.c,v 1.2 2016/12/31 11:51:20 martin Exp $"); #include "../../common/exec_prot.h" int exec_prot_support(void) { - return NOTIMPL; + + return PERPAGE_XP; } diff --git a/lib/libc/arch/sparc64/return_one.S b/lib/libc/arch/sparc64/return_one.S index 3495260d6f68..ec8bcdd9de7f 100644 --- a/lib/libc/arch/sparc64/return_one.S +++ b/lib/libc/arch/sparc64/return_one.S @@ -1,8 +1,11 @@ -/* $NetBSD: return_one.S,v 1.1 2011/07/18 23:16:10 jym Exp $ */ +/* $NetBSD: return_one.S,v 1.2 2016/12/31 11:51:20 martin Exp $ */ #include -.globl return_one, return_one_end; +.global return_one_end -return_one: return_one_end: - nop +ENTRY(return_one) +return_one: + retl + mov 1, %o0 +return_one_end: diff --git a/lib/libc/db/Makefile b/lib/libc/db/Makefile index ffcc96e98bf6..fa5f94c5c18d 100644 --- a/lib/libc/db/Makefile +++ b/lib/libc/db/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2015/11/18 18:35:35 christos Exp $ +# $NetBSD: Makefile,v 1.4 2016/09/24 20:12:33 christos Exp $ .include @@ -13,6 +13,7 @@ MKMAN= no PROGS+= h_db PROGS+= h_lfsr +CPPFLAGS.h_db.c += -I${NETBSDSRCDIR}/lib/libc/db/btree FILESDIR= ${TESTSDIR} diff --git a/lib/libc/db/h_db.c b/lib/libc/db/h_db.c index dfb13859d3f2..4bea6feb2769 100644 --- a/lib/libc/db/h_db.c +++ b/lib/libc/db/h_db.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_db.c,v 1.1 2011/01/07 15:05:58 pgoyette Exp $ */ +/* $NetBSD: h_db.c,v 1.3 2016/09/24 21:18:22 christos Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\ #if 0 static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94"; #else -__RCSID("$NetBSD: h_db.c,v 1.1 2011/01/07 15:05:58 pgoyette Exp $"); +__RCSID("$NetBSD: h_db.c,v 1.3 2016/09/24 21:18:22 christos Exp $"); #endif #endif /* not lint */ @@ -57,12 +57,13 @@ __RCSID("$NetBSD: h_db.c,v 1.1 2011/01/07 15:05:58 pgoyette Exp $"); #include #include #include +#include "btree.h" enum S { COMMAND, COMPARE, GET, PUT, REMOVE, SEQ, SEQFLAG, KEY, DATA }; static void compare(DBT *, DBT *); static DBTYPE dbtype(const char *); -static void dump(DB *, int); +static void dump(DB *, int, int); static void get(DB *, DBT *); static void getdata(DB *, DBT *, DBT *); static void put(DB *, DBT *, DBT *); @@ -73,6 +74,7 @@ static void *rfile(char *, size_t *); static void seq(DB *, DBT *); static u_int setflags(char *); static void *setinfo(DBTYPE, char *); +static void unlinkpg(DB *); static void usage(void) __attribute__((__noreturn__)); static void *xcopy(void *, size_t); static void chkcmd(enum S); @@ -82,6 +84,7 @@ static void chkkey(enum S); #ifdef STATISTICS extern void __bt_stat(DB *); #endif +extern int __bt_relink(BTREE *, PAGE *); static DBTYPE type; /* Database type. */ static void *infop; /* Iflags. */ @@ -315,7 +318,13 @@ lkey: switch (command) { } break; case 'o': - dump(dbp, p[1] == 'r'); + dump(dbp, p[1] == 'r', 0); + break; + case 'O': + dump(dbp, p[1] == 'r', 1); + break; + case 'u': + unlinkpg(dbp); break; default: errx(1, "line %zu: %s: unknown command character", @@ -483,17 +492,17 @@ seq(DB *dbp, DBT *kp) } static void -dump(DB *dbp, int rev) +dump(DB *dbp, int rev, int recurse) { DBT key, data; int xflags, nflags; if (rev) { xflags = R_LAST; - nflags = R_PREV; + nflags = recurse ? R_RPREV : R_PREV; } else { xflags = R_FIRST; - nflags = R_NEXT; + nflags = recurse ? R_RNEXT : R_NEXT; } for (;; xflags = nflags) switch (dbp->seq(dbp, &key, &data, xflags)) { @@ -511,6 +520,40 @@ dump(DB *dbp, int rev) done: return; } +void +unlinkpg(DB *dbp) +{ + BTREE *t = dbp->internal; + PAGE *h = NULL; + pgno_t pg; + + for (pg = P_ROOT; pg < t->bt_mp->npages; + mpool_put(t->bt_mp, h, 0), pg++) { + if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) + break; + /* Look for a nonempty leaf page that has both left + * and right siblings. */ + if (h->prevpg == P_INVALID || h->nextpg == P_INVALID) + continue; + if (NEXTINDEX(h) == 0) + continue; + if ((h->flags & (P_BLEAF | P_RLEAF))) + break; + } + if (h == NULL || pg == t->bt_mp->npages) { + errx(1, "%s: no appropriate page found", __func__); + return; + } + if (__bt_relink(t, h) != 0) { + perror("unlinkpg"); + goto cleanup; + } + h->prevpg = P_INVALID; + h->nextpg = P_INVALID; +cleanup: + mpool_put(t->bt_mp, h, MPOOL_DIRTY); +} + static u_int setflags(char *s) { @@ -725,7 +768,7 @@ static void usage(void) { (void)fprintf(stderr, - "Usage: %s [-l] [-f file] [-i info] [-o file] type script\n", - getprogname()); + "Usage: %s [-lu] [-f file] [-i info] [-o file] [-O file] " + "type script\n", getprogname()); exit(1); } diff --git a/lib/libc/db/t_db.sh b/lib/libc/db/t_db.sh index 53500ffe4a05..dc090d0802de 100755 --- a/lib/libc/db/t_db.sh +++ b/lib/libc/db/t_db.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_db.sh,v 1.6 2015/11/18 18:35:35 christos Exp $ +# $NetBSD: t_db.sh,v 1.7 2016/09/24 20:12:33 christos Exp $ # # Copyright (c) 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -540,6 +540,7 @@ delete_recno_body() h_repeated() { + local type="$1" TMPDIR="$(pwd)/db_dir"; export TMPDIR mkdir ${TMPDIR} @@ -558,7 +559,7 @@ h_repeated() } }' >in - $(prog_db) btree in + $(prog_db) $type in } atf_test_case repeated_btree @@ -618,11 +619,10 @@ duplicate_btree_body() h_cursor_flags() { + local type=$1 TMPDIR="$(pwd)/db_dir"; export TMPDIR mkdir ${TMPDIR} - type=$1 - echo $SEVEN_SEVEN | awk '{ for (i = 1; i <= 20; ++i) @@ -758,6 +758,7 @@ h_byte_orders() echo p echo k$i echo d$i + echo S echo g echo k$i done >in @@ -924,6 +925,292 @@ bsize_torture_body() done } +atf_test_case btree_weird_page_split +btree_weird_page_split_head() +{ + atf_set "descr" \ + "Test for a weird page split condition where an insertion " \ + "into index 0 of a page that would cause the new item to " \ + "be the only item on the left page results in index 0 of " \ + "the right page being erroneously skipped; this only " \ + "happens with one particular key+data length for each page size." +} +btree_weird_page_split_body() +{ + for psize in 512 1024 2048 4096 8192; do + echo " page size $psize" + kdsizes=`awk 'BEGIN { + psize = '$psize'; hsize = int(psize/2); + for (kdsize = hsize-40; kdsize <= hsize; kdsize++) { + print kdsize; + } + }' /dev/null` + + # Use a series of keylen+datalen values in the right + # neighborhood to find the one that triggers the bug. + # We could compute the exact size that triggers the + # bug but this additional fuzz may be useful. + + # Insert keys in reverse order to maximize the chances + # for a split on index 0. + + for kdsize in $kdsizes; do + awk 'BEGIN { + kdsize = '$kdsize'; + for (i = 8; i-- > 0; ) { + s = sprintf("a%03d:%09d", i, kdsize); + for (j = 0; j < kdsize-20; j++) { + s = s "x"; + } + printf("p\nka%03d\nd%s\n", i, s); + } + print "o"; + }' /dev/null > in + sed -n 's/^d//p' in | sort > exp + atf_check -o file:exp \ + "$(prog_db)" -i psize=$psize btree in + done + done +} + +# Extremely tricky test attempting to replicate some unusual database +# corruption seen in the field: pieces of the database becoming +# inaccessible to random access, sequential access, or both. The +# hypothesis is that at least some of these are triggered by the bug +# in page splits on index 0 with a particular exact keylen+datalen. +# (See Test 40.) For psize=4096, this size is exactly 2024. + +# The order of operations here relies on very specific knowledge of +# the internals of the btree access method in order to place records +# at specific offsets in a page and to create certain keys on internal +# pages. The to-be-split page immediately prior to the bug-triggering +# split has the following properties: +# +# * is not the leftmost leaf page +# * key on the parent page is compares less than the key of the item +# on index 0 +# * triggering record's key also compares greater than the key on the +# parent page + +# Additionally, we prime the mpool LRU chain so that the head page on +# the chain has the following properties: +# +# * record at index 0 is located where it will not get overwritten by +# items written to the right-hand page during the split +# * key of the record at index 0 compares less than the key of the +# bug-triggering record + +# If the page-split bug exists, this test appears to create a database +# where some records are inaccessible to a search, but still remain in +# the file and are accessible by sequential traversal. At least one +# record gets duplicated out of sequence. + +atf_test_case btree_tricky_page_split +btree_tricky_page_split_head() +{ + atf_set "descr" \ + "btree: no unsearchables due to page split on index 0" +} +btree_tricky_page_split_body() +{ + list=`(for i in a b c d; do + for j in 990 998 999; do + echo g ${i}${j} 1024 + done + done; + echo g y997 2014 + for i in y z; do + for j in 998 999; do + echo g ${i}${j} 1024 + done + done)` + # Exact number for trigger condition accounts for newlines + # retained by dbtest with -ofile but not without; we use + # -ofile, so count newlines. keylen=5,datalen=5+2014 for + # psize=4096 here. + (cat - < in + (echo "$list"; echo "$list") | awk '{ + s = $2; + for (i = 0; i < $3; i++) { + s = s "x"; + } + print s; + }' > exp + atf_check -o file:exp \ + "$(prog_db)" -i psize=4096 btree in +} + +atf_test_case btree_recursive_traversal +btree_recursive_traversal_head() +{ + atf_set "descr" \ + "btree: Test for recursive traversal successfully " \ + "retrieving records that are inaccessible to normal " \ + "sequential 'sibling-link' traversal. This works by " \ + "unlinking a few leaf pages but leaving their parent " \ + "links intact. To verify that the unlink actually makes " \ + "records inaccessible, the test first uses 'o' to do a " \ + "normal sequential traversal, followed by 'O' to do a " \ + "recursive traversal." +} +btree_recursive_traversal_body() +{ + fill="abcdefghijklmnopqrstuvwxyzy" + script='{ + for (i = 0; i < 20000; i++) { + printf("p\nkAA%05d\nd%05d%s\n", i, i, $0); + } + print "u"; + print "u"; + print "u"; + print "u"; + }' + (echo $fill | awk "$script"; echo o) > in1 + echo $fill | + awk '{ + for (i = 0; i < 20000; i++) { + if (i >= 5 && i <= 40) + continue; + printf("%05d%s\n", i, $0); + } + }' > exp1 + atf_check -o file:exp1 \ + "$(prog_db)" -i psize=512 btree in1 + echo $fill | + awk '{ + for (i = 0; i < 20000; i++) { + printf("%05d%s\n", i, $0); + } + }' > exp2 + (echo $fill | awk "$script"; echo O) > in2 + atf_check -o file:exp2 \ + "$(prog_db)" -i psize=512 btree in2 +} + +atf_test_case btree_byteswap_unaligned_access_bksd +btree_byteswap_unaligned_access_bksd_head() +{ + atf_set "descr" \ + "btree: big key, small data, byteswap unaligned access" +} +btree_byteswap_unaligned_access_bksd_body() +{ + (echo foo; echo bar) | + awk '{ + s = $0 + for (i = 0; i < 488; i++) { + s = s "x"; + } + printf("p\nk%s\ndx\n", s); + }' > in + for order in 1234 4321; do + atf_check \ + "$(prog_db)" -o out -i psize=512,lorder=$order btree in + done +} + +atf_test_case btree_byteswap_unaligned_access_skbd +btree_byteswap_unaligned_access_skbd_head() +{ + atf_set "descr" \ + "btree: small key, big data, byteswap unaligned access" +} +btree_byteswap_unaligned_access_skbd_body() +{ + # 484 = 512 - 20 (header) - 7 ("foo1234") - 1 (newline) + (echo foo1234; echo bar1234) | + awk '{ + s = $0 + for (i = 0; i < 484; i++) { + s = s "x"; + } + printf("p\nk%s\nd%s\n", $0, s); + }' > in + for order in 1234 4321; do + atf_check \ + "$(prog_db)" -o out -i psize=512,lorder=$order btree in + done +} + +atf_test_case btree_known_byte_order +btree_known_byte_order_head() +{ + atf_set "descr" \ + "btree: small key, big data, known byte order" +} +btree_known_byte_order_body() +{ + local a="-i psize=512,lorder=" + + (echo foo1234; echo bar1234) | + awk '{ + s = $0 + for (i = 0; i < 484; i++) { + s = s "x"; + } + printf("%s\n", s); + }' > exp + (echo foo1234; echo bar1234) | + awk '{ + s = $0 + for (i = 0; i < 484; i++) { + s = s "x"; + } + printf("p\nk%s\nd%s\n", $0, s); + }' > in1 + for order in 1234 4321; do + atf_check \ + "$(prog_db)" -f out.$order $a$order btree in1 + done + (echo g; echo kfoo1234; echo g; echo kbar1234) > in2 + for order in 1234 4321; do + atf_check -o file:exp \ + "$(prog_db)" -s -f out.$order $a$order btree in2 + done +} + atf_init_test_cases() { atf_add_test_case small_btree @@ -952,4 +1239,10 @@ atf_init_test_cases() atf_add_test_case bsize_ffactor atf_add_test_case four_char_hash atf_add_test_case bsize_torture + atf_add_test_case btree_weird_page_split + atf_add_test_case btree_tricky_page_split + atf_add_test_case btree_recursive_traversal + atf_add_test_case btree_byteswap_unaligned_access_bksd + atf_add_test_case btree_byteswap_unaligned_access_skbd + atf_add_test_case btree_known_byte_order } diff --git a/lib/libc/gen/Makefile b/lib/libc/gen/Makefile index c99ada1d87d2..c4ba9e93e016 100644 --- a/lib/libc/gen/Makefile +++ b/lib/libc/gen/Makefile @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.49 2015/12/22 14:25:58 christos Exp $ +# $NetBSD: Makefile,v 1.50 2016/12/09 06:12:02 kamil Exp $ .include TESTSDIR= ${TESTSBASE}/lib/libc/gen -TESTS_SUBDIRS= execve +TESTS_SUBDIRS= exect +TESTS_SUBDIRS+= execve TESTS_SUBDIRS+= posix_spawn TESTS_C+= t_alarm diff --git a/lib/libc/gen/t_fnmatch.c b/lib/libc/gen/t_fnmatch.c index c0064c38f66a..69ee8d2f793d 100644 --- a/lib/libc/gen/t_fnmatch.c +++ b/lib/libc/gen/t_fnmatch.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $ */ +/* $NetBSD: t_fnmatch.c,v 1.7 2016/10/31 05:08:53 dholland Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $"); +__RCSID("$NetBSD: t_fnmatch.c,v 1.7 2016/10/31 05:08:53 dholland Exp $"); #include #include @@ -166,6 +166,7 @@ ATF_TC_BODY(fnmatch_initialbracket, tc) ATF_CHECK(fnmatch("[!]a-]", "b", 0) == 0); ATF_CHECK(fnmatch("[]-_]", "^", 0) == 0); /* range: ']', '^', '_' */ ATF_CHECK(fnmatch("[!]-_]", "X", 0) == 0); + ATF_CHECK(fnmatch("[A-\\\\]", "[", 0) == 0); ATF_CHECK(fnmatch("[a-z]/[a-z]", "a/b", 0) == 0); ATF_CHECK(fnmatch("[*]/b", "*/b", 0) == 0); ATF_CHECK(fnmatch("[?]/b", "?/b", 0) == 0); diff --git a/lib/libc/net/getaddrinfo/Makefile b/lib/libc/net/getaddrinfo/Makefile index a9f4b53f4c33..416af34a567a 100644 --- a/lib/libc/net/getaddrinfo/Makefile +++ b/lib/libc/net/getaddrinfo/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.1 2011/01/12 02:58:40 pgoyette Exp $ +# $NetBSD: Makefile,v 1.2 2016/08/26 01:31:43 darcy Exp $ -MKMAN= no +NOMAN= .include diff --git a/lib/libc/regex/Makefile b/lib/libc/regex/Makefile index c59a5b6d4acc..d8a46d474fe9 100644 --- a/lib/libc/regex/Makefile +++ b/lib/libc/regex/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.9 2012/08/24 20:24:40 jmmv Exp $ +# $NetBSD: Makefile,v 1.10 2016/08/26 01:31:43 darcy Exp $ -MKMAN= no +NOMAN= .include diff --git a/lib/libc/rpc/t_rpc.c b/lib/libc/rpc/t_rpc.c index 371576250f28..1cfe913c4e47 100644 --- a/lib/libc/rpc/t_rpc.c +++ b/lib/libc/rpc/t_rpc.c @@ -1,7 +1,7 @@ -/* $NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $ */ +/* $NetBSD: t_rpc.c,v 1.10 2016/08/27 14:36:22 christos Exp $ */ #include -__RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $"); +__RCSID("$NetBSD: t_rpc.c,v 1.10 2016/08/27 14:36:22 christos Exp $"); #include #include @@ -21,12 +21,12 @@ __RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/27 13:59:40 christos Exp $"); #define SKIPX(ev, msg, ...) do { \ atf_tc_skip(msg, __VA_ARGS__); \ - return; \ + return ev; \ } while(/*CONSTCOND*/0) #else -#define ERRX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) -#define SKIPX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) +#define ERRX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__) +#define SKIPX(ev, msg, ...) errx(EXIT_FAILURE, msg, __VA_ARGS__) #endif #ifdef DEBUG @@ -72,13 +72,13 @@ onehost(const char *host, const char *transp) __rpc_control(CLCR_SET_RPCB_TIMEOUT, &tv); if ((clnt = clnt_create(host, RPCBPROG, RPCBVERS, transp)) == NULL) - SKIPX(EXIT_FAILURE, "clnt_create (%s)", clnt_spcreateerror("")); + SKIPX(, "clnt_create (%s)", clnt_spcreateerror("")); tv.tv_sec = 1; tv.tv_usec = 0; if (clnt_call(clnt, RPCBPROC_NULL, xdr_void, NULL, xdr_void, NULL, tv) != RPC_SUCCESS) - ERRX(EXIT_FAILURE, "clnt_call (%s)", clnt_sperror(clnt, "")); + ERRX(, "clnt_call (%s)", clnt_sperror(clnt, "")); clnt_control(clnt, CLGET_SVC_ADDR, (char *) &addr); reply(NULL, &addr, NULL); } @@ -100,13 +100,13 @@ server(struct svc_req *rqstp, SVCXPRT *transp) switch (rqstp->rq_proc) { case NULLPROC: if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL)) - ERRX(EXIT_FAILURE, "svc_sendreply failed %d", 0); + ERRX(, "svc_sendreply failed %d", 0); return; case PLUSONE: break; case DESTROY: if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL)) - ERRX(EXIT_FAILURE, "svc_sendreply failed %d", 0); + ERRX(, "svc_sendreply failed %d", 0); svc_destroy(transp); exit(0); default: @@ -121,7 +121,7 @@ server(struct svc_req *rqstp, SVCXPRT *transp) DPRINTF("About to increment\n"); num++; if (!svc_sendreply(transp, (xdrproc_t)xdr_int, (void *)&num)) - ERRX(EXIT_FAILURE, "svc_sendreply failed %d", 1); + ERRX(, "svc_sendreply failed %d", 1); DPRINTF("Leaving server procedure.\n"); } @@ -176,7 +176,7 @@ regtest(const char *hostname, const char *transp, const char *arg, int p) svc_fdset_init(p ? SVC_FDSET_POLL : 0); if (!svc_create(server, PROGNUM, VERSNUM, transp)) - ERRX(EXIT_FAILURE, "Cannot create server %d", num); + SKIPX(EXIT_FAILURE, "Cannot create server %d", num); switch ((pid = fork())) { case 0: diff --git a/lib/libc/sync/cpp_atomic_ops_linkable.cc b/lib/libc/sync/cpp_atomic_ops_linkable.cc index 742685103dba..e7822b768d7f 100644 --- a/lib/libc/sync/cpp_atomic_ops_linkable.cc +++ b/lib/libc/sync/cpp_atomic_ops_linkable.cc @@ -1,4 +1,4 @@ -/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.4 2016/02/27 18:50:39 joerg Exp $ */ +/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.5 2017/01/11 12:10:26 joerg Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -58,19 +58,13 @@ private: volatile std::atomic m_val; }; -#if defined(__clang__) && defined(__sparc64__) -#define NO_SHORT_ATOMICS -#endif - int main(int argc, char **argv) { -#ifndef NO_SHORT_ATOMICS ATest(); ATest(); ATest(); ATest(); ATest(); -#endif ATest(); ATest(); ATest(); @@ -79,29 +73,23 @@ int main(int argc, char **argv) ATest(); ATest(); #endif -#ifndef NO_SHORT_ATOMICS ATest(); -#endif ATest(); ATest(); -#ifndef NO_SHORT_ATOMICS ATest(); ATest(); ATest(); ATest(); -#endif ATest(); ATest(); #ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); #endif -#ifndef NO_SHORT_ATOMICS ATest(); ATest(); ATest(); ATest(); -#endif ATest(); ATest(); #ifdef __HAVE_ATOMIC64_OPS @@ -115,5 +103,5 @@ int main(int argc, char **argv) #ifdef __HAVE_ATOMIC64_OPS ATest(); ATest(); -#endif /* NO_SHORT_ATOMICS */ +#endif } diff --git a/lib/libc/sys/Makefile b/lib/libc/sys/Makefile index f96beb444fea..962cb098c112 100644 --- a/lib/libc/sys/Makefile +++ b/lib/libc/sys/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.43 2016/07/30 11:03:54 njoly Exp $ +# $NetBSD: Makefile,v 1.45 2016/11/11 15:30:44 njoly Exp $ MKMAN= no @@ -12,6 +12,7 @@ TESTS_C+= t_access TESTS_C+= t_bind TESTS_C+= t_chroot TESTS_C+= t_clock_gettime +TESTS_C+= t_clock_nanosleep TESTS_C+= t_clone TESTS_C+= t_connect TESTS_C+= t_dup @@ -67,6 +68,8 @@ TESTS_C+= t_ucontext TESTS_C+= t_umask TESTS_C+= t_unlink TESTS_C+= t_wait +TESTS_C+= t_wait_noproc +TESTS_C+= t_wait_noproc_wnohang TESTS_C+= t_write SRCS.t_mprotect= t_mprotect.c ${SRCS_EXEC_PROT} diff --git a/lib/libc/sys/t_clock_nanosleep.c b/lib/libc/sys/t_clock_nanosleep.c new file mode 100644 index 000000000000..8c1fd036b8ba --- /dev/null +++ b/lib/libc/sys/t_clock_nanosleep.c @@ -0,0 +1,63 @@ +/* $NetBSD: t_clock_nanosleep.c,v 1.1 2016/11/11 15:30:44 njoly Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_clock_nanosleep.c,v 1.1 2016/11/11 15:30:44 njoly Exp $"); + +#include +#include + +ATF_TC(clock_nanosleep_remain); +ATF_TC_HEAD(clock_nanosleep_remain, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Check clock_nanosleep(2) remaining time"); +} + +ATF_TC_BODY(clock_nanosleep_remain, tc) +{ + struct timespec rqtp, rmtp; + + rqtp.tv_sec = 0; rqtp.tv_nsec = 0; + rmtp.tv_sec = -1; rmtp.tv_nsec = -1; + ATF_REQUIRE(clock_nanosleep(CLOCK_REALTIME, 0, &rqtp, &rmtp) == 0); + ATF_CHECK(rmtp.tv_sec == 0 && rmtp.tv_nsec == 0); + + ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &rqtp) == 0); + rmtp.tv_sec = -1; rmtp.tv_nsec = -1; + ATF_REQUIRE(clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &rqtp, &rmtp) == 0); + ATF_CHECK(rmtp.tv_sec == -1 && rmtp.tv_nsec == -1); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, clock_nanosleep_remain); + + return atf_no_error(); +} diff --git a/lib/libc/sys/t_wait_noproc.c b/lib/libc/sys/t_wait_noproc.c new file mode 100644 index 000000000000..5d95e526a187 --- /dev/null +++ b/lib/libc/sys/t_wait_noproc.c @@ -0,0 +1,340 @@ +/* $NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_wait_noproc.c,v 1.5 2016/11/09 17:50:19 kamil Exp $"); + +#include +#include + +#include +#include + +#include + +#ifndef TWAIT_OPTION +#define TWAIT_OPTION 0 +#endif + +#if TWAIT_OPTION == 0 +ATF_TC(wait); +ATF_TC_HEAD(wait, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait(2) returns ECHILD for no child"); +} + +ATF_TC_BODY(wait, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, wait(NULL) == -1); +} +#endif + +ATF_TC(waitpid); +ATF_TC_HEAD(waitpid, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitpid(2) returns ECHILD for WAIT_ANY and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(waitpid, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, waitpid(WAIT_ANY, NULL, TWAIT_OPTION) == -1); +} + +ATF_TC(waitid); +ATF_TC_HEAD(waitid, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitid(2) returns ECHILD for P_ALL and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(waitid, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, + waitid(P_ALL, 0, NULL, + WTRAPPED | WEXITED | TWAIT_OPTION) == -1); +} + +ATF_TC(wait3); +ATF_TC_HEAD(wait3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait3(2) returns ECHILD for no child"); +} + +ATF_TC_BODY(wait3, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, wait3(NULL, TWAIT_OPTION, NULL) == -1); +} + +ATF_TC(wait4); +ATF_TC_HEAD(wait4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait4(2) returns ECHILD for WAIT_ANY and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait4, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, + wait4(WAIT_ANY, NULL, TWAIT_OPTION, NULL) == -1); +} + +ATF_TC(wait6); +ATF_TC_HEAD(wait6, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait6(2) returns ECHILD for P_ALL and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait6, tc) +{ + ATF_REQUIRE_ERRNO(ECHILD, + wait6(P_ALL, 0, NULL, + WTRAPPED | WEXITED | TWAIT_OPTION, NULL, NULL) == -1); +} + +/* + * Generator of valid combinations of options + * Usage: i = 0; while ((o = get_options_wait6(i++)) != -1) {} + */ +static int +get_options6(size_t pos) +{ + int rv = 0; + size_t n; + + /* + * waitid(2) must specify at least one of WEXITED, WUNTRACED, + * WSTOPPED, WTRAPPED or WCONTINUED. Single option WNOWAIT + * isn't valid. + */ + + const int matrix[] = { + WNOWAIT, /* First in order to blacklist it easily */ + WEXITED, + WUNTRACED, + WSTOPPED, /* SUS compatibility, equal to WUNTRACED */ + WTRAPPED, + WCONTINUED + }; + + const size_t M = (1 << __arraycount(matrix)) - 1; + + /* Skip empty and sole WNOWAIT option */ + pos+=2; + + if (pos > M) + return -1; + + for (n = 0; n < __arraycount(matrix); n++) { + if (pos & __BIT(n)) + rv |= matrix[n]; + } + + return rv; +} + +/* + * Generator of valid combinations of options + * Usage: i = 0; while ((o = get_options_wait4(i++)) != -1) {} + */ +static int +get_options4(size_t pos) +{ + int rv = 0; + size_t n; + + const int special[] = { + 0, + WALLSIG, + WALTSIG, + __WALL, /* Linux compatibility, equal to WALLSIG */ + __WCLONE /* Linux compatibility, equal to WALTSIG */ + }; + + const int matrix[] = { + WNOWAIT, + WEXITED, + WUNTRACED, + WSTOPPED, /* SUS compatibility, equal to WUNTRACED */ + WTRAPPED, + WCONTINUED + }; + + const size_t M = (1 << __arraycount(special)) - 1; + + if (pos < __arraycount(special)) + return special[pos]; + + pos -= __arraycount(special); + + ++pos; /* Don't start with empty mask */ + + if (pos > M) + return -1; + + for (n = 0; n < __arraycount(special); n++) { + if (pos & __BIT(n)) + rv |= matrix[n]; + } + + return rv; +} + +ATF_TC(waitpid_options); +ATF_TC_HEAD(waitpid_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitpid(2) returns ECHILD for WAIT_ANY and valid " + "combination of options with%s WNOHANG", + TWAIT_OPTION == 0 ? "out" : ""); +} + +ATF_TC_BODY(waitpid_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options4(i++)) != -1) { + printf("Testing waitpid(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + waitpid(WAIT_ANY, NULL, o | TWAIT_OPTION) == -1); + } +} + +ATF_TC(waitid_options); +ATF_TC_HEAD(waitid_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that waitid(2) returns ECHILD for P_ALL and valid " + "combination of options with%s WNOHANG", + TWAIT_OPTION == 0 ? "out" : ""); +} + +ATF_TC_BODY(waitid_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options6(i++)) != -1) { + printf("Testing waitid(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + waitid(P_ALL, 0, NULL, o | TWAIT_OPTION) == -1); + } +} + +ATF_TC(wait3_options); +ATF_TC_HEAD(wait3_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait3(2) returns ECHILD for no child"); +} + +ATF_TC_BODY(wait3_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options4(i++)) != -1) { + printf("Testing wait3(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + wait3(NULL, o | TWAIT_OPTION, NULL) == -1); + } +} + +ATF_TC(wait4_options); +ATF_TC_HEAD(wait4_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait4(2) returns ECHILD for WAIT_ANY and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait4_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options4(i++)) != -1) { + printf("Testing wait4(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + wait4(WAIT_ANY, NULL, o | TWAIT_OPTION, NULL) == -1); + } +} + +ATF_TC(wait6_options); +ATF_TC_HEAD(wait6_options, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test that wait6(2) returns ECHILD for P_ALL and option %s", + ___STRING(TWAIT_OPTION)); +} + +ATF_TC_BODY(wait6_options, tc) +{ + size_t i = 0; + int o; + + while((o = get_options6(i++)) != -1) { + printf("Testing wait6(2) with options %x\n", o); + + ATF_REQUIRE_ERRNO(ECHILD, + wait6(P_ALL, 0, NULL, o | TWAIT_OPTION, NULL, NULL) == -1); + } +} + +ATF_TP_ADD_TCS(tp) +{ + +#if TWAIT_OPTION == 0 + ATF_TP_ADD_TC(tp, wait); +#endif + ATF_TP_ADD_TC(tp, waitpid); + ATF_TP_ADD_TC(tp, waitid); + ATF_TP_ADD_TC(tp, wait3); + ATF_TP_ADD_TC(tp, wait4); + ATF_TP_ADD_TC(tp, wait6); + + ATF_TP_ADD_TC(tp, waitpid_options); + ATF_TP_ADD_TC(tp, waitid_options); + ATF_TP_ADD_TC(tp, wait3_options); + ATF_TP_ADD_TC(tp, wait4_options); + ATF_TP_ADD_TC(tp, wait6_options); + + return atf_no_error(); +} diff --git a/lib/libc/sys/t_wait_noproc_wnohang.c b/lib/libc/sys/t_wait_noproc_wnohang.c new file mode 100644 index 000000000000..45a9998580f0 --- /dev/null +++ b/lib/libc/sys/t_wait_noproc_wnohang.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_wait_noproc_wnohang.c,v 1.1 2016/11/06 15:03:30 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_OPTION WNOHANG +#include "t_wait_noproc.c" diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 77a39af2600e..f13134e58a67 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.37 2016/01/24 20:26:47 gson Exp $ +# $NetBSD: Makefile,v 1.42 2016/12/20 06:13:19 maya Exp $ .include @@ -9,11 +9,14 @@ COPTS+= -mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i .endif CPPFLAGS.t_fenv.c+= -D__TEST_FENV +CPPFLAGS.t_fe_round.c+= -D__TEST_FENV +CPPFLAGS.t_ilogb.c+= -D__TEST_FENV CPPFLAGS.t_fmod.c+= -I${.CURDIR}/../libc/gen TESTS_C+= t_acos TESTS_C+= t_asin TESTS_C+= t_atan +TESTS_C+= t_casinh TESTS_C+= t_cbrt TESTS_C+= t_ceil TESTS_C+= t_cos @@ -21,8 +24,10 @@ TESTS_C+= t_cosh TESTS_C+= t_erf TESTS_C+= t_exp TESTS_C+= t_fenv +TESTS_C+= t_fe_round TESTS_C+= t_fmod TESTS_C+= t_hypot +TESTS_C+= t_ilogb TESTS_C+= t_infinity TESTS_C+= t_ldexp TESTS_C+= t_log diff --git a/lib/libm/t_ldexp.c b/lib/libm/t_ldexp.c index eaf8a4bfdb18..251f2aeba5fb 100644 --- a/lib/libm/t_ldexp.c +++ b/lib/libm/t_ldexp.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ldexp.c,v 1.14 2014/11/04 00:20:19 justin Exp $ */ +/* $NetBSD: t_ldexp.c,v 1.16 2016/08/25 00:32:31 maya Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_ldexp.c,v 1.14 2014/11/04 00:20:19 justin Exp $"); +__RCSID("$NetBSD: t_ldexp.c,v 1.16 2016/08/25 00:32:31 maya Exp $"); #include @@ -96,10 +96,12 @@ struct ldexp_test ldexp_overflow[] = { { 1.0, 1023, 1, " inf" }, { 1.0, -1022, 2046, " inf" }, { 1.0, 1025, SKIP, " inf" }, + { 2.0, INT_MAX,SKIP, " inf" }, { -1.0, 1024, SKIP, " -inf" }, { -1.0, 1023, 1, " -inf" }, { -1.0, -1022, 2046, " -inf" }, { -1.0, 1025, SKIP, " -inf" }, + { -2.0, INT_MAX,SKIP, " -inf" }, { 0, 0, 0, NULL } }; @@ -170,10 +172,8 @@ run_test(struct ldexp_test *table) v = ldexp(table->x, table->exp1); - if (table->exp2 == SKIP) - continue; - - v = ldexp(v, table->exp2); + if (table->exp2 != SKIP) + v = ldexp(v, table->exp2); (void)snprintf(outbuf, sizeof(outbuf), FORMAT, v); diff --git a/lib/libm/t_precision.c b/lib/libm/t_precision.c index 777666f297fb..df2d8a36e3f6 100644 --- a/lib/libm/t_precision.c +++ b/lib/libm/t_precision.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_precision.c,v 1.2 2014/11/04 00:20:19 justin Exp $ */ +/* $NetBSD: t_precision.c,v 1.3 2016/08/27 10:07:05 christos Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_precision.c,v 1.2 2014/11/04 00:20:19 justin Exp $"); +__RCSID("$NetBSD: t_precision.c,v 1.3 2016/08/27 10:07:05 christos Exp $"); #include @@ -45,7 +45,9 @@ ATF_TC_HEAD(t_precision, tc) } volatile double x = 1; +#if __HAVE_LONG_DOUBLE volatile long double y = 1; +#endif ATF_TC_BODY(t_precision, tc) { @@ -58,6 +60,7 @@ ATF_TC_BODY(t_precision, tc) x += DBL_EPSILON; ATF_CHECK(x == 2.0); +#if __HAVE_LONG_DOUBLE y += LDBL_EPSILON; ATF_CHECK(y != 1.0L); y -= 1; @@ -65,6 +68,7 @@ ATF_TC_BODY(t_precision, tc) y = 2; y += LDBL_EPSILON; ATF_CHECK(y == 2.0L); +#endif } ATF_TP_ADD_TCS(tp) diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index 4f227aaa8eff..cb84bcd0a807 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2013/04/12 17:18:11 christos Exp $ +# $NetBSD: Makefile,v 1.12 2016/10/30 16:17:16 kamil Exp $ NOMAN= # defined @@ -38,6 +38,7 @@ TESTS_C+= t_sigsuspend TESTS_C+= t_siglongjmp TESTS_C+= t_sleep TESTS_C+= t_swapcontext +TESTS_C+= t_timedmutex LDADD.t_sem+= -lrt diff --git a/lib/libpthread/h_common.h b/lib/libpthread/h_common.h index f4d03bcdec9e..2e8b0a123e75 100644 --- a/lib/libpthread/h_common.h +++ b/lib/libpthread/h_common.h @@ -9,4 +9,10 @@ ATF_REQUIRE_MSG(ret == 0, "%s: %s", #x, strerror(ret)); \ } while (0) +#define PTHREAD_REQUIRE_STATUS(x, v) \ + do { \ + int ret = (x); \ + ATF_REQUIRE_MSG(ret == (v), "%s: %s", #x, strerror(ret)); \ + } while (0) + #endif // H_COMMON_H diff --git a/lib/libpthread/t_mutex.c b/lib/libpthread/t_mutex.c index f2cba5e4deec..e9ba2fc5754a 100644 --- a/lib/libpthread/t_mutex.c +++ b/lib/libpthread/t_mutex.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mutex.c,v 1.10 2016/07/31 13:01:29 christos Exp $ */ +/* $NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,12 +29,13 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_mutex.c,v 1.10 2016/07/31 13:01:29 christos Exp $"); +__RCSID("$NetBSD: t_mutex.c,v 1.14 2016/10/31 23:51:20 christos Exp $"); #include #include #include #include +#include #include #include #include @@ -47,6 +48,31 @@ static pthread_mutex_t mutex; static pthread_mutex_t static_mutex = PTHREAD_MUTEX_INITIALIZER; static int global_x; +#ifdef TIMEDMUTEX +/* This code is used for verifying non-timed specific code */ +static struct timespec ts_lengthy = { + .tv_sec = UINT16_MAX, + .tv_nsec = 0 +}; +/* This code is used for verifying timed-only specific code */ +static struct timespec ts_shortlived = { + .tv_sec = 0, + .tv_nsec = 120 +}; + +static int +mutex_lock(pthread_mutex_t *m, const struct timespec *ts) +{ + struct timespec ts_wait; + ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &ts_wait) != -1); + timespecadd(&ts_wait, ts, &ts_wait); + + return pthread_mutex_timedlock(m, &ts_wait); +} +#else +#define mutex_lock(a, b) pthread_mutex_lock(a) +#endif + static void * mutex1_threadfunc(void *arg) { @@ -56,7 +82,7 @@ mutex1_threadfunc(void *arg) param = arg; printf("2: Locking mutex\n"); - pthread_mutex_lock(&mutex); + mutex_lock(&mutex, &ts_lengthy); printf("2: Got mutex. *param = %d\n", *param); ATF_REQUIRE_EQ(*param, 20); (*param)++; @@ -81,7 +107,7 @@ ATF_TC_BODY(mutex1, tc) PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); x = 1; - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex1_threadfunc, &x)); printf("1: Before changing the value.\n"); sleep(2); @@ -92,7 +118,7 @@ ATF_TC_BODY(mutex1, tc) printf("1: After releasing the mutex.\n"); PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (int) was %d\n", x, *(int *)joinval); ATF_REQUIRE_EQ(x, 21); @@ -108,7 +134,7 @@ mutex2_threadfunc(void *arg) printf("2: Second thread (%p). Count is %ld\n", pthread_self(), count); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } @@ -141,7 +167,7 @@ ATF_TC_BODY(mutex2, tc) global_x = 0; count = count2 = 10000000; - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex2_threadfunc, &count2)); printf("1: Thread %p\n", pthread_self()); @@ -149,14 +175,14 @@ ATF_TC_BODY(mutex2, tc) PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (long) was %ld\n", global_x, (long)joinval); ATF_REQUIRE_EQ(global_x, 20000000); @@ -178,7 +204,7 @@ mutex3_threadfunc(void *arg) printf("2: Second thread (%p). Count is %ld\n", pthread_self(), count); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&static_mutex)); } @@ -210,7 +236,7 @@ ATF_TC_BODY(mutex3, tc) global_x = 0; count = count2 = 10000000; - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex3_threadfunc, &count2)); printf("1: Thread %p\n", pthread_self()); @@ -218,14 +244,14 @@ ATF_TC_BODY(mutex3, tc) PTHREAD_REQUIRE(pthread_mutex_unlock(&static_mutex)); while (count--) { - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); global_x++; PTHREAD_REQUIRE(pthread_mutex_unlock(&static_mutex)); } PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex)); + PTHREAD_REQUIRE(mutex_lock(&static_mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (long) was %ld\n", global_x, (long)joinval); ATF_REQUIRE_EQ(global_x, 20000000); @@ -248,7 +274,7 @@ mutex4_threadfunc(void *arg) param = arg; printf("2: Locking mutex\n"); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("2: Got mutex. *param = %d\n", *param); (*param)++; @@ -279,11 +305,11 @@ ATF_TC_BODY(mutex4, tc) PTHREAD_REQUIRE(pthread_mutexattr_destroy(&mattr)); x = 1; - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex4_threadfunc, &x)); printf("1: Before recursively acquiring the mutex.\n"); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Before releasing the mutex once.\n"); sleep(2); @@ -299,7 +325,7 @@ ATF_TC_BODY(mutex4, tc) PTHREAD_REQUIRE(pthread_join(new, &joinval)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (int) was %d\n", x, *(int *)joinval); ATF_REQUIRE_EQ(x, 21); @@ -320,7 +346,7 @@ child_func(void* arg) res = _sched_protect(-2); ATF_REQUIRE_EQ_MSG(res, -1, "sched_protect returned %d", res); ATF_REQUIRE_EQ(errno, ENOENT); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex5)); + PTHREAD_REQUIRE(mutex_lock(&mutex5, &ts_lengthy)); printf("child is owning resource\n"); res = _sched_protect(-2); ATF_REQUIRE_EQ(res, max_fifo_prio); @@ -363,7 +389,7 @@ ATF_TC_BODY(mutex5, tc) max_fifo_prio)); PTHREAD_REQUIRE(pthread_mutex_init(&mutex5, &attr5)); - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex5)); + PTHREAD_REQUIRE(mutex_lock(&mutex5, &ts_lengthy)); printf("enter critical section for main\n"); PTHREAD_REQUIRE(pthread_create(&child, NULL, child_func, NULL)); printf("main starts to sleep\n"); @@ -401,7 +427,7 @@ high_prio(void* arg) high_cnt = 0; sleep(1); } - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex6)); + PTHREAD_REQUIRE(mutex_lock(&mutex6, &ts_lengthy)); if (start == 0) start = 2; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex6)); @@ -433,7 +459,7 @@ low_prio(void* arg) low_cnt = 0; sleep(1); } - PTHREAD_REQUIRE(pthread_mutex_lock(&mutex6)); + PTHREAD_REQUIRE(mutex_lock(&mutex6, &ts_lengthy)); if (start == 0) start = 1; PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex6)); @@ -551,6 +577,123 @@ ATF_TC_BODY(mutexattr2, tc) } } +#ifdef TIMEDMUTEX +ATF_TC(timedmutex1); +ATF_TC_HEAD(timedmutex1, tc) +{ + atf_tc_set_md_var(tc, "descr", "Checks timeout on selflock"); +} + +ATF_TC_BODY(timedmutex1, tc) +{ + + printf("Timed mutex-test 1\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + + printf("Before endeavor to reacquire timed-mutex (timeout expected)\n"); + PTHREAD_REQUIRE_STATUS(mutex_lock(&mutex, &ts_shortlived), + ETIMEDOUT); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} + +ATF_TC(timedmutex2); +ATF_TC_HEAD(timedmutex2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks timeout on selflock with timedlock"); +} + +ATF_TC_BODY(timedmutex2, tc) +{ + + printf("Timed mutex-test 2\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex with timedlock\n"); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); + + printf("Before endeavor to reacquire timed-mutex (timeout expected)\n"); + PTHREAD_REQUIRE_STATUS(mutex_lock(&mutex, &ts_shortlived), + ETIMEDOUT); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} + +ATF_TC(timedmutex3); +ATF_TC_HEAD(timedmutex3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks timeout on selflock in a new thread"); +} + +static void * +timedmtx_thrdfunc(void *arg) +{ + printf("Before endeavor to reacquire timed-mutex (timeout expected)\n"); + PTHREAD_REQUIRE_STATUS(mutex_lock(&mutex, &ts_shortlived), + ETIMEDOUT); + + return NULL; +} + +ATF_TC_BODY(timedmutex3, tc) +{ + pthread_t new; + + printf("Timed mutex-test 3\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex with timedlock\n"); + PTHREAD_REQUIRE(pthread_mutex_lock(&mutex)); + + printf("Before creating new thread\n"); + PTHREAD_REQUIRE(pthread_create(&new, NULL, timedmtx_thrdfunc, NULL)); + + printf("Before joining the mutex\n"); + PTHREAD_REQUIRE(pthread_join(new, NULL)); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} + +ATF_TC(timedmutex4); +ATF_TC_HEAD(timedmutex4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Checks timeout on selflock with timedlock in a new thread"); +} + +ATF_TC_BODY(timedmutex4, tc) +{ + pthread_t new; + + printf("Timed mutex-test 4\n"); + + PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); + + printf("Before acquiring mutex with timedlock\n"); + PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); + + printf("Before creating new thread\n"); + PTHREAD_REQUIRE(pthread_create(&new, NULL, timedmtx_thrdfunc, NULL)); + + printf("Before joining the mutex\n"); + PTHREAD_REQUIRE(pthread_join(new, NULL)); + + printf("Unlocking mutex\n"); + PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); +} +#endif + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, mutex1); @@ -561,6 +704,13 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mutex6); ATF_TP_ADD_TC(tp, mutexattr1); ATF_TP_ADD_TC(tp, mutexattr2); - + +#ifdef TIMEDMUTEX + ATF_TP_ADD_TC(tp, timedmutex1); + ATF_TP_ADD_TC(tp, timedmutex2); + ATF_TP_ADD_TC(tp, timedmutex3); + ATF_TP_ADD_TC(tp, timedmutex4); +#endif + return atf_no_error(); } diff --git a/lib/librumpclient/Makefile b/lib/librumpclient/Makefile index 3cc3f437e698..9dc696d575b4 100644 --- a/lib/librumpclient/Makefile +++ b/lib/librumpclient/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.7 2016/08/10 21:10:18 kre Exp $ +# $NetBSD: Makefile,v 1.9 2016/10/06 20:14:11 christos Exp $ # .include diff --git a/lib/librumpclient/h_execthr.c b/lib/librumpclient/h_execthr.c index f653fe6afe0a..c209375e4b9f 100644 --- a/lib/librumpclient/h_execthr.c +++ b/lib/librumpclient/h_execthr.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_execthr.c,v 1.3 2014/08/13 00:03:00 pooka Exp $ */ +/* $NetBSD: h_execthr.c,v 1.7 2016/11/24 00:37:29 dholland Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -42,6 +42,14 @@ #include #include +//#define VERBOSE + +#ifdef VERBOSE +#define SAY(...) printf(__VA_ARGS__) +#else +#define SAY(...) +#endif + static int canreturn = 0; /* @@ -103,6 +111,7 @@ main(int argc, char *argv[], char *envp[]) else execd = 0; sprintf(nexec, "%d", execd+1); + SAY("execd: %d\n", execd); if (rumpclient_init() == -1) { if (execd) @@ -111,33 +120,43 @@ main(int argc, char *argv[], char *envp[]) err(1, "init"); } mypid = rump_sys_getpid(); + SAY("rumpclient_init finished.\n"); if (execd) { canreturn = 1; - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)P2_0) != 0) - errx(1, "exec pthread_create"); + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)P2_0); + if (errno != 0) + err(1, "exec pthread_create"); + SAY("startup pthread_create finished.\n"); i = 37; rump_sys_write(P2_1, &i, sizeof(i)); pthread_join(pt, NULL); + SAY("startup pthread_join finished.\n"); n = rump_sys_read(P1_0, &i, sizeof(i)); if (n != -1 || errno != EBADF) errx(1, "post-exec cloexec works"); + SAY("startup rump_sys_read finished.\n"); getproc(mypid, &p); + SAY("startup getproc finished.\n"); if (p.p_nlwps != 2) errx(1, "invalid nlwps: %lld", (long long)p.p_nlwps); /* we passed? */ - if (execd > 10) + if (execd > 10) { + SAY("done.\n"); exit(0); + } rump_sys_close(P2_0); rump_sys_close(P2_1); } + SAY("making pipes...\n"); + if (rump_sys_pipe(p1) == -1) err(1, "pipe1"); if (p1[0] != P1_0 || p1[1] != P1_1) @@ -151,32 +170,47 @@ main(int argc, char *argv[], char *envp[]) if (rump_sys_fcntl(p1[1], F_SETFD, FD_CLOEXEC) == -1) err(1, "cloexec"); - for (i = 0; i < NTHR; i++) - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)p1[0]) != 0) - errx(1, "pthread_create 1 %d", i); + SAY("making threads...\n"); - for (i = 0; i < NTHR; i++) - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)p2[0]) != 0) - errx(1, "pthread_create 2 %d", i); + for (i = 0; i < NTHR; i++) { + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)p1[0]); + if (errno != 0) + err(1, "pthread_create 1 %d", i); + } + + for (i = 0; i < NTHR; i++) { + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)p2[0]); + if (errno != 0) + err(1, "pthread_create 2 %d", i); + } + + SAY("waiting for threads to start...\n"); /* wait for all the threads to be enjoying themselves */ for (;;) { getproc(mypid, &p); + SAY("getproc finished.\n"); if (p.p_nlwps == 2*NTHR + 2) break; usleep(10000); } + SAY("making some more threads start...\n"); + /* * load up one more (big) set. these won't start executing, though, * but we're interested in if they create blockage */ - for (i = 0; i < 3*NTHR; i++) - if (pthread_create(&pt, NULL, - wrk, (void *)(uintptr_t)p1[0]) != 0) - errx(1, "pthread_create 1 %d", i); + for (i = 0; i < 3*NTHR; i++) { + errno = pthread_create(&pt, NULL, + wrk, (void *)(uintptr_t)p1[0]); + if (errno != 0) + err(1, "pthread_create 3 %d", i); + } + + SAY("calling exec...\n"); /* then, we exec! */ execarg[0] = argv[0]; diff --git a/lib/librumphijack/t_tcpip.sh b/lib/librumphijack/t_tcpip.sh index 718dfdc1de4c..411be3340bbc 100755 --- a/lib/librumphijack/t_tcpip.sh +++ b/lib/librumphijack/t_tcpip.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.17 2016/08/11 21:29:44 kre Exp $ +# $NetBSD: t_tcpip.sh,v 1.18 2016/08/13 11:22:11 christos Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,7 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -rumpnetsrv='rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev' +rumpnetlibs="-lrumpnet -lrumpnet_net -lrumpnet_netinet6 -lrumpnet_netinet" +rumpnetsrv="rump_server $rumpnetlibs -lrumpdev" export RUMP_SERVER=unix://csock atf_test_case http cleanup @@ -37,7 +38,7 @@ http_head() http_body() { - atf_check -s exit:0 ${rumpnetsrv} -lrumpnet_netinet6 ${RUMP_SERVER} + atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} # start bozo in daemon mode atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ diff --git a/lib/libusbhid/t_usbhid.c b/lib/libusbhid/t_usbhid.c index f20652a926f1..2766da234f1a 100644 --- a/lib/libusbhid/t_usbhid.c +++ b/lib/libusbhid/t_usbhid.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_usbhid.c,v 1.11 2016/01/07 16:10:49 jakllsch Exp $ */ +/* $NetBSD: t_usbhid.c,v 1.12 2016/08/17 12:10:42 jakllsch Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_usbhid.c,v 1.11 2016/01/07 16:10:49 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.12 2016/08/17 12:10:42 jakllsch Exp $"); #include @@ -244,6 +244,9 @@ ATF_TC_BODY(check_hid_get_data, tc) int32_t data; uint32_t udat; + atf_tc_expect_fail("only the 32-bit opcode works, " + "8 and 16-bit is broken"); + ATF_REQUIRE((hrd = hid_use_report_desc( range_test_report_descriptor, __arraycount(range_test_report_descriptor))) != NULL); diff --git a/net/Makefile b/net/Makefile index 6f6ad298ed2b..8268e4b29bfa 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.28 2016/04/15 01:38:17 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.30 2016/11/26 03:19:48 ozaki-r Exp $ .include @@ -7,7 +7,7 @@ TESTSDIR= ${TESTSBASE}/net TESTS_SUBDIRS= fdpass in_cksum net sys .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_SUBDIRS+= arp bpf bpfilter carp icmp if if_bridge if_gif if_loop -TESTS_SUBDIRS+= if_pppoe if_tap mcast mpls ndp npf route +TESTS_SUBDIRS+= if_pppoe if_tap if_tun mcast mpls ndp npf route if_vlan .if (${MKSLJIT} != "no") TESTS_SUBDIRS+= bpfjit .endif diff --git a/net/arp/Makefile b/net/arp/Makefile index fc11e5af6fbe..98d80dd7054c 100644 --- a/net/arp/Makefile +++ b/net/arp/Makefile @@ -1,11 +1,13 @@ -# $NetBSD: Makefile,v 1.3 2015/07/30 05:43:42 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.4 2016/11/24 08:52:19 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/arp -TESTS_SH= t_arp -TESTS_SH+= t_dad +.for name in arp dad +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .include diff --git a/net/arp/t_arp.sh b/net/arp/t_arp.sh index ab55eb326ed0..04e2f70375c2 100755 --- a/net/arp/t_arp.sh +++ b/net/arp/t_arp.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_arp.sh,v 1.16 2016/06/21 05:04:16 ozaki-r Exp $ +# $NetBSD: t_arp.sh,v 1.22 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev -lrumpnet_tap" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP4SRC=10.0.1.1 @@ -36,7 +32,7 @@ IP4DST=10.0.1.2 IP4DST_PROXYARP1=10.0.1.3 IP4DST_PROXYARP2=10.0.1.4 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 atf_test_case arp_cache_expiration_5s cleanup @@ -106,9 +102,9 @@ arp_static_head() setup_dst_server() { + + rump_server_add_iface $SOCKDST shmif0 bus1 export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4DST/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -127,8 +123,7 @@ setup_src_server() atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.arp.keep=$keep # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet $IP4SRC/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -145,8 +140,8 @@ test_cache_expiration() local arp_keep=$1 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -172,12 +167,16 @@ test_cache_expiration() arp_cache_expiration_5s_body() { + test_cache_expiration 5 + rump_server_destroy_ifaces } arp_cache_expiration_10s_body() { + test_cache_expiration 10 + rump_server_destroy_ifaces } arp_command_body() @@ -185,8 +184,8 @@ arp_command_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -257,7 +256,7 @@ arp_command_body() $DEBUG && rump.arp -n -a #atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.10 - return 0 + rump_server_destroy_ifaces } make_pkt_str_arpreq() @@ -273,12 +272,12 @@ arp_garp_body() { local pkt= - atf_check -s exit:0 ${inetserver} $SOCKSRC + rump_server_start $SOCKSRC + export RUMP_SERVER=$SOCKSRC # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias atf_check -s exit:0 rump.ifconfig shmif0 up @@ -304,6 +303,8 @@ arp_garp_body() atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" pkt=$(make_pkt_str_arpreq 10.0.0.4 10.0.0.4) atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'" + + rump_server_destroy_ifaces } arp_cache_overwriting_body() @@ -311,8 +312,8 @@ arp_cache_overwriting_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep @@ -341,7 +342,7 @@ arp_cache_overwriting_body() atf_check -s exit:0 -o match:'b2:a0:20:00:00:ff' rump.arp -n 10.0.1.10 $DEBUG && rump.arp -n -a - return 0 + rump_server_destroy_ifaces } make_pkt_str_arprep() @@ -363,36 +364,21 @@ make_pkt_str_garp() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - test_proxy_arp() { local arp_keep=5 local opts= title= flags= local type=$1 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST tap setup_dst_server setup_src_server $arp_keep export RUMP_SERVER=$SOCKDST atf_check -s exit:0 -o ignore rump.sysctl -w net.inet.ip.forwarding=1 - macaddr_dst=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') + macaddr_dst=$(get_macaddr $SOCKDST shmif0) if [ "$type" = "pub" ]; then opts="pub" @@ -416,7 +402,7 @@ test_proxy_arp() rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 # Flushing - extract_new_packets > ./out + extract_new_packets bus1 > ./out # Set up proxy ARP entry export RUMP_SERVER=$SOCKDST @@ -435,7 +421,7 @@ test_proxy_arp() rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP1 fi - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt1=$(make_pkt_str_arprep $IP4DST_PROXYARP1 $macaddr_dst) @@ -461,7 +447,7 @@ test_proxy_arp() atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -n -w 1 -c 1 $IP4DST_PROXYARP2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # ARP reply should be sent @@ -482,12 +468,14 @@ arp_proxy_arp_pub_body() { test_proxy_arp pub + rump_server_destroy_ifaces } arp_proxy_arp_pubproxy_body() { test_proxy_arp pubproxy + rump_server_destroy_ifaces } arp_link_activation_body() @@ -495,14 +483,14 @@ arp_link_activation_body() local arp_keep=5 local bonus=2 - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep # flush old packets - extract_new_packets > ./out + extract_new_packets bus1 > ./out export RUMP_SERVER=$SOCKSRC @@ -510,7 +498,7 @@ arp_link_activation_body() b2:a1:00:00:00:01 atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) @@ -520,12 +508,14 @@ arp_link_activation_body() b2:a1:00:00:00:02 active atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str_arpreq $IP4SRC $IP4SRC) atf_check -s exit:0 -x \ "cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'" + + rump_server_destroy_ifaces } arp_static_body() @@ -533,14 +523,13 @@ arp_static_body() local arp_keep=5 local macaddr_src= - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKDST setup_dst_server setup_src_server $arp_keep - export RUMP_SERVER=$SOCKSRC - macaddr_src=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}') + macaddr_src=$(get_macaddr $SOCKSRC shmif0) # Set a (valid) static ARP entry for the src server export RUMP_SERVER=$SOCKDST @@ -551,37 +540,8 @@ arp_static_body() # Test receiving an ARP request with the static ARP entry (as spa/sha) export RUMP_SERVER=$SOCKSRC atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST -} -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -dump_src() -{ - export RUMP_SERVER=$SOCKSRC - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_dst() -{ - export RUMP_SERVER=$SOCKDST - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_src - dump_dst - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } arp_cache_expiration_5s_cleanup() @@ -604,9 +564,8 @@ arp_command_cleanup() arp_garp_cleanup() { - $DEBUG && dump_src - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKSRC rump.halt + $DEBUG && dump + cleanup } arp_cache_overwriting_cleanup() diff --git a/net/arp/t_dad.sh b/net/arp/t_dad.sh index aefcb0befa45..57a7d4b0ecc4 100755 --- a/net/arp/t_dad.sh +++ b/net/arp/t_dad.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.7 2016/08/10 22:05:07 kre Exp $ +# $NetBSD: t_dad.sh,v 1.13 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,14 +25,10 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -inetserver="${inetserver} -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKLOCAL=unix://commsock1 SOCKPEER=unix://commsock2 -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case dad_basic cleanup atf_test_case dad_duplicated cleanup @@ -54,10 +50,9 @@ setup_server() local sock=$1 local ip=$2 - export RUMP_SERVER=$sock + rump_server_add_iface $sock shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet $ip/24 atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -74,30 +69,15 @@ make_pkt_str() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - dad_basic_body() { local pkt= - atf_check -s exit:0 ${inetserver} $SOCKLOCAL + rump_server_start $SOCKLOCAL + rump_server_add_iface $SOCKLOCAL shmif0 bus1 + export RUMP_SERVER=$SOCKLOCAL - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.1/24 atf_check -s exit:0 rump.ifconfig shmif0 inet 10.0.0.2/24 alias $DEBUG && rump.ifconfig shmif0 @@ -107,13 +87,13 @@ dad_basic_body() $DEBUG && cat ./out # The primary address doesn't start with tentative state - atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -q tentative" + atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -iq tentative" # The alias address starts with tentative state # XXX we have no stable way to check this, so skip for now - #atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -q tentative" + #atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -iq tentative" atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check DAD probe packets @@ -127,14 +107,14 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig -w 10 # Give a chance to send a DAD announce packet atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check the DAD announce packet pkt=$(make_pkt_str 10.0.0.2 10.0.0.2) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # The alias address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -q tentative" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -iq tentative" # # Add a new address on the fly @@ -143,11 +123,11 @@ dad_basic_body() # The new address starts with tentative state # XXX we have no stable way to check this, so skip for now - #atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative" + #atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" # Check DAD probe packets atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_pkt_str 10.0.0.3 0.0.0.0) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" @@ -156,14 +136,16 @@ dad_basic_body() atf_check -s exit:0 rump.ifconfig -w 10 # Give a chance to send a DAD announce packet atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check the DAD announce packet pkt=$(make_pkt_str 10.0.0.3 10.0.0.3) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # The new address left tentative - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative" + + rump_server_destroy_ifaces } dad_duplicated_body() @@ -172,8 +154,8 @@ dad_duplicated_body() local localip2=10.0.1.11 local peerip=10.0.1.2 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - atf_check -s exit:0 ${inetserver} $SOCKPEER + rump_server_start $SOCKLOCAL + rump_server_start $SOCKPEER setup_server $SOCKLOCAL $localip1 setup_server $SOCKPEER $peerip @@ -181,7 +163,7 @@ dad_duplicated_body() export RUMP_SERVER=$SOCKLOCAL # The primary address isn't marked as duplicated - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated" + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -iq duplicated" # # Add a new address duplicated with the peer server @@ -190,50 +172,20 @@ dad_duplicated_body() atf_check -s exit:0 sleep 1 # The new address is marked as duplicated - atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated" + atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -iq duplicated" # A unique address isn't marked as duplicated atf_check -s exit:0 rump.ifconfig shmif0 inet $localip2 alias atf_check -s exit:0 sleep 1 - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated" -} + atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -iq duplicated" -cleanup() -{ - env RUMP_SERVER=$SOCKLOCAL rump.halt - env RUMP_SERVER=$SOCKPEER rump.halt -} - -dump_local() -{ - export RUMP_SERVER=$SOCKLOCAL - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_peer() -{ - export RUMP_SERVER=$SOCKPEER - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_local - dump_peer - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } dad_basic_cleanup() { - $DEBUG && dump_local - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKLOCAL rump.halt + $DEBUG && dump + cleanup } dad_duplicated_cleanup() diff --git a/net/icmp/Makefile b/net/icmp/Makefile index b419c8d91967..18d42f8e57e5 100644 --- a/net/icmp/Makefile +++ b/net/icmp/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2016/08/08 14:49:35 pgoyette Exp $ +# $NetBSD: Makefile,v 1.9 2016/11/24 09:06:09 ozaki-r Exp $ # .include @@ -8,7 +8,10 @@ TESTSDIR= ${TESTSBASE}/net/icmp TESTS_C= t_forward TESTS_C+= t_ping -TESTS_SH= t_ping2 t_icmp_redirect t_icmp6_redirect +.for name in ping2 icmp_redirect icmp6_redirect +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor LDADD+= -lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet LDADD+= -lrump -lrumpuser -lrump -lpthread -lrumpdev -lrumpvfs diff --git a/net/icmp/t_icmp6_redirect.sh b/net/icmp/t_icmp6_redirect.sh index c12017d5b090..5dcdc9cda03e 100755 --- a/net/icmp/t_icmp6_redirect.sh +++ b/net/icmp/t_icmp6_redirect.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_icmp6_redirect.sh,v 1.2 2016/08/10 22:17:44 kre Exp $ +# $NetBSD: t_icmp6_redirect.sh,v 1.7 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -24,8 +24,6 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -netserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_shmif" -netserver="${netserver} -lrumpnet_netinet -lrumpnet_netinet6 -lrumpdev" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 @@ -44,50 +42,38 @@ IP6IF0_GW2=fc00:1::3 REDIRECT_TIMEOUT=5 -DEBUG=true +DEBUG=${DEBUG:-true} -get_lladdr() -{ +atf_test_case icmp6_redirect_basic cleanup - export RUMP_SERVER=${1} - rump.ifconfig ${2} inet6 | awk "/fe80/ {sub(/%$2/, \"\"); print \$2;}" - unset RUMP_SERVER - - return 0 -} - -atf_test_case basic cleanup - -basic_head() +icmp6_redirect_basic_head() { atf_set "descr" "Test for the basically function of the ICMP6 redirect" atf_set "require.progs" "rump_server rump.route rump.ping rump.ifconfig" } -basic_body() +icmp6_redirect_basic_body() { local gw1_lladdr0= local gw1_lladdr1= local gw2_lladdr0= - atf_check -s exit:0 ${netserver} ${SOCK_LOCAL} - atf_check -s exit:0 ${netserver} ${SOCK_PEER} - atf_check -s exit:0 ${netserver} ${SOCK_GW1} - atf_check -s exit:0 ${netserver} ${SOCK_GW2} + rump_server_start $SOCK_LOCAL netinet6 + rump_server_start $SOCK_PEER netinet6 + rump_server_start $SOCK_GW1 netinet6 + rump_server_start $SOCK_GW2 netinet6 # # Setup # # Setup gateway #1 (real gateway) export RUMP_SERVER=${SOCK_GW1} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS1} + rump_server_add_iface $SOCK_GW1 shmif0 $BUS1 + rump_server_add_iface $SOCK_GW1 shmif1 $BUS2 + atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_GW1} atf_check -s exit:0 rump.ifconfig shmif0 up - - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr ${BUS2} atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6IF1_GW1} atf_check -s exit:0 rump.ifconfig shmif1 up @@ -95,13 +81,12 @@ basic_body() net.inet6.ip6.forwarding=1 unset RUMP_SERVER - gw1_lladdr0=`get_lladdr ${SOCK_GW1} shmif0` - gw1_lladdr1=`get_lladdr ${SOCK_GW1} shmif1` + gw1_lladdr0=`get_linklocal_addr ${SOCK_GW1} shmif0` + gw1_lladdr1=`get_linklocal_addr ${SOCK_GW1} shmif1` # Setup a peer behind gateway #1 export RUMP_SERVER=${SOCK_PEER} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS2} + rump_server_add_iface $SOCK_PEER shmif0 $BUS2 atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_PEER} atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 -o ignore rump.route add \ @@ -110,8 +95,7 @@ basic_body() # Setup gateway #2 (fake gateway) export RUMP_SERVER=${SOCK_GW2} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS1} + rump_server_add_iface $SOCK_GW2 shmif0 $BUS1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_GW2} atf_check -s exit:0 rump.ifconfig shmif0 up @@ -121,11 +105,10 @@ basic_body() net.inet6.ip6.forwarding=1 unset RUMP_SERVER - gw2_lladdr0=`get_lladdr ${SOCK_GW2} shmif0` + gw2_lladdr0=`get_linklocal_addr ${SOCK_GW2} shmif0` export RUMP_SERVER=${SOCK_LOCAL} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${BUS1} + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6IF0_LOCAL} atf_check -s exit:0 rump.ifconfig shmif0 up @@ -152,20 +135,18 @@ basic_body() atf_check -s exit:0 -o not-match:"gateway: ${gw1_lladdr0}" rump.route get \ -inet6 ${IP6IF0_PEER} - unset RUMP_SERVER + rump_server_destroy_ifaces } -basic_cleanup() +icmp6_redirect_basic_cleanup() { - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt - env RUMP_SERVER=$SOCK_GW1 rump.halt - env RUMP_SERVER=$SOCK_GW2 rump.halt + $DEBUG && dump + cleanup } atf_init_test_cases() { - atf_add_test_case basic + atf_add_test_case icmp6_redirect_basic } diff --git a/net/icmp/t_icmp_redirect.sh b/net/icmp/t_icmp_redirect.sh index 730f2d28a11f..669721649365 100755 --- a/net/icmp/t_icmp_redirect.sh +++ b/net/icmp/t_icmp_redirect.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_icmp_redirect.sh,v 1.3 2016/08/10 22:17:44 kre Exp $ +# $NetBSD: t_icmp_redirect.sh,v 1.6 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -27,8 +27,6 @@ # Most codes are derived from tests/net/route/t_flags.sh -netserver=\ -"rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 SOCK_GW=unix://commsock3 @@ -36,7 +34,7 @@ BUS=bus1 BUS2=bus2 REDIRECT_TIMEOUT=5 -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case icmp_redirect_timeout cleanup @@ -50,11 +48,10 @@ icmp_redirect_timeout_head() setup_local() { - atf_check -s exit:0 ${netserver} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up @@ -68,11 +65,10 @@ setup_local() setup_peer() { - atf_check -s exit:0 ${netserver} ${SOCK_PEER} + rump_server_start $SOCK_PEER + rump_server_add_iface $SOCK_PEER shmif0 $BUS export RUMP_SERVER=$SOCK_PEER - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up @@ -83,16 +79,14 @@ setup_peer() setup_gw() { - atf_check -s exit:0 ${netserver} ${SOCK_GW} + rump_server_start $SOCK_GW + rump_server_add_iface $SOCK_GW shmif0 $BUS + rump_server_add_iface $SOCK_GW shmif1 $BUS2 export RUMP_SERVER=$SOCK_GW - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.254/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 linkstr ${BUS2} atf_check -s exit:0 -o ignore rump.ifconfig shmif1 10.0.2.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 alias 10.0.2.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 up @@ -105,39 +99,6 @@ setup_gw() $DEBUG && rump.netstat -rn -f inet } -teardown_gw() -{ - - env RUMP_SERVER=$SOCK_GW rump.halt -} - -check_entry_flags() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 - - atf_check -s exit:0 -o match:" $flags " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_gw() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local gw=$2 - - atf_check -s exit:0 -o match:" $gw " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_fail() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - icmp_redirect_timeout_body() { @@ -159,7 +120,7 @@ icmp_redirect_timeout_body() export RUMP_SERVER=$SOCK_PEER atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.254 # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS # # Setup the default gateway to the peer, 10.0.0.1 @@ -167,39 +128,25 @@ icmp_redirect_timeout_body() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add default 10.0.0.1 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS # Try ping 10.0.2.1 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 10.0.2.1 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Dynamic - check_entry_flags 10.0.2.1 UGHD - check_entry_gw 10.0.2.1 10.0.0.254 + check_route_flags 10.0.2.1 UGHD + check_route_gw 10.0.2.1 10.0.0.254 atf_check -s exit:0 sleep $((REDIRECT_TIMEOUT + 2)) # The dynamic entry should be expired and removed - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 export RUMP_SERVER=$SOCK_PEER $DEBUG && rump.netstat -rn -f inet - teardown_gw -} - -dump() -{ - - shmif_dumpbus -p - $BUS 2>/dev/null | tcpdump -n -e -r - - gdb -ex bt /usr/bin/rump_server rump_server.core -} - -cleanup() -{ - - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt + rump_server_destroy_ifaces } icmp_redirect_timeout_cleanup() @@ -249,7 +196,7 @@ icmp_redirect_body() export RUMP_SERVER=$SOCK_PEER atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.254 # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS # # Setup the default gateway to the peer, 10.0.0.1 @@ -257,7 +204,7 @@ icmp_redirect_body() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add default 10.0.0.1 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS ### ICMP redirects are NOT sent by the peer ### @@ -274,7 +221,7 @@ icmp_redirect_body() $DEBUG && rump.netstat -rn -f inet # A direct route shouldn't be created - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 ### ICMP redirects are sent by the peer ### @@ -291,8 +238,8 @@ icmp_redirect_body() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Dynamic - check_entry_flags 10.0.2.1 UGHD - check_entry_gw 10.0.2.1 10.0.0.254 + check_route_flags 10.0.2.1 UGHD + check_route_gw 10.0.2.1 10.0.0.254 export RUMP_SERVER=$SOCK_PEER $DEBUG && rump.netstat -rn -f inet @@ -301,7 +248,7 @@ icmp_redirect_body() # cleanup export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route delete 10.0.2.1 - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 ### ICMP redirects are NOT sent by the peer (again) ### @@ -318,10 +265,9 @@ icmp_redirect_body() $DEBUG && rump.netstat -rn -f inet # A direct route shouldn't be created - check_entry_fail 10.0.2.1 + check_route_no_entry 10.0.2.1 - - teardown_gw + rump_server_destroy_ifaces } icmp_redirect_cleanup() diff --git a/net/if/t_compat.c b/net/if/t_compat.c index 4798034fa2cc..9eb84a3bbbe9 100644 --- a/net/if/t_compat.c +++ b/net/if/t_compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_compat.c,v 1.1 2010/11/07 19:53:42 pooka Exp $ */ +/* $NetBSD: t_compat.c,v 1.4 2016/11/12 15:12:59 kre Exp $ */ #include #include @@ -65,6 +65,8 @@ ATF_TC_BODY(OOSIOCGIFBRDADDR, tc) sprintf(ifreq.ifr_name, "shmif%d", ifnum); netcfg_rump_if(ifreq.ifr_name, "1.7.64.10", "255.255.0.0"); + atf_tc_expect_fail("PR kern/51610: rump does not include COMPAT_43"); + /* query kernel for iface bcast */ RL(fd = rump_sys_socket(AF_INET, SOCK_DGRAM, 0)); RL(rump_sys_ioctl(fd, OOSIOCGIFBRDADDR, &ifreq)); diff --git a/net/if/t_ifconfig.sh b/net/if/t_ifconfig.sh index e8c53e675b41..a6100179de43 100755 --- a/net/if/t_ifconfig.sh +++ b/net/if/t_ifconfig.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ifconfig.sh,v 1.11 2016/08/10 22:30:02 kre Exp $ +# $NetBSD: t_ifconfig.sh,v 1.14 2016/10/01 22:15:04 kre Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -34,6 +34,9 @@ RUMP_FLAGS="${RUMP_FLAGS} -lrumpdev" TIMEOUT=3 +anycast="[Aa][Nn][Yy][Cc][Aa][Ss][Tt]" +deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]" + atf_test_case ifconfig_create_destroy cleanup ifconfig_create_destroy_head() { @@ -227,16 +230,17 @@ ifconfig_parameters_body() rump.ifconfig shmif0 # down, up atf_check -s exit:0 rump.ifconfig shmif0 down - atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 \ + atf_check -s not-exit:0 -o ignore -e ignore rump.ping -c 1 \ -w $TIMEOUT -n 192.168.0.2 atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT -n 192.168.0.2 # alias atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias - atf_check -s exit:0 -o match:'alias 192.168.1.1' rump.ifconfig shmif0 + atf_check -s exit:0 -o match:'192.168.1.1/24' rump.ifconfig shmif0 atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 -alias - atf_check -s exit:0 -o not-match:'192.168.1.1' rump.ifconfig shmif0 + atf_check -s exit:0 -o not-match:'192.168.1.1/24' rump.ifconfig shmif0 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 atf_check -s exit:0 -o match:'fc00::1' rump.ifconfig shmif0 inet6 @@ -290,22 +294,22 @@ ifconfig_parameters_body() # anycast atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 anycast - atf_check -s exit:0 -o match:'fc00::2.+anycast' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o match:"fc00::2.+$anycast" rump.ifconfig shmif0 inet6 # deprecated atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 deprecated # Not deprecated immediately. Need to wait nd6_timer that does it is scheduled. interval=$(sysctl -n net.inet6.icmp6.nd6_prune) atf_check -s exit:0 sleep $((interval + 1)) - atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 -deprecated - atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 # pltime atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 pltime 3 - atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 atf_check -s exit:0 sleep 5 - atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6 + atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6 # eui64 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00:1::0 eui64 diff --git a/net/if_bridge/Makefile b/net/if_bridge/Makefile index 1d21951dff5f..894dc9dc2576 100644 --- a/net/if_bridge/Makefile +++ b/net/if_bridge/Makefile @@ -1,10 +1,13 @@ -# $NetBSD: Makefile,v 1.1 2014/09/18 15:13:27 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.2 2016/11/24 09:07:09 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/if_bridge -TESTS_SH= t_bridge +.for name in bridge +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .include diff --git a/net/if_bridge/t_bridge.sh b/net/if_bridge/t_bridge.sh index 769893d44781..25edb35895ba 100755 --- a/net/if_bridge/t_bridge.sh +++ b/net/if_bridge/t_bridge.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_bridge.sh,v 1.13 2016/08/10 22:37:07 kre Exp $ +# $NetBSD: t_bridge.sh,v 1.16 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,13 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -libs1="-lrumpnet -lrumpnet_net -lrumpnet_netinet" -libs2="-lrumpnet_bridge -lrumpnet_shmif -lrumpdev" -libs6="-lrumpnet_netinet6" - -inetserver="rump_server ${libs1} ${libs2}" -inet6server="rump_server ${libs1} ${libs6} ${libs2}" - SOCK1=unix://commsock1 SOCK2=unix://commsock2 SOCK3=unix://commsock3 @@ -44,6 +37,7 @@ IPBR2=10.0.0.12 IP6BR1=fc00::11 IP6BR2=fc00::12 +DEBUG=${DEBUG:-false} TIMEOUT=5 atf_test_case bridge_ipv4 cleanup @@ -89,9 +83,8 @@ setup_endpoint() bus=${3} mode=${4} + rump_server_add_iface $sock shmif0 $bus export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${bus} if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} else @@ -99,7 +92,7 @@ setup_endpoint() fi atf_check -s exit:0 rump.ifconfig shmif0 up - rump.ifconfig shmif0 + $DEBUG && rump.ifconfig shmif0 } test_endpoint() @@ -118,14 +111,6 @@ test_endpoint() fi } -show_endpoint() -{ - sock=${1} - - export RUMP_SERVER=${sock} - rump.ifconfig -v shmif0 -} - test_setup() { test_endpoint $SOCK1 $IP1 bus1 ipv4 @@ -148,21 +133,20 @@ test_setup6() setup_bridge_server() { - export RUMP_SERVER=$SOCK2 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 - atf_check -s exit:0 rump.ifconfig shmif0 up - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr bus2 + rump_server_add_iface $SOCK2 shmif0 bus1 + rump_server_add_iface $SOCK2 shmif1 bus2 + export RUMP_SERVER=$SOCK2 + atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig shmif1 up } setup() { - atf_check -s exit:0 ${inetserver} $SOCK1 - atf_check -s exit:0 ${inetserver} $SOCK2 - atf_check -s exit:0 ${inetserver} $SOCK3 + + rump_server_start $SOCK1 bridge + rump_server_start $SOCK2 bridge + rump_server_start $SOCK3 bridge setup_endpoint $SOCK1 $IP1 bus1 ipv4 setup_endpoint $SOCK3 $IP2 bus2 ipv4 @@ -171,9 +155,10 @@ setup() setup6() { - atf_check -s exit:0 ${inet6server} $SOCK1 - atf_check -s exit:0 ${inet6server} $SOCK2 - atf_check -s exit:0 ${inet6server} $SOCK3 + + rump_server_start $SOCK1 netinet6 bridge + rump_server_start $SOCK2 netinet6 bridge + rump_server_start $SOCK3 netinet6 bridge setup_endpoint $SOCK1 $IP61 bus1 ipv6 setup_endpoint $SOCK3 $IP62 bus2 ipv6 @@ -244,19 +229,6 @@ test_setup_bridge() unset LD_PRELOAD } -cleanup() -{ - env RUMP_SERVER=$SOCK1 rump.halt - env RUMP_SERVER=$SOCK2 rump.halt - env RUMP_SERVER=$SOCK3 rump.halt -} - -dump_bus() -{ - /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null| /usr/sbin/tcpdump -n -e -r - - /usr/bin/shmif_dumpbus -p - bus2 2>/dev/null| /usr/sbin/tcpdump -n -e -r - -} - down_up_interfaces() { export RUMP_SERVER=$SOCK1 @@ -360,11 +332,8 @@ test_brconfig_maxaddr() addr1= addr3= n= # Get MAC addresses of the endpoints. - export RUMP_SERVER=$SOCK1 - addr1=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - export RUMP_SERVER=$SOCK3 - addr3=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - unset RUMP_SERVER + addr1=$(get_macaddr $SOCK1 shmif0) + addr3=$(get_macaddr $SOCK3 shmif0) # Refill the MAC addresses of the endpoints. export RUMP_SERVER=$SOCK1 @@ -422,6 +391,8 @@ bridge_ipv4_body() teardown_bridge test_ping_failure + + rump_server_destroy_ifaces } bridge_ipv6_body() @@ -438,6 +409,8 @@ bridge_ipv6_body() teardown_bridge test_ping6_failure + + rump_server_destroy_ifaces } bridge_rtable_body() @@ -448,16 +421,13 @@ bridge_rtable_body() setup_bridge # Get MAC addresses of the endpoints. - export RUMP_SERVER=$SOCK1 - addr1=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - export RUMP_SERVER=$SOCK3 - addr3=$(rump.ifconfig shmif0 |awk '/address:/ { print $2;}') - unset RUMP_SERVER + addr1=$(get_macaddr $SOCK1 shmif0) + addr3=$(get_macaddr $SOCK3 shmif0) # Confirm there is no MAC address caches. export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - /sbin/brconfig bridge0 + $DEBUG && /sbin/brconfig bridge0 atf_check -s exit:0 -o not-match:"$addr1" /sbin/brconfig bridge0 atf_check -s exit:0 -o not-match:"$addr3" /sbin/brconfig bridge0 unset LD_PRELOAD @@ -470,7 +440,7 @@ bridge_rtable_body() # Tests the addresses are in the cache. export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - /sbin/brconfig bridge0 + $DEBUG && /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr1 shmif0" /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr3 shmif1" /sbin/brconfig bridge0 @@ -487,7 +457,7 @@ bridge_rtable_body() unset RUMP_SERVER export RUMP_SERVER=$SOCK2 export LD_PRELOAD=/usr/lib/librumphijack.so - /sbin/brconfig bridge0 + $DEBUG && /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr1 shmif0" /sbin/brconfig bridge0 atf_check -s exit:0 -o match:"$addr3 shmif1" /sbin/brconfig bridge0 @@ -511,6 +481,8 @@ bridge_rtable_body() # TODO: brconfig static/flushall/discover/learn # TODO: cache expiration; it takes 5 minutes at least and we want to # wait here so long. Should we have a sysctl to change the period? + + rump_server_destroy_ifaces } bridge_member_ipv4_body() @@ -531,6 +503,8 @@ bridge_member_ipv4_body() teardown_bridge test_ping_failure + + rump_server_destroy_ifaces } bridge_member_ipv6_body() @@ -550,35 +524,42 @@ bridge_member_ipv6_body() teardown_bridge test_ping6_failure + + rump_server_destroy_ifaces } bridge_ipv4_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_ipv6_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_rtable_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_member_ipv4_cleanup() { - dump_bus + + $DEBUG && dump cleanup } bridge_member_ipv6_cleanup() { - dump_bus + + $DEBUG && dump cleanup } diff --git a/net/if_gif/Makefile b/net/if_gif/Makefile index 4ccd0127f4dd..4e828fbf636f 100644 --- a/net/if_gif/Makefile +++ b/net/if_gif/Makefile @@ -1,10 +1,13 @@ -# $NetBSD: Makefile,v 1.1 2015/11/05 00:02:59 knakahara Exp $ +# $NetBSD: Makefile,v 1.2 2016/11/24 09:03:53 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/if_gif -TESTS_SH= t_gif +.for name in gif +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .include diff --git a/net/if_gif/t_gif.sh b/net/if_gif/t_gif.sh index b804d7b21cc4..8690d78b2dde 100755 --- a/net/if_gif/t_gif.sh +++ b/net/if_gif/t_gif.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_gif.sh,v 1.5 2016/08/10 08:29:20 ozaki-r Exp $ +# $NetBSD: t_gif.sh,v 1.9 2016/12/21 09:46:39 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -server="rump_server -v -lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet \ - -lrumpnet_netinet6 -lrumpnet_shmif -lrumpnet_gif" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCK1=unix://commsock1 # for ROUTER1 SOCK2=unix://commsock2 # for ROUTER2 ROUTER1_LANIP=192.168.1.1 @@ -65,6 +61,7 @@ ROUTER2_GIFIP6_DUMMY=fc00:14::1 ROUTER2_GIFIP6_RECURSIVE1=fc00:104::1 ROUTER2_GIFIP6_RECURSIVE2=fc00:204::1 +DEBUG=${DEBUG:-true} TIMEOUT=5 setup_router() @@ -75,9 +72,10 @@ setup_router() wan=${4} wan_mode=${5} + rump_server_add_iface $sock shmif0 bus0 + rump_server_add_iface $sock shmif1 bus1 + export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus0 if [ ${lan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${lan} else @@ -86,8 +84,6 @@ setup_router() atf_check -s exit:0 rump.ifconfig shmif0 up rump.ifconfig shmif0 - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr bus1 if [ ${wan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${wan} else @@ -126,8 +122,8 @@ setup() inner=${1} outer=${2} - atf_check -s exit:0 ${server} $SOCK1 - atf_check -s exit:0 ${server} $SOCK2 + rump_server_start $SOCK1 netinet6 gif + rump_server_start $SOCK2 netinet6 gif router1_lan="" router1_lan_mode="" @@ -482,18 +478,6 @@ teardown_recursive_tunnels() atf_check -s exit:0 rump.ifconfig gif2 destroy } -cleanup() -{ - env RUMP_SERVER=$SOCK1 rump.halt - env RUMP_SERVER=$SOCK2 rump.halt -} - -dump_bus() -{ - /usr/bin/shmif_dumpbus -p - bus0 2>/dev/null| /usr/sbin/tcpdump -n -e -r - - /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null| /usr/sbin/tcpdump -n -e -r - -} - test_ping_failure() { mode=$1 @@ -739,7 +723,7 @@ add_test() inner=$3 outer=$4 - name="${category}${inner}over${outer}" + name="gif_${category}_${inner}over${outer}" fulldesc="Does ${inner} over ${outer} if_gif ${desc}" atf_test_case ${name} cleanup @@ -751,9 +735,10 @@ add_test() ${category}_setup ${inner} ${outer}; \ ${category}_test ${inner} ${outer}; \ ${category}_teardown ${inner} ${outer}; \ + rump_server_destroy_ifaces; \ }; \ ${name}_cleanup() { \ - dump_bus; \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case ${name} diff --git a/net/if_pppoe/Makefile b/net/if_pppoe/Makefile index c082be8a7dba..091ed3150d08 100644 --- a/net/if_pppoe/Makefile +++ b/net/if_pppoe/Makefile @@ -1,8 +1,13 @@ +# $NetBSD: Makefile,v 1.3 2016/11/24 09:03:53 ozaki-r Exp $ +# .include TESTSDIR= ${TESTSBASE}/net/if_pppoe -TESTS_SH= t_pppoe +.for name in pppoe +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .include diff --git a/net/if_pppoe/t_pppoe.sh b/net/if_pppoe/t_pppoe.sh index 3199ca0a73e9..8d9d5c23a7a1 100755 --- a/net/if_pppoe/t_pppoe.sh +++ b/net/if_pppoe/t_pppoe.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_pppoe.sh,v 1.2 2016/08/07 23:34:31 pgoyette Exp $ +# $NetBSD: t_pppoe.sh,v 1.16 2016/12/14 03:30:30 knakahara Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -28,6 +28,7 @@ server="rump_server -lrump -lrumpnet -lrumpnet_net -lrumpnet_netinet \ -lrumpnet_netinet6 -lrumpnet_shmif -lrumpdev \ -lrumpnet_pppoe" +# pppoectl doesn't work with RUMPHIJACK=sysctl=yes HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so" SERVER=unix://commsock1 @@ -35,17 +36,23 @@ CLIENT=unix://commsock2 SERVER_IP=10.3.3.1 CLIENT_IP=10.3.3.3 +SERVER_IP6=fc00::1 +CLIENT_IP6=fc00::3 AUTHNAME=foobar@baz.com SECRET=oink BUS=bus0 TIMEOUT=3 -WAITTIME=5 -DEBUG=false - -atf_test_case pap cleanup +WAITTIME=10 +DEBUG=${DEBUG:-false} setup() { + inet=true + + if [ $# -ne 0 ]; then + eval $@ + fi + atf_check -s exit:0 ${server} $SERVER atf_check -s exit:0 ${server} $CLIENT @@ -55,7 +62,8 @@ setup() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig pppoe0 create - atf_check -s exit:0 rump.ifconfig pppoe0 inet $SERVER_IP $CLIENT_IP down + $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + inet $SERVER_IP $CLIENT_IP down atf_check -s exit:0 rump.ifconfig pppoe0 link0 $DEBUG && rump.ifconfig @@ -70,22 +78,19 @@ setup() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig pppoe0 create - atf_check -s exit:0 rump.ifconfig pppoe0 inet 0.0.0.0 0.0.0.1 down + $inet && atf_check -s exit:0 rump.ifconfig pppoe0 \ + inet 0.0.0.0 0.0.0.1 down atf_check -s exit:0 -x "$HIJACKING pppoectl -e shmif0 pppoe0" unset RUMP_SERVER } + cleanup() { env RUMP_SERVER=$SERVER rump.halt env RUMP_SERVER=$CLIENT rump.halt } -pap_head() -{ - atf_set "descr" "Does simple pap tests" - atf_set "require.progs" "rump_server pppoectl" -} wait_for_session_established() { @@ -98,21 +103,50 @@ wait_for_session_established() sleep 1 done - if [ $dontfail != "dontfail" ]; then + if [ "$dontfail" != "dontfail" ]; then atf_fail "Couldn't connect to the server for $n seconds." fi } -pap_body() +wait_for_disconnected() { - local auth=pap + local dontfail=$1 + local n=$WAITTIME + + for i in $(seq $n); do + $HIJACKING pppoectl -d pppoe0 | grep -q "state = initial" + [ $? = 0 ] && return + # If PPPoE client is disconnected by PPPoE server and then + # the client kicks callout of pppoe_timeout(), the client + # state is changed to PPPOE_STATE_PADI_SENT while padi retrying. + $HIJACKING pppoectl -d pppoe0 | grep -q "state = PADI sent" + [ $? = 0 ] && return + + sleep 1 + done + + if [ "$dontfail" != "dontfail" ]; then + atf_fail "Couldn't disconnect for $n seconds." + fi +} + +run_test() +{ + local auth=$1 setup + # As pppoe client doesn't support rechallenge yet. + local server_optparam="" + if [ $auth = "chap" ]; then + server_optparam="norechallenge" + fi + export RUMP_SERVER=$SERVER local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ 'hisauthname=$AUTHNAME' \ 'hisauthsecret=$SECRET' \ - 'myauthproto=none'" + 'myauthproto=none' \ + $server_optparam" atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" atf_check -s exit:0 rump.ifconfig pppoe0 up unset RUMP_SERVER @@ -130,8 +164,11 @@ pap_body() unset RUMP_SERVER # test for disconnection from server - atf_check -s exit:0 -x "env RUMP_SERVER=$SERVER rump.ifconfig pppoe0 down" + export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected export RUMP_SERVER=$CLIENT + wait_for_disconnected atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $SERVER_IP atf_check -s exit:0 -o match:'PADI sent' -x "$HIJACKING pppoectl -d pppoe0" @@ -145,15 +182,18 @@ pap_body() unset RUMP_SERVER # test for disconnection from client - atf_check -s exit:0 -x "env RUMP_SERVER=$CLIENT rump.ifconfig pppoe0 down" + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -x rump.ifconfig pppoe0 down + wait_for_disconnected export RUMP_SERVER=$SERVER + wait_for_disconnected $DEBUG && $HIJACKING pppoectl -d pppoe0 atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $CLIENT_IP atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0" unset RUMP_SERVER - # test for recconecting + # test for reconnecting export RUMP_SERVER=$CLIENT atf_check -s exit:0 -x rump.ifconfig pppoe0 up wait_for_session_established @@ -162,6 +202,7 @@ pap_body() unset RUMP_SERVER export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig -w 10 atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT $CLIENT_IP atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0" $DEBUG && HIJACKING pppoectl -d pppoe0 @@ -170,6 +211,7 @@ pap_body() # test for invalid password export RUMP_SERVER=$CLIENT atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ 'myauthname=$AUTHNAME' \ 'myauthsecret=invalidsecret' \ @@ -179,15 +221,196 @@ pap_body() wait_for_session_established dontfail atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping -c 1 -w $TIMEOUT $SERVER_IP - atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0" + atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0 unset RUMP_SERVER } -pap_cleanup() +atf_test_case pppoe_pap cleanup + +pppoe_pap_head() +{ + atf_set "descr" "Does simple pap tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe_pap_body() +{ + run_test pap +} + +pppoe_pap_cleanup() { cleanup } + +atf_test_case pppoe_chap cleanup + +pppoe_chap_head() +{ + atf_set "descr" "Does simple chap tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe_chap_body() +{ + run_test chap +} + +pppoe_chap_cleanup() +{ + cleanup +} + +run_test6() +{ + local auth=$1 + setup "inet=false" + + # As pppoe client doesn't support rechallenge yet. + local server_optparam="" + if [ $auth = "chap" ]; then + server_optparam="norechallenge" + fi + + export RUMP_SERVER=$SERVER + local setup_serverparam="pppoectl pppoe0 hisauthproto=$auth \ + 'hisauthname=$AUTHNAME' \ + 'hisauthsecret=$SECRET' \ + 'myauthproto=none' \ + $server_optparam" + atf_check -s exit:0 -x "$HIJACKING $setup_serverparam" + atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $SERVER_IP6/64 down + atf_check -s exit:0 rump.ifconfig pppoe0 up + unset RUMP_SERVER + + export RUMP_SERVER=$CLIENT + local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ + 'myauthname=$AUTHNAME' \ + 'myauthsecret=$SECRET' \ + 'hisauthproto=none'" + atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" + atf_check -s exit:0 rump.ifconfig pppoe0 inet6 $CLIENT_IP6/64 down + atf_check -s exit:0 rump.ifconfig pppoe0 up + $DEBUG && rump.ifconfig + wait_for_session_established + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + export RUMP_SERVER=$SERVER + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + unset RUMP_SERVER + + # test for disconnection from server + export RUMP_SERVER=$SERVER + session_id=`$HIJACKING pppoectl -d pppoe0 | grep state` + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + export RUMP_SERVER=$CLIENT + wait_for_disconnected + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + atf_check -s exit:0 -o not-match:"$session_id" -x "$HIJACKING pppoectl -d pppoe0" + unset RUMP_SERVER + + # test for recoonecting + export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig pppoe0 up + wait_for_session_established + atf_check -s exit:0 rump.ifconfig -w 10 + $DEBUG && $HIJACKING pppoectl -d pppoe0 + $DEBUG && rump.ifconfig pppoe0 + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + unset RUMP_SERVER + + # test for disconnection from client + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + + export RUMP_SERVER=$SERVER + wait_for_disconnected + $DEBUG && $HIJACKING pppoectl -d pppoe0 + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6 + atf_check -s exit:0 -o match:'initial' -x "$HIJACKING pppoectl -d pppoe0" + unset RUMP_SERVER + + # test for reconnecting + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 up + wait_for_session_established + atf_check -s exit:0 rump.ifconfig -w 10 + + $DEBUG && rump.ifconfig pppoe0 + $DEBUG && $HIJACKING pppoectl -d pppoe0 + unset RUMP_SERVER + + export RUMP_SERVER=$SERVER + atf_check -s exit:0 rump.ifconfig -w 10 + atf_check -s exit:0 -o ignore rump.ping6 -c 1 -X $TIMEOUT $CLIENT_IP6 + atf_check -s exit:0 -o match:'session' -x "$HIJACKING pppoectl -d pppoe0" + $DEBUG && HIJACKING pppoectl -d pppoe0 + unset RUMP_SERVER + + # test for invalid password + export RUMP_SERVER=$CLIENT + atf_check -s exit:0 rump.ifconfig pppoe0 down + wait_for_disconnected + local setup_clientparam="pppoectl pppoe0 myauthproto=$auth \ + 'myauthname=$AUTHNAME' \ + 'myauthsecret=invalidsecret' \ + 'hisauthproto=none'" + atf_check -s exit:0 -x "$HIJACKING $setup_clientparam" + atf_check -s exit:0 rump.ifconfig pppoe0 up + wait_for_session_established dontfail + atf_check -s not-exit:0 -o ignore -e ignore \ + rump.ping6 -c 1 -X $TIMEOUT $SERVER_IP6 + atf_check -s exit:0 -o match:'DETACHED' rump.ifconfig pppoe0 + unset RUMP_SERVER +} + +atf_test_case pppoe6_pap cleanup + +pppoe6_pap_head() +{ + atf_set "descr" "Does simple pap using IPv6 tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe6_pap_body() +{ + run_test6 pap +} + +pppoe6_pap_cleanup() +{ + cleanup +} + +atf_test_case pppoe6_chap cleanup + +pppoe6_chap_head() +{ + atf_set "descr" "Does simple chap using IPv6 tests" + atf_set "require.progs" "rump_server pppoectl" +} + +pppoe6_chap_body() +{ + run_test6 chap +} + +pppoe6_chap_cleanup() +{ + cleanup +} + atf_init_test_cases() { - atf_add_test_case pap + atf_add_test_case pppoe_pap + atf_add_test_case pppoe_chap + atf_add_test_case pppoe6_pap + atf_add_test_case pppoe6_chap } diff --git a/net/if_tap/Makefile b/net/if_tap/Makefile index d55c140329ab..e3d06c930c44 100644 --- a/net/if_tap/Makefile +++ b/net/if_tap/Makefile @@ -1,10 +1,13 @@ -# $NetBSD: Makefile,v 1.1 2016/03/04 02:44:45 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.2 2016/11/25 08:51:16 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/if_tap -TESTS_SH= t_tap +.for name in tap +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .include diff --git a/net/if_tap/t_tap.sh b/net/if_tap/t_tap.sh index 29efc201b488..4b1ce2566e2f 100755 --- a/net/if_tap/t_tap.sh +++ b/net/if_tap/t_tap.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_tap.sh,v 1.3 2016/08/10 22:42:21 kre Exp $ +# $NetBSD: t_tap.sh,v 1.6 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -25,10 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6" -RUMP_FLAGS="$RUMP_FLAGS -lrumpnet_shmif -lrumpnet_tap -lrumpnet_bridge -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCK_LOCAL=unix://commsock1 SOCK_REMOTE=unix://commsock2 BUS=bus1 @@ -39,7 +35,7 @@ IP6_LOCAL=fc00::1 IP6_TAP=fc00::2 IP6_REMOTE=fc00::3 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 atf_test_case tap_create_destroy cleanup @@ -53,7 +49,7 @@ tap_create_destroy_head() tap_create_destroy_body() { - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL netinet6 tap export RUMP_SERVER=${SOCK_LOCAL} @@ -77,7 +73,8 @@ tap_create_destroy_body() tap_create_destroy_cleanup() { - RUMP_SERVER=${SOCK_LOCAL} rump.halt + $DEBUG && dump + cleanup } atf_test_case tap_stand_alone cleanup @@ -90,13 +87,14 @@ tap_create_destroy_head() tap_stand_alone_body() { - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE} + + rump_server_start $SOCK_LOCAL netinet6 tap + rump_server_start $SOCK_REMOTE netinet6 tap + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS export RUMP_SERVER=${SOCK_LOCAL} - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 up @@ -108,8 +106,6 @@ tap_stand_alone_body() export RUMP_SERVER=${SOCK_REMOTE} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 up @@ -124,13 +120,15 @@ tap_stand_alone_body() # Cannot reach to an alone tap atf_check -s not-exit:0 -o ignore -e ignore \ rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP + + rump_server_destroy_ifaces } tap_stand_alone_cleanup() { - RUMP_SERVER=${SOCK_LOCAL} rump.halt - RUMP_SERVER=${SOCK_REMOTE} rump.halt + $DEBUG && dump + cleanup } atf_test_case tap_bridged cleanup @@ -143,13 +141,15 @@ tap_bridged_head() tap_bridged_body() { - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} - atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE} + + rump_server_start $SOCK_LOCAL netinet6 tap bridge + rump_server_start $SOCK_REMOTE netinet6 tap + + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS export RUMP_SERVER=${SOCK_LOCAL} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 rump.ifconfig shmif0 up @@ -168,8 +168,6 @@ tap_bridged_body() export RUMP_SERVER=${SOCK_REMOTE} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 $IP4_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_REMOTE atf_check -s exit:0 rump.ifconfig shmif0 up @@ -180,13 +178,15 @@ tap_bridged_body() atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_LOCAL atf_check -s exit:0 -o ignore rump.ping6 -n -X $TIMEOUT -c 1 $IP6_TAP + + rump_server_destroy_ifaces } tap_bridged_cleanup() { - RUMP_SERVER=${SOCK_LOCAL} rump.halt - RUMP_SERVER=${SOCK_REMOTE} rump.halt + $DEBUG && dump + cleanup } atf_init_test_cases() diff --git a/net/mcast/Makefile b/net/mcast/Makefile index 5085e1e9def3..cdce1c691592 100644 --- a/net/mcast/Makefile +++ b/net/mcast/Makefile @@ -1,11 +1,14 @@ -# $NetBSD: Makefile,v 1.2 2015/05/26 00:42:07 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.3 2016/11/25 08:51:16 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/mcast -TESTS_SH= t_mcast +.for name in mcast +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor PROGS= mcast MAN.mcast= # empty diff --git a/net/mcast/t_mcast.sh b/net/mcast/t_mcast.sh index 67e13d4a9cdc..aeb70001716f 100755 --- a/net/mcast/t_mcast.sh +++ b/net/mcast/t_mcast.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_mcast.sh,v 1.2 2016/08/10 22:45:39 kre Exp $ +# $NetBSD: t_mcast.sh,v 1.4 2016/11/25 08:51:16 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,12 +25,9 @@ # POSSIBILITY OF SUCH DAMAGE. # -netserver="rump_server -lrumpnet -lrumpnet_net" -netserver="$netserver -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif" -netserver="$netserver -lrumpdev" export RUMP_SERVER=unix://commsock -DEBUG=false +DEBUG=${DEBUG:-false} run_test() { @@ -38,9 +35,8 @@ run_test() local opts="$2" local mcast="$(atf_get_srcdir)/mcast" - atf_check -s exit:0 ${netserver} ${RUMP_SERVER} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_start $RUMP_SERVER netinet6 + rump_server_add_iface $RUMP_SERVER shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.2/24 atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2/64 atf_check -s exit:0 rump.ifconfig shmif0 up @@ -79,11 +75,11 @@ add_test() }; \ mcast_${name}_body() { \ run_test \"${name}\" \"${opts}\"; \ + rump_server_destroy_ifaces; \ }; \ mcast_${name}_cleanup() { \ - ${DEBUG} && /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null | \ - /usr/sbin/tcpdump -n -e -r -; \ - env RUMP_SERVER=unix://commsock rump.halt; \ + ${DEBUG} && dump; \ + cleanup; \ }" atf_add_test_case "mcast_${name}" } diff --git a/net/ndp/Makefile b/net/ndp/Makefile index 2d890e7ee220..8b96613774d6 100644 --- a/net/ndp/Makefile +++ b/net/ndp/Makefile @@ -1,12 +1,13 @@ -# $NetBSD: Makefile,v 1.2 2015/11/11 07:52:57 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.3 2016/11/24 08:52:20 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/ndp -TESTS_SH= t_dad -TESTS_SH+= t_ndp -TESTS_SH+= t_ra +.for name in dad ndp ra +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .include diff --git a/net/ndp/t_dad.sh b/net/ndp/t_dad.sh index 98b8ae0b8c8b..50ec933560de 100755 --- a/net/ndp/t_dad.sh +++ b/net/ndp/t_dad.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_dad.sh,v 1.5 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_dad.sh,v 1.12 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,18 +25,16 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" -inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKLOCAL=unix://commsock1 SOCKPEER=unix://commsock2 -DEBUG=false +DEBUG=${DEBUG:-false} + +duplicated="[Dd][Uu][Pp][Ll][Ii][Cc][Aa][Tt][Ee][Dd]" atf_test_case dad_basic cleanup atf_test_case dad_duplicated cleanup +atf_test_case dad_count cleanup dad_basic_head() { @@ -50,15 +48,20 @@ dad_duplicated_head() atf_set "require.progs" "rump_server" } +dad_count_head() +{ + atf_set "descr" "Tests for IPv6 DAD count behavior" + atf_set "require.progs" "rump_server" +} + setup_server() { local sock=$1 local ip=$2 - export RUMP_SERVER=$sock + rump_server_add_iface $sock shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -76,21 +79,6 @@ make_ns_pkt_str() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - dad_basic_body() { local pkt= @@ -98,11 +86,10 @@ dad_basic_body() local localip2=fc00::2 local localip3=fc00::3 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - export RUMP_SERVER=$SOCKLOCAL + rump_server_start $SOCKLOCAL netinet6 + rump_server_add_iface $SOCKLOCAL shmif0 bus1 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + export RUMP_SERVER=$SOCKLOCAL atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2 $DEBUG && rump.ifconfig shmif0 @@ -118,7 +105,7 @@ dad_basic_body() #atf_check -s exit:0 -x "cat ./out |grep $localip2 |grep -q tentative" atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # Check DAD probe packets (Neighbor Solicitation Message) @@ -130,7 +117,7 @@ dad_basic_body() # Waiting for DAD complete atf_check -s exit:0 rump.ifconfig -w 10 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # IPv6 DAD doesn't announce (Neighbor Advertisement Message) @@ -149,20 +136,22 @@ dad_basic_body() # Check DAD probe packets (Neighbor Solicitation Message) atf_check -s exit:0 sleep 2 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out pkt=$(make_ns_pkt_str 3 $localip3) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" # Waiting for DAD complete atf_check -s exit:0 rump.ifconfig -w 10 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out # IPv6 DAD doesn't announce (Neighbor Advertisement Message) # The new address left tentative atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip3 |grep -q tentative" + + rump_server_destroy_ifaces } dad_duplicated_body() @@ -171,8 +160,8 @@ dad_duplicated_body() local localip2=fc00::11 local peerip=fc00::2 - atf_check -s exit:0 ${inetserver} $SOCKLOCAL - atf_check -s exit:0 ${inetserver} $SOCKPEER + rump_server_start $SOCKLOCAL netinet6 + rump_server_start $SOCKPEER netinet6 setup_server $SOCKLOCAL $localip1 setup_server $SOCKPEER $peerip @@ -180,7 +169,8 @@ dad_duplicated_body() export RUMP_SERVER=$SOCKLOCAL # The primary address isn't marked as duplicated - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated" + atf_check -s exit:0 -o not-match:"$localip1.+$duplicated" \ + rump.ifconfig shmif0 # # Add a new address duplicated with the peer server @@ -189,52 +179,81 @@ dad_duplicated_body() atf_check -s exit:0 sleep 1 # The new address is marked as duplicated - atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated" + atf_check -s exit:0 -o match:"$peerip.+$duplicated" \ + rump.ifconfig shmif0 # A unique address isn't marked as duplicated atf_check -s exit:0 rump.ifconfig shmif0 inet6 $localip2 atf_check -s exit:0 sleep 1 - atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated" + atf_check -s exit:0 -o not-match:"$localip2.+$duplicated" \ + rump.ifconfig shmif0 + + rump_server_destroy_ifaces } -cleanup() +dad_count_test() { - gdb -ex bt /usr/bin/rump_server rump_server.core - gdb -ex bt /usr/sbin/arp arp.core - env RUMP_SERVER=$SOCKLOCAL rump.halt - env RUMP_SERVER=$SOCKPEER rump.halt + local pkt= + local count=$1 + local id=$2 + local target=$3 + + # + # Set DAD count to $count + # + atf_check -s exit:0 rump.sysctl -w -q net.inet6.ip6.dad_count=$count + + # Add a new address + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $target + + # Waiting for DAD complete + atf_check -s exit:0 rump.ifconfig -w 20 + + # Check the number of DAD probe packets (Neighbor Solicitation Message) + atf_check -s exit:0 sleep 2 + extract_new_packets bus1 > ./out + $DEBUG && cat ./out + pkt=$(make_ns_pkt_str $id $target) + atf_check -s exit:0 -o match:"$count" \ + -x "cat ./out |grep '$pkt' | wc -l | tr -d ' '" } -dump_local() +dad_count_body() { + local localip1=fc00::1 + local localip2=fc00::2 + + rump_server_start $SOCKLOCAL netinet6 + rump_server_add_iface $SOCKLOCAL shmif0 bus1 + export RUMP_SERVER=$SOCKLOCAL - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} -dump_peer() -{ - export RUMP_SERVER=$SOCKPEER - rump.netstat -nr - rump.arp -n -a - rump.ifconfig - $HIJACKING dmesg -} + # Check default value + atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet6.ip6.dad_count -dump() -{ - dump_local - dump_peer - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - + # Setup interface + atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 sleep 2 + rump.ifconfig shmif0 > ./out + $DEBUG && cat ./out + + # + # Set and test DAD count (count=1) + # + dad_count_test 1 1 $localip1 + + # + # Set and test DAD count (count=8) + # + dad_count_test 8 2 $localip2 + + rump_server_destroy_ifaces } dad_basic_cleanup() { - $DEBUG && dump_local - $DEBUG && shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - env RUMP_SERVER=$SOCKLOCAL rump.halt + $DEBUG && dump + cleanup } dad_duplicated_cleanup() @@ -243,8 +262,15 @@ dad_duplicated_cleanup() cleanup } +dad_count_cleanup() +{ + $DEBUG && dump + cleanup +} + atf_init_test_cases() { atf_add_test_case dad_basic atf_add_test_case dad_duplicated + atf_add_test_case dad_count } diff --git a/net/ndp/t_ndp.sh b/net/ndp/t_ndp.sh index 449198122f69..aa96390cf96e 100755 --- a/net/ndp/t_ndp.sh +++ b/net/ndp/t_ndp.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ndp.sh,v 1.13 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_ndp.sh,v 1.17 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,17 +25,12 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" -inetserver="$inetserver -lrumpnet_netinet6 -lrumpnet_shmif" -inetserver="$inetserver -lrumpdev" -HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" - SOCKSRC=unix://commsock1 SOCKDST=unix://commsock2 IP6SRC=fc00::1 IP6DST=fc00::2 -DEBUG=true +DEBUG=${DEBUG:-true} TIMEOUT=1 atf_test_case ndp_cache_expiration cleanup @@ -78,9 +73,8 @@ setup_dst_server() { local assign_ip=$1 + rump_server_add_iface $SOCKDST shmif0 bus1 export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 if [ "$assign_ip" != no ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6DST fi @@ -97,8 +91,7 @@ setup_src_server() export RUMP_SERVER=$SOCKSRC # Setup an interface - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKSRC shmif0 bus1 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig -w 10 @@ -119,8 +112,9 @@ get_timeout() ndp_cache_expiration_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -144,6 +138,8 @@ ndp_cache_expiration_body() atf_check -s exit:0 -o match:'permanent' rump.ndp -n $IP6SRC # Expired but remains until GC sweaps it (1 day) atf_check -s exit:0 -o match:'(1d0h0m|23h59m)' rump.ndp -n $IP6DST + + rump_server_destroy_ifaces } ifdown_dst_server() @@ -155,8 +151,9 @@ ifdown_dst_server() ndp_commands_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -217,13 +214,14 @@ ndp_commands_body() $DEBUG && rump.ndp -n -a atf_check -s exit:0 -o not-match:'permanent' rump.ndp -n fc00::10 - return 0 + rump_server_destroy_ifaces } ndp_cache_overwriting_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server @@ -249,7 +247,7 @@ ndp_cache_overwriting_body() #atf_check -s not-exit:0 -e ignore rump.ndp -s fc00::10 b2:a0:20:00:00:ff #$DEBUG && rump.ndp -n -a - return 0 + rump_server_destroy_ifaces } get_n_caches() @@ -261,8 +259,8 @@ get_n_caches() ndp_neighborgcthresh_body() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server no setup_src_server @@ -311,7 +309,7 @@ ndp_neighborgcthresh_body() atf_fail "Neighbor caches are not GC-ed" fi - return 0 + rump_server_destroy_ifaces } make_pkt_str_na() @@ -324,33 +322,18 @@ make_pkt_str_na() echo $pkt } -extract_new_packets() -{ - local old=./old - - if [ ! -f $old ]; then - old=/dev/null - fi - - shmif_dumpbus -p - bus1 2>/dev/null| \ - tcpdump -n -e -r - 2>/dev/null > ./new - diff -u $old ./new |grep '^+' |cut -d '+' -f 2 > ./diff - mv -f ./new ./old - cat ./diff -} - ndp_link_activation_body() { local linklocal= - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKDST netinet6 setup_dst_server setup_src_server # flush old packets - extract_new_packets > ./out + extract_new_packets bus1 > ./out export RUMP_SERVER=$SOCKSRC @@ -358,7 +341,7 @@ ndp_link_activation_body() b2:a1:00:00:00:01 atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}') @@ -371,7 +354,7 @@ ndp_link_activation_body() b2:a1:00:00:00:02 active atf_check -s exit:0 sleep 1 - extract_new_packets > ./out + extract_new_packets bus1 > ./out $DEBUG && cat ./out linklocal=$(rump.ifconfig shmif0 |awk '/fe80/ {print $2;}' |awk -F % '{print $1;}') @@ -379,39 +362,8 @@ ndp_link_activation_body() pkt=$(make_pkt_str_na $linklocal b2:a1:00:00:00:02) atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'" -} -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -dump_src() -{ - export RUMP_SERVER=$SOCKSRC - rump.netstat -nr - rump.ndp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump_dst() -{ - export RUMP_SERVER=$SOCKDST - rump.netstat -nr - rump.ndp -n -a - rump.ifconfig - $HIJACKING dmesg -} - -dump() -{ - dump_src - dump_dst - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - $DEBUG && gdb -ex bt /usr/bin/rump_server rump_server.core - $DEBUG && gdb -ex bt /usr/sbin/rump.ndp rump.ndp.core + rump_server_destroy_ifaces } ndp_cache_expiration_cleanup() diff --git a/net/ndp/t_ra.sh b/net/ndp/t_ra.sh index cf81683fc0f4..b2345704f462 100755 --- a/net/ndp/t_ra.sh +++ b/net/ndp/t_ra.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ra.sh,v 1.3 2016/08/10 23:07:57 kre Exp $ +# $NetBSD: t_ra.sh,v 1.20 2017/01/11 03:15:44 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -25,27 +25,49 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMPFLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6" -RUMPFLAGS="${RUMPFLAGS} -lrumpnet_shmif -lrumpdev" -RUMPFLAGS="${RUMPFLAGS} -lrumpvfs -lrumpfs_ffs" - RUMPSRV=unix://r1 +RUMPSRV1_2=unix://r12 RUMPCLI=unix://r2 +RUMPSRV3=unix://r3 +RUMPSRV4=unix://r4 IP6SRV=fc00:1::1 +IP6SRV1_2=fc00:1::2 +IP6SRV_PREFIX=fc00:1: IP6CLI=fc00:2::2 -PIDFILE=/var/run/rump.rtadvd.pid +IP6SRV3=fc00:3::1 +IP6SRV3_PREFIX=fc00:3: +IP6SRV4=fc00:4::1 +IP6SRV4_PREFIX=fc00:4: +PIDFILE=./rump.rtadvd.pid +PIDFILE1_2=./rump.rtadvd.pid12 +PIDFILE3=./rump.rtadvd.pid3 +PIDFILE4=./rump.rtadvd.pid4 CONFIG=./rtadvd.conf -DEBUG=true +WAITTIME=2 +DEBUG=${DEBUG:-true} + +init_server() +{ + + export RUMP_SERVER=$1 + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1 + export LD_PRELOAD=/usr/lib/librumphijack.so + atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd + unset LD_PRELOAD + unset RUMP_SERVER +} setup_shmif0() { - local IP6ADDR=${1} - shift + local sock=$1 + local IP6ADDR=$2 - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $sock shmif0 bus1 + + export RUMP_SERVER=$sock atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6ADDR} atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig } @@ -72,41 +94,81 @@ shmif0:\ _EOF } -atf_test_case basic cleanup -basic_head() +start_rtadvd() +{ + local sock=$1 + local pidfile=$2 + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p $pidfile shmif0 + while [ ! -f $pidfile ]; do + sleep 0.2 + done + unset RUMP_SERVER +} + +check_entries() +{ + local cli=$1 + local srv=$2 + local addr_prefix=$3 + local mac_srv= ll_srv= + + ll_srv=$(get_linklocal_addr $srv shmif0) + mac_srv=$(get_macaddr $srv shmif0) + + export RUMP_SERVER=$cli + $DEBUG && dump_entries + atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r + atf_check -s exit:0 -o match:'advertised' rump.ndp -p + atf_check -s exit:0 -o match:"${ll_srv}%shmif0 \(reachable\)" rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 + atf_check -s exit:0 \ + -o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \ + rump.ndp -n -a + atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a + atf_check -s exit:0 -o match:"$addr_prefix.+" \ + rump.ifconfig shmif0 inet6 + unset RUMP_SERVER +} + +dump_entries() +{ + + echo ndp -n -a + rump.ndp -n -a + echo ndp -p + rump.ndp -p + echo ndp -r + rump.ndp -r +} + +atf_test_case ra_basic cleanup +ra_basic_head() { atf_set "descr" "Tests for basic functions of router advaertisement(RA)" atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" } -basic_body() +ra_basic_body() { - atf_check -s exit:0 rump_server ${RUMPFLAGS} ${RUMPSRV} - atf_check -s exit:0 rump_server ${RUMPFLAGS} ${RUMPCLI} + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 - export RUMP_SERVER=${RUMPSRV} - setup_shmif0 ${IP6SRV} - atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.forwarding=1 - export LD_PRELOAD=/usr/lib/librumphijack.so - atf_check -s exit:0 mkdir -p /rump/var/chroot/rtadvd - unset LD_PRELOAD - unset RUMP_SERVER + setup_shmif0 ${RUMPSRV} ${IP6SRV} + init_server $RUMPSRV + setup_shmif0 ${RUMPCLI} ${IP6CLI} export RUMP_SERVER=${RUMPCLI} - setup_shmif0 ${IP6CLI} $DEBUG && rump.ndp -n -a atf_check -s exit:0 -o match:'= 0' rump.sysctl net.inet6.ip6.accept_rtadv unset RUMP_SERVER create_rtadvdconfig - - export RUMP_SERVER=${RUMPSRV} - atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0 - atf_check -s exit:0 sleep 3 - atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE} - unset RUMP_SERVER + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME export RUMP_SERVER=${RUMPCLI} atf_check -s exit:0 -o empty rump.ndp -r @@ -124,30 +186,18 @@ basic_body() atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 unset RUMP_SERVER - export RUMP_SERVER=${RUMPSRV} - atf_check -s exit:0 rump.rtadvd -c ${CONFIG} shmif0 - atf_check -s exit:0 sleep 3 - atf_check -s exit:0 -o ignore -e empty cat ${PIDFILE} - unset RUMP_SERVER + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME - export RUMP_SERVER=${RUMPCLI} - $DEBUG && rump.ndp -n -a - $DEBUG && rump.ndp -r - atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r - atf_check -s exit:0 -o match:'advertised' rump.ndp -p - atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 - atf_check -s exit:0 -o match:'23h59m..s S R' rump.ndp -n -a - atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a - atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6 - unset RUMP_SERVER + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` wait_term ${PIDFILE} - return 0 + rump_server_destroy_ifaces } -basic_cleanup() +ra_basic_cleanup() { if [ -f ${PIDFILE} ]; then @@ -155,12 +205,483 @@ basic_cleanup() wait_term ${PIDFILE} fi - env RUMP_SERVER=${RUMPSRV} rump.halt - env RUMP_SERVER=${RUMPCLI} rump.halt + $DEBUG && dump + cleanup +} + +atf_test_case ra_flush_prefix_entries cleanup +ra_flush_prefix_entries_head() +{ + + atf_set "descr" "Tests for flushing prefixes (ndp -P)" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_flush_prefix_entries_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + export RUMP_SERVER=${RUMPCLI} + + # Terminate rtadvd to prevent new RA messages from coming + # Note that ifconfig down; kill -TERM doesn't work + kill -KILL `cat ${PIDFILE}` + + # Flush all the entries in the prefix list + atf_check -s exit:0 rump.ndp -P + + $DEBUG && dump_entries + atf_check -s exit:0 -o match:'if=shmif0' rump.ndp -r + atf_check -s exit:0 -o empty rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 + atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a + atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a + atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + rump_server_destroy_ifaces +} + +ra_flush_prefix_entries_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ra_flush_defrouter_entries cleanup +ra_flush_defrouter_entries_head() +{ + + atf_set "descr" "Tests for flushing default routers (ndp -R)" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_flush_defrouter_entries_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + export RUMP_SERVER=${RUMPCLI} + + # Terminate rtadvd to prevent new RA messages from coming + # Note that ifconfig down; kill -TERM doesn't work + kill -KILL `cat ${PIDFILE}` + + # Flush all the entries in the default router list + atf_check -s exit:0 rump.ndp -R + + $DEBUG && dump_entries + atf_check -s exit:0 -o empty rump.ndp -r + atf_check -s exit:0 -o match:'No advertising router' rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=1300' rump.ndp -n -i shmif0 + atf_check -s exit:0 -o match:'(23h59m|1d0h0m)..s S R' rump.ndp -n -a + atf_check -s exit:0 -o match:'fc00:1:' rump.ndp -n -a + atf_check -s exit:0 -o match:'fc00:1:' rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + rump_server_destroy_ifaces +} + +ra_flush_defrouter_entries_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ra_delete_address cleanup +ra_delete_address_head() +{ + + atf_set "descr" "Tests for deleting auto-configured address" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_delete_address_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + export RUMP_SERVER=${RUMPCLI} + $DEBUG && rump.ifconfig shmif0 + atf_check -s exit:0 rump.ifconfig shmif0 inet6 \ + $(rump.ifconfig shmif0 |awk '/AUTOCONF/ {print $2}') delete + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + + rump_server_destroy_ifaces +} + +ra_delete_address_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_multiple_routers cleanup +ra_multiple_routers_head() +{ + + atf_set "descr" "Tests for multiple routers" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_multiple_routers_body() +{ + local n= + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_fs_start $RUMPSRV3 netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPSRV3} ${IP6SRV3} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + init_server $RUMPSRV3 + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + start_rtadvd $RUMPSRV3 $PIDFILE3 + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX + + export RUMP_SERVER=$RUMPCLI + # Two prefixes are advertised by differnt two routers + n=$(rump.ndp -p |grep 'advertised by' |wc -l) + atf_check_equal $n 2 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + + rump_server_destroy_ifaces +} + +ra_multiple_routers_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + if [ -f ${PIDFILE3} ]; then + kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_multiple_routers_single_prefix cleanup +ra_multiple_routers_single_prefix_head() +{ + + atf_set "descr" "Tests for multiple routers with a single prefix" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_multiple_routers_single_prefix_body() +{ + local n= + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_fs_start $RUMPSRV1_2 netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPSRV1_2} ${IP6SRV1_2} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + init_server $RUMPSRV1_2 + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + start_rtadvd $RUMPSRV1_2 $PIDFILE1_2 + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + check_entries $RUMPCLI $RUMPSRV1_2 $IP6SRV_PREFIX + + export RUMP_SERVER=$RUMPCLI + # One prefix is advertised by differnt two routers + n=$(rump.ndp -p |grep 'advertised by' |wc -l) + atf_check_equal $n 1 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE1_2}` + wait_term ${PIDFILE1_2} + + rump_server_destroy_ifaces +} + +ra_multiple_routers_single_prefix_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + if [ -f ${PIDFILE1_2} ]; then + kill -TERM `cat ${PIDFILE1_2}` + wait_term ${PIDFILE1_2} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_multiple_routers_maxifprefixes cleanup +ra_multiple_routers_maxifprefixes_head() +{ + + atf_set "descr" "Tests for exceeding the number of maximum prefixes" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_multiple_routers_maxifprefixes_body() +{ + local n= + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_fs_start $RUMPSRV3 netinet6 + rump_server_fs_start $RUMPSRV4 netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 ${RUMPSRV3} ${IP6SRV3} + setup_shmif0 ${RUMPSRV4} ${IP6SRV4} + setup_shmif0 ${RUMPCLI} ${IP6CLI} + + init_server $RUMPSRV + init_server $RUMPSRV3 + init_server $RUMPSRV4 + + create_rtadvdconfig + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + # Limit the maximum number of prefix entries to 2 + atf_check -s exit:0 -o match:'16.->.2' \ + rump.sysctl -w net.inet6.ip6.maxifprefixes=2 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + start_rtadvd $RUMPSRV3 $PIDFILE3 + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + check_entries $RUMPCLI $RUMPSRV3 $IP6SRV3_PREFIX + + start_rtadvd $RUMPSRV4 $PIDFILE4 + sleep $WAITTIME + + export RUMP_SERVER=${RUMPCLI} + $DEBUG && dump_entries + # There should remain two prefixes + n=$(rump.ndp -p |grep 'advertised by' |wc -l) + atf_check_equal $n 2 + # TODO check other conditions + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + atf_check -s exit:0 kill -TERM `cat ${PIDFILE4}` + wait_term ${PIDFILE4} + + rump_server_destroy_ifaces +} + +ra_multiple_routers_maxifprefixes_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + if [ -f ${PIDFILE3} ]; then + kill -TERM `cat ${PIDFILE3}` + wait_term ${PIDFILE3} + fi + if [ -f ${PIDFILE4} ]; then + kill -TERM `cat ${PIDFILE4}` + wait_term ${PIDFILE4} + fi + + $DEBUG && dump + cleanup +} + +atf_test_case ra_temporary_address cleanup +ra_temporary_address_head() +{ + + atf_set "descr" "Tests for IPv6 temporary address" + atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" +} + +ra_temporary_address_body() +{ + + rump_server_fs_start $RUMPSRV netinet6 + rump_server_start $RUMPCLI netinet6 + + setup_shmif0 ${RUMPSRV} ${IP6SRV} + init_server $RUMPSRV + + setup_shmif0 ${RUMPCLI} ${IP6CLI} + export RUMP_SERVER=${RUMPCLI} + $DEBUG && rump.ndp -n -a + atf_check -s exit:0 -o match:'= 0' \ + rump.sysctl net.inet6.ip6.accept_rtadv + atf_check -s exit:0 -o match:'= 0' \ + rump.sysctl net.inet6.ip6.use_tempaddr + unset RUMP_SERVER + + create_rtadvdconfig + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o empty rump.ndp -r + atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p + atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0 + atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a + atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a + atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.accept_rtadv=1 + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.use_tempaddr=1 + unset RUMP_SERVER + + start_rtadvd $RUMPSRV $PIDFILE + sleep $WAITTIME + + check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + + # Check temporary address + export RUMP_SERVER=${RUMPCLI} + atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+" \ + rump.ifconfig shmif0 inet6 + unset RUMP_SERVER + + atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + + rump_server_destroy_ifaces +} + +ra_temporary_address_cleanup() +{ + + if [ -f ${PIDFILE} ]; then + kill -TERM `cat ${PIDFILE}` + wait_term ${PIDFILE} + fi + + $DEBUG && dump + cleanup } atf_init_test_cases() { - atf_add_test_case basic + atf_add_test_case ra_basic + atf_add_test_case ra_flush_prefix_entries + atf_add_test_case ra_flush_defrouter_entries + atf_add_test_case ra_delete_address + atf_add_test_case ra_multiple_routers + atf_add_test_case ra_multiple_routers_single_prefix + atf_add_test_case ra_multiple_routers_maxifprefixes + atf_add_test_case ra_temporary_address } diff --git a/net/net/Makefile b/net/net/Makefile index a3a5e413c80e..521b8e5cfb9a 100644 --- a/net/net/Makefile +++ b/net/net/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2016/08/08 14:16:32 pgoyette Exp $ +# $NetBSD: Makefile,v 1.19 2016/11/24 08:52:20 ozaki-r Exp $ # .include @@ -11,10 +11,12 @@ TESTS_C+= t_udp TESTS_C+= t_pktinfo .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_C+= t_raw -TESTS_SH= t_forwarding -TESTS_SH+= t_ipaddress -TESTS_SH+= t_ipv6address -TESTS_SH+= t_ipv6_lifetime + +.for name in forwarding ipaddress ipv6address ipv6_lifetime mtudisc mtudisc6 \ + ping6_opts +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor .endif LDADD.t_raw+= -lrumpnet_local -lrumpnet_netinet -lrumpnet_net -lrumpdev diff --git a/net/net/t_forwarding.sh b/net/net/t_forwarding.sh index 9e96738311f0..fc30530f14cc 100755 --- a/net/net/t_forwarding.sh +++ b/net/net/t_forwarding.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_forwarding.sh,v 1.15 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_forwarding.sh,v 1.19 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,9 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -inetserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" -inet6server="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif -lrumpdev" - SOCKSRC=unix://commsock1 SOCKFWD=unix://commsock2 SOCKDST=unix://commsock3 @@ -40,10 +37,9 @@ IP6SRC=fc00:0:0:1::2 IP6SRCGW=fc00:0:0:1::1 IP6DSTGW=fc00:0:0:2::1 IP6DST=fc00:0:0:2::2 -HTTPD_PID=httpd.pid HTML_FILE=index.html -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=5 atf_test_case ipforwarding_v4 cleanup @@ -64,6 +60,18 @@ ipforwarding_v6_head() atf_set "require.progs" "rump_server" } +ipforwarding_fastforward_v4_head() +{ + atf_set "descr" "Tests for IPv4 fastforward" + atf_set "require.progs" "rump_server" +} + +ipforwarding_fastforward_v6_head() +{ + atf_set "descr" "Tests for IPv6 fastfoward" + atf_set "require.progs" "rump_server" +} + ipforwarding_misc_head() { atf_set "descr" "Does IPv4 forwarding tests" @@ -78,9 +86,9 @@ setup_endpoint() mode=${4} gw=${5} + rump_server_add_iface $sock shmif0 $bus + export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${bus} if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw} @@ -116,12 +124,10 @@ setup_forwarder() { mode=${1} - export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr bus1 + rump_server_add_iface $SOCKFWD shmif0 bus1 + rump_server_add_iface $SOCKFWD shmif1 bus2 - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr bus2 + export RUMP_SERVER=$SOCKFWD if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW} @@ -146,9 +152,9 @@ setup_forwarder() setup() { - atf_check -s exit:0 ${inetserver} $SOCKSRC - atf_check -s exit:0 ${inetserver} $SOCKFWD - atf_check -s exit:0 ${inetserver} $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKFWD + rump_server_start $SOCKDST setup_endpoint $SOCKSRC $IP4SRC bus1 ipv4 $IP4SRCGW setup_endpoint $SOCKDST $IP4DST bus2 ipv4 $IP4DSTGW @@ -157,29 +163,15 @@ setup() setup6() { - atf_check -s exit:0 ${inet6server} $SOCKSRC - atf_check -s exit:0 ${inet6server} $SOCKFWD - atf_check -s exit:0 ${inet6server} $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKFWD netinet6 + rump_server_start $SOCKDST netinet6 setup_endpoint $SOCKSRC $IP6SRC bus1 ipv6 $IP6SRCGW setup_endpoint $SOCKDST $IP6DST bus2 ipv6 $IP6DSTGW setup_forwarder ipv6 } -setup_bozo() -{ - local ip=$1 - - export RUMP_SERVER=$SOCKDST - - touch $HTML_FILE - # start bozo in daemon mode - atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ - /usr/libexec/httpd -P $HTTPD_PID -i $ip -b -s $(pwd) - - $DEBUG && rump.netstat -a -} - test_http_get() { local ip=$1 @@ -270,15 +262,8 @@ teardown_icmp_bmcastecho() teardown_interfaces() { - export RUMP_SERVER=$SOCKSRC - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 destroy - export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 destroy - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 destroy - - export RUMP_SERVER=$SOCKDST - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 destroy + rump_server_destroy_ifaces } test_setup_forwarding() @@ -307,33 +292,6 @@ test_teardown_forwarding6() rump.sysctl net.inet6.ip6.forwarding } -cleanup() -{ - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKFWD rump.halt - env RUMP_SERVER=$SOCKDST rump.halt -} - -cleanup_bozo() -{ - - if [ -f $HTTPD_PID ]; then - kill -9 "$(cat $HTTPD_PID)" - rm -f $HTTPD_PID - fi - rm -f $HTML_FILE -} - -dump() -{ - env RUMP_SERVER=$SOCKSRC rump.netstat -nr - env RUMP_SERVER=$SOCKFWD rump.netstat -nr - env RUMP_SERVER=$SOCKDST rump.netstat -nr - - /usr/bin/shmif_dumpbus -p - bus1 2>/dev/null| /usr/sbin/tcpdump -n -e -r - - /usr/bin/shmif_dumpbus -p - bus2 2>/dev/null| /usr/sbin/tcpdump -n -e -r - -} - test_ping_failure() { export RUMP_SERVER=$SOCKSRC @@ -481,7 +439,10 @@ ipforwarding_fastforward_v4_body() setup_forwarding test_setup_forwarding - setup_bozo $IP4DST + touch $HTML_FILE + start_httpd $SOCKDST $IP4DST + $DEBUG && rump.netstat -a + test_http_get $IP4DST teardown_interfaces @@ -495,7 +456,10 @@ ipforwarding_fastforward_v6_body() setup_forwarding6 test_setup_forwarding6 - setup_bozo $IP6DST + touch $HTML_FILE + start_httpd $SOCKDST $IP6DST + $DEBUG && rump.netstat -a + test_http_get "[$IP6DST]" teardown_interfaces @@ -513,7 +477,10 @@ ipforwarding_misc_body() test_directed_broadcast - setup_bozo $IP4DST + touch $HTML_FILE + start_httpd $SOCKDST $IP4DST + $DEBUG && rump.netstat -a + test_sysctl_ttl $IP4DST teardown_interfaces @@ -522,34 +489,34 @@ ipforwarding_misc_body() ipforwarding_v4_cleanup() { - dump + $DEBUG && dump cleanup } ipforwarding_v6_cleanup() { - dump + $DEBUG && dump cleanup } ipforwarding_fastforward_v4_cleanup() { - dump - cleanup_bozo + $DEBUG && dump + stop_httpd cleanup } ipforwarding_fastforward_v6_cleanup() { - dump - cleanup_bozo + $DEBUG && dump + stop_httpd cleanup } ipforwarding_misc_cleanup() { - dump - cleanup_bozo + $DEBUG && dump + stop_httpd cleanup } diff --git a/net/net/t_ipaddress.sh b/net/net/t_ipaddress.sh index a46f484b6ff3..4cdd9545b693 100755 --- a/net/net/t_ipaddress.sh +++ b/net/net/t_ipaddress.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ipaddress.sh,v 1.3 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_ipaddress.sh,v 1.9 2016/12/15 02:43:56 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -25,61 +25,37 @@ # POSSIBILITY OF SUCH DAMAGE. # -SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" -SERVER6="$SERVER -lrumpnet_netinet6" SOCK_LOCAL=unix://commsock1 BUS=bus -DEBUG=false - -check_entry() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local word=$2 - - atf_check -s exit:0 -o match:"$word" -e ignore -x \ - "rump.netstat -rn | grep ^'$ip'" -} - -check_entry_fail() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn | grep ^'$ip'" -} +DEBUG=${DEBUG:-false} test_same_address() { local ip=10.0.0.1 local net=10.0.0/24 - atf_check -s exit:0 ${SERVER} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip delete $DEBUG && rump.netstat -nr -f inet - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net # Assign the same address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip/24 @@ -87,20 +63,18 @@ test_same_address() $DEBUG && rump.netstat -nr -f inet - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 $ip delete $DEBUG && rump.netstat -nr -f inet - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net + + rump_server_destroy_ifaces } test_same_address6() @@ -108,31 +82,27 @@ test_same_address6() local ip=fc00::1 local net=fc00::/64 - atf_check -s exit:0 ${SERVER6} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL netinet6 + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet6 - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip delete $DEBUG && rump.netstat -nr -f inet6 - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net # Assign the same address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip @@ -140,27 +110,58 @@ test_same_address6() $DEBUG && rump.netstat -nr -f inet6 - check_entry $ip UHl - check_entry $ip lo0 - check_entry $ip 'link#2' - check_entry $net U - check_entry $net shmif0 - check_entry $net 'link#2' + check_route $ip 'link#2' UHl lo0 + check_route $net 'link#2' UC shmif0 # Delete the address again atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $ip delete $DEBUG && rump.netstat -nr -f inet6 - check_entry_fail $ip - check_entry_fail $net + check_route_no_entry $ip + check_route_no_entry $net + + rump_server_destroy_ifaces } -cleanup() +test_auto_linklocal() { - $DEBUG && shmif_dumpbus -p - $BUS 2>/dev/null | tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_LOCAL rump.halt + rump_server_start $SOCK_LOCAL netinet6 + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + + # + # Test enabled auto linklocal + # + + # Check default value + atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet6.ip6.auto_linklocal + + atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + + $DEBUG && rump.netstat -nr -f inet + + # IPv6 link-local address is set + atf_check -s exit:0 -o match:"inet6 fe80::" rump.ifconfig shmif0 + + # + # Test disabled auto linklocal + # + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet6.ip6.auto_linklocal=0 + + rump_server_add_iface $SOCK_LOCAL shmif1 $BUS + atf_check -s exit:0 -o ignore rump.ifconfig shmif1 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 + + $DEBUG && rump.netstat -nr -f inet + + # IPv6 link-local address is not set + atf_check -s exit:0 -o not-match:"inet6 fe80::" rump.ifconfig shmif1 + + rump_server_destroy_ifaces } add_test() @@ -177,6 +178,7 @@ add_test() test_${name}; \ }; \ ipaddr_${name}_cleanup() { \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case "ipaddr_${name}" @@ -187,4 +189,5 @@ atf_init_test_cases() add_test same_address "Assigning/deleting an IP address twice" add_test same_address6 "Assigning/deleting an IPv6 address twice" + add_test auto_linklocal "Assigning an IPv6 link-local address automatically" } diff --git a/net/net/t_ipv6_lifetime.sh b/net/net/t_ipv6_lifetime.sh index 5fb34d0649c0..10e50fd3e1e6 100755 --- a/net/net/t_ipv6_lifetime.sh +++ b/net/net/t_ipv6_lifetime.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ipv6_lifetime.sh,v 1.2 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_ipv6_lifetime.sh,v 1.6 2016/11/25 08:51:17 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,13 +25,12 @@ # POSSIBILITY OF SUCH DAMAGE. # -INET6SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev" -INET6SERVER="$INET6SERVER -lrumpnet_netinet6 -lrumpnet_shmif" - SOCK=unix://sock BUS=./bus -DEBUG=false +DEBUG=${DEBUG:-false} + +deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]" atf_test_case basic cleanup @@ -47,11 +46,11 @@ basic_body() local bonus=2 local ip="fc00::1" - atf_check -s exit:0 ${INET6SERVER} $SOCK + rump_server_start $SOCK netinet6 + rump_server_add_iface $SOCK shmif0 $BUS + export RUMP_SERVER=$SOCK - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS atf_check -s exit:0 rump.ifconfig shmif0 up # A normal IP address doesn't contain preferred/valid lifetime @@ -69,7 +68,7 @@ basic_body() atf_check -s exit:0 sleep $(($time + $bonus)) $DEBUG && rump.ifconfig -L shmif0 # Should remain but marked as deprecated - atf_check -s exit:0 -o match:'deprecated' rump.ifconfig -L shmif0 + atf_check -s exit:0 -o match:"$ip.+$deprecated" rump.ifconfig -L shmif0 atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip delete # Setting only a valid lifetime (invalid) @@ -87,38 +86,33 @@ basic_body() # Shouldn't remain anymore atf_check -s exit:0 -o not-match:"$ip" rump.ifconfig -L shmif0 + # Setting both preferred and valid lifetimes (pltime > vltime) + atf_check -s not-exit:0 -e match:'Invalid argument' rump.ifconfig \ + shmif0 inet6 $ip pltime $(($time * 2)) vltime $time + # Setting both preferred and valid lifetimes (pltime < vltime) atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip \ pltime $time vltime $((time * 2)) $DEBUG && rump.ifconfig -L shmif0 atf_check -s exit:0 -o match:'pltime' rump.ifconfig -L shmif0 atf_check -s exit:0 -o match:'vltime' rump.ifconfig -L shmif0 + + if sysctl machdep.cpu_brand 2>/dev/null | grep QEMU >/dev/null 2>&1 + then + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip delete + atf_skip "unreliable under qemu, skip until PR kern/43997 fixed" + fi + atf_check -s exit:0 sleep $(($time + $bonus)) $DEBUG && rump.ifconfig -L shmif0 # Should remain but marked as deprecated - atf_check -s exit:0 -o match:'deprecated' rump.ifconfig -L shmif0 + atf_check -s exit:0 -o match:"$ip.+$deprecated" rump.ifconfig -L shmif0 atf_check -s exit:0 sleep $(($time + $bonus)) $DEBUG && rump.ifconfig -L shmif0 # Shouldn't remain anymore atf_check -s exit:0 -o not-match:"$ip" rump.ifconfig -L shmif0 - # Setting both preferred and valid lifetimes (pltime > vltime) - atf_check -s not-exit:0 -e match:'Invalid argument' rump.ifconfig \ - shmif0 inet6 $ip pltime $(($time * 2)) vltime $time - - return 0 -} - -cleanup() -{ - env RUMP_SERVER=$SOCK rump.halt -} - -dump() -{ - env RUMP_SERVER=$SOCK rump.ifconfig - env RUMP_SERVER=$SOCK rump.netstat -nr - shmif_dumpbus -p - $BUS 2>/dev/null| tcpdump -n -e -r - + rump_server_destroy_ifaces } basic_cleanup() diff --git a/net/net/t_ipv6address.sh b/net/net/t_ipv6address.sh index 3448e86b3d92..539a16d38061 100755 --- a/net/net/t_ipv6address.sh +++ b/net/net/t_ipv6address.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ipv6address.sh,v 1.7 2016/08/10 21:33:52 kre Exp $ +# $NetBSD: t_ipv6address.sh,v 1.12 2016/12/14 02:50:42 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -24,8 +24,9 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev" -SERVER6="$SERVER -lrumpnet_netinet6" +SERVER="rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet" +SERVER="${SERVER} -lrumpnet_shmif -lrumpdev" +SERVER6="${SERVER} -lrumpnet_netinet6" SOCKSRC=unix://commsock1 SOCKFWD=unix://commsock2 @@ -40,7 +41,7 @@ BUS2=bus2 BUSSRC=bus_src BUSDST=bus_dst -DEBUG=true +DEBUG=${DEBUG:-true} TIMEOUT=3 atf_test_case linklocal cleanup @@ -118,41 +119,41 @@ setup_route() { local tmp_rump_server=$RUMP_SERVER - local src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0` - local dst_if0_lladdr=`get_lladdr ${SOCKDST} shmif0` - local fwd_if0_lladdr=`get_lladdr ${SOCKFWD} shmif0` - local fwd_if1_lladdr=`get_lladdr ${SOCKFWD} shmif1` + local src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0` + local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0` + local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0` + local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1` export RUMP_SERVER=${SOCKSRC} - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 default \ - ${fwd_if0_lladdr}%shmif0 - atf_check -s exit:0 -o match:"add net default:" rump.route add -inet6 default \ - ${fwd_if0_lladdr}%shmif0 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 default ${fwd_if0_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net default:" \ + rump.route add -inet6 default ${fwd_if0_lladdr}%shmif0 atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6SRC} atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -rn -f inet6 unset RUMP_SERVER export RUMP_SERVER=${SOCKDST} - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 default \ - ${fwd_if1_lladdr}%shmif0 - atf_check -s exit:0 -o match:"add net default:" rump.route add -inet6 default \ - ${fwd_if1_lladdr}%shmif0 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 default ${fwd_if1_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net default:" \ + rump.route add -inet6 default ${fwd_if1_lladdr}%shmif0 atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DST} atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -rn -f inet6 unset RUMP_SERVER export RUMP_SERVER=${SOCKFWD} - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 ${IP6SRCNW} \ - ${src_if0_lladdr}%shmif0 - atf_check -s exit:0 -o match:"add net" rump.route add -inet6 ${IP6SRCNW} \ - ${src_if0_lladdr}%shmif0 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 ${IP6SRCNW} ${src_if0_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net" \ + rump.route add -inet6 ${IP6SRCNW} ${src_if0_lladdr}%shmif0 - atf_check -s ignore -o ignore -e ignore rump.route delete -inet6 ${IP6DSTNW} \ - ${dst_if0_lladdr}%shmif1 - atf_check -s exit:0 -o match:"add net" rump.route add -inet6 ${IP6DSTNW} \ - ${dst_if0_lladdr}%shmif1 + atf_check -s ignore -o ignore -e ignore \ + rump.route delete -inet6 ${IP6DSTNW} ${dst_if0_lladdr}%shmif1 + atf_check -s exit:0 -o match:"add net" \ + rump.route add -inet6 ${IP6DSTNW} ${dst_if0_lladdr}%shmif1 atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.netstat -rn -f inet6 unset RUMP_SERVER @@ -197,17 +198,6 @@ cleanup_bus() export RUMP_SERVER=$tmp_rump_server } - -get_lladdr() -{ - export RUMP_SERVER=${1} - rump.ifconfig ${2} inet6 | grep "fe80" \ - | awk '{print $2}' | sed -e "s/%$2//g" - unset RUMP_SERVER - - return 0 -} - cleanup_rump_servers() { @@ -221,11 +211,11 @@ dump_bus() shmif_dumpbus -p - ${BUSSRC} 2>/dev/null| tcpdump -n -e -r - shmif_dumpbus -p - ${BUSDST} 2>/dev/null| tcpdump -n -e -r - - shmif_dumpbus -p - ${BUS1} 2>/dev/null| tcpdump -n -e -r - - shmif_dumpbus -p - ${BUS2} 2>/dev/null| tcpdump -n -e -r - + shmif_dumpbus -p - ${BUS1} 2>/dev/null| tcpdump -n -e -r - + shmif_dumpbus -p - ${BUS2} 2>/dev/null| tcpdump -n -e -r - } -dump() +_dump() { export RUMP_SERVER=${SOCKSRC} @@ -242,19 +232,21 @@ dump() linklocal_head() { - atf_set "descr" "Test for bassically function of the IPv6 linklocal address" - atf_set "require.progs" "rump_server rump.route rump.ifconfig rump.ping6" + atf_set "descr" \ + "Test for bassically function of the IPv6 linklocal address" + atf_set "require.progs" \ + "rump_server rump.route rump.ifconfig rump.ping6" } linklocal_body() { setup - local src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0` - local src_if1_lladdr=`get_lladdr ${SOCKSRC} shmif1` - local dst_if0_lladdr=`get_lladdr ${SOCKDST} shmif0` - local fwd_if0_lladdr=`get_lladdr ${SOCKFWD} shmif0` - local fwd_if1_lladdr=`get_lladdr ${SOCKFWD} shmif1` + local src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0` + local src_if1_lladdr=`get_linklocal_addr ${SOCKSRC} shmif1` + local dst_if0_lladdr=`get_linklocal_addr ${SOCKDST} shmif0` + local fwd_if0_lladdr=`get_linklocal_addr ${SOCKFWD} shmif0` + local fwd_if1_lladdr=`get_linklocal_addr ${SOCKFWD} shmif1` export RUMP_SERVER=${SOCKSRC} $DEBUG && rump.ifconfig @@ -271,7 +263,7 @@ linklocal_body() atf_check -s ignore -o empty -e ignore \ -x "shmif_dumpbus -p - ${BUSSRC} | tcpdump -r - -n -p icmp6" atf_check -s ignore -o not-empty -e ignore \ - -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" + -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" cleanup_bus @@ -279,7 +271,7 @@ linklocal_body() rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if1_lladdr}%shmif1 \ ${fwd_if0_lladdr}%shmif0 atf_check -s ignore -o not-match:"${src_if1_lladdr}" -e ignore \ - -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" + -x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6" $DEBUG && shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6 unset RUMP_SERVER @@ -290,16 +282,16 @@ linklocal_body() unset RUMP_SERVER export RUMP_SERVER=${SOCKSRC} - atf_check -s exit:0 -o match:"add net default:" rump.route add -inet6 default \ - ${fwd_if0_lladdr}%shmif0 + atf_check -s exit:0 -o match:"add net default:" \ + rump.route add -inet6 default ${fwd_if0_lladdr}%shmif0 atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig shmif0 - $DEBUG && dump + $DEBUG && _dump export RUMP_SERVER=${SOCKSRC} atf_check -s exit:0 -o match:"0.0% packet loss" \ - rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if0_lladdr}%shmif0 ${IP6FWD0} + rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if0_lladdr}%shmif0 ${IP6FWD0} unset RUMP_SERVER export RUMP_SERVER=${SOCKFWD} @@ -340,7 +332,7 @@ linklocal_body() linklocal_cleanup() { - $DEBUG && dump + $DEBUG && _dump $DEBUG && dump_bus cleanup_rump_servers } @@ -348,7 +340,8 @@ linklocal_cleanup() linklocal_ops_head() { - atf_set "descr" "Test for various operations to IPv6 linklocal addresses" + atf_set "descr" \ + "Test for various operations to IPv6 linklocal addresses" atf_set "require.progs" "rump_server rump.route rump.ndp" } @@ -358,7 +351,7 @@ linklocal_ops_body() setup - src_if0_lladdr=`get_lladdr ${SOCKSRC} shmif0` + src_if0_lladdr=`get_linklocal_addr ${SOCKSRC} shmif0` export RUMP_SERVER=${SOCKSRC} diff --git a/net/net/t_mtudisc.sh b/net/net/t_mtudisc.sh new file mode 100755 index 000000000000..a99d652c477d --- /dev/null +++ b/net/net/t_mtudisc.sh @@ -0,0 +1,192 @@ +# $NetBSD: t_mtudisc.sh,v 1.8 2016/12/21 01:16:18 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +SOCKLOCAL=unix://commsock1 +SOCKGATEWAY=unix://commsock2 +SOCKREMOTE=unix://commsock3 +HTML_FILE=index.html + +DEBUG=${DEBUG:-false} + +atf_test_case mtudisc_basic cleanup + +mtudisc_basic_head() +{ + atf_set "descr" "Tests for IPv4 Path MTU Dicorvery basic behavior" + atf_set "require.progs" "rump_server" +} + +setup_server() +{ + local sock=$1 + local if=$2 + local bus=$3 + local ip=$4 + + rump_server_add_iface $sock $if $bus + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $if $ip + atf_check -s exit:0 rump.ifconfig $if up + atf_check -s exit:0 rump.ifconfig -w 10 + + $DEBUG && rump.ifconfig $if +} + +prepare_download_file() +{ + local file=$1 + local data="0123456789" + + touch $file + for i in `seq 1 512` + do + echo $data >> $file + done +} + +do_http_get() +{ + local ip=$1 + local ret=$2 + local timeout=5 + + # get the webpage + atf_check -s exit:$ret env LD_PRELOAD=/usr/lib/librumphijack.so \ + ftp -q $timeout -o ./out http://$ip/$HTML_FILE +} + +mtudisc_basic_body() +{ + local pkt= + local local_ip=10.0.0.2 + local gateway_local_ip=10.0.0.1 + local gateway_remote_ip=10.0.1.1 + local remote_ip=10.0.1.2 + local prefixlen=24 + + rump_server_start $SOCKLOCAL + rump_server_start $SOCKGATEWAY + rump_server_start $SOCKREMOTE + + # + # Setup servers + # + # [local server] [gateway server] [remote server with httpd] + # | 10.0.0.2 10.0.0.1 | | 10.0.1.1 10.0.1.2 | + # shmif0(mtu=1500) ----- shmif1(mtu=1280) shmif0(mtu=1500) ----- shmif0(mtu=1500) + # + + # Assign IP addresses + setup_server $SOCKLOCAL shmif0 bus1 $local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif0 bus1 $gateway_local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif1 bus2 $gateway_remote_ip/$prefixlen + setup_server $SOCKREMOTE shmif0 bus2 $remote_ip/$prefixlen + + ### Setup gateway server + export RUMP_SERVER=$SOCKGATEWAY + + # Set mtu of shmif0 to 1280 + export RUMP_SERVER=$SOCKGATEWAY + atf_check -s exit:0 rump.ifconfig shmif0 mtu 1280 + + # Enable IPv4 forwarding + atf_check -s exit:0 rump.sysctl -w -q net.inet.ip.forwarding=1 + + ### Setup remote server + export RUMP_SERVER=$SOCKREMOTE + + # Check default value + atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet.ip.mtudisc + + # Start httpd daemon + prepare_download_file $HTML_FILE + start_httpd $SOCKREMOTE $remote_ip + $DEBUG && rump.netstat -a -f inet + + # Teach the peer thar 10.0.0.2(local serer) is behind 10.0.1.1(gateway server) + atf_check -s exit:0 -o ignore rump.route add $local_ip/32 $gateway_remote_ip + + ### Setup local server + export RUMP_SERVER=$SOCKLOCAL + + # Teach the peer thar 10.0.1.2(remote serer) is behind 10.0.0.1(gateway server) + atf_check -s exit:0 -o ignore rump.route add $remote_ip/32 $gateway_local_ip + + # Don't accept fragmented packets + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet.ip.maxfragpackets=0 + + # + # Test disabled path mtu discorvery + # + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet.ip.mtudisc=0 + + # Get the webpage (expect: failed) + export RUMP_SERVER=$SOCKLOCAL + do_http_get $remote_ip 1 + $DEBUG && extract_new_packets bus2 > ./out + $DEBUG && cat ./out + + # Check path mtu size on remote server + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 \ + -o match:"^10.0.0.2 +10.0.1.1 +UGHS +- +- +- +shmif0" \ + rump.netstat -nr -f inet + + # + # Test enabled path mtu discorvery + # + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 -o ignore rump.sysctl -w -q net.inet.ip.mtudisc=1 + + # Get the webpage (expect: success) + export RUMP_SERVER=$SOCKLOCAL + do_http_get $remote_ip 0 + $DEBUG && extract_new_packets bus2 > ./out + $DEBUG && cat ./out + + # Check path mtu size on remote server + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 \ + -o match:"^10.0.0.2 +10.0.1.1 +UGHS +- +- +1280 +shmif0" \ + rump.netstat -nr -f inet + + rump_server_destroy_ifaces +} + +mtudisc_basic_cleanup() +{ + $DEBUG && dump + stop_httpd + cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case mtudisc_basic +} diff --git a/net/net/t_mtudisc6.sh b/net/net/t_mtudisc6.sh new file mode 100755 index 000000000000..93bc12e3623f --- /dev/null +++ b/net/net/t_mtudisc6.sh @@ -0,0 +1,179 @@ +# $NetBSD: t_mtudisc6.sh,v 1.5 2016/11/25 08:51:17 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +SOCKLOCAL=unix://commsock1 +SOCKGATEWAY=unix://commsock2 +SOCKREMOTE=unix://commsock3 +HTML_FILE=index.html + +DEBUG=${DEBUG:-false} + +atf_test_case mtudisc6_basic cleanup + +mtudisc6_basic_head() +{ + + atf_set "descr" "Tests for IPv6 Path MTU Dicorvery basic behavior" + atf_set "require.progs" "rump_server" +} + +setup_server() +{ + local sock=$1 + local if=$2 + local bus=$3 + local ip=$4 + + rump_server_add_iface $sock $if $bus + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $if inet6 $ip + atf_check -s exit:0 rump.ifconfig $if up + atf_check -s exit:0 rump.ifconfig -w 10 + + $DEBUG && rump.ifconfig $if +} + +prepare_download_file() +{ + local file=$1 + local data="0123456789" + + touch $file + for i in `seq 1 512` + do + echo $data >> $file + done +} + +do_http_get() +{ + local ip=$1 + local ret=$2 + local timeout=5 + + # get the webpage + atf_check -s exit:$ret env LD_PRELOAD=/usr/lib/librumphijack.so \ + ftp -q $timeout -o ./out "http://[$ip]/$HTML_FILE" +} + +mtudisc6_basic_body() +{ + local pkt= + local local_ip=fc00:0:0:1::2 + local gateway_local_ip=fc00:0:0:1::1 + local gateway_remote_ip=fc00:0:0:2::1 + local remote_ip=fc00:0:0:2::2 + local prefixlen=64 + + rump_server_start $SOCKLOCAL netinet6 + rump_server_start $SOCKGATEWAY netinet6 + rump_server_start $SOCKREMOTE netinet6 + + # + # Setup servers + # + # [local server] [gateway server] [remote server] + # | | | | + # shmif0(1500) -- shmif1(1280) shmif0(1500) -- shmif0(1500) + # + + # Assign IP addresses + setup_server $SOCKLOCAL shmif0 bus1 $local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif0 bus1 $gateway_local_ip/$prefixlen + setup_server $SOCKGATEWAY shmif1 bus2 $gateway_remote_ip/$prefixlen + setup_server $SOCKREMOTE shmif0 bus2 $remote_ip/$prefixlen + + ### Setup gateway server + export RUMP_SERVER=$SOCKGATEWAY + + # Set MTU of shmif0 to 1280 + export RUMP_SERVER=$SOCKGATEWAY + atf_check -s exit:0 rump.ifconfig shmif0 mtu 1280 + + # Enable IPv6 forwarding + atf_check -s exit:0 rump.sysctl -w -q net.inet6.ip6.forwarding=1 + + ### Setup remote server + export RUMP_SERVER=$SOCKREMOTE + + # Start httpd daemon + prepare_download_file $HTML_FILE + start_httpd $SOCKREMOTE $remote_ip + $DEBUG && rump.netstat -a + + # Teach the peer that local serer is behind gateway server + atf_check -s exit:0 -o ignore \ + rump.route add -inet6 $local_ip/128 $gateway_remote_ip + + # Check path MTU size on remote server + atf_check -s exit:0 \ + -o match:"^$local_ip +$gateway_remote_ip +UGHS +- +- +- +shmif0" \ + rump.netstat -nr -f inet6 + + ### Setup local server + export RUMP_SERVER=$SOCKLOCAL + + # Teach the peer that remote serer is behind gateway server + atf_check -s exit:0 -o ignore \ + rump.route add -inet6 $remote_ip/128 $gateway_local_ip + + # Don't accept fragmented packets + atf_check -s exit:0 -o ignore \ + rump.sysctl -w -q net.inet6.ip6.maxfragpackets=0 + + # + # Test enabled path MTU discorvery + # + # Get the webpage (expect: success) + export RUMP_SERVER=$SOCKLOCAL + do_http_get $remote_ip 0 + $DEBUG && extract_new_packets bus2 > ./out + $DEBUG && cat ./out + + # Check path MTU size on remote server + export RUMP_SERVER=$SOCKREMOTE + atf_check -s exit:0 \ + -o match:"^$local_ip +$gateway_remote_ip +UGHS +- +- +1280 +shmif0" \ + rump.netstat -nr -f inet6 + + rump_server_destroy_ifaces +} + +mtudisc6_basic_cleanup() +{ + + $DEBUG && dump + stop_httpd + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case mtudisc6_basic +} diff --git a/net/net/t_ping6_opts.sh b/net/net/t_ping6_opts.sh new file mode 100755 index 000000000000..e2e774e75783 --- /dev/null +++ b/net/net/t_ping6_opts.sh @@ -0,0 +1,380 @@ +# $NetBSD: t_ping6_opts.sh,v 1.8 2016/11/25 08:51:17 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +SOCKSRC=unix://commsock1 +SOCKFWD=unix://commsock2 +SOCKDST=unix://commsock3 +IP6SRC=fc00:0:0:1::2 +IP6SRCGW=fc00:0:0:1::1 +IP6DSTGW=fc00:0:0:2::1 +IP6DST=fc00:0:0:2::2 +BUS_SRCGW=bus1 +BUS_DSTGW=bus2 + +IP6SRC2=fc00:0:0:1::3 +IP6SRCGW2=fc00:0:0:1::254 + +DEBUG=${DEBUG:-false} +TIMEOUT=1 + +# +# Utility functions +# +setup_endpoint() +{ + local sock=${1} + local addr=${2} + local bus=${3} + local gw=${4} + + rump_server_add_iface $sock shmif0 $bus + + export RUMP_SERVER=${sock} + atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} + atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw} + atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + if $DEBUG; then + rump.ifconfig shmif0 + rump.netstat -nr + fi +} + +setup_forwarder() +{ + + rump_server_add_iface $SOCKFWD shmif0 $BUS_SRCGW + rump_server_add_iface $SOCKFWD shmif1 $BUS_DSTGW + + export RUMP_SERVER=$SOCKFWD + + atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW} + atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DSTGW} + + atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 + + if $DEBUG; then + rump.netstat -nr + rump.sysctl net.inet6.ip6.forwarding + fi +} + +setup_forwarding6() +{ + export RUMP_SERVER=$SOCKFWD + atf_check -s exit:0 -o ignore rump.sysctl -w net.inet6.ip6.forwarding=1 +} + +setup6() +{ + + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKFWD netinet6 + rump_server_start $SOCKDST netinet6 + + setup_endpoint $SOCKSRC $IP6SRC $BUS_SRCGW $IP6SRCGW + setup_endpoint $SOCKDST $IP6DST $BUS_DSTGW $IP6DSTGW + setup_forwarder +} + +check_echo_request_pkt() +{ + local pkt="$1 > $2: .+ echo request" + + extract_new_packets $BUS_SRCGW > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + +check_echo_request_pkt_with_macaddr() +{ + local pkt="$1 > $2, .+ $3 > $4: .+ echo request" + + extract_new_packets $BUS_SRCGW > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + +check_echo_request_pkt_with_macaddr_and_rthdr0() +{ + local pkt= + + pkt="$1 > $2, .+ $3 > $4:" + pkt="$pkt srcrt \\(len=2, type=0, segleft=1, \\[0\\]$5\\)" + pkt="$pkt .+ echo request" + + extract_new_packets $BUS_SRCGW > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + +# +# Tests +# +atf_test_case ping6_opts_sourceaddr cleanup +ping6_opts_sourceaddr_head() +{ + + atf_set "descr" "tests of ping6 -S option" + atf_set "require.progs" "rump_server" +} + +ping6_opts_sourceaddr_body() +{ + + setup6 + setup_forwarding6 + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt $IP6SRC $IP6DST + + atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6SRC2 + atf_check -s exit:0 rump.ifconfig -w 10 + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt $IP6SRC $IP6DST + + # ping6 -S + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -S $IP6SRC $IP6DST + check_echo_request_pkt $IP6SRC $IP6DST + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -S $IP6SRC2 $IP6DST + check_echo_request_pkt $IP6SRC2 $IP6DST + + rump_server_destroy_ifaces +} + +ping6_opts_sourceaddr_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ping6_opts_interface cleanup +ping6_opts_interface_head() +{ + + atf_set "descr" "tests of ping6 -I option" + atf_set "require.progs" "rump_server" +} + +ping6_opts_interface_body() +{ + local shmif0_lladdr= + local shmif1_lladdr= + local gw_lladdr= + + setup6 + setup_forwarding6 + + shmif0_lladdr=$(get_linklocal_addr ${SOCKSRC} shmif0) + gw_lladdr=$(get_linklocal_addr ${SOCKFWD} shmif0) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $gw_lladdr + check_echo_request_pkt $shmif0_lladdr $gw_lladdr + + rump_server_add_iface $SOCKSRC shmif1 $BUS_SRCGW + atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 + shmif1_lladdr=$(get_linklocal_addr ${SOCKSRC} shmif1) + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $gw_lladdr + check_echo_request_pkt $shmif0_lladdr $gw_lladdr + + # ping6 -I + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -I shmif0 $gw_lladdr + check_echo_request_pkt $shmif0_lladdr $gw_lladdr + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -I shmif1 $gw_lladdr + check_echo_request_pkt $shmif1_lladdr $gw_lladdr + + rump_server_destroy_ifaces +} + +ping6_opts_interface_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ping6_opts_gateway cleanup +ping6_opts_gateway_head() +{ + + atf_set "descr" "tests of ping6 -g option" + atf_set "require.progs" "rump_server" +} + +ping6_opts_gateway_body() +{ + local my_macaddr= + local gw_shmif0_macaddr= + local gw_shmif2_macaddr= + + setup6 + setup_forwarding6 + + my_macaddr=$(get_macaddr ${SOCKSRC} shmif0) + gw_shmif0_macaddr=$(get_macaddr ${SOCKFWD} shmif0) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + rump_server_add_iface $SOCKFWD shmif2 $BUS_SRCGW + export RUMP_SERVER=$SOCKFWD + atf_check -s exit:0 rump.ifconfig shmif2 inet6 $IP6SRCGW2 + atf_check -s exit:0 rump.ifconfig -w 10 + gw_shmif2_macaddr=$(get_macaddr ${SOCKFWD} shmif2) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + # ping6 -g + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6DST + + rump_server_destroy_ifaces +} + +ping6_opts_gateway_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case ping6_opts_hops cleanup +ping6_opts_hops_head() +{ + + atf_set "descr" "tests of ping6 hops (Type 0 Routing Header)" + atf_set "require.progs" "rump_server" +} + +ping6_opts_hops_body() +{ + local my_macaddr= + local gw_shmif0_macaddr= + local gw_shmif2_macaddr= + + setup6 + setup_forwarding6 + + my_macaddr=$(get_macaddr ${SOCKSRC} shmif0) + gw_shmif0_macaddr=$(get_macaddr ${SOCKFWD} shmif0) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + rump_server_add_iface $SOCKFWD shmif2 $BUS_SRCGW + export RUMP_SERVER=$SOCKFWD + atf_check -s exit:0 rump.ifconfig shmif2 inet6 $IP6SRCGW2 + atf_check -s exit:0 rump.ifconfig -w 10 + gw_shmif2_macaddr=$(get_macaddr ${SOCKFWD} shmif2) + + export RUMP_SERVER=$SOCKSRC + atf_check -s exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT $IP6DST + check_echo_request_pkt_with_macaddr \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6DST + + # ping6 hops + + # ping6 fails expectedly because the kernel doesn't support + # to receive packets with type 0 routing headers, but we can + # check whether a sent packet is correct. + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + $IP6SRCGW $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW $IP6DST + + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6SRCGW2 $IP6DST + + # ping6 -g hops + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW $IP6SRCGW $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW $IP6DST + + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW2 $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif2_macaddr $IP6SRC $IP6SRCGW2 $IP6DST + + # ping6 -g hops, but different nexthops (is it valid?) + atf_check -s not-exit:0 -o ignore rump.ping6 -n -c 1 -X $TIMEOUT \ + -g $IP6SRCGW $IP6SRCGW2 $IP6DST + check_echo_request_pkt_with_macaddr_and_rthdr0 \ + $my_macaddr $gw_shmif0_macaddr $IP6SRC $IP6SRCGW2 $IP6DST + + rump_server_destroy_ifaces +} + +ping6_opts_hops_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case ping6_opts_sourceaddr + atf_add_test_case ping6_opts_interface + atf_add_test_case ping6_opts_gateway + atf_add_test_case ping6_opts_hops +} diff --git a/net/net_common.sh b/net/net_common.sh new file mode 100755 index 000000000000..df21a881ab5d --- /dev/null +++ b/net/net_common.sh @@ -0,0 +1,314 @@ +# $NetBSD: net_common.sh,v 1.11 2017/01/10 05:55:34 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +# +# Common utility functions for tests/net +# + +HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes" + +extract_new_packets() +{ + local bus=$1 + local old=./.__old + + if [ ! -f $old ]; then + old=/dev/null + fi + + shmif_dumpbus -p - $bus 2>/dev/null| \ + tcpdump -n -e -r - 2>/dev/null > ./.__new + diff -u $old ./.__new |grep '^+' |cut -d '+' -f 2 > ./.__diff + mv -f ./.__new ./.__old + cat ./.__diff +} + +check_route() +{ + local target=$1 + local gw=$2 + local flags=${3:-\.\+} + local ifname=${4:-\.\+} + + target=$(echo $target |sed 's/\./\\./g') + if [ "$gw" = "" ]; then + gw=".+" + else + gw=$(echo $gw |sed 's/\./\\./g') + fi + + atf_check -s exit:0 -e ignore \ + -o match:"^$target +$gw +$flags +- +- +.+ +$ifname" \ + rump.netstat -rn +} + +check_route_flags() +{ + + check_route "$1" "" "$2" "" +} + +check_route_gw() +{ + + check_route "$1" "$2" "" "" +} + +check_route_no_entry() +{ + local target=$(echo $1 |sed 's/\./\\./g') + + atf_check -s exit:0 -e ignore -o not-match:"^$target" \ + rump.netstat -rn +} + +get_linklocal_addr() +{ + + export RUMP_SERVER=${1} + rump.ifconfig ${2} inet6 | + awk "/fe80/ {sub(/%$2/, \"\"); sub(/\\/[0-9]*/, \"\"); print \$2;}" + unset RUMP_SERVER + + return 0 +} + +get_macaddr() +{ + + env RUMP_SERVER=${1} \ + rump.ifconfig ${2} |awk '/address/ {print $2;}' +} + +HTTPD_PID=./.__httpd.pid +start_httpd() +{ + local sock=$1 + local ip=$2 + local backup=$RUMP_SERVER + + export RUMP_SERVER=$sock + + # start httpd in daemon mode + atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ + /usr/libexec/httpd -P $HTTPD_PID -i $ip -b -s $(pwd) + + export RUMP_SERVER=$backup + + sleep 3 +} + +stop_httpd() +{ + + if [ -f $HTTPD_PID ]; then + kill -9 $(cat $HTTPD_PID) + rm -f $HTTPD_PID + sleep 1 + fi +} + +BASIC_LIBS="-lrumpnet -lrumpnet_net -lrumpnet_netinet \ + -lrumpnet_shmif -lrumpdev" +FS_LIBS="$BASIC_LIBS -lrumpvfs -lrumpfs_ffs" + +# We cannot keep variables between test phases, so need to store in files +_rump_server_socks=./.__socks +_rump_server_ifaces=./.__ifaces +_rump_server_buses=./.__buses + +_rump_server_start_common() +{ + local sock=$1 + local libs= + + shift 1 + libs="$*" + + atf_check -s exit:0 rump_server $libs $sock + + echo $sock >> $_rump_server_socks + $DEBUG && cat $_rump_server_socks +} + +rump_server_start() +{ + local sock=$1 + local _libs= + local libs="$BASIC_LIBS" + + shift 1 + _libs="$*" + + for lib in $_libs; do + libs="$libs -lrumpnet_$lib" + done + + _rump_server_start_common $sock $libs + + return 0 +} + +rump_server_fs_start() +{ + local sock=$1 + local _libs= + local libs="$FS_LIBS" + + shift 1 + _libs="$*" + + for lib in $_libs; do + libs="$libs -lrumpnet_$lib" + done + + _rump_server_start_common $sock $libs + + return 0 +} + +rump_server_add_iface() +{ + local sock=$1 + local ifname=$2 + local bus=$3 + local backup=$RUMP_SERVER + + export RUMP_SERVER=$sock + atf_check -s exit:0 rump.ifconfig $ifname create + atf_check -s exit:0 rump.ifconfig $ifname linkstr $bus + export RUMP_SERVER=$backup + + echo $sock $ifname >> $_rump_server_ifaces + $DEBUG && cat $_rump_server_ifaces + + echo $bus >> $_rump_server_buses + cat $_rump_server_buses |sort -u >./.__tmp + mv -f ./.__tmp $_rump_server_buses + $DEBUG && cat $_rump_server_buses + + return 0 +} + +rump_server_destroy_ifaces() +{ + local backup=$RUMP_SERVER + + $DEBUG && cat $_rump_server_ifaces + + # Try to dump states before destroying interfaces + for sock in $(cat $_rump_server_socks); do + export RUMP_SERVER=$sock + atf_check -s exit:0 -o ignore rump.ifconfig + atf_check -s exit:0 -o ignore rump.netstat -nr + # XXX still need hijacking + atf_check -s exit:0 -o ignore $HIJACKING rump.netstat -i -a + atf_check -s exit:0 -o ignore rump.arp -na + atf_check -s exit:0 -o ignore rump.ndp -na + atf_check -s exit:0 -o ignore $HIJACKING ifmcstat + done + + # XXX using pipe doesn't work. See PR bin/51667 + #cat $_rump_server_ifaces | while read sock ifname; do + while read sock ifname; do + export RUMP_SERVER=$sock + if rump.ifconfig -l |grep -q $ifname; then + atf_check -s exit:0 rump.ifconfig $ifname destroy + fi + atf_check -s exit:0 -o ignore rump.ifconfig + done < $_rump_server_ifaces + export RUMP_SERVER=$backup + + return 0 +} + +rump_server_halt_servers() +{ + local backup=$RUMP_SERVER + + $DEBUG && cat $_rump_server_socks + for sock in $(cat $_rump_server_socks); do + env RUMP_SERVER=$sock rump.halt + done + export RUMP_SERVER=$backup + + return 0 +} + +rump_server_dump_servers() +{ + local backup=$RUMP_SERVER + + $DEBUG && cat $_rump_server_socks + for sock in $(cat $_rump_server_socks); do + echo "### Dumping $sock" + export RUMP_SERVER=$sock + rump.ifconfig + rump.netstat -nr + # XXX still need hijacking + $HIJACKING rump.netstat -i -a + rump.arp -na + rump.ndp -na + $HIJACKING ifmcstat + $HIJACKING dmesg + done + export RUMP_SERVER=$backup + + if [ -f rump_server.core ]; then + gdb -ex bt /usr/bin/rump_server rump_server.core + strings rump_server.core |grep panic + fi + return 0 +} + +rump_server_dump_buses() +{ + + if [ ! -f $_rump_server_buses ]; then + return 0 + fi + + $DEBUG && cat $_rump_server_buses + for bus in $(cat $_rump_server_buses); do + echo "### Dumping $bus" + shmif_dumpbus -p - $bus 2>/dev/null| tcpdump -n -e -r - + done + return 0 +} + +cleanup() +{ + + rump_server_halt_servers +} + +dump() +{ + + rump_server_dump_servers + rump_server_dump_buses +} diff --git a/net/route/Makefile b/net/route/Makefile index 7ca14767995e..9a64e6def939 100644 --- a/net/route/Makefile +++ b/net/route/Makefile @@ -1,10 +1,14 @@ -# $NetBSD: Makefile,v 1.4 2016/04/21 05:10:15 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.5 2016/11/24 09:05:17 ozaki-r Exp $ # .include TESTSDIR= ${TESTSBASE}/net/route -TESTS_SH= t_change t_flags t_flags6 t_route +.for name in change flags flags6 route +TESTS_SH+= t_${name} +TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh +.endfor + .include diff --git a/net/route/t_change.sh b/net/route/t_change.sh index 669c9f3baae7..260cad02d7bf 100755 --- a/net/route/t_change.sh +++ b/net/route/t_change.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_change.sh,v 1.8 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_change.sh,v 1.9 2016/11/07 05:25:37 ozaki-r Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -30,7 +30,7 @@ netserver=\ -lrumpnet_netinet -lrumpnet_shmif" export RUMP_SERVER=unix://commsock -DEBUG=false +DEBUG=${DEBUG:-false} atf_test_case route_change_reject2blackhole cleanup route_change_reject2blackhole_head() diff --git a/net/route/t_flags.sh b/net/route/t_flags.sh index 26625bbb899f..457e3f5bdd94 100755 --- a/net/route/t_flags.sh +++ b/net/route/t_flags.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_flags.sh,v 1.11 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_flags.sh,v 1.15 2016/12/21 02:46:08 ozaki-r Exp $ # # Copyright (c) 2015 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,27 +25,24 @@ # POSSIBILITY OF SUCH DAMAGE. # -netserver=\ -"rump_server -lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet \ - -lrumpnet_shmif" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 SOCK_GW=unix://commsock3 BUS=bus1 BUS2=bus2 -DEBUG=false +DEBUG=${DEBUG:-false} setup_local() { - atf_check -s exit:0 ${netserver} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet @@ -54,13 +51,13 @@ setup_local() setup_peer() { - atf_check -s exit:0 ${netserver} ${SOCK_PEER} + rump_server_start $SOCK_PEER + rump_server_add_iface $SOCK_PEER shmif0 $BUS export RUMP_SERVER=$SOCK_PEER - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet @@ -69,16 +66,14 @@ setup_peer() setup_gw() { - atf_check -s exit:0 ${netserver} ${SOCK_GW} + rump_server_start $SOCK_GW + rump_server_add_iface $SOCK_GW shmif0 $BUS + rump_server_add_iface $SOCK_GW shmif1 $BUS2 export RUMP_SERVER=$SOCK_GW - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 10.0.0.254/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif1 linkstr ${BUS2} atf_check -s exit:0 -o ignore rump.ifconfig shmif1 10.0.2.1/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 alias 10.0.2.2/24 atf_check -s exit:0 -o ignore rump.ifconfig shmif1 up @@ -91,46 +86,13 @@ setup_gw() $DEBUG && rump.netstat -rn -f inet } -teardown_gw() -{ - - env RUMP_SERVER=$SOCK_GW rump.halt -} - -check_entry_flags() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 - - atf_check -s exit:0 -o match:" $flags " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_gw() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local gw=$2 - - atf_check -s exit:0 -o match:" $gw " -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - -check_entry_fail() -{ - ip=$(echo $1 |sed 's/\./\\./g') - flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn -f inet | grep ^'$ip'" -} - test_lo() { export RUMP_SERVER=$SOCK_LOCAL # Up, Host, local - check_entry_flags 127.0.0.1 UHl + check_route_flags 127.0.0.1 UHl } test_connected() @@ -139,10 +101,10 @@ test_connected() export RUMP_SERVER=$SOCK_LOCAL # Up, Host, LLINFO, local - check_entry_flags 10.0.0.2 UHl + check_route_flags 10.0.0.2 UHl # Up, Cloning - check_entry_flags 10.0.0/24 UC + check_route_flags 10.0.0/24 UC } test_default_gateway() @@ -154,7 +116,7 @@ test_default_gateway() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS } test_static() @@ -167,14 +129,14 @@ test_static() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Static - check_entry_flags 10.0.1.1 UGHS + check_route_flags 10.0.1.1 UGHS # Static route to network atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS } test_blackhole() @@ -193,14 +155,14 @@ test_blackhole() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Blackhole, Static - check_entry_flags 10.0.0/24 UGBS + check_route_flags 10.0.0/24 UGBS atf_check -s not-exit:0 -o match:'100.0% packet loss' \ rump.ping -n -w 1 -c 1 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Shouldn't be created - check_entry_fail 10.0.0.1 UH + check_route_no_entry 10.0.0.1 } test_reject() @@ -215,14 +177,14 @@ test_reject() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Reject, Static - check_entry_flags 10.0.0/24 UGRS + check_route_flags 10.0.0/24 UGRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping -n -w 1 -c 1 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Shouldn't be created - check_entry_fail 10.0.0.1 UH + check_route_no_entry 10.0.0.1 # Gateway is lo0 (RTF_GATEWAY) @@ -234,14 +196,14 @@ test_reject() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Reject, Static - check_entry_flags 10.0.0/24 UGRS + check_route_flags 10.0.0/24 UGRS atf_check -s not-exit:0 -o ignore -e match:'Network is unreachable' \ rump.ping -n -w 1 -c 1 10.0.0.1 $DEBUG && rump.netstat -rn -f inet # Shouldn't be created - check_entry_fail 10.0.0.1 UH + check_route_no_entry 10.0.0.1 # Gateway is lo0 (RTF_HOST) @@ -253,7 +215,7 @@ test_reject() $DEBUG && rump.netstat -rn -f inet # Up, Host, Reject, Static - check_entry_flags 10.0.0.1 UHRS + check_route_flags 10.0.0.1 UHRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping -n -w 1 -c 1 10.0.0.1 @@ -278,7 +240,7 @@ test_icmp_redirect() export RUMP_SERVER=$SOCK_PEER atf_check -s exit:0 -o ignore rump.route add -net 10.0.2.0/24 10.0.0.254 # Up, Gateway, Static - check_entry_flags 10.0.2/24 UGS + check_route_flags 10.0.2/24 UGS # # Setup the default gateway to the peer, 10.0.0.1 @@ -286,15 +248,15 @@ test_icmp_redirect() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add default 10.0.0.1 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS # Try ping 10.0.2.1 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 10.0.2.1 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Dynamic - check_entry_flags 10.0.2.1 UGHD - check_entry_gw 10.0.2.1 10.0.0.254 + check_route_flags 10.0.2.1 UGHD + check_route_gw 10.0.2.1 10.0.0.254 export RUMP_SERVER=$SOCK_PEER $DEBUG && rump.netstat -rn -f inet @@ -307,18 +269,16 @@ test_icmp_redirect() export RUMP_SERVER=$SOCK_LOCAL atf_check -s exit:0 -o ignore rump.route add 10.0.2.2 10.0.0.1 # Up, Gateway, Host, Static - check_entry_flags 10.0.2.2 UGHS - check_entry_gw 10.0.2.2 10.0.0.1 + check_route_flags 10.0.2.2 UGHS + check_route_gw 10.0.2.2 10.0.0.1 # Try ping 10.0.2.2 atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 10.0.2.2 $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Host, Modified, Static - check_entry_flags 10.0.2.2 UGHMS - check_entry_gw 10.0.2.2 10.0.0.254 - - teardown_gw + check_route_flags 10.0.2.2 UGHMS + check_route_gw 10.0.2.2 10.0.0.254 } test_announce() @@ -332,19 +292,11 @@ test_announce() $DEBUG && rump.netstat -rn -f inet # Up, Gateway, Static, proxy - check_entry_flags 10.0.0/24 UGSp + check_route_flags 10.0.0/24 UGSp # TODO test its behavior } -cleanup() -{ - $DEBUG && /usr/bin/shmif_dumpbus -p - $BUS 2>/dev/null | \ - /usr/sbin/tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt -} - add_test() { local name=$1 @@ -359,8 +311,10 @@ add_test() setup_local; \ setup_peer; \ test_${name}; \ + rump_server_destroy_ifaces; \ }; \ route_flags_${name}_cleanup() { \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case "route_flags_${name}" diff --git a/net/route/t_flags6.sh b/net/route/t_flags6.sh index 20b800e57ba2..e5708296b7bf 100755 --- a/net/route/t_flags6.sh +++ b/net/route/t_flags6.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_flags6.sh,v 1.7 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_flags6.sh,v 1.12 2016/12/21 02:46:08 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -25,9 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMP_OPTS="-lrumpdev -lrumpnet -lrumpnet_net" -RUMP_OPTS="$RUMP_OPTS -lrumpnet_netinet -lrumpnet_netinet6" -RUMP_OPTS="$RUMP_OPTS -lrumpnet_shmif" SOCK_LOCAL=unix://commsock1 SOCK_PEER=unix://commsock2 SOCK_GW=unix://commsock3 @@ -37,18 +34,18 @@ BUS2=bus2 IP6_LOCAL=fc00::2 IP6_PEER=fc00::1 -DEBUG=false +DEBUG=${DEBUG:-false} setup_local() { - atf_check -s exit:0 rump_server ${RUMP_OPTS} ${SOCK_LOCAL} + rump_server_start $SOCK_LOCAL netinet6 + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS export RUMP_SERVER=$SOCK_LOCAL - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $IP6_LOCAL atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet6 @@ -57,55 +54,28 @@ setup_local() setup_peer() { - atf_check -s exit:0 rump_server ${RUMP_OPTS} ${SOCK_PEER} + rump_server_start $SOCK_PEER netinet6 + rump_server_add_iface $SOCK_PEER shmif0 $BUS export RUMP_SERVER=$SOCK_PEER - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 create - atf_check -s exit:0 -o ignore rump.ifconfig shmif0 linkstr ${BUS} atf_check -s exit:0 -o ignore rump.ifconfig shmif0 inet6 $IP6_PEER atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up + atf_check -s exit:0 -o ignore rump.ifconfig -w 10 $DEBUG && rump.ifconfig $DEBUG && rump.netstat -rn -f inet6 } -check_entry_flags() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local flags=$2 - - atf_check -s exit:0 -o match:" $flags " -e ignore -x \ - "rump.netstat -rn -f inet6 | grep ^'$ip'" -} - -check_entry_gw() -{ - local ip=$(echo $1 |sed 's/\./\\./g') - local gw=$2 - - atf_check -s exit:0 -o match:" $gw " -e ignore -x \ - "rump.netstat -rn -f inet6 | grep ^'$ip'" -} - -check_entry_fail() -{ - ip=$(echo $1 |sed 's/\./\\./g') - flags=$2 # Not used currently - - atf_check -s not-exit:0 -e ignore -x \ - "rump.netstat -rn -f inet6 | grep ^'$ip'" -} - test_lo6() { export RUMP_SERVER=$SOCK_LOCAL # Up, Host, local - check_entry_flags fe80::1 UHl + check_route_flags fe80::1 UHl - # Up, Host - check_entry_flags ::1 UH + # Up, Host, local + check_route_flags ::1 UHl } test_connected6() @@ -114,10 +84,10 @@ test_connected6() export RUMP_SERVER=$SOCK_LOCAL # Up, Host, local - check_entry_flags $IP6_LOCAL UHl + check_route_flags $IP6_LOCAL UHl # Up, Connected - check_entry_flags fc00::/64 UC + check_route_flags fc00::/64 UC } test_default_gateway6() @@ -129,7 +99,7 @@ test_default_gateway6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Static - check_entry_flags default UGS + check_route_flags default UGS } test_static6() @@ -143,7 +113,7 @@ test_static6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Host, Static - check_entry_flags fc00::1:1 UGHS + check_route_flags fc00::1:1 UGHS # Static route to network atf_check -s exit:0 -o ignore \ @@ -151,7 +121,7 @@ test_static6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Static - check_entry_flags fc00::/24 UGS + check_route_flags fc00::/24 UGS } test_blackhole6() @@ -171,14 +141,14 @@ test_blackhole6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Blackhole, Static - check_entry_flags fc00::/64 UGBS + check_route_flags fc00::/64 UGBS atf_check -s not-exit:0 -o match:'100.0% packet loss' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER $DEBUG && rump.netstat -rn -f inet6 # Shouldn't be created - check_entry_fail $IP6_PEER UH + check_route_no_entry $IP6_PEER } test_reject6() @@ -195,14 +165,14 @@ test_reject6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Reject, Static - check_entry_flags fc00::/64 UGRS + check_route_flags fc00::/64 UGRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER $DEBUG && rump.netstat -rn -f inet6 # Shouldn't be created - check_entry_fail $IP6_PEER UH + check_route_no_entry $IP6_PEER # Gateway is lo0 (RTF_GATEWAY) @@ -215,14 +185,14 @@ test_reject6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Reject, Static - check_entry_flags fc00::/64 UGRS + check_route_flags fc00::/64 UGRS atf_check -s not-exit:0 -o ignore -e match:'Network is unreachable' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER $DEBUG && rump.netstat -rn -f inet6 # Shouldn't be created - check_entry_fail $IP6_PEER UH + check_route_no_entry $IP6_PEER # Gateway is lo0 (RTF_HOST) @@ -235,7 +205,7 @@ test_reject6() $DEBUG && rump.netstat -rn -f inet6 # Up, Host, Reject, Static - check_entry_flags fc00:: UHRS + check_route_flags fc00:: UHRS atf_check -s not-exit:0 -o ignore -e match:'No route to host' \ rump.ping6 -n -X 1 -c 1 $IP6_PEER @@ -257,19 +227,11 @@ test_announce6() $DEBUG && rump.netstat -rn -f inet6 # Up, Gateway, Static, proxy - check_entry_flags fc00::/64 UGSp + check_route_flags fc00::/64 UGSp # TODO test its behavior } -cleanup() -{ - $DEBUG && /usr/bin/shmif_dumpbus -p - $BUS 2>/dev/null | \ - /usr/sbin/tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_LOCAL rump.halt - env RUMP_SERVER=$SOCK_PEER rump.halt -} - add_test() { local name=$1 @@ -284,8 +246,10 @@ add_test() setup_local; \ setup_peer; \ test_${name}; \ + rump_server_destroy_ifaces; \ }; \ route_flags_${name}_cleanup() { \ + $DEBUG && dump; \ cleanup; \ }" atf_add_test_case "route_flags_${name}" diff --git a/net/route/t_route.sh b/net/route/t_route.sh index 37ede4cec7b7..053f48f7286e 100755 --- a/net/route/t_route.sh +++ b/net/route/t_route.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_route.sh,v 1.7 2016/08/10 23:00:39 roy Exp $ +# $NetBSD: t_route.sh,v 1.10 2016/12/21 02:46:08 ozaki-r Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -25,9 +25,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -RUMP_LIBS="-lrumpdev -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif" -RUMP_LIBS_IPV6="$RUMP_LIBS -lrumpnet_netinet6" - # non_subnet_gateway SOCK_CLIENT=unix://commsock1 SOCK_GW=unix://commsock2 @@ -49,7 +46,7 @@ IP6DST=fc00:0:0:2::2 BUS_SRCGW=bus1 BUS_DSTGW=bus2 -DEBUG=false +DEBUG=${DEBUG:-false} TIMEOUT=1 PING_OPTS="-n -c 1 -w $TIMEOUT" @@ -64,13 +61,11 @@ route_non_subnet_gateway_head() route_non_subnet_gateway_body() { - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${SOCK_CLIENT} - atf_check -s exit:0 rump_server ${RUMP_LIBS} ${SOCK_GW} + rump_server_start $SOCK_CLIENT + rump_server_start $SOCK_GW export RUMP_SERVER=${SOCK_GW} - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + rump_server_add_iface $SOCK_GW shmif0 $BUS atf_check -s exit:0 rump.ifconfig shmif0 192.168.0.1 atf_check -s exit:0 rump.ifconfig shmif0 up @@ -81,11 +76,10 @@ route_non_subnet_gateway_body() $DEBUG && rump.netstat -nr -f inet export RUMP_SERVER=${SOCK_CLIENT} - - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + rump_server_add_iface $SOCK_CLIENT shmif0 $BUS atf_check -s exit:0 rump.ifconfig shmif0 10.0.0.1/32 atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.netstat -nr -f inet @@ -104,15 +98,14 @@ route_non_subnet_gateway_body() # Be reachable to the gateway atf_check -s exit:0 -o ignore rump.ping $PING_OPTS 192.168.0.1 - unset RUMP_SERVER + rump_server_destroy_ifaces } route_non_subnet_gateway_cleanup() { - $DEBUG && shmif_dumpbus -p - $BUS 2>/dev/null | tcpdump -n -e -r - - env RUMP_SERVER=$SOCK_CLIENT rump.halt - env RUMP_SERVER=$SOCK_GW rump.halt + $DEBUG && dump + cleanup } atf_test_case route_command_get cleanup @@ -140,8 +133,7 @@ setup_endpoint() local gw=${5} export RUMP_SERVER=${sock} - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr ${bus} + rump_server_add_iface $sock shmif0 $bus if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${addr} atf_check -s exit:0 -o ignore rump.route add -inet6 default ${gw} @@ -150,6 +142,7 @@ setup_endpoint() atf_check -s exit:0 -o ignore rump.route add default ${gw} fi atf_check -s exit:0 rump.ifconfig shmif0 up + atf_check -s exit:0 rump.ifconfig -w 10 if $DEBUG; then rump.ifconfig shmif0 @@ -161,13 +154,10 @@ setup_forwarder() { mode=${1} + rump_server_add_iface $SOCKFWD shmif0 $BUS_SRCGW + rump_server_add_iface $SOCKFWD shmif1 $BUS_DSTGW + export RUMP_SERVER=$SOCKFWD - atf_check -s exit:0 rump.ifconfig shmif0 create - atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS_SRCGW - - atf_check -s exit:0 rump.ifconfig shmif1 create - atf_check -s exit:0 rump.ifconfig shmif1 linkstr $BUS_DSTGW - if [ $mode = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6SRCGW} atf_check -s exit:0 rump.ifconfig shmif1 inet6 ${IP6DSTGW} @@ -178,6 +168,7 @@ setup_forwarder() atf_check -s exit:0 rump.ifconfig shmif0 up atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 if $DEBUG; then rump.netstat -nr @@ -204,9 +195,9 @@ setup_forwarding6() setup() { - atf_check -s exit:0 rump_server $RUMP_LIBS $SOCKSRC - atf_check -s exit:0 rump_server $RUMP_LIBS $SOCKFWD - atf_check -s exit:0 rump_server $RUMP_LIBS $SOCKDST + rump_server_start $SOCKSRC + rump_server_start $SOCKFWD + rump_server_start $SOCKDST setup_endpoint $SOCKSRC $IP4SRC $BUS_SRCGW ipv4 $IP4SRCGW setup_endpoint $SOCKDST $IP4DST $BUS_DSTGW ipv4 $IP4DSTGW @@ -216,9 +207,9 @@ setup() setup6() { - atf_check -s exit:0 rump_server $RUMP_LIBS_IPV6 $SOCKSRC - atf_check -s exit:0 rump_server $RUMP_LIBS_IPV6 $SOCKFWD - atf_check -s exit:0 rump_server $RUMP_LIBS_IPV6 $SOCKDST + rump_server_start $SOCKSRC netinet6 + rump_server_start $SOCKFWD netinet6 + rump_server_start $SOCKDST netinet6 setup_endpoint $SOCKSRC $IP6SRC $BUS_SRCGW ipv6 $IP6SRCGW setup_endpoint $SOCKDST $IP6DST $BUS_DSTGW ipv6 $IP6DSTGW @@ -380,6 +371,7 @@ route_command_get_body() setup setup_forwarding test_route_get + rump_server_destroy_ifaces } route_command_get6_body() @@ -388,36 +380,20 @@ route_command_get6_body() setup6 setup_forwarding6 test_route_get6 -} - -dump() -{ - - env RUMP_SERVER=$SOCKSRC rump.netstat -nr - env RUMP_SERVER=$SOCKFWD rump.netstat -nr - env RUMP_SERVER=$SOCKDST rump.netstat -nr - - shmif_dumpbus -p - bus1 2>/dev/null| tcpdump -n -e -r - - shmif_dumpbus -p - bus2 2>/dev/null| tcpdump -n -e -r - -} - -cleanup() -{ - - env RUMP_SERVER=$SOCKSRC rump.halt - env RUMP_SERVER=$SOCKFWD rump.halt - env RUMP_SERVER=$SOCKDST rump.halt + rump_server_destroy_ifaces } route_command_get_cleanup() { + $DEBUG && dump cleanup } route_command_get6_cleanup() { - dump + + $DEBUG && dump cleanup } diff --git a/rump/modautoload/Makefile b/rump/modautoload/Makefile index 905e79ac0f6c..dc58b14fef3b 100644 --- a/rump/modautoload/Makefile +++ b/rump/modautoload/Makefile @@ -1,9 +1,12 @@ -# $NetBSD: Makefile,v 1.3 2015/12/27 06:36:36 pgoyette Exp $ +# $NetBSD: Makefile,v 1.8 2016/10/14 16:02:35 christos Exp $ # +.include + TESTSDIR= ${TESTSBASE}/rump/modautoload TESTS_C= t_modautoload +PAXCTL_FLAGS= +ma SRCS.t_modautoload+= t_modautoload.c @@ -15,6 +18,7 @@ LDADD+= -Wl,--whole-archive ${DESTDIR}/usr/lib/librumpvfs.a \ ${DESTDIR}/usr/lib/librump.a \ -Wl,--no-whole-archive LDADD+= -lrumpuser -lpthread +DPADD+= ${LIBRUMPVFS} ${LIBRUMP} ${LIBRUMPUSER} WARNS= 4 diff --git a/rump/modautoload/t_modautoload.c b/rump/modautoload/t_modautoload.c index b73e52a2963b..2c21a90b664b 100644 --- a/rump/modautoload/t_modautoload.c +++ b/rump/modautoload/t_modautoload.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_modautoload.c,v 1.4 2015/12/27 08:21:44 pgoyette Exp $ */ +/* $NetBSD: t_modautoload.c,v 1.5 2016/09/14 03:19:11 ozaki-r Exp $ */ #include #include @@ -46,6 +46,7 @@ mountkernfs(void) atf_tc_fail_errno("mkdir /kern"); new_autoload = true; + old_len = sizeof(old_autoload); new_len = sizeof(new_autoload); error = sysctlbyname("kern.module.autoload", &old_autoload, &old_len, diff --git a/rump/rumpkern/t_lwproc.c b/rump/rumpkern/t_lwproc.c index d4eee3a6119a..6e78d0219e2b 100644 --- a/rump/rumpkern/t_lwproc.c +++ b/rump/rumpkern/t_lwproc.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_lwproc.c,v 1.7 2015/01/21 15:19:01 pooka Exp $ */ +/* $NetBSD: t_lwproc.c,v 1.8 2017/01/10 22:36:29 christos Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/sys/net/t_print.c b/sys/net/t_print.c index 0aaeb3070f98..ff178952a90d 100644 --- a/sys/net/t_print.c +++ b/sys/net/t_print.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_print.c,v 1.1 2014/12/02 19:48:21 christos Exp $ */ +/* $NetBSD: t_print.c,v 1.2 2016/08/27 11:30:49 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_print.c,v 1.1 2014/12/02 19:48:21 christos Exp $"); +__RCSID("$NetBSD: t_print.c,v 1.2 2016/08/27 11:30:49 christos Exp $"); #include "net/dl_print.c" @@ -147,7 +147,10 @@ ATF_TC_BODY(sdl_print, tc) memcpy(&sdl.sdl_addr, &tst[i].ia, sizeof(sdl.sdl_addr)); sdl.sdl_index = (uint16_t)i; r = sdl_print(buf, l, &sdl); - e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); + if (i == 3) + e = snprintf(res, l, "link#%zu", i); + else + e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); ATF_REQUIRE_STREQ(buf, res); ATF_REQUIRE_EQ(r, e); } @@ -157,7 +160,10 @@ ATF_TC_BODY(sdl_print, tc) memcpy(&sdl.sdl_addr, &tst[i].ia, sizeof(sdl.sdl_addr)); sdl.sdl_index = (uint16_t)i; r = sdl_print(buf, l, &sdl); - e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); + if (i == 3) + e = snprintf(res, l, "link#%zu", i); + else + e = snprintf(res, l, "[%s]:%zu", tst[i].str, i); ATF_REQUIRE_STREQ(buf, res); ATF_REQUIRE_EQ(r, e); } diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 34417786b120..1ed2d1a5885c 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.21 2016/04/08 10:09:16 gson Exp $ +# $NetBSD: Makefile,v 1.23 2017/01/02 15:40:09 christos Exp $ # .include @@ -7,8 +7,8 @@ TESTSDIR= ${TESTSBASE}/usr.bin TESTS_SUBDIRS= awk basename bzip2 cc cmp config cut \ diff dirname find gdb grep gzip id \ - infocmp jot ld m4 make mkdep \ + infocmp jot ld m4 make mixerctl mkdep \ nbperf netpgpverify pr rump_server shmif_dumpbus sdiff \ - sed sort tmux tr unifdef vmstat xlint + sed sort tmux tr unifdef uniq vmstat xlint .include diff --git a/usr.bin/config/t_config.sh b/usr.bin/config/t_config.sh index 8a8079c6a814..55af069f5afd 100755 --- a/usr.bin/config/t_config.sh +++ b/usr.bin/config/t_config.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_config.sh,v 1.7 2015/10/04 07:59:47 uebayasi Exp $ +# $NetBSD: t_config.sh,v 1.8 2016/08/27 12:08:14 christos Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,12 +25,32 @@ # POSSIBILITY OF SUCH DAMAGE. # +srcdir=.. +merge_backslash() +{ + sed ' +: again +/\\$/ { + N + s/\\\n// + t again +} +' "$1" +} run_and_check_prep() { local name="${1}"; shift - mkdir compile - supportdir="$(atf_get_srcdir)/support" + mkdir -p compile + srcdir="$(atf_get_srcdir)" + if [ ! -d "${srcdir}/support" ]; then + srcdir="$(dirname "${srcdir}")" + if [ ! -d "${srcdir}/support" ]; then + atf_fail "bad source directory ${srcdir}" + exit 1 + fi + fi + supportdir="${srcdir}/support" local config_str eval config_str=\$${name}_config_str @@ -38,7 +58,7 @@ run_and_check_prep() config="d_${name}" printf "$config_str" >"${config}" else - config="$(atf_get_srcdir)/d_${name}" + config="${srcdir}/d_${name}" fi } @@ -121,28 +141,28 @@ test_case deffs_redef fail "Checks that config doesn't allow a deffs to use" \ "the same name as a previous defflag/defparam" # Selecting an undefined option. -undefined_opt_config_str=' -include "../d_min" +undefined_opt_config_str=" +include \"${srcdir}/d_min\" options UNDEFINED -' +" test_case undefined_opt pass \ "Checks that config allows a selection for an undefined options" # Negating an undefined option. -no_undefined_opt_config_str=' -include "../d_min" +no_undefined_opt_config_str=" +include \"${srcdir}/d_min\" no options UNDEFINED -' +" no_undefined_opt_stderr='match:UNDEFINED' test_case no_undefined_opt warn \ "Checks that config allows a negation for an undefined options" # Attribute selection test_case select pass "Attribute selection" -select_config_str=' -include "../d_min" +select_config_str=" +include \"${srcdir}/d_min\" select c -' +" check_select() { local f=Makefile @@ -158,11 +178,11 @@ select_body() { # Attribute negation test_case no_select pass "Attribute negation" -no_select_config_str=' -include "../d_min" +no_select_config_str=" +include \"${srcdir}/d_min\" select c no select a -' +" check_no_select() { local f=Makefile @@ -181,10 +201,10 @@ no_select_body() { # Device instance test_case devi pass "Device instance" -devi_config_str=' -include "../d_min" +devi_config_str=" +include \"${srcdir}/d_min\" d0 at root -' +" check_devi() { local f=ioconf.c @@ -226,9 +246,7 @@ check_min_makefile() grep -q '^%' $f >tmp.template grep -q '^MACHINE=regress$' $f && - grep -q '^PARAM=-DMAXUSERS=4$' $f && - grep -q '^all: regress$' $f && - grep -q '^regress:' $f && + (merge_backslash $f | grep -q '^IDENT=[ ]*-DMAXUSERS="4"') && [ ! -s tmp.template ] && : } diff --git a/usr.bin/netpgpverify/t_netpgpverify.sh b/usr.bin/netpgpverify/t_netpgpverify.sh index 9c191160c7bf..2d532c0cb72d 100755 --- a/usr.bin/netpgpverify/t_netpgpverify.sh +++ b/usr.bin/netpgpverify/t_netpgpverify.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: t_netpgpverify.sh,v 1.3 2016/06/01 06:39:11 agc Exp $ +# $NetBSD: t_netpgpverify.sh,v 1.4 2016/08/28 15:59:15 christos Exp $ # # Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -525,7 +525,7 @@ StZtC+VbuN66pfHwsAIAAw== EOF uudecode << EOF begin-base64 644 NetBSD-6.0_hashes.asc.gz -H4sICAAAAAACA05ldEJTRC02LjBfaGFzaGVzLmFzYwDUvduOXceVpX3deoq87B8o +H4sICLYIw1cCA05ldEJTRC02LjBfaGFzaGVzLmFzYwDUvduOXceVpX3deoq87B8o y3E+NNDA7yqrXQZKsmHZQN8V4igTRYkCSVWV++n7G4tMcu9kZnJlSgW4SYsmM3fG ihUz5pxjRMzDr37Fr3/86ne//+bmj7/74823v//dN1/99ubrr7799je/+0rf+9UX /9ze/PV/3Hz7z7+xX/Drz39dN/vVy5ev/uPFD9/dvHhz027Gq+9/fLnerpuXL968 @@ -6708,223 +6708,223 @@ pL+3CVk1P6YRa9KiMyiRJWfnUcDul1ZuoxYIExVsxJTRktenJljvSqENKgZEXQQW BeCV0wUcL/W2jQwurZdliEKl2Ol1HS0Xpw+yNnd9qx0rSprqJhxbsLFvfQAi0aZN pTRGqo9C9qYTP8xFN3tCiDKUTNeRnoJ2u51wDl1ddeJgE/FtR7seraSeOo4asdKK bxwm6/orfaEf8K9bixVNVftP13/91f5hVoH4dzDUKrcQQIuRU4qxndLiRl+02mk/ -Bh1fXF4EQ/TgfzV3bl1CFcmXf+dT9Oss12jmyfusNQ8IXpBWQW21fZmVVxtEEBRB -Pv3s3ymwq6CoOsXfB221Fak8eU5kRuzIjNi7Vu0jbRwtMMQ4a+7dRjdho1Re1isd -jn4IRwv/dXIzoZ9ZKHiqm4BLHEZZrFxTLDkprfdCiDD1piSMKCchDGZXsyvSn4kg -l1ahU6K3Ynyb+S6ZNo1KSiiGAF2hsHMklKdnizClGkjiYD5q9lw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/vxYf/P +90+fPPzllzvzw/FjdD9c/+fNx/Gbn6//+lX7/BMfvjS3W3ny4vdP7z/76scv71xL +dz+5+8v9B789/+H6jY++8f/qD5/867tvf/v1vbvP4/Wv8r3nn62n//zhy2dPzZ1b +X//7s0dPv8wf/+fn8u+b8fntj3+pz679+HG4ux798uv2y7f3y70Pknn69cOfPv3h +obt/68EHd776bdz843n/6ZPtm4fzwW/XP37+6fNfvvnm2b343c/Xn4YX9vtrX3zz +2U+Pv3/85fxo3rz/9ffX/xjLfPPi92d/rJ8+eXr39+/urC/y9+/d/c+PH7XH1/+1 +nt6+c/uLfHM9fHAvXQ9ffPjztce3bt2xjx494P6s3Pn27vXfb/vb7bv1zdMb9vH2 +5Na/f/rnJy/K7x8+/+TO/burfPX8n/67B5+37x+/mA+++/Wzm9f+Yz//9tvf/C/x +0U3/6ON79Yu7f3ypiPC5+f7bh09vvBf79a/uvffVk5+efGDufdp+/fDZD7999/TO +i7r9/uzzX839G9duf5TN3X/a+3cf3Lz707I37j364vtfPv3xt3+t35W6Xe/6bfnx +/V/e++3x7Yc/fPHj7Wc3Xnx076MH6+GjP8rPX975+doH//7i+bOP/p3vv7jR4s9P +zQfun59tN756+tuzm7d+/DLdjvX6oxg+/Ohbc7/Gr/8I9cUq929/9MX12+3FXD9+ +cu36XXvj0zuPXPz9h9/6oz8++LLceTpvP/sgmE8e/7g9efLRk5u/vLiRf/rsl/DA +3X04f/vpAz9/efrTN0/lc9972q+ZB1/f//zZjU9a/P73p4+/IF15+OT2rVuf3r31 +3Yzxu/7Tg3L/0xeP37t+3z76z40H9sObn3//6EF58Um7/ezu7XvX4h/3fnh+45O7 +5fP5xwfmgf3mvV8/uvZ/H33yXT/ZJLc+v3neFvn/qZKFEe79DQA= ==== EOF gunzip NetBSD-6.0_hashes.asc.gz @@ -6958,18 +6958,15 @@ YzFlNiBiZjcxIDg4NDUgNDE2YiA5NTIyIDc5ZGUgYjYxZSA0ODhlIGVlNzQgCgo= EOF uudecode << EOF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zdGFpcmNyb29rcy5j +b20+CnVpZCAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tzIDxhZ2NAcGtnc3JjLm9y +Zz4KdWlkICAgICAgICAgICBBbGlzdGFpciBDcm9va3MgPGFnY0BuZXRic2Qub3Jn +Pgp1aWQgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQG5ldGZsaXguY29t +PgoK ==== EOF uudecode << EOF @@ -6995,18 +6992,15 @@ aW5hcnkvdGV4dApiIGxlbmd0aApjIHN0cmluZwpMIG10aW1lCnRleHQK EOF uudecode << EOF begin-base64 644 expected21 -R29vZCBzaWduYXR1cmUgZm9yIFtzdGRpbl0gbWFkZSBTdW4gU2VwICA5IDE3OjQ0 -OjExIDIwMTIKc2lnbmF0dXJlICAyMDQ4L1JTQSAoRW5jcnlwdCBvciBTaWduKSAx -YjY4ZGNmY2MwNTk2ODIzIDIwMDQtMDEtMTIKZmluZ2VycHJpbnQ6ICBkNDE1IDlk -ZWIgMzM2ZCBlNGNjIGNkZmEgMDBjZCAxYjY4IGRjZmMgYzA1OSA2ODIzIAp1aWQg -ICAgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQGFsaXN0YWlyY3Jvb2tz -LmNvbT4KdWlkICAgICAgICAgICAgICBBbGlzdGFpciBDcm9va3MgPGFnY0Bwa2dz -cmMub3JnPgp1aWQgICAgICAgICAgICAgIEFsaXN0YWlyIENyb29rcyA8YWdjQG5l -dGJzZC5vcmc+CnVpZCAgICAgICAgICAgICAgQWxpc3RhaXIgQ3Jvb2tzIDxhZ2NA -bmV0ZmxpeC5jb20+CmVuY3J5cHRpb24gMjA0OC9SU0EgKEVuY3J5cHQgb3IgU2ln -bikgNzlkZWI2MWU0ODhlZWU3NCAyMDA0LTAxLTEyCmZpbmdlcnByaW50OiAgNTdj -MCBjMWU2IGJmNzEgODg0NSA0MTZiIDk1MjIgNzlkZSBiNjFlIDQ4OGUgZWU3NCAK -Cg== +R29vZCBzaWduYXR1cm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KYiBoYXNoIGFsZwpiIHB1YmtleSBhbGcKOGIga2V5aWQKCmxp +dGVyYWwgZGF0YSAodGFnIDExKQo9PT09PT09PT09PT09CmIgYmluYXJ5L3RleHQK +YiBsZW5ndGgKYyBzdHJpbmcKTCBtdGltZQp0ZXh0ClBST0c9cApTUkNTPXBhcnNl +LmMKV0FSTlM9NQpNS01BTj1ubwpDUFBGTEFHUys9LWcgLU8wCkxERkxBR1MrPS1n +IC1PMAoKLmluY2x1ZGUgPGJzZC5wcm9nLm1rPgoKdDogJHtQUk9HfQoJLi8ke1BS +T0d9IGdwZ3NpZ25lZC1hLmdwZwo= ==== EOF uudecode << EOF @@ -7207,13 +7194,12 @@ IG5ldHBncHZlcmlmeQo= ==== EOF atf_check -s eq:0 -o file:expected16 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify b.gpg - atf_check -s eq:0 -o file:2.expected -e empty b2e < 2.in - atf_check -s eq:0 -o file:expected18 -e empty env TZ=US/Pacific netpgpverify -c verify a.gpg - atf_check -s eq:0 -o file:expected19 -e empty env TZ=US/Pacific netpgpverify -c verify NetBSD-6.0_RC2_hashes.asc + atf_check -s eq:0 -o file:expected18 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify a.gpg +# atf_check -s eq:0 -o file:expected19 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c verify NetBSD-6.0_RC2_hashes.asc atf_check -s eq:0 -o file:expected20 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat jj.asc - atf_check -s eq:0 -o file:expected21 -e empty env TZ=US/Pacific netpgpverify < a.gpg + atf_check -s eq:0 -o file:expected21 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < a.gpg atf_check -s eq:0 -o file:expected22 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < jj.asc - atf_check -s eq:0 -o file:expected23 -e empty env TZ=US/Pacific netpgpverify < NetBSD-6.0_RC2_hashes.asc +# atf_check -s eq:0 -o file:expected23 -e empty env TZ=US/Pacific netpgpverify < NetBSD-6.0_RC2_hashes.asc atf_check -s eq:0 -o file:expected24 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg < b.gpg #atf_check -s eq:0 -o file:expected25 -e empty netpgpverify NetBSD-6.0_RC1_hashes.gpg #atf_check -s eq:0 -o file:expected26 -e empty netpgpverify < NetBSD-6.0_RC1_hashes.gpg @@ -7225,7 +7211,7 @@ EOF atf_check -s eq:0 -o file:expected32 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg b.gpg b.gpg b.gpg atf_check -s eq:0 -o file:expected33 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat b.gpg jj.asc b.gpg atf_check -s eq:0 -o file:expected34 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg det.sig - atf_check -s eq:0 -o file:expected35 -e empty env TZ=US/Pacific netpgpverify -c cat -k pubring.gpg det.sig + atf_check -s eq:0 -o file:expected35 -e empty env TZ=US/Pacific netpgpverify -k pubring.gpg -c cat det.sig #atf_check -s eq:0 -o file:expected46 -e empty netpgpverify -k problem-pubring.gpg NetBSD-6.0_hashes.asc } diff --git a/usr.bin/xlint/lint1/Makefile b/usr.bin/xlint/lint1/Makefile index 3690d1a67685..f72acb1cda94 100644 --- a/usr.bin/xlint/lint1/Makefile +++ b/usr.bin/xlint/lint1/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2015/10/14 16:32:55 christos Exp $ +# $NetBSD: Makefile,v 1.13 2016/08/19 10:21:50 christos Exp $ NOMAN= # defined @@ -11,6 +11,7 @@ TESTS_SH= t_integration FILESDIR= ${TESTSDIR} FILES+= d_alignof.c FILES+= d_c99_anon_struct.c +FILES+= d_c99_anon_union.c FILES+= d_c99_complex_num.c FILES+= d_c99_complex_split.c FILES+= d_c99_compound_literal_comma.c @@ -23,6 +24,7 @@ FILES+= d_c99_func.c FILES+= d_c99_recursive_init.c FILES+= d_c99_struct_init.c FILES+= d_c99_nested_struct.c +FILES+= d_c99_union_cast.c FILES+= d_c99_union_init1.c FILES+= d_c99_union_init2.c FILES+= d_c99_union_init3.c diff --git a/usr.bin/xlint/lint1/d_c99_anon_union.c b/usr.bin/xlint/lint1/d_c99_anon_union.c new file mode 100644 index 000000000000..508bcc9bdf43 --- /dev/null +++ b/usr.bin/xlint/lint1/d_c99_anon_union.c @@ -0,0 +1,16 @@ +/* struct with only anonymous members */ + +struct foo { + union { + long loo; + double doo; + }; +}; + +int +main(void) { + + struct foo *f = 0; + printf("%p\n", &f[1]); + return 0; +} diff --git a/usr.bin/xlint/lint1/d_c99_union_cast.c b/usr.bin/xlint/lint1/d_c99_union_cast.c new file mode 100644 index 000000000000..31628b456288 --- /dev/null +++ b/usr.bin/xlint/lint1/d_c99_union_cast.c @@ -0,0 +1,18 @@ +/* union cast */ + +struct bar { + int a; + int b; +}; + +union foo { + struct bar *a; + int b; +}; + +void +foo(void) { + struct bar *a; + + ((union foo)a).a; +} From 35cfc322f1809b193bfb308d46c4f1ff083e01be Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 12 Jan 2017 08:31:42 +0000 Subject: [PATCH 020/126] Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked MFC after: 13 days --- contrib/netbsd-tests/lib/libc/sys/t_access.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_access.c b/contrib/netbsd-tests/lib/libc/sys/t_access.c index e15241febc64..c537ecaf954b 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_access.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_access.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */ +/* $NetBSD: t_access.c,v 2.2 2017/01/10 22:36:29 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -31,6 +31,10 @@ #include __RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $"); +#ifdef __FreeBSD__ +#include /* For __FreeBSD_version */ +#endif + #include #include From 9527fa4f663fa848cff1018f5c92bcccfc2adeee Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 12 Jan 2017 08:40:52 +0000 Subject: [PATCH 021/126] Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . MFC after: 1 week --- contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c | 4 ---- lib/libc/tests/stdlib/Makefile | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c index 905306d042bf..06f2de09c50b 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c @@ -51,10 +51,6 @@ static const char * const inf_strings[] = const char *nan_string = "NaN(x)y"; #endif -#ifdef __FreeBSD__ -#define __HAVE_LONG_DOUBLE -#endif - ATF_TC(strtod_basic); ATF_TC_HEAD(strtod_basic, tc) { diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index f2d866c4c9df..c681cb604383 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -11,6 +11,14 @@ ATF_TESTS_CXX+= cxa_thread_atexit_test ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test .endif +# Not sure why this isn't defined for all architectures, since most +# have long double. +.if ${MACHINE_CPUARCH} == "aarch64" || \ + ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" +CFLAGS+= -D__HAVE_LONG_DOUBLE +.endif + # TODO: t_getenv_thread, t_mi_vector_hash, t_strtoi NETBSD_ATF_TESTS_C+= abs_test NETBSD_ATF_TESTS_C+= atoi_test From b6bd3eb5f3c023fc20d2df000e818962e609ae01 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 12 Jan 2017 08:46:19 +0000 Subject: [PATCH 022/126] Add additional testcases missed in r311966 --- lib/libm/t_casinh.c | 81 ++++++++++++++++++++++ lib/libm/t_fe_round.c | 124 +++++++++++++++++++++++++++++++++ lib/libm/t_ilogb.c | 127 ++++++++++++++++++++++++++++++++++ lib/libpthread/t_timedmutex.c | 30 ++++++++ 4 files changed, 362 insertions(+) create mode 100644 lib/libm/t_casinh.c create mode 100644 lib/libm/t_fe_round.c create mode 100644 lib/libm/t_ilogb.c create mode 100644 lib/libpthread/t_timedmutex.c diff --git a/lib/libm/t_casinh.c b/lib/libm/t_casinh.c new file mode 100644 index 000000000000..f9f93c31b9f9 --- /dev/null +++ b/lib/libm/t_casinh.c @@ -0,0 +1,81 @@ +/* $NetBSD: t_casinh.c,v 1.2 2016/09/20 17:19:28 christos Exp $ */ + +/* + * Written by Maya Rashish + * Public domain. + * + * Testing special values of casinh + * Values from ISO/IEC 9899:201x G.6.2.2 + */ + +#include +#include +#include + +#define RE(z) (((double *)(&z))[0]) +#define IM(z) (((double *)(&z))[1]) + +static const struct { + double input_re; + double input_im; + double result_re; + double result_im; +} values[] = { + { +0, +0, +0, +0}, + { +5.032E3, +INFINITY, +INFINITY, +M_PI/2}, + { +INFINITY, +5.023E3, +INFINITY, +0}, + { +INFINITY, +INFINITY, +INFINITY, +M_PI/4}, +#ifdef __HAVE_NANF + { +INFINITY, +NAN, +INFINITY, +NAN}, + { +5.032E3, +NAN, +NAN, +NAN}, /* + FE_INVALID optionally raised */ + { +NAN, +0, +NAN, +0}, + { +NAN, -5.023E3, +NAN, +NAN}, /* + FE_INVALID optionally raised */ + { +NAN, +INFINITY, +INFINITY, +NAN}, /* sign of real part of result unspecified */ + { +NAN, +NAN, +NAN, +NAN}, +#endif +}; + +#ifdef __HAVE_NANF +#define both_nan(a,b) (isnan(a) && isnan(b)) +#else +#define both_nan(a,b) 0 +#endif + +#define crude_equality(a,b) ((a == b) || both_nan(a,b)) + +#define ATF_COMPLEX_EQUAL(a,b) do { \ + complex double ci = casinh(a); \ + ATF_CHECK_MSG(crude_equality(creal(ci),creal(b)) && \ + crude_equality(cimag(ci), cimag(b)), \ + "for casinh([%g,%g]) = [%g,%g] != [%g,%g]", \ + creal(a), cimag(a), creal(ci), cimag(ci), creal(b), cimag(b)); \ +} while (0/*CONSTCOND*/) + + +ATF_TC(casinh); +ATF_TC_HEAD(casinh, tc) +{ + atf_tc_set_md_var(tc, "descr","Check casinh family - special values"); +} + +ATF_TC_BODY(casinh, tc) +{ + complex double input; + complex double result; + unsigned int i; + for (i = 0; i < __arraycount(values); i++) { + RE(input) = values[i].input_re; + IM(input) = values[i].input_im; + RE(result) = values[i].result_re; + IM(result) = values[i].result_im; + ATF_COMPLEX_EQUAL(input, result); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, casinh); + + return atf_no_error(); +} diff --git a/lib/libm/t_fe_round.c b/lib/libm/t_fe_round.c new file mode 100644 index 000000000000..fe805b4f86b8 --- /dev/null +++ b/lib/libm/t_fe_round.c @@ -0,0 +1,124 @@ +/* + * Written by Maya Rashish + * Public domain. + * + * Testing IEEE-754 rounding modes (and lrint) + */ + +#include +#include +#ifdef __HAVE_FENV +#include +#include +#include + +/*#pragma STDC FENV_ACCESS ON gcc?? */ + +#define INT 9223L + +#define EPSILON 0.001 + +static const struct { + int round_mode; + double input; + long int expected; +} values[] = { + { FE_DOWNWARD, 3.7, 3}, + { FE_DOWNWARD, -3.7, -4}, + { FE_DOWNWARD, +0, 0}, + { FE_DOWNWARD, -INT-0.01, -INT-1}, + { FE_DOWNWARD, +INT-0.01, INT-1}, + { FE_DOWNWARD, -INT+0.01, -INT}, + { FE_DOWNWARD, +INT+0.01, INT}, +#if 0 /* cpu bugs? */ + { FE_DOWNWARD, -0, -1}, + + { FE_UPWARD, +0, 1}, +#endif + { FE_UPWARD, -0, 0}, + { FE_UPWARD, -123.7, -123}, + { FE_UPWARD, 123.999, 124}, + { FE_UPWARD, -INT-0.01, -INT}, + { FE_UPWARD, +INT-0.01, INT}, + { FE_UPWARD, -INT+0.01, -INT+1}, + { FE_UPWARD, +INT+0.01, INT+1}, + + { FE_TOWARDZERO, 1.99, 1}, + { FE_TOWARDZERO, -1.99, -1}, + { FE_TOWARDZERO, 0.2, 0}, + { FE_TOWARDZERO, INT+0.01, INT}, + { FE_TOWARDZERO, INT-0.01, INT - 1}, + { FE_TOWARDZERO, -INT+0.01, -INT + 1}, + { FE_TOWARDZERO, +0, 0}, + { FE_TOWARDZERO, -0, 0}, + + { FE_TONEAREST, -INT-0.01, -INT}, + { FE_TONEAREST, +INT-0.01, INT}, + { FE_TONEAREST, -INT+0.01, -INT}, + { FE_TONEAREST, +INT+0.01, INT}, + { FE_TONEAREST, -INT-0.501, -INT-1}, + { FE_TONEAREST, +INT-0.501, INT-1}, + { FE_TONEAREST, -INT+0.501, -INT+1}, + { FE_TONEAREST, +INT+0.501, INT+1}, + { FE_TONEAREST, +0, 0}, + { FE_TONEAREST, -0, 0}, +}; + +ATF_TC(fe_round); +ATF_TC_HEAD(fe_round, tc) +{ + atf_tc_set_md_var(tc, "descr","Checking IEEE 754 rounding modes using lrint"); +} + +ATF_TC_BODY(fe_round, tc) +{ + long int received; + + for (unsigned int i = 0; i < __arraycount(values); i++) { + fesetround(values[i].round_mode); + + received = lrint(values[i].input); + ATF_CHECK_MSG( + (labs(received - values[i].expected) < EPSILON), + "lrint rounding wrong, difference too large\n" + "input: %f (index %d): got %ld, expected %ld\n", + values[i].input, i, received, values[i].expected); + + /* Do we get the same rounding mode out? */ + ATF_CHECK_MSG( + (fegetround() == values[i].round_mode), + "Didn't get the same rounding mode out!\n" + "(index %d) fed in %d rounding mode, got %d out\n", + i, fegetround(), values[i].round_mode); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fe_round); + + return atf_no_error(); +} +#else +ATF_TC(t_nofe_round); + +ATF_TC_HEAD(t_nofe_round, tc) +{ + atf_tc_set_md_var(tc, "descr", + "dummy test case - no fenv.h support"); +} + + +ATF_TC_BODY(t_nofe_round, tc) +{ + atf_tc_skip("no fenv.h support on this architecture"); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, t_nofe_round); + return atf_no_error(); +} + +#endif diff --git a/lib/libm/t_ilogb.c b/lib/libm/t_ilogb.c new file mode 100644 index 000000000000..8e3d2990ce79 --- /dev/null +++ b/lib/libm/t_ilogb.c @@ -0,0 +1,127 @@ +/* $NetBSD: t_ilogb.c,v 1.6 2016/08/26 08:01:55 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Maya Rashish. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +#include +#include + +#ifndef __HAVE_FENV + +# define ATF_CHECK_RAISED_INVALID +# define ATF_CHECK_RAISED_NOTHING + +#else +# define ATF_CHECK_RAISED_INVALID do { \ + int r = fetestexcept(FE_ALL_EXCEPT); \ + ATF_CHECK_MSG(r == FE_INVALID, "r=%#x != %#x\n", r, FE_INVALID); \ + (void)feclearexcept(FE_ALL_EXCEPT); \ +} while (/*CONSTCOND*/0) + +# define ATF_CHECK_RAISED_NOTHING do { \ + int r = fetestexcept(FE_ALL_EXCEPT); \ + ATF_CHECK_MSG(r == 0, "r=%#x != 0\n", r); \ + (void)feclearexcept(FE_ALL_EXCEPT); \ +} while (/*CONSTCOND*/0) +#endif + +ATF_TC(ilogb); +ATF_TC_HEAD(ilogb, tc) +{ + atf_tc_set_md_var(tc, "descr","Check ilogb family"); +} + +ATF_TC_BODY(ilogb, tc) +{ + + ATF_CHECK(ilogbf(0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(-0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(-0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(-0) == FP_ILOGB0); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(-INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(-INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(-INFINITY) == INT_MAX); + ATF_CHECK_RAISED_INVALID; +#endif + + ATF_CHECK(ilogbf(1024) == 10); + ATF_CHECK_RAISED_NOTHING; + ATF_CHECK(ilogb(1024) == 10); + ATF_CHECK_RAISED_NOTHING; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(1024) == 10); + ATF_CHECK_RAISED_NOTHING; +#endif + +#ifndef __vax__ + ATF_CHECK(ilogbf(NAN) == FP_ILOGBNAN); + ATF_CHECK_RAISED_INVALID; + ATF_CHECK(ilogb(NAN) == FP_ILOGBNAN); + ATF_CHECK_RAISED_INVALID; +#ifdef __HAVE_LONG_DOUBLE + ATF_CHECK(ilogbl(NAN) == FP_ILOGBNAN); + ATF_CHECK_RAISED_INVALID; +#endif +#endif +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, ilogb); + + return atf_no_error(); +} diff --git a/lib/libpthread/t_timedmutex.c b/lib/libpthread/t_timedmutex.c new file mode 100644 index 000000000000..4f71acdc72fb --- /dev/null +++ b/lib/libpthread/t_timedmutex.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_timedmutex.c,v 1.2 2016/10/31 16:21:23 christos Exp $ */ + +/* + * Copyright (c) 2008 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TIMEDMUTEX +#include "t_mutex.c" From 17160457b41ff26b4384d8f82ed176a2844eb272 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Thu, 12 Jan 2017 08:53:10 +0000 Subject: [PATCH 023/126] Report random flash storage as non-rotating to GEOM_DISK. While doing it, introduce respective constants in geom_disk.h. MFC after: 1 week --- sys/cam/nvme/nvme_da.c | 2 +- sys/dev/mmc/mmcsd.c | 1 + sys/dev/nand/nand_geom.c | 2 ++ sys/dev/nvd/nvd.c | 6 ++---- sys/geom/geom_disk.c | 12 ++++++------ sys/geom/geom_disk.h | 5 +++++ 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c index 5e316c365295..1aa9954747a3 100644 --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -761,7 +761,7 @@ ndaregister(struct cam_periph *periph, void *arg) MIN(sizeof(softc->disk->d_descr), sizeof(cd->mn))); strlcpy(softc->disk->d_ident, cd->sn, MIN(sizeof(softc->disk->d_ident), sizeof(cd->sn))); - disk->d_rotation_rate = 0; /* Spinning rust need not apply */ + disk->d_rotation_rate = DISK_RR_NON_ROTATING; disk->d_open = ndaopen; disk->d_close = ndaclose; disk->d_strategy = ndastrategy; diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 3132c21aea01..ac697a3cf814 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -170,6 +170,7 @@ mmcsd_attach(device_t dev) d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize; strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); strlcpy(d->d_descr, mmc_get_card_id_string(dev), sizeof(d->d_descr)); + d->d_rotation_rate = DISK_RR_NON_ROTATING; /* * Display in most natural units. There's no cards < 1MB. The SD diff --git a/sys/dev/nand/nand_geom.c b/sys/dev/nand/nand_geom.c index 593b5f5e766a..ec789c517e8b 100644 --- a/sys/dev/nand/nand_geom.c +++ b/sys/dev/nand/nand_geom.c @@ -394,6 +394,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(ndisk->d_ident, sizeof(ndisk->d_ident), "nand: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); + ndisk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(ndisk, DISK_VERSION); @@ -415,6 +416,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(rdisk->d_ident, sizeof(rdisk->d_ident), "nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); + disk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(rdisk, DISK_VERSION); diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c index a9c623fe9172..bfb3d264d1e1 100644 --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -352,13 +352,11 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg) */ nvme_strvis(disk->d_ident, nvme_ns_get_serial_number(ns), sizeof(disk->d_ident), NVME_SERIAL_NUMBER_LENGTH); - nvme_strvis(descr, nvme_ns_get_model_number(ns), sizeof(descr), NVME_MODEL_NUMBER_LENGTH); - -#if __FreeBSD_version >= 900034 strlcpy(disk->d_descr, descr, sizeof(descr)); -#endif + + disk->d_rotation_rate = DISK_RR_NON_ROTATING; ndisk->ns = ns; ndisk->disk = disk; diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index dbaa6b524db3..9a52ad1a3586 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -588,12 +588,12 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g * special cases, and there's also a valid range. */ sbuf_printf(sb, "%s", indent); - if (dp->d_rotation_rate == 0) /* Old drives don't */ - sbuf_printf(sb, "unknown"); /* report RPM. */ - else if (dp->d_rotation_rate == 1) /* Since 0 is used */ - sbuf_printf(sb, "0"); /* above, SSDs use 1. */ - else if ((dp->d_rotation_rate >= 0x041) && - (dp->d_rotation_rate <= 0xfffe)) + if (dp->d_rotation_rate == DISK_RR_UNKNOWN) /* Old drives */ + sbuf_printf(sb, "unknown"); /* don't report RPM. */ + else if (dp->d_rotation_rate == DISK_RR_NON_ROTATING) + sbuf_printf(sb, "0"); + else if ((dp->d_rotation_rate >= DISK_RR_MIN) && + (dp->d_rotation_rate <= DISK_RR_MAX)) sbuf_printf(sb, "%u", dp->d_rotation_rate); else sbuf_printf(sb, "invalid"); diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h index 5fce5b93f69c..642a51296051 100644 --- a/sys/geom/geom_disk.h +++ b/sys/geom/geom_disk.h @@ -119,6 +119,11 @@ struct disk { #define DISKFLAG_DIRECT_COMPLETION 0x20 #define DISKFLAG_CANZONE 0x80 +#define DISK_RR_UNKNOWN 0 +#define DISK_RR_NON_ROTATING 1 +#define DISK_RR_MIN 0x0401 +#define DISK_RR_MAX 0xfffe + struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); void disk_destroy(struct disk *disk); From 7ad417dff84775a57d6aef409066ac5afc93cc6f Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 12 Jan 2017 09:01:14 +0000 Subject: [PATCH 024/126] Add __BIT and __BITS macros from NetBSD to help support new testcases MFC after: 1 week --- lib/libnetbsd/sys/cdefs.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libnetbsd/sys/cdefs.h b/lib/libnetbsd/sys/cdefs.h index 46372f368afd..325c23422446 100644 --- a/lib/libnetbsd/sys/cdefs.h +++ b/lib/libnetbsd/sys/cdefs.h @@ -71,4 +71,13 @@ */ #define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) +/* __BIT(n): nth bit, where __BIT(0) == 0x1. */ +#define __BIT(__n) \ + (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \ + ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1)))) + +/* __BITS(m, n): bits m through n, m < n. */ +#define __BITS(__m, __n) \ + ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1)) + #endif /* _LIBNETBSD_SYS_CDEFS_H_ */ From 5e946c03c77bc83fda134e49072220e931087d02 Mon Sep 17 00:00:00 2001 From: Maxim Sobolev Date: Thu, 12 Jan 2017 10:14:54 +0000 Subject: [PATCH 025/126] Fix slight type mismatch between so_options defined in sys/socketvar.h and tw_so_options defined here which is supposed to be a copy of the former (short vs u_short respectively). Switch tw_so_options to be "signed short" to match the type of the field it's inherited from. --- sys/netinet/tcp_var.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index f4ea246b1837..38e8a15e7e19 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -452,7 +452,7 @@ struct tcptw { tcp_seq iss; tcp_seq irs; u_short last_win; /* cached window value */ - u_short tw_so_options; /* copy of so_options */ + short tw_so_options; /* copy of so_options */ struct ucred *tw_cred; /* user credentials */ u_int32_t t_recent; u_int32_t ts_offset; /* our timestamp offset */ From 58223d5b7a5a168eeff5ae7ca2bf85cb185746ca Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 12 Jan 2017 13:00:17 +0000 Subject: [PATCH 026/126] sfxge(4): add tunable to configure MAC stats update period Reviewed by: philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9151 --- share/man/man4/sfxge.4 | 8 ++++++++ sys/dev/sfxge/sfxge.h | 1 + sys/dev/sfxge/sfxge_port.c | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/share/man/man4/sfxge.4 b/share/man/man4/sfxge.4 index 9be27e018047..0e33f4b03d8e 100644 --- a/share/man/man4/sfxge.4 +++ b/share/man/man4/sfxge.4 @@ -158,6 +158,14 @@ The default for each port will be the value of .Va hw.sfxge.mcdi_logging. The logging may also be enabled or disabled after the driver is loaded using the sysctl .Va dev.sfxge.%d.mcdi_logging. +.It Va hw.sfxge.stats_update_period_ms +Period in milliseconds to refresh interface statistics from hardware. +The accepted range is 0 to 65535, the default is 1000 (1 second). +Use zero value to disable periodic statistics update. +Supported on SFN8xxx series adapters with firmware v6.2.1.1033 and later and +SFN5xxx and SFN6xxx series adapters. +SFN7xxx series adapters and SFN8xxx series with earlier firmware use a +fixed 1000 milliseconds statistics update period. .El .Sh SUPPORT For general information and support, diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h index 90914dac68fc..ed8b49d6fb28 100644 --- a/sys/dev/sfxge/sfxge.h +++ b/sys/dev/sfxge/sfxge.h @@ -248,6 +248,7 @@ struct sfxge_port { #endif struct sfxge_hw_stats phy_stats; struct sfxge_hw_stats mac_stats; + uint16_t stats_update_period_ms; efx_link_mode_t link_mode; uint8_t mcast_addrs[EFX_MAC_MULTICAST_LIST_MAX * EFX_MAC_ADDR_LEN]; diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index cb574f0c9100..3585f0d71920 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -43,6 +43,15 @@ __FBSDID("$FreeBSD$"); #include "sfxge.h" +#define SFXGE_PARAM_STATS_UPDATE_PERIOD_MS \ + SFXGE_PARAM(stats_update_period_ms) +static int sfxge_stats_update_period_ms = SFXGE_STATS_UPDATE_PERIOD_MS; +TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD_MS, + &sfxge_stats_update_period_ms); +SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period_ms, CTLFLAG_RDTUN, + &sfxge_stats_update_period_ms, 0, + "netstat interface statistics update period in milliseconds"); + static int sfxge_phy_cap_mask(struct sfxge_softc *, int, uint32_t *); static int @@ -62,7 +71,7 @@ sfxge_mac_stat_update(struct sfxge_softc *sc) goto out; } - min_ticks = (unsigned int)hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000; + min_ticks = (unsigned int)hz * port->stats_update_period_ms / 1000; now = ticks; if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) { @@ -515,7 +524,7 @@ sfxge_port_start(struct sfxge_softc *sc) /* Update MAC stats by DMA every period */ if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, - SFXGE_STATS_UPDATE_PERIOD_MS, + port->stats_update_period_ms, B_FALSE)) != 0) goto fail6; @@ -673,6 +682,26 @@ sfxge_port_fini(struct sfxge_softc *sc) port->sc = NULL; } +static uint16_t +sfxge_port_stats_update_period_ms(struct sfxge_softc *sc) +{ + int period_ms = sfxge_stats_update_period_ms; + + if (period_ms < 0) { + device_printf(sc->dev, + "treat negative stats update period %d as 0 (disable)\n", + period_ms); + period_ms = 0; + } else if (period_ms > UINT16_MAX) { + device_printf(sc->dev, + "treat too big stats update period %d as %u\n", + period_ms, UINT16_MAX); + period_ms = UINT16_MAX; + } + + return period_ms; +} + int sfxge_port_init(struct sfxge_softc *sc) { @@ -721,6 +750,7 @@ sfxge_port_init(struct sfxge_softc *sc) M_SFXGE, M_WAITOK | M_ZERO); if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0) goto fail2; + port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc); sfxge_mac_stat_init(sc); port->init_state = SFXGE_PORT_INITIALIZED; From 8bc3dfc424be63d68c4e7220e41b75d87ac19158 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 14:18:52 +0000 Subject: [PATCH 027/126] Attempt to use the "new" BAR address for newer igb(4) devices. This code was dropped during the IFLIB migration. Reported by: olivier Reviewed by: mmacy@nextbsd.org --- sys/dev/e1000/if_em.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 629ae91025d3..c498354b7f86 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -770,6 +770,8 @@ em_if_attach_pre(if_ctx_t ctx) if (adapter->hw.mac.type >= igb_mac_min) { + int try_second_bar; + scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_adv_rx_desc), EM_DBA_ALIGN); scctx->isc_txrx = &igb_txrx; @@ -779,6 +781,15 @@ em_if_attach_pre(if_ctx_t ctx) if (adapter->hw.mac.type != e1000_82575) scctx->isc_tx_csum_flags |= CSUM_SCTP | CSUM_IP6_SCTP; + /* + ** Some new devices, as with ixgbe, now may + ** use a different BAR, so we need to keep + ** track of which is used. + */ + try_second_bar = pci_read_config(dev, scctx->isc_msix_bar, 4); + if (try_second_bar == 0) + scctx->isc_msix_bar += 4; + } else if (adapter->hw.mac.type >= em_mac_min) { scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN); From 0aa7d3ff9ea9e5bbfacee813addb17bfde6bfcab Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 14:28:32 +0000 Subject: [PATCH 028/126] Reset the EIAC register to include the LINK status bit and restore link up/down notifications. Submitted by: Franco Fichtner --- sys/dev/e1000/if_em.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index c498354b7f86..a95814404c46 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -3117,7 +3117,7 @@ em_if_enable_intr(if_ctx_t ctx) u32 ims_mask = IMS_ENABLE_MASK; if (hw->mac.type == e1000_82574) { - E1000_WRITE_REG(hw, EM_EIAC, adapter->ims); + E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); ims_mask |= adapter->ims; } if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= igb_mac_min) { u32 mask = (adapter->que_mask | adapter->link_mask); From 062a4b8c687c93b395507b1c3b972c2c33552731 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 14:38:18 +0000 Subject: [PATCH 029/126] Deprecate kernel configuration option EM_MULTIQUEUE now that the em(4) driver conforms to iflib. --- UPDATING | 4 ++++ sys/conf/NOTES | 3 --- sys/conf/files | 2 ++ sys/conf/options | 3 --- sys/dev/e1000/if_em.h | 9 --------- sys/modules/em/Makefile | 2 +- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/UPDATING b/UPDATING index d604e4289431..107fd8b1782e 100644 --- a/UPDATING +++ b/UPDATING @@ -51,6 +51,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20170112: + The EM_MULTIQUEUE kernel configuration option is deprecated now that + the em(4) driver conforms to iflib specifications. + 20170109: The igb(4), em(4) and lem(4) ethernet drivers are now implemented via IFLIB. If you have a custom kernel configuration that excludes em(4) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 711c9a88de4a..2e430bc129da 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -3055,9 +3055,6 @@ options RANDOM_ENABLE_UMA # slab allocator # Module to enable execution of application via emulators like QEMU options IMAGACT_BINMISC -# Intel em(4) driver -options EM_MULTIQUEUE # Activate multiqueue features/disable MSI-X - # zlib I/O stream support # This enables support for compressed core dumps. options GZIO diff --git a/sys/conf/files b/sys/conf/files index c221bbec85bf..d8e76b1a3bae 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2139,6 +2139,8 @@ dev/ixgbe/ix_txrx.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_osdep.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/ixgbe_sysctl.c optional ix inet | ixv inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_phy.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_api.c optional ix inet | ixv inet \ diff --git a/sys/conf/options b/sys/conf/options index 17923ea628b9..dee1eaddbb0d 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -986,9 +986,6 @@ RANDOM_LOADABLE opt_global.h # the uma slab allocator. RANDOM_ENABLE_UMA opt_global.h -# Intel em(4) driver -EM_MULTIQUEUE opt_em.h - # BHND(4) driver BHND_LOGLEVEL opt_global.h diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h index 635d172bf458..d7290fd72455 100644 --- a/sys/dev/e1000/if_em.h +++ b/sys/dev/e1000/if_em.h @@ -25,7 +25,6 @@ */ /*$FreeBSD$*/ -#include "opt_em.h" #include "opt_ddb.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -176,11 +175,7 @@ * restoring the network connection. To eliminate the potential * for the hang ensure that EM_RDTR is set to 0. */ -#ifdef EM_MULTIQUEUE -#define EM_RDTR 64 -#else #define EM_RDTR 0 -#endif /* * Receive Interrupt Absolute Delay Timer (Not valid for 82542/82543/82544) @@ -193,11 +188,7 @@ * along with EM_RDTR, may improve traffic throughput in specific network * conditions. */ -#ifdef EM_MULTIQUEUE -#define EM_RADV 128 -#else #define EM_RADV 64 -#endif /* * This parameter controls whether or not autonegotation is enabled. diff --git a/sys/modules/em/Makefile b/sys/modules/em/Makefile index ead132978052..18f16756bfa5 100644 --- a/sys/modules/em/Makefile +++ b/sys/modules/em/Makefile @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../dev/e1000 KMOD = if_em -SRCS = device_if.h bus_if.h pci_if.h opt_ddb.h opt_em.h opt_inet.h \ +SRCS = device_if.h bus_if.h pci_if.h opt_ddb.h opt_inet.h \ opt_inet6.h ifdi_if.h SRCS += $(CORE_SRC) $(LEGACY_SRC) SRCS += $(COMMON_SHARED) $(LEGACY_SHARED) $(PCIE_SHARED) From f5ab496e624ec7af19c212111381841a53d110f2 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Thu, 12 Jan 2017 14:44:41 +0000 Subject: [PATCH 030/126] rpcgen(1): Check getrlimit() return for generated code. Obtained from: NetBSD (CVS rev 1.27, 1.28) MFC after: 1 week --- usr.bin/rpcgen/rpc_svcout.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index aa5a86ad2ba9..3c6d0824f11a 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -728,7 +728,8 @@ write_timeout_func(void) if (tirpcflag) { f_print(fout, "\t\t\tstruct rlimit rl;\n\n"); f_print(fout, "\t\t\trl.rlim_max = 0;\n"); - f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n"); + f_print(fout, "\t\t\tif (getrlimit(RLIMIT_NOFILE, &rl) == -1)\n"); + f_print(fout, "\t\t\t\treturn;\n"); f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n"); if (mtflag) @@ -902,7 +903,11 @@ write_rpc_svc_fg(const char *infile, const char *sp) /* get number of file descriptors */ if (tirpcflag) { f_print(fout, "%srl.rlim_max = 0;\n", sp); - f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, &rl);\n", sp); + f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, &rl) == -1) {\n", + sp); + f_print(fout, "%s\tperror(\"getrlimit\");\n", sp); + f_print(fout, "%s\texit(1);\n", sp); + f_print(fout, "%s}\n", sp); f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp); f_print(fout, "%s\texit(1);\n", sp); } else { From 653e35e69f65fa95eae8d5d0dada477a0a83cbb4 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 14:47:44 +0000 Subject: [PATCH 031/126] Restore fixup for newer em(4) devices WOL capabilities post iflib integration. PR: 208343 --- sys/dev/e1000/if_em.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index a95814404c46..e874fc31474a 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -3308,6 +3308,8 @@ em_get_wakeup(if_ctx_t ctx) case e1000_ich10lan: case e1000_pchlan: case e1000_pch2lan: + case e1000_pch_lpt: + case e1000_pch_spt: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); @@ -3376,7 +3378,7 @@ em_enable_wakeup(if_ctx_t ctx) struct adapter *adapter = iflib_get_softc(ctx); device_t dev = iflib_get_dev(ctx); if_t ifp = iflib_get_ifp(ctx); - u32 pmc, ctrl, ctrl_ext, rctl; + u32 pmc, ctrl, ctrl_ext, rctl, wuc; u16 status; if ((pci_find_cap(dev, PCIY_PMG, &pmc) != 0)) @@ -3386,7 +3388,9 @@ em_enable_wakeup(if_ctx_t ctx) ctrl = E1000_READ_REG(&adapter->hw, E1000_CTRL); ctrl |= (E1000_CTRL_SWDPIN2 | E1000_CTRL_SWDPIN3); E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); - E1000_WRITE_REG(&adapter->hw, E1000_WUC, E1000_WUC_PME_EN); + wuc = E1000_READ_REG(&adapter->hw, E1000_WUC); + wuc |= E1000_WUC_PME_EN ; + E1000_WRITE_REG(&adapter->hw, E1000_WUC, wuc); if ((adapter->hw.mac.type == e1000_ich8lan) || (adapter->hw.mac.type == e1000_pchlan) || @@ -3418,7 +3422,9 @@ em_enable_wakeup(if_ctx_t ctx) } if ((adapter->hw.mac.type == e1000_pchlan) || - (adapter->hw.mac.type == e1000_pch2lan)) { + (adapter->hw.mac.type == e1000_pch2lan) || + (adapter->hw.mac.type == e1000_pch_lpt) || + (adapter->hw.mac.type == e1000_pch_spt)) { if (em_enable_phy_wakeup(adapter)) return; } else { From a0e88689f0407cf3d14710f17e46348fb8aa3be7 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 12 Jan 2017 15:26:23 +0000 Subject: [PATCH 032/126] sfxge(4): add sysctl to change MAC stats update period The sysctl controls the period per interface. Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9153 --- share/man/man4/sfxge.4 | 2 ++ sys/dev/sfxge/sfxge_port.c | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/share/man/man4/sfxge.4 b/share/man/man4/sfxge.4 index 0e33f4b03d8e..589129792ceb 100644 --- a/share/man/man4/sfxge.4 +++ b/share/man/man4/sfxge.4 @@ -166,6 +166,8 @@ Supported on SFN8xxx series adapters with firmware v6.2.1.1033 and later and SFN5xxx and SFN6xxx series adapters. SFN7xxx series adapters and SFN8xxx series with earlier firmware use a fixed 1000 milliseconds statistics update period. +The period may also be changed after the driver is loaded using the sysctl +.Va dev.sfxge.%d.stats_update_period_ms . .El .Sh SUPPORT For general information and support, diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index 3585f0d71920..5723f31b507a 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -702,6 +702,48 @@ sfxge_port_stats_update_period_ms(struct sfxge_softc *sc) return period_ms; } +static int +sfxge_port_stats_update_period_ms_handler(SYSCTL_HANDLER_ARGS) +{ + struct sfxge_softc *sc; + struct sfxge_port *port; + unsigned int period_ms; + int error; + + sc = arg1; + port = &sc->port; + + if (req->newptr != NULL) { + error = SYSCTL_IN(req, &period_ms, sizeof(period_ms)); + if (error != 0) + return (error); + + if (period_ms > UINT16_MAX) + return (EINVAL); + + SFXGE_PORT_LOCK(port); + + if (port->stats_update_period_ms != period_ms) { + if (port->init_state == SFXGE_PORT_STARTED) + error = efx_mac_stats_periodic(sc->enp, + &port->mac_stats.dma_buf, + period_ms, B_FALSE); + if (error == 0) + port->stats_update_period_ms = period_ms; + } + + SFXGE_PORT_UNLOCK(port); + } else { + SFXGE_PORT_LOCK(port); + period_ms = port->stats_update_period_ms; + SFXGE_PORT_UNLOCK(port); + + error = SYSCTL_OUT(req, &period_ms, sizeof(period_ms)); + } + + return (error); +} + int sfxge_port_init(struct sfxge_softc *sc) { @@ -753,6 +795,11 @@ sfxge_port_init(struct sfxge_softc *sc) port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc); sfxge_mac_stat_init(sc); + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "stats_update_period_ms", CTLTYPE_UINT|CTLFLAG_RW, sc, 0, + sfxge_port_stats_update_period_ms_handler, "IU", + "interface statistics refresh period"); + port->init_state = SFXGE_PORT_INITIALIZED; DBGPRINT(sc->dev, "success"); From f8adf1a78416cce82165e1a68d7018e325665bc4 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 12 Jan 2017 15:54:03 +0000 Subject: [PATCH 033/126] For the main binary, postpone enforcing relro read-only protection until copy relocations are done. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Newer binutils and lld seems to output copy into relro-protected range. Reported by: Rafael Espц╜ndola via emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week --- libexec/rtld-elf/rtld.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 50e1a0e9105a..327c939b9b27 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -103,6 +103,7 @@ static int load_needed_objects(Obj_Entry *, int); static int load_preload_objects(void); static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); +static int obj_enforce_relro(Obj_Entry *); static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *); static void objlist_call_init(Objlist *, RtldLockState *); @@ -617,6 +618,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) if (do_copy_relocations(obj_main) == -1) rtld_die(); + dbg("enforcing main obj relro"); + if (obj_enforce_relro(obj_main) == -1) + rtld_die(); + if (getenv(_LD("DUMP_REL_POST")) != NULL) { dump_relocations(obj_main); exit (0); @@ -2746,14 +2751,8 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj, reloc_non_plt(obj, rtldobj, flags | SYMLOOK_IFUNC, lockstate)) return (-1); - if (obj->relro_size > 0) { - if (mprotect(obj->relro_page, obj->relro_size, - PROT_READ) == -1) { - _rtld_error("%s: Cannot enforce relro protection: %s", - obj->path, rtld_strerror(errno)); - return (-1); - } - } + if (!obj->mainprog && obj_enforce_relro(obj) == -1) + return (-1); /* * Set up the magic number and version in the Obj_Entry. These @@ -5124,6 +5123,19 @@ _rtld_is_dlopened(void *arg) return (res); } +int +obj_enforce_relro(Obj_Entry *obj) +{ + + if (obj->relro_size > 0 && mprotect(obj->relro_page, obj->relro_size, + PROT_READ) == -1) { + _rtld_error("%s: Cannot enforce relro protection: %s", + obj->path, rtld_strerror(errno)); + return (-1); + } + return (0); +} + static void map_stacks_exec(RtldLockState *lockstate) { From c6e3715fbc88e01ad68b7e9e12247e0257b94844 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Thu, 12 Jan 2017 16:22:28 +0000 Subject: [PATCH 034/126] Fix uninitialized variable CIDs in route6d The variables in question are actually return arguments, but it's still good form to initialize them. Reported by: Coverity CID: 979679 979680 MFC after: 4 weeks Sponsored by: Spectra Logic Corp --- usr.sbin/route6d/route6d.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 90a492f7fe8a..41f8fe315d87 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1062,6 +1062,7 @@ sendpacket(struct sockaddr_in6 *sin6, int len) iov[0].iov_len = len; m.msg_iov = iov; m.msg_iovlen = 1; + m.msg_flags = 0; if (!idx) { m.msg_control = NULL; m.msg_controllen = 0; @@ -1126,6 +1127,7 @@ riprecv(void) cm = (struct cmsghdr *)cmsgbuf; m.msg_control = (caddr_t)cm; m.msg_controllen = sizeof(cmsgbuf); + m.msg_flags = 0; if ((len = recvmsg(ripsock, &m, 0)) < 0) { fatal("recvmsg"); /*NOTREACHED*/ From 25a334104870cd36696d6d988443d981f7f81388 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 16:24:10 +0000 Subject: [PATCH 035/126] Fix panic on mb_free_ext() due to NULL destructor. This used to happen because of the SET_MBUF_DESTRUCTOR() called on unregif. Submitted by: Vincenzo Maffione --- sys/dev/netmap/netmap_generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/netmap/netmap_generic.c b/sys/dev/netmap/netmap_generic.c index 87072069fbcf..cb1cff1f0e71 100644 --- a/sys/dev/netmap/netmap_generic.c +++ b/sys/dev/netmap/netmap_generic.c @@ -165,12 +165,12 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ -#define SET_MBUF_DESTRUCTOR(m, fn) do { \ - (m)->m_ext.ext_free = (void *)fn; \ -} while (0) - static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } +#define SET_MBUF_DESTRUCTOR(m, fn) do { \ + (m)->m_ext.ext_free = fn ? (void *)fn : (void *)void_mbuf_dtor; \ +} while (0) + static inline struct mbuf * nm_os_get_mbuf(struct ifnet *ifp, int len) { From fb1d9b7f4113d7aeb72a7313f05a629ad691c627 Mon Sep 17 00:00:00 2001 From: Bruce M Simpson Date: Thu, 12 Jan 2017 16:30:27 +0000 Subject: [PATCH 036/126] Allow uart(4) to use MSI interrupts on single-port PCI instances. Do this here as puc(4) disallows single-port instances; at least one multi-port PCIe UART chip (in this case, the ASIX MCS9922) present separate PCI configuration space (functions) for each UART. Tested using lrzsz and a null-modem cable. The ExpressCard/34 variants containing the MCS9922 should also use MSI with this change. Reviewed by: jhb, imp, rpokala MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9123 --- sys/dev/uart/uart_bus_pci.c | 42 +++++++++++++++++++++++++++++++++++-- sys/dev/uart/uart_core.c | 1 - 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 2203c3f2d66f..13be31f6c4fe 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -45,12 +45,14 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_RCLK 1843200 static int uart_pci_probe(device_t dev); +static int uart_pci_attach(device_t dev); +static int uart_pci_detach(device_t dev); static device_method_t uart_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, uart_pci_probe), - DEVMETHOD(device_attach, uart_bus_attach), - DEVMETHOD(device_detach, uart_bus_detach), + DEVMETHOD(device_attach, uart_pci_attach), + DEVMETHOD(device_detach, uart_pci_detach), DEVMETHOD(device_resume, uart_bus_resume), DEVMETHOD_END }; @@ -209,4 +211,40 @@ uart_pci_probe(device_t dev) return (result); } +static int +uart_pci_attach(device_t dev) +{ + struct uart_softc *sc; + int count; + + sc = device_get_softc(dev); + + /* + * Use MSI in preference to legacy IRQ if available. + * Whilst some PCIe UARTs support >1 MSI vector, use only the first. + */ + if (pci_msi_count(dev) > 0) { + count = 1; + if (pci_alloc_msi(dev, &count) == 0) { + sc->sc_irid = 1; + device_printf(dev, "Using %d MSI message\n", count); + } + } + + return (uart_bus_attach(dev)); +} + +static int +uart_pci_detach(device_t dev) +{ + struct uart_softc *sc; + + sc = device_get_softc(dev); + + if (sc->sc_irid != 0) + pci_release_msi(dev); + + return (uart_bus_detach(dev)); +} + DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL); diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 6c9d7aa23a06..cc2d0dc82ff0 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -677,7 +677,6 @@ uart_bus_attach(device_t dev) * safest thing to do. */ if (filt != FILTER_SCHEDULE_THREAD && !uart_force_poll) { - sc->sc_irid = 0; sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid, RF_ACTIVE | RF_SHAREABLE); } From 9acdec7132311db962ea20157233452b233424b2 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 16:44:40 +0000 Subject: [PATCH 037/126] Purge EM_MULTIQUEUE references from the man page for em(4). --- share/man/man4/em.4 | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/share/man/man4/em.4 b/share/man/man4/em.4 index ac7319d011f5..38fa449cfe3e 100644 --- a/share/man/man4/em.4 +++ b/share/man/man4/em.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 16, 2015 +.Dd January 12, 2016 .Dt EM 4 .Os .Sh NAME @@ -45,14 +45,6 @@ kernel configuration file: .Cd "device em" .Ed .Pp -Optional multiqueue support is available via the following kernel -compile options: -.Bd -ragged -offset indent -.Cd "options EM_MULTIQUEUE" -.Ed -.Pp -Note: Activating EM_MULTIQUEUE support is not supported by Intel. -.Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : @@ -253,12 +245,6 @@ If .Va hw.em.tx_int_delay is non-zero, this tunable limits the maximum delay in which a transmit interrupt is generated. -.It Va hw.em.num_queues -Number of hardware queues that will be configured on this adapter (maximum of 2) -Defaults to 1. -Only valid with kernel configuration -.Cd "options EM_MULTIQUEUE". -.El .Sh FILES .Bl -tag -width /dev/led/em* .It Pa /dev/led/em* @@ -311,5 +297,3 @@ The .Nm driver was written by .An Intel Corporation Aq Mt freebsd@intel.com . -.Sh BUGS -Activating EM_MULTIQUEUE support requires MSI-X features. From 484820d4422cd808b39ef1f3c1f0ea2b7ac9e469 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Thu, 12 Jan 2017 17:02:29 +0000 Subject: [PATCH 038/126] libkern: Remove obsolete 'register' keyword Sponsored by: Dell EMC Isilon --- sys/libkern/bcmp.c | 2 +- sys/libkern/bsearch.c | 14 +++++++------- sys/libkern/iconv_ucs.c | 4 ++-- sys/libkern/iconv_xlat16.c | 8 ++++---- sys/libkern/memmem.c | 2 +- sys/libkern/qdivrem.c | 8 ++++---- sys/libkern/qsort.c | 6 +++--- sys/libkern/random.c | 2 +- sys/libkern/scanc.c | 6 +++--- sys/libkern/strcmp.c | 2 +- sys/libkern/strncpy.c | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sys/libkern/bcmp.c b/sys/libkern/bcmp.c index 90576c6d4c62..cd00ba9e6b52 100644 --- a/sys/libkern/bcmp.c +++ b/sys/libkern/bcmp.c @@ -44,7 +44,7 @@ typedef const unsigned long *culp; int bcmp(b1, b2, length) const void *b1, *b2; - register size_t length; + size_t length; { #if BYTE_ORDER == LITTLE_ENDIAN /* diff --git a/sys/libkern/bsearch.c b/sys/libkern/bsearch.c index 298f32735dfc..cbac2fb762b2 100644 --- a/sys/libkern/bsearch.c +++ b/sys/libkern/bsearch.c @@ -54,16 +54,16 @@ __FBSDID("$FreeBSD$"); */ void * bsearch(key, base0, nmemb, size, compar) - register const void *key; + const void *key; const void *base0; size_t nmemb; - register size_t size; - register int (*compar)(const void *, const void *); + size_t size; + int (*compar)(const void *, const void *); { - register const char *base = base0; - register size_t lim; - register int cmp; - register const void *p; + const char *base = base0; + size_t lim; + int cmp; + const void *p; for (lim = nmemb; lim != 0; lim >>= 1) { p = base + (lim >> 1) * size; diff --git a/sys/libkern/iconv_ucs.c b/sys/libkern/iconv_ucs.c index 047436de351e..6d63f0b9e89d 100644 --- a/sys/libkern/iconv_ucs.c +++ b/sys/libkern/iconv_ucs.c @@ -523,14 +523,14 @@ ucs4_to_utf8(uint32_t ucs4, char *dst, size_t *utf8width, size_t dstlen) } static uint32_t -encode_surrogate(register uint32_t code) +encode_surrogate(uint32_t code) { return ((((code - 0x10000) << 6) & 0x3ff0000) | ((code - 0x10000) & 0x3ff) | 0xd800dc00); } static uint32_t -decode_surrogate(register const u_char *ucs) +decode_surrogate(const u_char *ucs) { return ((((ucs[0] & 0x3) << 18) | (ucs[1] << 10) | ((ucs[2] & 0x3) << 8) | ucs[3]) + 0x10000); diff --git a/sys/libkern/iconv_xlat16.c b/sys/libkern/iconv_xlat16.c index dbac8926b376..630cbd3aff76 100644 --- a/sys/libkern/iconv_xlat16.c +++ b/sys/libkern/iconv_xlat16.c @@ -298,10 +298,10 @@ iconv_xlat16_name(struct iconv_converter_class *dcp) } static int -iconv_xlat16_tolower(void *d2p, register int c) +iconv_xlat16_tolower(void *d2p, int c) { struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p; - register int c1, c2, out; + int c1, c2, out; if (c < 0x100) { c1 = C2I1(c << 8); @@ -323,10 +323,10 @@ iconv_xlat16_tolower(void *d2p, register int c) } static int -iconv_xlat16_toupper(void *d2p, register int c) +iconv_xlat16_toupper(void *d2p, int c) { struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p; - register int c1, c2, out; + int c1, c2, out; if (c < 0x100) { c1 = C2I1(c << 8); diff --git a/sys/libkern/memmem.c b/sys/libkern/memmem.c index 11c3d9eec508..b4720e64fe7e 100644 --- a/sys/libkern/memmem.c +++ b/sys/libkern/memmem.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); void * memmem(const void *l, size_t l_len, const void *s, size_t s_len) { - register char *cur, *last; + char *cur, *last; const char *cl = (const char *)l; const char *cs = (const char *)s; diff --git a/sys/libkern/qdivrem.c b/sys/libkern/qdivrem.c index fbfd715ef0af..b4cc91f1cff2 100644 --- a/sys/libkern/qdivrem.c +++ b/sys/libkern/qdivrem.c @@ -59,9 +59,9 @@ typedef u_long digit; * We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS. */ static void -__shl(register digit *p, register int len, register int sh) +__shl(digit *p, int len, int sh) { - register int i; + int i; for (i = 0; i < len; i++) p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh)); @@ -82,7 +82,7 @@ __qdivrem(uq, vq, arq) { union uu tmp; digit *u, *v, *q; - register digit v1, v2; + digit v1, v2; u_long qhat, rhat, t; int m, n, d, j, i; digit uspace[5], vspace[5], qspace[5]; @@ -192,7 +192,7 @@ __qdivrem(uq, vq, arq) v1 = v[1]; /* for D3 -- note that v[1..n] are constant */ v2 = v[2]; /* for D3 */ do { - register digit uj0, uj1, uj2; + digit uj0, uj1, uj2; /* * D3: Calculate qhat (\^q, in TeX notation). diff --git a/sys/libkern/qsort.c b/sys/libkern/qsort.c index bb0baee73c9f..7a758d3a8555 100644 --- a/sys/libkern/qsort.c +++ b/sys/libkern/qsort.c @@ -48,10 +48,10 @@ static __inline void swapfunc(char *, char *, int, int); */ #define swapcode(TYPE, parmi, parmj, n) { \ long i = (n) / sizeof (TYPE); \ - register TYPE *pi = (TYPE *) (parmi); \ - register TYPE *pj = (TYPE *) (parmj); \ + TYPE *pi = (TYPE *) (parmi); \ + TYPE *pj = (TYPE *) (parmj); \ do { \ - register TYPE t = *pi; \ + TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ } while (--i > 0); \ diff --git a/sys/libkern/random.c b/sys/libkern/random.c index 3ad75bfb2e9b..22a14ef5021f 100644 --- a/sys/libkern/random.c +++ b/sys/libkern/random.c @@ -57,7 +57,7 @@ srandom(seed) u_long random() { - register long x, hi, lo, t; + long x, hi, lo, t; /* * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). diff --git a/sys/libkern/scanc.c b/sys/libkern/scanc.c index 28a5b7ec1f14..a7800d0eeb55 100644 --- a/sys/libkern/scanc.c +++ b/sys/libkern/scanc.c @@ -37,11 +37,11 @@ __FBSDID("$FreeBSD$"); int scanc(size, cp, table, mask0) u_int size; - register const u_char *cp, table[]; + const u_char *cp, table[]; int mask0; { - register const u_char *end; - register u_char mask; + const u_char *end; + u_char mask; mask = mask0; for (end = &cp[size]; cp < end; ++cp) { diff --git a/sys/libkern/strcmp.c b/sys/libkern/strcmp.c index 7313e6011c04..43a06d9be587 100644 --- a/sys/libkern/strcmp.c +++ b/sys/libkern/strcmp.c @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); */ int strcmp(s1, s2) - register const char *s1, *s2; + const char *s1, *s2; { while (*s1 == *s2++) if (*s1++ == 0) diff --git a/sys/libkern/strncpy.c b/sys/libkern/strncpy.c index 7daaaea3dc1d..d4d0964317ba 100644 --- a/sys/libkern/strncpy.c +++ b/sys/libkern/strncpy.c @@ -43,8 +43,8 @@ char * strncpy(char * __restrict dst, const char * __restrict src, size_t n) { if (n != 0) { - register char *d = dst; - register const char *s = src; + char *d = dst; + const char *s = src; do { if ((*d++ = *s++) == 0) { From 245c5ebbcecba70a314f301ede1ab94906d4a10b Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Thu, 12 Jan 2017 17:18:25 +0000 Subject: [PATCH 039/126] Purge surprise change to sys/conf/files for ixgbe(4). Reported by: imp --- sys/conf/files | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index d8e76b1a3bae..c221bbec85bf 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2139,8 +2139,6 @@ dev/ixgbe/ix_txrx.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_osdep.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_sysctl.c optional ix inet | ixv inet \ - compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_phy.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixgbe/ixgbe_api.c optional ix inet | ixv inet \ From eae0fba4534eab90c6ab4a994fc90402a2e29813 Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Thu, 12 Jan 2017 18:05:12 +0000 Subject: [PATCH 040/126] Fix typo in r311971. Reported by: ohartmann at walstatt.org --- sys/dev/nand/nand_geom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nand/nand_geom.c b/sys/dev/nand/nand_geom.c index ec789c517e8b..cd3f5211630b 100644 --- a/sys/dev/nand/nand_geom.c +++ b/sys/dev/nand/nand_geom.c @@ -416,7 +416,7 @@ create_geom_disk(struct nand_chip *chip) snprintf(rdisk->d_ident, sizeof(rdisk->d_ident), "nand_raw: Man:0x%02x Dev:0x%02x", chip->id.man_id, chip->id.dev_id); - disk->d_rotation_rate = DISK_RR_NON_ROTATING; + rdisk->d_rotation_rate = DISK_RR_NON_ROTATING; disk_create(rdisk, DISK_VERSION); From c10340d44095d1d3d660a468559323b5fb5ed70e Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Thu, 12 Jan 2017 18:44:58 +0000 Subject: [PATCH 041/126] - Fix dereference of NULL pointer which could cause a crash [1] - Fix memory leak due to lack of freeaddrinfo() [2] CID: 1018281 [1] CID: 1225057 [2] MFC after: 3 days --- usr.sbin/route6d/route6d.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 41f8fe315d87..3f824cbba9f2 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -684,6 +684,7 @@ init(void) /*NOTREACHED*/ } #endif + freeaddrinfo(res); memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_INET6; @@ -699,6 +700,7 @@ init(void) /*NOTREACHED*/ } memcpy(&ripsin, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); #ifdef HAVE_POLL_H set[0].fd = ripsock; @@ -788,10 +790,17 @@ ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 * error = sendpacket(sin6, RIPSIZE(nrt)); if (error == EAFNOSUPPORT) { /* Protocol not supported */ - tracet(1, "Could not send info to %s (%s): " - "set IFF_UP to 0\n", - ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr)); - ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */ + if (ifcp != NULL) { + tracet(1, "Could not send info to %s (%s): " + "set IFF_UP to 0\n", + ifcp->ifc_name, + inet6_n2p(&ifcp->ifc_ripsin.sin6_addr)); + /* As if down for AF_INET6 */ + ifcp->ifc_flags &= ~IFF_UP; + } else { + tracet(1, "Could not send info to %s\n", + inet6_n2p(&sin6->sin6_addr)); + } } } From 4f56243aad9c03dc9b205b27dc502ac7a693b5ba Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 12 Jan 2017 20:26:02 +0000 Subject: [PATCH 042/126] Fix the contiguity once more. --- sys/vm/vnode_pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index ccb4b8a5713a..2368fc2073a2 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -974,7 +974,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, #ifdef INVARIANTS KASSERT(bp->b_npages <= nitems(bp->b_pages), ("%s: buf %p overflowed", __func__, bp)); - for (int j = 1, prev = 1; j < bp->b_npages; j++) { + for (int j = 1, prev = 0; j < bp->b_npages; j++) { if (bp->b_pages[j] == bogus_page) continue; KASSERT(bp->b_pages[j]->pindex - bp->b_pages[prev]->pindex == From e046e8e680f4c507eee89402d95b761dee420909 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Thu, 12 Jan 2017 21:18:43 +0000 Subject: [PATCH 043/126] Restructure the tty_drain loop so that device-busy is checked one more time after tty_timedwait() returns an error only if the error is EWOULDBLOCK; other errors cause an immediate return. This fixes the case of the tty disappearing while in tty_drain(). Reported by: pho --- sys/kern/tty.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index a252d5b87fa1..499bd13a38a4 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -166,11 +166,9 @@ tty_drain(struct tty *tp, int leaving) return (error); ttydevsw_outwakeup(tp); error = tty_timedwait(tp, &tp->t_outwait, hz / 10); - if (timeout_at == 0 && error == EWOULDBLOCK) - error = 0; - if (error != EWOULDBLOCK) - continue; - if (getsbinuptime() < timeout_at) + if (error != 0 && error != EWOULDBLOCK) + return (error); + else if (timeout_at == 0 || getsbinuptime() < timeout_at) error = 0; else if (leaving && ttyoutq_bytesused(&tp->t_outq) < bytes) { /* In close, making progress, grant an extra second. */ From be04edbb4fd3e93b406e4881ce88f36198c4311d Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 13 Jan 2017 01:39:19 +0000 Subject: [PATCH 044/126] Remove __nonnull() attributes from x86 machine check architecture. These are of the few cases where we use the GCC non-null attributes in non-header code. As part of a review [1] of our use of such attributes we are replacing such uses of the overly aggressive GCC attribute with clang's _Nonnull attribute. In this case the attributes serve little purpose as they just don't enforce run time checks, If anything the attributes would cause NULL pointer checks to be ignored but there are no such checks so only effect is cosmetic. The references appear to be left over from code development and likely already fulfilled their purpose. Reference [1]: https://reviews.freebsd.org/D9004 Reviewed by: jhb MFC after: 3 weeks --- sys/x86/x86/mca.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c index 1d99efc74ed8..a917cc45f26b 100644 --- a/sys/x86/x86/mca.c +++ b/sys/x86/x86/mca.c @@ -247,7 +247,7 @@ mca_error_mmtype(uint16_t mca_error) return ("???"); } -static int __nonnull(1) +static int mca_mute(const struct mca_record *rec) { @@ -276,7 +276,7 @@ mca_mute(const struct mca_record *rec) } /* Dump details about a single machine check. */ -static void __nonnull(1) +static void mca_log(const struct mca_record *rec) { uint16_t mca_error; @@ -415,7 +415,7 @@ mca_log(const struct mca_record *rec) printf("MCA: Misc 0x%llx\n", (long long)rec->mr_misc); } -static int __nonnull(2) +static int mca_check_status(int bank, struct mca_record *rec) { uint64_t status; @@ -482,7 +482,7 @@ mca_refill(void *context, int pending) mca_fill_freelist(); } -static void __nonnull(2) +static void mca_record_entry(enum scan_mode mode, const struct mca_record *record) { struct mca_internal *rec; From 68c3c0258de657b61f35ef465354d5394d07154b Mon Sep 17 00:00:00 2001 From: Kevin Lo Date: Fri, 13 Jan 2017 02:11:16 +0000 Subject: [PATCH 045/126] Increase retry count to 100 in r88e_fw_cmd() and r92c_fw_cmd(). --- sys/dev/rtwn/rtl8188e/r88e_fw.c | 2 +- sys/dev/rtwn/rtl8192c/r92c_fw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/rtwn/rtl8188e/r88e_fw.c b/sys/dev/rtwn/rtl8188e/r88e_fw.c index 435fb650238b..4ae4abbda1d7 100644 --- a/sys/dev/rtwn/rtl8188e/r88e_fw.c +++ b/sys/dev/rtwn/rtl8188e/r88e_fw.c @@ -69,7 +69,7 @@ r88e_fw_cmd(struct rtwn_softc *sc, uint8_t id, const void *buf, int len) } /* Wait for current FW box to be empty. */ - for (ntries = 0; ntries < 50; ntries++) { + for (ntries = 0; ntries < 100; ntries++) { if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur))) break; rtwn_delay(sc, 2000); diff --git a/sys/dev/rtwn/rtl8192c/r92c_fw.c b/sys/dev/rtwn/rtl8192c/r92c_fw.c index b6de795e37ac..96ea3449dfea 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_fw.c +++ b/sys/dev/rtwn/rtl8192c/r92c_fw.c @@ -80,7 +80,7 @@ r92c_fw_cmd(struct rtwn_softc *sc, uint8_t id, const void *buf, int len) } /* Wait for current FW box to be empty. */ - for (ntries = 0; ntries < 50; ntries++) { + for (ntries = 0; ntries < 100; ntries++) { if (!(rtwn_read_1(sc, R92C_HMETFR) & (1 << sc->fwcur))) break; rtwn_delay(sc, 2000); From e266075649ba68252e4e29d3f5cb6c730cdb529d Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Fri, 13 Jan 2017 02:12:58 +0000 Subject: [PATCH 046/126] fstyp(8): Detect exFAT filesystems Simply detect the exFAT filesystem name in the Volume Boot Record (superblock). PR: 214908 Reported by: --- usr.sbin/fstyp/Makefile | 2 +- usr.sbin/fstyp/exfat.c | 77 +++++++++++++++++++++++++++++++++++++++++ usr.sbin/fstyp/fstyp.8 | 6 ++-- usr.sbin/fstyp/fstyp.c | 1 + usr.sbin/fstyp/fstyp.h | 1 + 5 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 usr.sbin/fstyp/exfat.c diff --git a/usr.sbin/fstyp/Makefile b/usr.sbin/fstyp/Makefile index 2397b806c8b9..8379c0206d10 100644 --- a/usr.sbin/fstyp/Makefile +++ b/usr.sbin/fstyp/Makefile @@ -3,7 +3,7 @@ .include PROG= fstyp -SRCS= cd9660.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c +SRCS= cd9660.c exfat.c ext2fs.c fstyp.c geli.c msdosfs.c ntfs.c ufs.c .if ${MK_ZFS} != "no" SRCS += zfs.c diff --git a/usr.sbin/fstyp/exfat.c b/usr.sbin/fstyp/exfat.c new file mode 100644 index 000000000000..9c379df0c3f6 --- /dev/null +++ b/usr.sbin/fstyp/exfat.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2017 Conrad Meyer + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "fstyp.h" + +struct exfat_vbr { + char ev_jmp[3]; + char ev_fsname[8]; + char ev_zeros[53]; + uint64_t ev_part_offset; + uint64_t ev_vol_length; + uint32_t ev_fat_offset; + uint32_t ev_fat_length; + uint32_t ev_cluster_offset; + uint32_t ev_cluster_count; + uint32_t ev_rootdir_cluster; + uint32_t ev_vol_serial; + uint16_t ev_fs_revision; + uint16_t ev_vol_flags; + uint8_t ev_log_bytes_per_sect; + uint8_t ev_log_sect_per_clust; + uint8_t ev_num_fats; + uint8_t ev_drive_sel; + uint8_t ev_percent_used; +} __packed; + +int +fstyp_exfat(FILE *fp, char *label, size_t size) +{ + struct exfat_vbr *ev; + + ev = (struct exfat_vbr *)read_buf(fp, 0, 512); + if (ev == NULL || strncmp(ev->ev_fsname, "EXFAT ", 8) != 0) + goto fail; + + /* + * Reading the volume label requires walking the root directory to look + * for a special label file. Left as an exercise for the reader. + */ + free(ev); + return (0); + +fail: + free(ev); + return (1); +} diff --git a/usr.sbin/fstyp/fstyp.8 b/usr.sbin/fstyp/fstyp.8 index 628fc998082b..9bd27fcef2d8 100644 --- a/usr.sbin/fstyp/fstyp.8 +++ b/usr.sbin/fstyp/fstyp.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 28, 2016 +.Dd January 12, 2017 .Dt FSTYP 8 .Os .Sh NAME @@ -43,7 +43,7 @@ The .Nm utility is used to determine the filesystem type on a given device. -It can recognize ISO-9660, Ext2, FAT, NTFS, and UFS filesystems. +It can recognize ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems. When the .Fl u flag is specified, @@ -61,6 +61,8 @@ as, respectively: .It cd9660 .It +exfat +.It ext2fs .It geli diff --git a/usr.sbin/fstyp/fstyp.c b/usr.sbin/fstyp/fstyp.c index 803a4c8a797a..76ec7948ca0d 100644 --- a/usr.sbin/fstyp/fstyp.c +++ b/usr.sbin/fstyp/fstyp.c @@ -57,6 +57,7 @@ static struct { bool unmountable; } fstypes[] = { { "cd9660", &fstyp_cd9660, false }, + { "exfat", &fstyp_exfat, true }, { "ext2fs", &fstyp_ext2fs, false }, { "geli", &fstyp_geli, true }, { "msdosfs", &fstyp_msdosfs, false }, diff --git a/usr.sbin/fstyp/fstyp.h b/usr.sbin/fstyp/fstyp.h index 8deba5ece1b5..f858b0c53827 100644 --- a/usr.sbin/fstyp/fstyp.h +++ b/usr.sbin/fstyp/fstyp.h @@ -39,6 +39,7 @@ char *checked_strdup(const char *s); void rtrim(char *label, size_t size); int fstyp_cd9660(FILE *fp, char *label, size_t size); +int fstyp_exfat(FILE *fp, char *label, size_t size); int fstyp_ext2fs(FILE *fp, char *label, size_t size); int fstyp_geli(FILE *fp, char *label, size_t size); int fstyp_msdosfs(FILE *fp, char *label, size_t size); From cebf8a2ca797b292611b106231839a27e234be96 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 13 Jan 2017 03:42:51 +0000 Subject: [PATCH 047/126] Add license preamble for r286964; credit to asomers While here, clean up trailing whitespace MFC after: 3 days Sponsored by: Dell EMC Isilon --- usr.sbin/fstyp/tests/fstyp_test.sh | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/usr.sbin/fstyp/tests/fstyp_test.sh b/usr.sbin/fstyp/tests/fstyp_test.sh index 8a1ea7209cc2..1a9836f18bda 100755 --- a/usr.sbin/fstyp/tests/fstyp_test.sh +++ b/usr.sbin/fstyp/tests/fstyp_test.sh @@ -1,3 +1,29 @@ +#!/bin/sh +# +# Copyright (c) 2015 Alan Somers +# 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$ atf_test_case cd9660 @@ -9,7 +35,7 @@ cd9660_body() { atf_check -s exit:0 -o ignore makefs -t cd9660 -Z -s 64m cd9660.img dir atf_check -s exit:0 -o inline:"cd9660\n" fstyp cd9660.img atf_check -s exit:0 -o inline:"cd9660\n" fstyp -l cd9660.img -} +} atf_test_case cd9660_label cd9660_label_head() { @@ -21,7 +47,7 @@ cd9660_label_body() { atf_check -s exit:0 -o inline:"cd9660\n" fstyp cd9660.img # Note: cd9660 labels are always upper case atf_check -s exit:0 -o inline:"cd9660 FOO\n" fstyp -l cd9660.img -} +} atf_test_case dir dir_head() { @@ -177,7 +203,7 @@ ufs2_label_body() { atf_check -s exit:0 mkdir dir atf_check -s exit:0 -o ignore makefs -o version=2,label="foo" -Z -s 64m ufs.img dir atf_check -s exit:0 -o inline:"ufs foo\n" fstyp -l ufs.img -} +} atf_test_case ufs_on_device cleanup ufs_on_device_head() { From 6f81c4d9bb0e0092f1b278d23e45f9cf284277ca Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 13 Jan 2017 04:02:09 +0000 Subject: [PATCH 048/126] Add testcase for exFAT that currently fails Disk image obtained from: http://www.cfreds.nist.gov/dfr-images/dfr-01-xfat.dd.bz2 -- was ripped off the first GPT partition and verified to be a FAT-like partition with file(1)/hexdump. This testcase currently fails PR: 214908 Sponsored by: Dell EMC Isilon --- usr.sbin/fstyp/tests/Makefile | 1 + usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 | Bin 0 -> 135440 bytes usr.sbin/fstyp/tests/fstyp_test.sh | 10 ++++++++++ 3 files changed, 11 insertions(+) create mode 100644 usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 diff --git a/usr.sbin/fstyp/tests/Makefile b/usr.sbin/fstyp/tests/Makefile index 71fc811a7eda..9c4624af3a4c 100644 --- a/usr.sbin/fstyp/tests/Makefile +++ b/usr.sbin/fstyp/tests/Makefile @@ -4,6 +4,7 @@ PACKAGE= tests ATF_TESTS_SH= fstyp_test +${PACKAGE}FILES+= dfr-01-xfat.img.bz2 ${PACKAGE}FILES+= ext2.img.bz2 ${PACKAGE}FILES+= ext3.img.bz2 ${PACKAGE}FILES+= ext4.img.bz2 diff --git a/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 b/usr.sbin/fstyp/tests/dfr-01-xfat.img.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..418d6379948e5da0678ff2b0308a5a0df0a1a699 GIT binary patch literal 135440 zcmeDk2S60Zc8@NCU_r4U7GlAeV2KTpvy0J)%1P{4f{6;)QE3-7iWNnT5EZcFp<*;( zL5iA)1;vI9DUm2jgaZ+e&VMs|x3_z@cih3D#_x!?yR$R%-n@D9-kUdN2Tl61Z?}OH zJB**`_Nzsi-szWqRn>*REf)}zh!IA=v6nl^p3;P(J?jU4&>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6oxYlAI@_V%;Llf};u_`F?hWt8db#r3V>34!L<*0qXBWm_R(7c{4w3Qzs@n~p=NK}3a>r$`2lZN>qy`t_t~_w zOrs+SmMBrG_gpOMdTr)9^wdMPInIyKn!}^9<||iTerBB|O)5PN7j_*m zJx6l=;AFfWR{FbL8Q1;dU@3Zkvip)or-h|sAcz8nL{%Ii;=eFB`7P5G9Y{92_=?24 zom&X+z$UDa=cuM!l3VE5Bfu*`x?$I(4_Z7$T@$V^F2@f%5mktLDLu2IX>v99sqqEq{KWuV39Xuh8KnjGQ9YB<)8AvD{U3p|8)@G?!-uanlX? zJG{Sig=`si*LpHJBC@uu6sxg^Jm>1MbsspoYR_!=pBGNLeKRf^DU39?3$KwCG9rkQlq!)eTtfrRjK3OMn+9&-4^^J&f-x;luBO~d1`Ec; z3GZR^(V>H14x^?fLj{s-rrbyy05Nb;wk3C4fWb_ZzX|<}AY*epg|rOMAborTjb_(v z5Gh)hoOcL9sJ77pvQIAW1hG@o&?;mTFC_wDiPTD3I_iAIhodP2IPDeQ@!$gU{C7ziiFU exfat.img + atf_check -s exit:0 -o inline:"exfat\n" fstyp exfat.img +} + atf_test_case empty empty_head() { atf_set "descr" "fstyp(8) should fail on an empty file" @@ -242,6 +251,7 @@ atf_init_test_cases() { atf_add_test_case cd9660_label atf_add_test_case dir atf_add_test_case empty + atf_add_test_case exfat atf_add_test_case ext2 atf_add_test_case ext3 atf_add_test_case ext4 From ef7ff3e308e615b34117acdec39edbe873e16e5a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 13 Jan 2017 04:04:48 +0000 Subject: [PATCH 049/126] Use dfr-01-xfat.img.bz2, not dfr-01-xfat.dd.bz2 (the latter case was the full disk image from the website, which was never checked in to svn) Regardless, the testcase still fails PR: 214908 Sponsored by: Dell EMC Isilon --- usr.sbin/fstyp/tests/fstyp_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/fstyp/tests/fstyp_test.sh b/usr.sbin/fstyp/tests/fstyp_test.sh index d4c766706d78..5b3bfa71c1a4 100755 --- a/usr.sbin/fstyp/tests/fstyp_test.sh +++ b/usr.sbin/fstyp/tests/fstyp_test.sh @@ -63,7 +63,7 @@ exfat_head() { atf_set "descr" "fstyp(8) can detect exFAT filesystems" } exfat_body() { - bzcat $(atf_get_srcdir)/dfr-01-xfat.dd.bz2 > exfat.img + bzcat $(atf_get_srcdir)/dfr-01-xfat.img.bz2 > exfat.img atf_check -s exit:0 -o inline:"exfat\n" fstyp exfat.img } From ee5d5813c0feb6fad6de73e04c4f96630c3ed158 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 13 Jan 2017 04:21:09 +0000 Subject: [PATCH 050/126] fmaxmin_test still fails with clang 3.9.x.. bypass the test MFC after: 3 days PR: 208703 Sponsored by: Dell EMC Isilon --- lib/msun/tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index e86eecf4a86a..3a61b4d6b6db 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -56,7 +56,7 @@ TAP_TESTS_C+= exponential_test TAP_TESTS_C+= fenv_test TAP_TESTS_C+= fma_test # clang 3.8.0 fails always fails this test. See: bug 208703 -.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800) +.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30800) TAP_TESTS_C+= fmaxmin_test .endif TAP_TESTS_C+= ilogb2_test From 1296e1b0b7aad51be037d4fc5598e8a28c8b8e4b Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Fri, 13 Jan 2017 06:22:49 +0000 Subject: [PATCH 051/126] - Add static for functions and variables with internal linkage. - Quiet down -Wcast-align warnings. - Remove dead code. There is no functionality change. --- usr.sbin/route6d/route6d.c | 406 ++++++++++++++++++------------------- 1 file changed, 194 insertions(+), 212 deletions(-) diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 3f824cbba9f2..c6b499302e6c 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -100,7 +100,7 @@ struct ifc { /* Configuration of an interface */ TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */ int ifc_joined; /* joined to ff02::9 */ }; -TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); +static TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); struct ifac { /* Adddress associated to an interface */ TAILQ_ENTRY(ifac) ifac_next; @@ -120,21 +120,21 @@ struct iff { /* Filters for an interface */ int iff_plen; }; -struct ifc **index2ifc; -unsigned int nindex2ifc; -struct ifc *loopifcp = NULL; /* pointing to loopback */ +static struct ifc **index2ifc; +static unsigned int nindex2ifc; +static struct ifc *loopifcp = NULL; /* pointing to loopback */ #ifdef HAVE_POLL_H -struct pollfd set[2]; +static struct pollfd set[2]; #else -fd_set *sockvecp; /* vector to select() for receiving */ -fd_set *recvecp; -int fdmasks; -int maxfd; /* maximum fd for select() */ +static fd_set *sockvecp; /* vector to select() for receiving */ +static fd_set *recvecp; +static int fdmasks; +static int maxfd; /* maximum fd for select() */ #endif -int rtsock; /* the routing socket */ -int ripsock; /* socket to send/receive RIP datagram */ +static int rtsock; /* the routing socket */ +static int ripsock; /* socket to send/receive RIP datagram */ -struct rip6 *ripbuf; /* packet buffer for sending */ +static struct rip6 *ripbuf; /* packet buffer for sending */ /* * Maintain the routes in a linked list. When the number of the routes @@ -159,41 +159,43 @@ struct riprt { time_t rrt_t; /* when the route validated */ int rrt_index; /* ifindex from which this route got */ }; -TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); +static TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); -int dflag = 0; /* debug flag */ -int qflag = 0; /* quiet flag */ -int nflag = 0; /* don't update kernel routing table */ -int aflag = 0; /* age out even the statically defined routes */ -int hflag = 0; /* don't split horizon */ -int lflag = 0; /* exchange site local routes */ -int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ -int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ -int sflag = 0; /* announce static routes w/ split horizon */ -int Sflag = 0; /* announce static routes to every interface */ -unsigned long routetag = 0; /* route tag attached on originating case */ +static int dflag = 0; /* debug flag */ +static int qflag = 0; /* quiet flag */ +static int nflag = 0; /* don't update kernel routing table */ +static int aflag = 0; /* age out even the statically defined routes */ +static int hflag = 0; /* don't split horizon */ +static int lflag = 0; /* exchange site local routes */ +static int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ +static int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ +static int sflag = 0; /* announce static routes w/ split horizon */ +static int Sflag = 0; /* announce static routes to every interface */ +static unsigned long routetag = 0; /* route tag attached on originating case */ -char *filter[MAXFILTER]; -int filtertype[MAXFILTER]; -int nfilter = 0; +static char *filter[MAXFILTER]; +static int filtertype[MAXFILTER]; +static int nfilter = 0; -pid_t pid; +static pid_t pid; -struct sockaddr_storage ripsin; +static struct sockaddr_storage ripsin; -int interval = 1; -time_t nextalarm = 0; -time_t sup_trig_update = 0; +static int interval = 1; +static time_t nextalarm = 0; +#if 0 +static time_t sup_trig_update = 0; +#endif -FILE *rtlog = NULL; +static FILE *rtlog = NULL; -int logopened = 0; +static int logopened = 0; static int seq = 0; -volatile sig_atomic_t seenalrm; -volatile sig_atomic_t seenquit; -volatile sig_atomic_t seenusr1; +static volatile sig_atomic_t seenalrm; +static volatile sig_atomic_t seenquit; +static volatile sig_atomic_t seenusr1; #define RRTF_AGGREGATE 0x08000000 #define RRTF_NOADVERTISE 0x10000000 @@ -202,66 +204,67 @@ volatile sig_atomic_t seenusr1; #define RRTF_CHANGED 0x80000000 int main(int, char **); -void sighandler(int); -void ripalarm(void); -void riprecv(void); -void ripsend(struct ifc *, struct sockaddr_in6 *, int); -int out_filter(struct riprt *, struct ifc *); -void init(void); -void sockopt(struct ifc *); -void ifconfig(void); -int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); -void rtrecv(void); -int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *, +static void sighandler(int); +static void ripalarm(void); +static void riprecv(void); +static void ripsend(struct ifc *, struct sockaddr_in6 *, int); +static int out_filter(struct riprt *, struct ifc *); +static void init(void); +static void ifconfig(void); +static int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); +static void rtrecv(void); +static int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *, const struct sockaddr_in6 *); -int rt_deladdr(struct ifc *, const struct sockaddr_in6 *, +static int rt_deladdr(struct ifc *, const struct sockaddr_in6 *, const struct sockaddr_in6 *); -void filterconfig(void); -int getifmtu(int); -const char *rttypes(struct rt_msghdr *); -const char *rtflags(struct rt_msghdr *); -const char *ifflags(int); -int ifrt(struct ifc *, int); -void ifrt_p2p(struct ifc *, int); -void applymask(struct in6_addr *, struct in6_addr *); -void applyplen(struct in6_addr *, int); -void ifrtdump(int); -void ifdump(int); -void ifdump0(FILE *, const struct ifc *); -void ifremove(int); -void rtdump(int); -void rt_entry(struct rt_msghdr *, int); -void rtdexit(void); -void riprequest(struct ifc *, struct netinfo6 *, int, +static void filterconfig(void); +static int getifmtu(int); +static const char *rttypes(struct rt_msghdr *); +static const char *rtflags(struct rt_msghdr *); +static const char *ifflags(int); +static int ifrt(struct ifc *, int); +static void ifrt_p2p(struct ifc *, int); +static void applyplen(struct in6_addr *, int); +static void ifrtdump(int); +static void ifdump(int); +static void ifdump0(FILE *, const struct ifc *); +static void ifremove(int); +static void rtdump(int); +static void rt_entry(struct rt_msghdr *, int); +static void rtdexit(void); +static void riprequest(struct ifc *, struct netinfo6 *, int, struct sockaddr_in6 *); -void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np); -void sendrequest(struct ifc *); -int sin6mask2len(const struct sockaddr_in6 *); -int mask2len(const struct in6_addr *, int); -int sendpacket(struct sockaddr_in6 *, int); -int addroute(struct riprt *, const struct in6_addr *, struct ifc *); -int delroute(struct netinfo6 *, struct in6_addr *); -struct in6_addr *getroute(struct netinfo6 *, struct in6_addr *); -void krtread(int); -int tobeadv(struct riprt *, struct ifc *); -char *allocopy(char *); -char *hms(void); -const char *inet6_n2p(const struct in6_addr *); -struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int); -struct in6_addr *plen2mask(int); -struct riprt *rtsearch(struct netinfo6 *); -int ripinterval(int); -time_t ripsuptrig(void); -void fatal(const char *, ...) +static void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np); +static void sendrequest(struct ifc *); +static int sin6mask2len(const struct sockaddr_in6 *); +static int mask2len(const struct in6_addr *, int); +static int sendpacket(struct sockaddr_in6 *, int); +static int addroute(struct riprt *, const struct in6_addr *, struct ifc *); +static int delroute(struct netinfo6 *, struct in6_addr *); +#if 0 +static struct in6_addr *getroute(struct netinfo6 *, struct in6_addr *); +#endif +static void krtread(int); +static int tobeadv(struct riprt *, struct ifc *); +static char *allocopy(char *); +static char *hms(void); +static const char *inet6_n2p(const struct in6_addr *); +static struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int); +static struct in6_addr *plen2mask(int); +static struct riprt *rtsearch(struct netinfo6 *); +static int ripinterval(int); +#if 0 +static time_t ripsuptrig(void); +#endif +static void fatal(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); -void trace(int, const char *, ...) +static void trace(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); -void tracet(int, const char *, ...) +static void tracet(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); -unsigned int if_maxindex(void); -struct ifc *ifc_find(char *); -struct iff *iff_find(struct ifc *, int); -void setindex2ifc(int, struct ifc *); +static struct ifc *ifc_find(char *); +static struct iff *iff_find(struct ifc *, int); +static void setindex2ifc(int, struct ifc *); #define MALLOC(type) ((type *)malloc(sizeof(type))) @@ -523,7 +526,7 @@ main(int argc, char *argv[]) } } -void +static void sighandler(int signo) { @@ -547,7 +550,7 @@ sighandler(int signo) * gracefully exits after resetting sockopts. */ /* ARGSUSED */ -void +static void rtdexit(void) { struct riprt *rrt; @@ -574,7 +577,7 @@ rtdexit(void) * routes more precisely. */ /* ARGSUSED */ -void +static void ripalarm(void) { struct ifc *ifcp; @@ -602,7 +605,7 @@ ripalarm(void) alarm(ripinterval(SUPPLY_INTERVAL6)); } -void +static void init(void) { int error; @@ -752,7 +755,7 @@ init(void) /* * ripflush flushes the rip datagram stored in the rip buffer */ -void +static void ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *np) { int i; @@ -807,7 +810,7 @@ ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 * /* * Generate RIP6_RESPONSE packets and send them. */ -void +static void ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) { struct riprt *rrt; @@ -948,7 +951,7 @@ ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) /* * outbound filter logic, per-route/interface. */ -int +static int out_filter(struct riprt *rrt, struct ifc *ifcp) { struct iff *iffp; @@ -1019,7 +1022,7 @@ out_filter(struct riprt *rrt, struct ifc *ifcp) * Determine if the route is to be advertised on the specified interface. * It checks options specified in the arguments and the split horizon rule. */ -int +static int tobeadv(struct riprt *rrt, struct ifc *ifcp) { @@ -1044,14 +1047,14 @@ tobeadv(struct riprt *rrt, struct ifc *ifcp) /* * Send a rip packet actually. */ -int +static int sendpacket(struct sockaddr_in6 *sin6, int len) { struct msghdr m; struct cmsghdr *cm; struct iovec iov[2]; - u_char cmsgbuf[256]; struct in6_pktinfo *pi; + u_char cmsgbuf[256]; int idx; struct sockaddr_in6 sincopy; @@ -1077,14 +1080,14 @@ sendpacket(struct sockaddr_in6 *sin6, int len) m.msg_controllen = 0; } else { memset(cmsgbuf, 0, sizeof(cmsgbuf)); - cm = (struct cmsghdr *)cmsgbuf; + cm = (struct cmsghdr *)(void *)cmsgbuf; m.msg_control = (caddr_t)cm; m.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo)); cm->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); cm->cmsg_level = IPPROTO_IPV6; cm->cmsg_type = IPV6_PKTINFO; - pi = (struct in6_pktinfo *)CMSG_DATA(cm); + pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm); memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*::*/ pi->ipi6_ifindex = idx; } @@ -1101,7 +1104,7 @@ sendpacket(struct sockaddr_in6 *sin6, int len) * Receive and process RIP packets. Update the routes/kernel forwarding * table if necessary. */ -void +static void riprecv(void) { struct ifc *ifcp, *ic; @@ -1133,7 +1136,7 @@ riprecv(void) iov[0].iov_len = sizeof(buf); m.msg_iov = iov; m.msg_iovlen = 1; - cm = (struct cmsghdr *)cmsgbuf; + cm = (struct cmsghdr *)(void *)cmsgbuf; m.msg_control = (caddr_t)cm; m.msg_controllen = sizeof(cmsgbuf); m.msg_flags = 0; @@ -1154,7 +1157,7 @@ riprecv(void) "invalid cmsg length for IPV6_PKTINFO\n"); return; } - pi = (struct in6_pktinfo *)(CMSG_DATA(cm)); + pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm); idx = pi->ipi6_ifindex; break; case IPV6_HOPLIMIT: @@ -1163,7 +1166,7 @@ riprecv(void) "invalid cmsg length for IPV6_HOPLIMIT\n"); return; } - hlimp = (int *)CMSG_DATA(cm); + hlimp = (int *)(void *)CMSG_DATA(cm); break; } } @@ -1188,7 +1191,7 @@ riprecv(void) nh = fsock.sin6_addr; nn = (len - sizeof(struct rip6) + sizeof(struct netinfo6)) / sizeof(struct netinfo6); - rp = (struct rip6 *)buf; + rp = (struct rip6 *)(void *)buf; np = rp->rip6_nets; if (rp->rip6_vers != RIP6_VERSION) { @@ -1449,7 +1452,7 @@ riprecv(void) /* * Send all routes request packet to the specified interface. */ -void +static void sendrequest(struct ifc *ifcp) { struct netinfo6 *np; @@ -1477,7 +1480,7 @@ sendrequest(struct ifc *ifcp) /* * Process a RIP6_REQUEST packet. */ -void +static void riprequest(struct ifc *ifcp, struct netinfo6 *np, int nn, @@ -1508,7 +1511,7 @@ riprequest(struct ifc *ifcp, /* * Get information of each interface. */ -void +static void ifconfig(void) { struct ifaddrs *ifap, *ifa; @@ -1583,7 +1586,7 @@ ifconfig(void) freeifaddrs(ifap); } -int +static int ifconfig1(const char *name, const struct sockaddr *sa, struct ifc *ifcp, @@ -1595,7 +1598,7 @@ ifconfig1(const char *name, int plen; char buf[BUFSIZ]; - sin6 = (const struct sockaddr_in6 *)sa; + sin6 = (const struct sockaddr_in6 *)(const void *)sa; if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && !lflag) return (-1); ifr.ifr_addr = *sin6; @@ -1663,7 +1666,7 @@ ifconfig1(const char *name, return 0; } -void +static void ifremove(int ifindex) { struct ifc *ifcp; @@ -1691,7 +1694,7 @@ ifremove(int ifindex) * Receive and process routing messages. * Update interface information as necesssary. */ -void +static void rtrecv(void) { char buf[BUFSIZ]; @@ -1730,33 +1733,34 @@ rtrecv(void) fprintf(stderr, "\n"); } - for (p = buf; p - buf < len; p += ((struct rt_msghdr *)p)->rtm_msglen) { - if (((struct rt_msghdr *)p)->rtm_version != RTM_VERSION) + for (p = buf; p - buf < len; p += + ((struct rt_msghdr *)(void *)p)->rtm_msglen) { + if (((struct rt_msghdr *)(void *)p)->rtm_version != RTM_VERSION) continue; /* safety against bogus message */ - if (((struct rt_msghdr *)p)->rtm_msglen <= 0) { + if (((struct rt_msghdr *)(void *)p)->rtm_msglen <= 0) { trace(1, "bogus rtmsg: length=%d\n", - ((struct rt_msghdr *)p)->rtm_msglen); + ((struct rt_msghdr *)(void *)p)->rtm_msglen); break; } rtm = NULL; ifam = NULL; ifm = NULL; - switch (((struct rt_msghdr *)p)->rtm_type) { + switch (((struct rt_msghdr *)(void *)p)->rtm_type) { case RTM_NEWADDR: case RTM_DELADDR: - ifam = (struct ifa_msghdr *)p; + ifam = (struct ifa_msghdr *)(void *)p; addrs = ifam->ifam_addrs; q = (char *)(ifam + 1); break; case RTM_IFINFO: - ifm = (struct if_msghdr *)p; + ifm = (struct if_msghdr *)(void *)p; addrs = ifm->ifm_addrs; q = (char *)(ifm + 1); break; case RTM_IFANNOUNCE: - ifan = (struct if_announcemsghdr *)p; + ifan = (struct if_announcemsghdr *)(void *)p; switch (ifan->ifan_what) { case IFAN_ARRIVAL: iface++; @@ -1768,7 +1772,7 @@ rtrecv(void) } break; default: - rtm = (struct rt_msghdr *)p; + rtm = (struct rt_msghdr *)(void *)p; addrs = rtm->rtm_addrs; q = (char *)(rtm + 1); if (rtm->rtm_version != RTM_VERSION) { @@ -1788,16 +1792,16 @@ rtrecv(void) memset(&rta, 0, sizeof(rta)); for (i = 0; i < RTAX_MAX; i++) { if (addrs & (1 << i)) { - rta[i] = (struct sockaddr_in6 *)q; + rta[i] = (struct sockaddr_in6 *)(void *)q; q += ROUNDUP(rta[i]->sin6_len); } } trace(1, "rtsock: %s (addrs=%x)\n", - rttypes((struct rt_msghdr *)p), addrs); + rttypes((struct rt_msghdr *)(void *)p), addrs); if (dflag >= 2) { for (i = 0; - i < ((struct rt_msghdr *)p)->rtm_msglen; + i < ((struct rt_msghdr *)(void *)p)->rtm_msglen; i++) { fprintf(stderr, "%02x ", p[i] & 0xff); if (i % 16 == 15) fprintf(stderr, "\n"); @@ -1811,7 +1815,7 @@ rtrecv(void) * We may be able to optimize by using ifm->ifm_index or * ifam->ifam_index. For simplicity we don't do that here. */ - switch (((struct rt_msghdr *)p)->rtm_type) { + switch (((struct rt_msghdr *)(void *)p)->rtm_type) { case RTM_NEWADDR: case RTM_IFINFO: iface++; @@ -1852,7 +1856,7 @@ rtrecv(void) #endif /* hard ones */ - switch (((struct rt_msghdr *)p)->rtm_type) { + switch (((struct rt_msghdr *)(void *)p)->rtm_type) { case RTM_NEWADDR: case RTM_IFINFO: case RTM_ADD: @@ -1940,7 +1944,7 @@ rtrecv(void) /* * remove specified route from the internal routing table. */ -int +static int rt_del(const struct sockaddr_in6 *sdst, const struct sockaddr_in6 *sgw, const struct sockaddr_in6 *smask) @@ -2038,7 +2042,7 @@ rt_del(const struct sockaddr_in6 *sdst, /* * remove specified address from internal interface/routing table. */ -int +static int rt_deladdr(struct ifc *ifcp, const struct sockaddr_in6 *sifa, const struct sockaddr_in6 *smask) @@ -2139,7 +2143,7 @@ rt_deladdr(struct ifc *ifcp, * Get each interface address and put those interface routes to the route * list. */ -int +static int ifrt(struct ifc *ifcp, int again) { struct ifac *ifac; @@ -2250,7 +2254,7 @@ ifrt(struct ifc *ifcp, int again) * you pick one. it looks that gated behavior fits best with BSDs, * since BSD kernels do not look at prefix length on p2p interfaces. */ -void +static void ifrt_p2p(struct ifc *ifcp, int again) { struct ifac *ifac; @@ -2414,7 +2418,7 @@ ifrt_p2p(struct ifc *ifcp, int again) #undef P2PADVERT_MAX } -int +static int getifmtu(int ifindex) { int mib[6]; @@ -2441,7 +2445,7 @@ getifmtu(int ifindex) fatal("sysctl NET_RT_IFLIST"); /*NOTREACHED*/ } - ifm = (struct if_msghdr *)buf; + ifm = (struct if_msghdr *)(void *)buf; mtu = ifm->ifm_data.ifi_mtu; if (ifindex != ifm->ifm_index) { fatal("ifindex does not match with ifm_index"); @@ -2451,7 +2455,7 @@ getifmtu(int ifindex) return mtu; } -const char * +static const char * rttypes(struct rt_msghdr *rtm) { #define RTTYPE(s, f) \ @@ -2486,7 +2490,7 @@ do { \ return NULL; } -const char * +static const char * rtflags(struct rt_msghdr *rtm) { static char buf[BUFSIZ]; @@ -2546,7 +2550,7 @@ do { \ return buf; } -const char * +static const char * ifflags(int flags) { static char buf[BUFSIZ]; @@ -2582,7 +2586,7 @@ do { \ return buf; } -void +static void krtread(int again) { int mib[6]; @@ -2631,13 +2635,13 @@ krtread(int again) lim = buf + msize; for (p = buf; p < lim; p += rtm->rtm_msglen) { - rtm = (struct rt_msghdr *)p; + rtm = (struct rt_msghdr *)(void *)p; rt_entry(rtm, again); } free(buf); } -void +static void rt_entry(struct rt_msghdr *rtm, int again) { struct sockaddr_in6 *sin6_dst, *sin6_gw, *sin6_mask; @@ -2674,22 +2678,22 @@ rt_entry(struct rt_msghdr *rtm, int again) /* Destination */ if ((rtm->rtm_addrs & RTA_DST) == 0) return; /* ignore routes without destination address */ - sin6_dst = (struct sockaddr_in6 *)rtmp; + sin6_dst = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_dst->sin6_len); if (rtm->rtm_addrs & RTA_GATEWAY) { - sin6_gw = (struct sockaddr_in6 *)rtmp; + sin6_gw = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_gw->sin6_len); } if (rtm->rtm_addrs & RTA_NETMASK) { - sin6_mask = (struct sockaddr_in6 *)rtmp; + sin6_mask = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_mask->sin6_len); } if (rtm->rtm_addrs & RTA_GENMASK) { - sin6_genmask = (struct sockaddr_in6 *)rtmp; + sin6_genmask = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_genmask->sin6_len); } if (rtm->rtm_addrs & RTA_IFP) { - sin6_ifp = (struct sockaddr_in6 *)rtmp; + sin6_ifp = (struct sockaddr_in6 *)(void *)rtmp; rtmp += ROUNDUP(sin6_ifp->sin6_len); } @@ -2798,7 +2802,7 @@ rt_entry(struct rt_msghdr *rtm, int again) TAILQ_INSERT_HEAD(&riprt_head, rrt, rrt_next); } -int +static int addroute(struct riprt *rrt, const struct in6_addr *gw, struct ifc *ifcp) @@ -2823,7 +2827,7 @@ addroute(struct riprt *rrt, return 0; memset(buf, 0, sizeof(buf)); - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; rtm->rtm_type = RTM_ADD; rtm->rtm_version = RTM_VERSION; rtm->rtm_seq = ++seq; @@ -2833,24 +2837,24 @@ addroute(struct riprt *rrt, rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; rtm->rtm_rmx.rmx_hopcount = np->rip6_metric - 1; rtm->rtm_inits = RTV_HOPCOUNT; - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; /* Destination */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = np->rip6_dest; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Gateway */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *gw; if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) sin6->sin6_scope_id = ifcp->ifc_index; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Netmask */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *(plen2mask(np->rip6_plen)); - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); len = (char *)sin6 - (char *)buf; rtm->rtm_msglen = len; @@ -2873,7 +2877,7 @@ addroute(struct riprt *rrt, return -1; } -int +static int delroute(struct netinfo6 *np, struct in6_addr *gw) { u_char buf[BUFSIZ], buf2[BUFSIZ]; @@ -2891,7 +2895,7 @@ delroute(struct netinfo6 *np, struct in6_addr *gw) return 0; memset(buf, 0, sizeof(buf)); - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; rtm->rtm_type = RTM_DELETE; rtm->rtm_version = RTM_VERSION; rtm->rtm_seq = ++seq; @@ -2901,22 +2905,22 @@ delroute(struct netinfo6 *np, struct in6_addr *gw) if (np->rip6_plen == sizeof(struct in6_addr) * 8) rtm->rtm_flags |= RTF_HOST; rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; /* Destination */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = np->rip6_dest; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Gateway */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *gw; - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); /* Netmask */ sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = *(plen2mask(np->rip6_plen)); - sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); + sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); len = (char *)sin6 - (char *)buf; rtm->rtm_msglen = len; @@ -2939,7 +2943,8 @@ delroute(struct netinfo6 *np, struct in6_addr *gw) return -1; } -struct in6_addr * +#if 0 +static struct in6_addr * getroute(struct netinfo6 *np, struct in6_addr *gw) { u_char buf[BUFSIZ]; @@ -2948,7 +2953,7 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) struct rt_msghdr *rtm; struct sockaddr_in6 *sin6; - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; len = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in6); memset(rtm, 0, len); rtm->rtm_type = RTM_GET; @@ -2957,7 +2962,7 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) rtm->rtm_seq = myseq; rtm->rtm_addrs = RTA_DST; rtm->rtm_msglen = len; - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_addr = np->rip6_dest; @@ -2972,11 +2977,11 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) perror("read from rtsock"); exit(1); } - rtm = (struct rt_msghdr *)buf; + rtm = (struct rt_msghdr *)(void *)buf; } while (rtm->rtm_seq != myseq || rtm->rtm_pid != pid); - sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; + sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)]; if (rtm->rtm_addrs & RTA_DST) { - sin6 = (struct sockaddr_in6 *) + sin6 = (struct sockaddr_in6 *)(void *) ((char *)sin6 + ROUNDUP(sin6->sin6_len)); } if (rtm->rtm_addrs & RTA_GATEWAY) { @@ -2985,8 +2990,9 @@ getroute(struct netinfo6 *np, struct in6_addr *gw) } return NULL; } +#endif -const char * +static const char * inet6_n2p(const struct in6_addr *p) { static char buf[BUFSIZ]; @@ -2994,7 +3000,7 @@ inet6_n2p(const struct in6_addr *p) return inet_ntop(AF_INET6, (const void *)p, buf, sizeof(buf)); } -void +static void ifrtdump(int sig) { @@ -3002,7 +3008,7 @@ ifrtdump(int sig) rtdump(sig); } -void +static void ifdump(int sig) { struct ifc *ifcp; @@ -3041,7 +3047,7 @@ ifdump(int sig) fclose(dump); } -void +static void ifdump0(FILE *dump, const struct ifc *ifcp) { struct ifac *ifac; @@ -3097,7 +3103,7 @@ ifdump0(FILE *dump, const struct ifc *ifcp) fprintf(dump, "\n"); } -void +static void rtdump(int sig) { struct riprt *rrt; @@ -3146,7 +3152,7 @@ rtdump(int sig) * syntax: -A 5f09:c400::/32,ef0,ef1 (aggregate) * -O 5f09:c400::/32,ef0,ef1 (only when match) */ -void +static void filterconfig(void) { int i; @@ -3277,7 +3283,7 @@ filterconfig(void) * Returns a pointer to ifac whose address and prefix length matches * with the address and prefix length specified in the arguments. */ -struct ifac * +static struct ifac * ifa_match(const struct ifc *ifcp, const struct in6_addr *ia, int plen) @@ -3298,7 +3304,7 @@ ifa_match(const struct ifc *ifcp, * matches with the address and prefix length found in the argument. * Note: This is not a rtalloc(). Therefore exact match is necessary. */ -struct riprt * +static struct riprt * rtsearch(struct netinfo6 *np) { struct riprt *rrt; @@ -3313,7 +3319,7 @@ rtsearch(struct netinfo6 *np) return (rrt); } -int +static int sin6mask2len(const struct sockaddr_in6 *sin6) { @@ -3321,7 +3327,7 @@ sin6mask2len(const struct sockaddr_in6 *sin6) sin6->sin6_len - offsetof(struct sockaddr_in6, sin6_addr)); } -int +static int mask2len(const struct in6_addr *addr, int lenlim) { int i = 0, j; @@ -3348,22 +3354,11 @@ mask2len(const struct in6_addr *addr, int lenlim) return i; } -void -applymask(struct in6_addr *addr, struct in6_addr *mask) -{ - int i; - u_long *p, *q; - - p = (u_long *)addr; q = (u_long *)mask; - for (i = 0; i < 4; i++) - *p++ &= *q++; -} - static const u_char plent[8] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe }; -void +static void applyplen(struct in6_addr *ia, int plen) { u_char *p; @@ -3383,7 +3378,7 @@ static const int pl2m[9] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff }; -struct in6_addr * +static struct in6_addr * plen2mask(int n) { static struct in6_addr ia; @@ -3403,7 +3398,7 @@ plen2mask(int n) return &ia; } -char * +static char * allocopy(char *p) { int len = strlen(p) + 1; @@ -3418,7 +3413,7 @@ allocopy(char *p) return q; } -char * +static char * hms(void) { static char buf[BUFSIZ]; @@ -3437,7 +3432,7 @@ hms(void) #define RIPRANDDEV 1.0 /* 30 +- 15, max - min = 30 */ -int +static int ripinterval(int timer) { double r = rand(); @@ -3447,7 +3442,8 @@ ripinterval(int timer) return interval; } -time_t +#if 0 +static time_t ripsuptrig(void) { time_t t; @@ -3458,8 +3454,9 @@ ripsuptrig(void) sup_trig_update = time(NULL) + t; return t; } +#endif -void +static void #ifdef __STDC__ fatal(const char *fmt, ...) #else @@ -3486,7 +3483,7 @@ fatal(fmt, va_alist) rtdexit(); } -void +static void #ifdef __STDC__ tracet(int level, const char *fmt, ...) #else @@ -3522,7 +3519,7 @@ tracet(level, fmt, va_alist) } } -void +static void #ifdef __STDC__ trace(int level, const char *fmt, ...) #else @@ -3557,22 +3554,7 @@ trace(level, fmt, va_alist) } } -unsigned int -if_maxindex(void) -{ - struct if_nameindex *p, *p0; - unsigned int max = 0; - - p0 = if_nameindex(); - for (p = p0; p && p->if_index && p->if_name; p++) { - if (max < p->if_index) - max = p->if_index; - } - if_freenameindex(p0); - return max; -} - -struct ifc * +static struct ifc * ifc_find(char *name) { struct ifc *ifcp; @@ -3584,7 +3566,7 @@ ifc_find(char *name) return (ifcp); } -struct iff * +static struct iff * iff_find(struct ifc *ifcp, int type) { struct iff *iffp; @@ -3598,7 +3580,7 @@ iff_find(struct ifc *ifcp, int type) return (iffp); } -void +static void setindex2ifc(int idx, struct ifc *ifcp) { int n, nsize; From 67f4aa3878efa3ab6b639e65830d52b30e303f0d Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Fri, 13 Jan 2017 06:53:56 +0000 Subject: [PATCH 052/126] [net80211] initial, somewhat incomplete VHT channel setup code and attach path. This sets up: * vht capabilities in vaps; * calls vht_announce to announce VHT capabilities if any; * sets up vht20, vht40 and vht80 channels, assuming the regulatory code does the right thing with 80MHz available ranges; * adds support to the ieee80211_add_channel_list_5ghz() code to populate VHT channels, as this is the API my ath10k driver is using; * add support for the freq1/freq2 field population and lookup that VHT channels require. The VHT80 code assumes that the regulatory domain already has limited VHT80 bands to, well, 80MHz wide chunks. --- sys/net80211/ieee80211.c | 286 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 277 insertions(+), 9 deletions(-) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 487e1505ef08..4ef900ac748e 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include @@ -119,6 +120,8 @@ static const struct ieee80211_rateset ieee80211_rateset_11g = { 12, { B(2), B(4), B(11), B(22), 12, 18, 24, 36, 48, 72, 96, 108 } }; #undef B +static int set_vht_extchan(struct ieee80211_channel *c); + /* * Fill in 802.11 available channel set, mark * all available channels as active, and pick @@ -150,10 +153,23 @@ ieee80211_chan_init(struct ieee80211com *ic) */ if (c->ic_ieee == 0) c->ic_ieee = ieee80211_mhz2ieee(c->ic_freq,c->ic_flags); + + /* + * Setup the HT40/VHT40 upper/lower bits. + * The VHT80 math is done elsewhere. + */ if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0) c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq + (IEEE80211_IS_CHAN_HT40U(c) ? 20 : -20), c->ic_flags); + + /* Update VHT math */ + /* + * XXX VHT again, note that this assumes VHT80 channels + * are legit already + */ + set_vht_extchan(c); + /* default max tx power to max regulatory */ if (c->ic_maxpower == 0) c->ic_maxpower = 2*c->ic_maxregpower; @@ -343,6 +359,7 @@ ieee80211_ifattach(struct ieee80211com *ic) ieee80211_superg_attach(ic); #endif ieee80211_ht_attach(ic); + ieee80211_vht_attach(ic); ieee80211_scan_attach(ic); ieee80211_regdomain_attach(ic); ieee80211_dfs_attach(ic); @@ -386,6 +403,7 @@ ieee80211_ifdetach(struct ieee80211com *ic) #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_superg_detach(ic); #endif + ieee80211_vht_detach(ic); ieee80211_ht_detach(ic); /* NB: must be called before ieee80211_node_detach */ ieee80211_proto_detach(ic); @@ -515,8 +533,15 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, vap->iv_flags_ext = ic->ic_flags_ext; vap->iv_flags_ven = ic->ic_flags_ven; vap->iv_caps = ic->ic_caps &~ IEEE80211_C_OPMODE; + + /* 11n capabilities - XXX methodize */ vap->iv_htcaps = ic->ic_htcaps; vap->iv_htextcaps = ic->ic_htextcaps; + + /* 11ac capabilities - XXX methodize */ + vap->iv_vhtcaps = ic->ic_vhtcaps; + vap->iv_vhtextcaps = ic->ic_vhtextcaps; + vap->iv_opmode = opmode; vap->iv_caps |= ieee80211_opcap[opmode]; IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr); @@ -601,6 +626,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, ieee80211_superg_vattach(vap); #endif ieee80211_ht_vattach(vap); + ieee80211_vht_vattach(vap); ieee80211_scan_vattach(vap); ieee80211_regdomain_vattach(vap); ieee80211_radiotap_vattach(vap); @@ -737,6 +763,7 @@ ieee80211_vap_detach(struct ieee80211vap *vap) #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_superg_vdetach(vap); #endif + ieee80211_vht_vdetach(vap); ieee80211_ht_vdetach(vap); /* NB: must be before ieee80211_node_vdetach */ ieee80211_proto_vdetach(vap); @@ -1081,6 +1108,110 @@ set_extchan(struct ieee80211_channel *c) c->ic_extieee = 0; } +/* + * Populate the freq1/freq2 fields as appropriate for VHT channels. + * + * This for now uses a hard-coded list of 80MHz wide channels. + * + * For HT20/HT40, freq1 just is the centre frequency of the 40MHz + * wide channel we've already decided upon. + * + * For VHT80 and VHT160, there are only a small number of fixed + * 80/160MHz wide channels, so we just use those. + * + * This is all likely very very wrong - both the regulatory code + * and this code needs to ensure that all four channels are + * available and valid before the VHT80 (and eight for VHT160) channel + * is created. + */ + +struct vht_chan_range { + uint16_t freq_start; + uint16_t freq_end; +}; + +struct vht_chan_range vht80_chan_ranges[] = { + { 5170, 5250 }, + { 5250, 5330 }, + { 5490, 5570 }, + { 5570, 5650 }, + { 5650, 5730 }, + { 5735, 5815 }, + { 0, 0, } +}; + +static int +set_vht_extchan(struct ieee80211_channel *c) +{ + int i; + + if (! IEEE80211_IS_CHAN_VHT(c)) { + return (0); + } + + if (IEEE80211_IS_CHAN_VHT20(c)) { + c->ic_vht_ch_freq1 = c->ic_ieee; + return (1); + } + + if (IEEE80211_IS_CHAN_VHT40(c)) { + if (IEEE80211_IS_CHAN_HT40U(c)) + c->ic_vht_ch_freq1 = c->ic_ieee + 2; + else if (IEEE80211_IS_CHAN_HT40D(c)) + c->ic_vht_ch_freq1 = c->ic_ieee - 2; + else + return (0); + return (1); + } + + if (IEEE80211_IS_CHAN_VHT80(c)) { + for (i = 0; vht80_chan_ranges[i].freq_start != 0; i++) { + if (c->ic_freq >= vht80_chan_ranges[i].freq_start && + c->ic_freq < vht80_chan_ranges[i].freq_end) { + int midpoint; + + midpoint = vht80_chan_ranges[i].freq_start + 40; + c->ic_vht_ch_freq1 = + ieee80211_mhz2ieee(midpoint, c->ic_flags); + c->ic_vht_ch_freq2 = 0; +#if 0 + printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n", + __func__, c->ic_ieee, c->ic_freq, midpoint, + c->ic_vht_ch_freq1, c->ic_vht_ch_freq2); +#endif + return (1); + } + } + return (0); + } + + printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n", + __func__, + c->ic_ieee, + c->ic_flags); + + return (0); +} + +/* + * Return whether the current channel could possibly be a part of + * a VHT80 channel. + * + * This doesn't check that the whole range is in the allowed list + * according to regulatory. + */ +static int +is_vht80_valid_freq(uint16_t freq) +{ + int i; + for (i = 0; vht80_chan_ranges[i].freq_start != 0; i++) { + if (freq >= vht80_chan_ranges[i].freq_start && + freq < vht80_chan_ranges[i].freq_end) + return (1); + } + return (0); +} + static int addchan(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower, uint32_t flags) @@ -1090,13 +1221,25 @@ addchan(struct ieee80211_channel chans[], int maxchans, int *nchans, if (*nchans >= maxchans) return (ENOBUFS); +#if 0 + printf("%s: %d: ieee=%d, freq=%d, flags=0x%08x\n", + __func__, + *nchans, + ieee, + freq, + flags); +#endif + c = &chans[(*nchans)++]; c->ic_ieee = ieee; c->ic_freq = freq != 0 ? freq : ieee80211_ieee2mhz(ieee, flags); c->ic_maxregpower = maxregpower; c->ic_maxpower = 2 * maxregpower; c->ic_flags = flags; + c->ic_vht_ch_freq1 = 0; + c->ic_vht_ch_freq2 = 0; set_extchan(c); + set_vht_extchan(c); return (0); } @@ -1112,14 +1255,27 @@ copychan_prev(struct ieee80211_channel chans[], int maxchans, int *nchans, if (*nchans >= maxchans) return (ENOBUFS); +#if 0 + printf("%s: %d: flags=0x%08x\n", + __func__, + *nchans, + flags); +#endif + c = &chans[(*nchans)++]; c[0] = c[-1]; c->ic_flags = flags; + c->ic_vht_ch_freq1 = 0; + c->ic_vht_ch_freq2 = 0; set_extchan(c); + set_vht_extchan(c); return (0); } +/* + * XXX VHT-2GHz + */ static void getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40) { @@ -1140,35 +1296,73 @@ getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40) } static void -getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40) +getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { int nmodes; + /* + * the addchan_list function seems to expect the flags array to + * be in channel width order, so the VHT bits are interspersed + * as appropriate to maintain said order. + * + * It also assumes HT40U is before HT40D. + */ nmodes = 0; + + /* 20MHz */ if (isset(bands, IEEE80211_MODE_11A)) flags[nmodes++] = IEEE80211_CHAN_A; if (isset(bands, IEEE80211_MODE_11NA)) flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20; + if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT20 | + IEEE80211_CHAN_VHT20; + + /* 40MHz */ if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U; + } + if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U + | IEEE80211_CHAN_VHT40U; + } + if (ht40) { flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D; } + if (ht40 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D + | IEEE80211_CHAN_VHT40D; + } + + /* 80MHz */ + if (vht80 && isset(bands, IEEE80211_MODE_VHT_5GHZ)) { + flags[nmodes++] = IEEE80211_CHAN_A | + IEEE80211_CHAN_HT40U | IEEE80211_CHAN_VHT80; + flags[nmodes++] = IEEE80211_CHAN_A | + IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; + } + } + + /* XXX VHT80+80 */ + /* XXX VHT160 */ flags[nmodes] = 0; } static void -getflags(const uint8_t bands[], uint32_t flags[], int ht40) +getflags(const uint8_t bands[], uint32_t flags[], int ht40, int vht80) { flags[0] = 0; if (isset(bands, IEEE80211_MODE_11A) || - isset(bands, IEEE80211_MODE_11NA)) { + isset(bands, IEEE80211_MODE_11NA) || + isset(bands, IEEE80211_MODE_VHT_5GHZ)) { if (isset(bands, IEEE80211_MODE_11B) || isset(bands, IEEE80211_MODE_11G) || - isset(bands, IEEE80211_MODE_11NG)) + isset(bands, IEEE80211_MODE_11NG) || + isset(bands, IEEE80211_MODE_VHT_2GHZ)) return; - getflags_5ghz(bands, flags, ht40); + getflags_5ghz(bands, flags, ht40, vht80); } else getflags_2ghz(bands, flags, ht40); } @@ -1176,6 +1370,7 @@ getflags(const uint8_t bands[], uint32_t flags[], int ht40) /* * Add one 20 MHz channel into specified channel list. */ +/* XXX VHT */ int ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower, @@ -1184,7 +1379,7 @@ ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans, uint32_t flags[IEEE80211_MODE_MAX]; int i, error; - getflags(bands, flags, 0); + getflags(bands, flags, 0, 0); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower, @@ -1218,6 +1413,7 @@ findchannel(struct ieee80211_channel chans[], int nchans, uint16_t freq, /* * Add 40 MHz channel pair into specified channel list. */ +/* XXX VHT */ int ieee80211_add_channel_ht40(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, int8_t maxregpower, uint32_t flags) @@ -1275,11 +1471,17 @@ ieee80211_get_channel_center_freq(const struct ieee80211_channel *c) * For 80+80MHz channels this will be the centre of the primary * 80MHz channel; the secondary 80MHz channel will be center_freq2(). */ - uint32_t ieee80211_get_channel_center_freq1(const struct ieee80211_channel *c) { + /* + * VHT - use the pre-calculated centre frequency + * of the given channel. + */ + if (IEEE80211_IS_CHAN_VHT(c)) + return (ieee80211_ieee2mhz(c->ic_vht_ch_freq1, c->ic_flags)); + if (IEEE80211_IS_CHAN_HT40U(c)) { return (c->ic_freq + 10); } @@ -1291,12 +1493,15 @@ ieee80211_get_channel_center_freq1(const struct ieee80211_channel *c) } /* - * For now, no 80+80 support; this is zero. + * For now, no 80+80 support; it will likely always return 0. */ uint32_t ieee80211_get_channel_center_freq2(const struct ieee80211_channel *c) { + if (IEEE80211_IS_CHAN_VHT(c) && (c->ic_vht_ch_freq2 != 0)) + return (ieee80211_ieee2mhz(c->ic_vht_ch_freq2, c->ic_flags)); + return (0); } @@ -1310,16 +1515,70 @@ add_chanlist(struct ieee80211_channel chans[], int maxchans, int *nchans, { uint16_t freq; int i, j, error; + int is_vht; for (i = 0; i < nieee; i++) { freq = ieee80211_ieee2mhz(ieee[i], flags[0]); for (j = 0; flags[j] != 0; j++) { + /* + * Notes: + * + HT40 and VHT40 channels occur together, so + * we need to be careful that we actually allow that. + * + VHT80, VHT160 will coexist with HT40/VHT40, so + * make sure it's not skipped because of the overlap + * check used for (V)HT40. + */ + is_vht = !! (flags[j] & IEEE80211_CHAN_VHT); + + /* + * Test for VHT80. + * XXX This is all very broken right now. + * What we /should/ do is: + * + * + check that the frequency is in the list of + * allowed VHT80 ranges; and + * + the other 3 channels in the list are actually + * also available. + */ + if (is_vht && flags[j] & IEEE80211_CHAN_VHT80) + if (! is_vht80_valid_freq(freq)) + continue; + + /* + * Test for (V)HT40. + * + * This is also a fall through from VHT80; as we only + * allow a VHT80 channel if the VHT40 combination is + * also valid. If the VHT40 form is not valid then + * we certainly can't do VHT80.. + */ if (flags[j] & IEEE80211_CHAN_HT40D) + /* + * Can't have a "lower" channel if we are the + * first channel. + * + * Can't have a "lower" channel if it's below/ + * within 20MHz of the first channel. + * + * Can't have a "lower" channel if the channel + * below it is not 20MHz away. + */ if (i == 0 || ieee[i] < ieee[0] + 4 || freq - 20 != ieee80211_ieee2mhz(ieee[i] - 4, flags[j])) continue; if (flags[j] & IEEE80211_CHAN_HT40U) + /* + * Can't have an "upper" channel if we are + * the last channel. + * + * Can't have an "upper" channel be above the + * last channel in the list. + * + * Can't have an "upper" channel if the next + * channel according to the math isn't 20MHz + * away. (Likely for channel 13/14.) + */ if (i == nieee - 1 || ieee[i] + 4 > ieee[nieee - 1] || freq + 20 != @@ -1348,6 +1607,7 @@ ieee80211_add_channel_list_2ghz(struct ieee80211_channel chans[], int maxchans, { uint32_t flags[IEEE80211_MODE_MAX]; + /* XXX no VHT for now */ getflags_2ghz(bands, flags, ht40); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); @@ -1360,8 +1620,15 @@ ieee80211_add_channel_list_5ghz(struct ieee80211_channel chans[], int maxchans, int ht40) { uint32_t flags[IEEE80211_MODE_MAX]; + int vht80 = 0; - getflags_5ghz(bands, flags, ht40); + /* + * For now, assume VHT == VHT80 support as a minimum. + */ + if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) + vht80 = 1; + + getflags_5ghz(bands, flags, ht40, vht80); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); return (add_chanlist(chans, maxchans, nchans, ieee, nieee, flags)); @@ -1662,6 +1929,7 @@ ieee80211_announce(struct ieee80211com *ic) printf("\n"); } ieee80211_ht_announce(ic); + ieee80211_vht_announce(ic); } void From 51172f62a753fbf3305b6a339ad3dc3847cb1a64 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Fri, 13 Jan 2017 07:02:04 +0000 Subject: [PATCH 053/126] [net80211] Initial VHT node upgrade/downgrade support and initial IE parsing. This is the bulk of the magic to start enabling VHT channel negotiation. It is absolutely, positively not yet even a complete VHT wave-1 implementation. * parse IEs in scan, assoc req/resp, probe req/resp; * break apart the channel upgrade from the HT IE parsing - do it after the VHT IEs are parsed; * (dirty! sigh) add channel width decision making in ieee80211_ht.c htinfo_update_chw(). This is the main bit where negotiated channel promotion through IEs occur. * Shoehorn in VHT node init ,teardown, rate control, etc calls like the HT versions; * Do VHT channel adjustment where appropriate Tested: * monitor mode, ath10k port * STA mode, ath10k port - VHT20, VHT40, VHT80 modes TODO: * IBSS; * hostap; * (ignore mesh, wds for now); * finish 11n state engine - channel width change, opmode notifications, SMPS, etc; * VHT basic rate negotiation and acceptance criteria when scanning, associating, etc; * VHT control/management frame handling (group managment and operating mode being the two big ones); * Verify TX/RX VHT rate negotiation is actually working correctly. Whilst here, add some comments about seqno allocation and locking. To achieve the full VHT rates I need to push seqno allocation into the drivers and finally remove the IEEE80211_TX_LOCK() I added years ago to fix issues. :/ --- sys/net80211/ieee80211_adhoc.c | 6 +- sys/net80211/ieee80211_hostap.c | 27 +++ sys/net80211/ieee80211_ht.c | 289 +++++++++++++++++++++++++----- sys/net80211/ieee80211_ht.h | 5 +- sys/net80211/ieee80211_input.c | 26 +++ sys/net80211/ieee80211_node.c | 159 +++++++++++++++- sys/net80211/ieee80211_output.c | 126 ++++++++++++- sys/net80211/ieee80211_scan_sta.c | 46 ++++- sys/net80211/ieee80211_sta.c | 47 ++++- 9 files changed, 671 insertions(+), 60 deletions(-) diff --git a/sys/net80211/ieee80211_adhoc.c b/sys/net80211/ieee80211_adhoc.c index ec39a54d672f..6d26f85b56bc 100644 --- a/sys/net80211/ieee80211_adhoc.c +++ b/sys/net80211/ieee80211_adhoc.c @@ -822,10 +822,14 @@ adhoc_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, #if 0 if (scan.htcap != NULL && scan.htinfo != NULL && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { - if (ieee80211_ht_updateparams(ni, + ieee80211_ht_updateparams(ni, + scan.htcap, scan.htinfo)); + if (ieee80211_ht_updateparams_final(ni, scan.htcap, scan.htinfo)) ht_state_change = 1; } + + /* XXX same for VHT? */ #endif if (ni != NULL) { IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 9868f133bca7..66df1bd463a1 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -1745,6 +1746,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, struct ieee80211_frame *wh; uint8_t *frm, *efrm, *sfrm; uint8_t *ssid, *rates, *xrates, *wpa, *rsn, *wme, *ath, *htcap; + uint8_t *vhtcap, *vhtinfo; int reassoc, resp; uint8_t rate; @@ -2042,6 +2044,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, if (reassoc) frm += 6; /* ignore current AP info */ ssid = rates = xrates = wpa = rsn = wme = ath = htcap = NULL; + vhtcap = vhtinfo = NULL; sfrm = frm; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); @@ -2061,6 +2064,12 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, case IEEE80211_ELEMID_HTCAP: htcap = frm; break; + case IEEE80211_ELEMID_VHT_CAP: + vhtcap = frm; + break; + case IEEE80211_ELEMID_VHT_OPMODE: + vhtinfo = frm; + break; case IEEE80211_ELEMID_VENDOR: if (iswpaoui(frm)) wpa = frm; @@ -2135,10 +2144,22 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, vap->iv_stats.is_rx_assoc_norate++; return; } + /* * Do HT rate set handling and setup HT node state. */ ni->ni_chan = vap->iv_bss->ni_chan; + + /* VHT */ + if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { + /* XXX TODO; see below */ + printf("%s: VHT TODO!\n", __func__); + ieee80211_vht_node_init(ni); + ieee80211_vht_update_cap(ni, vhtcap, vhtinfo); + } else if (ni->ni_flags & IEEE80211_NODE_VHT) + ieee80211_vht_node_cleanup(ni); + + /* HT */ if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) { rate = ieee80211_setup_htrates(ni, htcap, IEEE80211_F_DOFMCS | IEEE80211_F_DONEGO | @@ -2153,6 +2174,12 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, ieee80211_ht_updatehtcap(ni, htcap); } else if (ni->ni_flags & IEEE80211_NODE_HT) ieee80211_ht_node_cleanup(ni); + + /* Finally - this will use HT/VHT info to change node channel */ + if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && htcap != NULL) { + ieee80211_ht_updatehtcap_final(ni); + } + #ifdef IEEE80211_SUPPORT_SUPERG /* Always do ff node cleanup; for A-MSDU */ ieee80211_ff_node_cleanup(ni); diff --git a/sys/net80211/ieee80211_ht.c b/sys/net80211/ieee80211_ht.c index 74e265ec9dce..2f28f002ec32 100644 --- a/sys/net80211/ieee80211_ht.c +++ b/sys/net80211/ieee80211_ht.c @@ -1490,52 +1490,117 @@ ieee80211_parse_htinfo(struct ieee80211_node *ni, const uint8_t *ie) } /* - * Handle 11n channel switch. Use the received HT ie's to - * identify the right channel to use. If we cannot locate it - * in the channel table then fallback to legacy operation. + * Handle 11n/11ac channel switch. + * + * Use the received HT/VHT ie's to identify the right channel to use. + * If we cannot locate it in the channel table then fallback to + * legacy operation. + * * Note that we use this information to identify the node's * channel only; the caller is responsible for insuring any * required channel change is done (e.g. in sta mode when * parsing the contents of a beacon frame). */ static int -htinfo_update_chw(struct ieee80211_node *ni, int htflags) +htinfo_update_chw(struct ieee80211_node *ni, int htflags, int vhtflags) { struct ieee80211com *ic = ni->ni_ic; struct ieee80211_channel *c; int chanflags; int ret = 0; - chanflags = (ni->ni_chan->ic_flags &~ IEEE80211_CHAN_HT) | htflags; - if (chanflags != ni->ni_chan->ic_flags) { - /* XXX not right for ht40- */ - c = ieee80211_find_channel(ic, ni->ni_chan->ic_freq, chanflags); - if (c == NULL && (htflags & IEEE80211_CHAN_HT40)) { - /* - * No HT40 channel entry in our table; fall back - * to HT20 operation. This should not happen. - */ - c = findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT20); + /* + * First step - do HT/VHT only channel lookup based on operating mode + * flags. This involves masking out the VHT flags as well. + * Otherwise we end up doing the full channel walk each time + * we trigger this, which is expensive. + */ + chanflags = (ni->ni_chan->ic_flags &~ + (IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)) | htflags | vhtflags; + + if (chanflags == ni->ni_chan->ic_flags) + goto done; + + /* + * If HT /or/ VHT flags have changed then check both. + * We need to start by picking a HT channel anyway. + */ + + c = NULL; + chanflags = (ni->ni_chan->ic_flags &~ + (IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)) | htflags; + /* XXX not right for ht40- */ + c = ieee80211_find_channel(ic, ni->ni_chan->ic_freq, chanflags); + if (c == NULL && (htflags & IEEE80211_CHAN_HT40)) { + /* + * No HT40 channel entry in our table; fall back + * to HT20 operation. This should not happen. + */ + c = findhtchan(ic, ni->ni_chan, IEEE80211_CHAN_HT20); #if 0 - IEEE80211_NOTE(ni->ni_vap, - IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, - "no HT40 channel (freq %u), falling back to HT20", - ni->ni_chan->ic_freq); + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, + "no HT40 channel (freq %u), falling back to HT20", + ni->ni_chan->ic_freq); #endif - /* XXX stat */ - } - if (c != NULL && c != ni->ni_chan) { - IEEE80211_NOTE(ni->ni_vap, - IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, - "switch station to HT%d channel %u/0x%x", - IEEE80211_IS_CHAN_HT40(c) ? 40 : 20, - c->ic_freq, c->ic_flags); - ni->ni_chan = c; - ret = 1; - } - /* NB: caller responsible for forcing any channel change */ + /* XXX stat */ } - /* update node's tx channel width */ + + /* Nothing found - leave it alone; move onto VHT */ + if (c == NULL) + c = ni->ni_chan; + + /* + * If it's non-HT, then bail out now. + */ + if (! IEEE80211_IS_CHAN_HT(c)) { + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, + "not HT; skipping VHT check (%u/0x%x)", + c->ic_freq, c->ic_flags); + goto done; + } + + /* + * Next step - look at the current VHT flags and determine + * if we need to upgrade. Mask out the VHT and HT flags since + * the vhtflags field will already have the correct HT + * flags to use. + */ + if (IEEE80211_CONF_VHT(ic) && ni->ni_vhtcap != 0 && vhtflags != 0) { + chanflags = (c->ic_flags + &~ (IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT)) + | vhtflags; + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, + ni, + "%s: VHT; chanwidth=0x%02x; vhtflags=0x%08x", + __func__, ni->ni_vht_chanwidth, vhtflags); + + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, + ni, + "%s: VHT; trying lookup for %d/0x%08x", + __func__, c->ic_freq, chanflags); + c = ieee80211_find_channel(ic, c->ic_freq, chanflags); + } + + /* Finally, if it's changed */ + if (c != NULL && c != ni->ni_chan) { + IEEE80211_NOTE(ni->ni_vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, ni, + "switch station to %s%d channel %u/0x%x", + IEEE80211_IS_CHAN_VHT(c) ? "VHT" : "HT", + IEEE80211_IS_CHAN_VHT80(c) ? 80 : + (IEEE80211_IS_CHAN_HT40(c) ? 40 : 20), + c->ic_freq, c->ic_flags); + ni->ni_chan = c; + ret = 1; + } + /* NB: caller responsible for forcing any channel change */ + +done: + /* update node's (11n) tx channel width */ ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan)? 40 : 20; return (ret); } @@ -1587,15 +1652,18 @@ htcap_update_shortgi(struct ieee80211_node *ni) /* * Parse and update HT-related state extracted from * the HT cap and info ie's. + * + * This is called from the STA management path and + * the ieee80211_node_join() path. It will take into + * account the IEs discovered during scanning and + * adjust things accordingly. */ -int +void ieee80211_ht_updateparams(struct ieee80211_node *ni, const uint8_t *htcapie, const uint8_t *htinfoie) { struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_ie_htinfo *htinfo; - int htflags; - int ret = 0; ieee80211_parse_htcap(ni, htcapie); if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) @@ -1607,8 +1675,115 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, htinfo = (const struct ieee80211_ie_htinfo *) htinfoie; htinfo_parse(ni, htinfo); + /* + * Defer the node channel change; we need to now + * update VHT parameters before we do it. + */ + + if ((htinfo->hi_byte1 & IEEE80211_HTINFO_RIFSMODE_PERM) && + (vap->iv_flags_ht & IEEE80211_FHT_RIFS)) + ni->ni_flags |= IEEE80211_NODE_RIFS; + else + ni->ni_flags &= ~IEEE80211_NODE_RIFS; +} + +static uint32_t +ieee80211_vht_get_vhtflags(struct ieee80211_node *ni, uint32_t htflags) +{ + struct ieee80211vap *vap = ni->ni_vap; + uint32_t vhtflags = 0; + + vhtflags = 0; + if (ni->ni_flags & IEEE80211_NODE_VHT && vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + if ((ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_160MHZ) && + /* XXX 2 means "160MHz and 80+80MHz", 1 means "160MHz" */ + (MS(vap->iv_vhtcaps, + IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= 1) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT160)) { + vhtflags = IEEE80211_CHAN_VHT160; + /* Mirror the HT40 flags */ + if (htflags == IEEE80211_CHAN_HT40U) { + vhtflags |= IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D) { + vhtflags |= IEEE80211_CHAN_HT40D; + } + } else if ((ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_80P80MHZ) && + /* XXX 2 means "160MHz and 80+80MHz" */ + (MS(vap->iv_vhtcaps, + IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT80P80)) { + vhtflags = IEEE80211_CHAN_VHT80_80; + /* Mirror the HT40 flags */ + if (htflags == IEEE80211_CHAN_HT40U) { + vhtflags |= IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D) { + vhtflags |= IEEE80211_CHAN_HT40D; + } + } else if ((ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_80MHZ) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT80)) { + vhtflags = IEEE80211_CHAN_VHT80; + /* Mirror the HT40 flags */ + if (htflags == IEEE80211_CHAN_HT40U) { + vhtflags |= IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D) { + vhtflags |= IEEE80211_CHAN_HT40D; + } + } else if (ni->ni_vht_chanwidth == IEEE80211_VHT_CHANWIDTH_USE_HT) { + /* Mirror the HT40 flags */ + /* + * XXX TODO: if ht40 is disabled, but vht40 isn't + * disabled then this logic will get very, very sad. + * It's quite possible the only sane thing to do is + * to not have vht40 as an option, and just obey + * 'ht40' as that flag. + */ + if ((htflags == IEEE80211_CHAN_HT40U) && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT40)) { + vhtflags = IEEE80211_CHAN_VHT40U + | IEEE80211_CHAN_HT40U; + } else if (htflags == IEEE80211_CHAN_HT40D && + (vap->iv_flags_vht & IEEE80211_FVHT_USEVHT40)) { + vhtflags = IEEE80211_CHAN_VHT40D + | IEEE80211_CHAN_HT40D; + } else if (htflags == IEEE80211_CHAN_HT20) { + vhtflags = IEEE80211_CHAN_VHT20 + | IEEE80211_CHAN_HT20; + } + } else { + vhtflags = IEEE80211_CHAN_VHT20; + } + } + return (vhtflags); +} + +/* + * Final part of updating the HT parameters. + * + * This is called from the STA management path and + * the ieee80211_node_join() path. It will take into + * account the IEs discovered during scanning and + * adjust things accordingly. + * + * This is done after a call to ieee80211_ht_updateparams() + * because it (and the upcoming VHT version of updateparams) + * needs to ensure everything is parsed before htinfo_update_chw() + * is called - which will change the channel config for the + * node for us. + */ +int +ieee80211_ht_updateparams_final(struct ieee80211_node *ni, + const uint8_t *htcapie, const uint8_t *htinfoie) +{ + struct ieee80211vap *vap = ni->ni_vap; + const struct ieee80211_ie_htinfo *htinfo; + int htflags, vhtflags; + int ret = 0; + + htinfo = (const struct ieee80211_ie_htinfo *) htinfoie; + htflags = (vap->iv_flags_ht & IEEE80211_FHT_HT) ? IEEE80211_CHAN_HT20 : 0; + /* NB: honor operating mode constraint */ if ((htinfo->hi_byte1 & IEEE80211_HTINFO_TXWIDTH_2040) && (vap->iv_flags_ht & IEEE80211_FHT_USEHT40)) { @@ -1617,14 +1792,16 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, else if (ni->ni_ht2ndchan == IEEE80211_HTINFO_2NDCHAN_BELOW) htflags = IEEE80211_CHAN_HT40D; } - if (htinfo_update_chw(ni, htflags)) - ret = 1; - if ((htinfo->hi_byte1 & IEEE80211_HTINFO_RIFSMODE_PERM) && - (vap->iv_flags_ht & IEEE80211_FHT_RIFS)) - ni->ni_flags |= IEEE80211_NODE_RIFS; - else - ni->ni_flags &= ~IEEE80211_NODE_RIFS; + /* + * VHT flags - do much the same; check whether VHT is available + * and if so, what our ideal channel use would be based on our + * capabilities and the (pre-parsed) VHT info IE. + */ + vhtflags = ieee80211_vht_get_vhtflags(ni, htflags); + + if (htinfo_update_chw(ni, htflags, vhtflags)) + ret = 1; return (ret); } @@ -1632,17 +1809,31 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, /* * Parse and update HT-related state extracted from the HT cap ie * for a station joining an HT BSS. + * + * This is called from the hostap path for each station. */ void ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie) { struct ieee80211vap *vap = ni->ni_vap; - int htflags; ieee80211_parse_htcap(ni, htcapie); if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) htcap_update_mimo_ps(ni); htcap_update_shortgi(ni); +} + +/* + * Called once HT and VHT capabilities are parsed in hostap mode - + * this will adjust the channel configuration of the given node + * based on the configuration and capabilities. + */ +void +ieee80211_ht_updatehtcap_final(struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + int htflags; + int vhtflags; /* NB: honor operating mode constraint */ /* XXX 40 MHz intolerant */ @@ -1655,7 +1846,14 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie) else if (IEEE80211_IS_CHAN_HT40D(vap->iv_bss->ni_chan)) htflags = IEEE80211_CHAN_HT40D; } - (void) htinfo_update_chw(ni, htflags); + /* + * VHT flags - do much the same; check whether VHT is available + * and if so, what our ideal channel use would be based on our + * capabilities and the (pre-parsed) VHT info IE. + */ + vhtflags = ieee80211_vht_get_vhtflags(ni, htflags); + + (void) htinfo_update_chw(ni, htflags, vhtflags); } /* @@ -2135,6 +2333,7 @@ ht_recv_action_ht_txchwidth(struct ieee80211_node *ni, "%s: HT txchwidth, width %d%s", __func__, chw, ni->ni_chw != chw ? "*" : ""); if (chw != ni->ni_chw) { + /* XXX does this need to change the ht40 station count? */ ni->ni_chw = chw; /* XXX notify on change */ } @@ -2229,6 +2428,10 @@ ieee80211_ampdu_request(struct ieee80211_node *ni, dialogtoken = (tokens+1) % 63; /* XXX */ tid = tap->txa_tid; + + /* + * XXX TODO: This is racy with any other parallel TX going on. :( + */ tap->txa_start = ni->ni_txseqs[tid]; args[0] = dialogtoken; diff --git a/sys/net80211/ieee80211_ht.h b/sys/net80211/ieee80211_ht.h index dfc7d1c312a0..b34d4edf3895 100644 --- a/sys/net80211/ieee80211_ht.h +++ b/sys/net80211/ieee80211_ht.h @@ -201,9 +201,12 @@ void ieee80211_htprot_update(struct ieee80211com *, int protmode); void ieee80211_ht_timeout(struct ieee80211com *); void ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *); void ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *); -int ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *, +void ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *, const uint8_t *); +int ieee80211_ht_updateparams_final(struct ieee80211_node *, + const uint8_t *, const uint8_t *); void ieee80211_ht_updatehtcap(struct ieee80211_node *, const uint8_t *); +void ieee80211_ht_updatehtcap_final(struct ieee80211_node *); int ieee80211_ampdu_request(struct ieee80211_node *, struct ieee80211_tx_ampdu *); void ieee80211_ampdu_stop(struct ieee80211_node *, diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 3f50268bedce..8af041eb8533 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -494,6 +494,8 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, scan->status = 0; /* * beacon/probe response frame format + * + * XXX Update from 802.11-2012 - eg where HT is * [8] time stamp * [2] beacon interval * [2] capability information @@ -508,6 +510,8 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, * [tlv] WPA or RSN * [tlv] HT capabilities * [tlv] HT information + * [tlv] VHT capabilities + * [tlv] VHT information * [tlv] Atheros capabilities * [tlv] Mesh ID * [tlv] Mesh Configuration @@ -585,6 +589,12 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, case IEEE80211_ELEMID_HTCAP: scan->htcap = frm; break; + case IEEE80211_ELEMID_VHT_CAP: + scan->vhtcap = frm; + break; + case IEEE80211_ELEMID_VHT_OPMODE: + scan->vhtopmode = frm; + break; case IEEE80211_ELEMID_RSN: scan->rsn = frm; break; @@ -718,6 +728,19 @@ ieee80211_parse_beacon(struct ieee80211_node *ni, struct mbuf *m, sizeof(struct ieee80211_ie_htinfo)-2, scan->htinfo = NULL); } + + /* Process VHT IEs */ + if (scan->vhtcap != NULL) { + IEEE80211_VERIFY_LENGTH(scan->vhtcap[1], + sizeof(struct ieee80211_ie_vhtcap) - 2, + scan->vhtcap = NULL); + } + if (scan->vhtopmode != NULL) { + IEEE80211_VERIFY_LENGTH(scan->vhtopmode[1], + sizeof(struct ieee80211_ie_vht_operation) - 2, + scan->vhtopmode = NULL); + } + return scan->status; } @@ -838,6 +861,9 @@ ieee80211_parse_action(struct ieee80211_node *ni, struct mbuf *m) } break; #endif + case IEEE80211_ACTION_CAT_VHT: + printf("%s: TODO: VHT handling!\n", __func__); + break; } return 0; } diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index c08051f68272..45899c0b3210 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -412,7 +413,11 @@ ieee80211_create_ibss(struct ieee80211vap* vap, struct ieee80211_channel *chan) /* XXX TODO: other bits and pieces - eg fast-frames? */ /* If we're an 11n channel then initialise the 11n bits */ - if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { + if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { + /* XXX what else? */ + ieee80211_ht_node_init(ni); + ieee80211_vht_node_init(ni); + } else if (IEEE80211_IS_CHAN_HT(ni->ni_chan)) { /* XXX what else? */ ieee80211_ht_node_init(ni); } @@ -707,10 +712,43 @@ gethtadjustflags(struct ieee80211com *ic) return flags; } +/* + * Calculate VHT channel promotion flags for all vaps. + * This assumes ni_chan have been setup for each vap. + */ +static int +getvhtadjustflags(struct ieee80211com *ic) +{ + struct ieee80211vap *vap; + int flags; + + flags = 0; + /* XXX locking */ + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + if (vap->iv_state < IEEE80211_S_RUN) + continue; + switch (vap->iv_opmode) { + case IEEE80211_M_WDS: + case IEEE80211_M_STA: + case IEEE80211_M_AHDEMO: + case IEEE80211_M_HOSTAP: + case IEEE80211_M_IBSS: + case IEEE80211_M_MBSS: + flags |= ieee80211_vhtchanflags(vap->iv_bss->ni_chan); + break; + default: + break; + } + } + return flags; +} + /* * Check if the current channel needs to change based on whether * any vap's are using HT20/HT40. This is used to sync the state * of ic_curchan after a channel width change on a running vap. + * + * Same applies for VHT. */ void ieee80211_sync_curchan(struct ieee80211com *ic) @@ -718,6 +756,8 @@ ieee80211_sync_curchan(struct ieee80211com *ic) struct ieee80211_channel *c; c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, gethtadjustflags(ic)); + c = ieee80211_vht_adjust_channel(ic, c, getvhtadjustflags(ic)); + if (c != ic->ic_curchan) { ic->ic_curchan = c; ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); @@ -743,10 +783,23 @@ ieee80211_setupcurchan(struct ieee80211com *ic, struct ieee80211_channel *c) * set of running vap's. This assumes we are called * after ni_chan is setup for each vap. */ + /* XXX VHT? */ /* NB: this assumes IEEE80211_FHT_USEHT40 > IEEE80211_FHT_HT */ if (flags > ieee80211_htchanflags(c)) c = ieee80211_ht_adjust_channel(ic, c, flags); } + + /* + * VHT promotion - this will at least promote to VHT20/40 + * based on what HT has done; it may further promote the + * channel to VHT80 or above. + */ + if (ic->ic_vhtcaps != 0) { + int flags = getvhtadjustflags(ic); + if (flags > ieee80211_vhtchanflags(c)) + c = ieee80211_vht_adjust_channel(ic, c, flags); + } + ic->ic_bsschan = ic->ic_curchan = c; ic->ic_curmode = ieee80211_chan2mode(ic->ic_curchan); ic->ic_rt = ieee80211_get_ratetable(ic->ic_curchan); @@ -849,6 +902,7 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; + int do_ht = 0; ni = ieee80211_alloc_node(&ic->ic_sta, vap, se->se_macaddr); if (ni == NULL) { @@ -896,9 +950,13 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, if (ni->ni_ies.tdma_ie != NULL) ieee80211_parse_tdma(ni, ni->ni_ies.tdma_ie); #endif + if (ni->ni_ies.vhtcap_ie != NULL) + ieee80211_parse_vhtcap(ni, ni->ni_ies.vhtcap_ie); + if (ni->ni_ies.vhtopmode_ie != NULL) + ieee80211_parse_vhtopmode(ni, ni->ni_ies.vhtopmode_ie); - /* XXX parse VHT IEs */ /* XXX parse BSSLOAD IE */ + /* XXX parse TXPWRENV IE */ /* XXX parse APCHANREP IE */ } @@ -926,10 +984,43 @@ ieee80211_sta_join(struct ieee80211vap *vap, struct ieee80211_channel *chan, ieee80211_ht_updateparams(ni, ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie); + do_ht = 1; + } + + /* + * Setup VHT state for this node if it's available. + * Same as the above. + * + * For now, don't allow 2GHz VHT operation. + */ + if (ni->ni_ies.vhtopmode_ie != NULL && + ni->ni_ies.vhtcap_ie != NULL && + vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { + printf("%s: BSS %6D: 2GHz channel, VHT info; ignoring\n", + __func__, + ni->ni_macaddr, + ":"); + } else { + ieee80211_vht_node_init(ni); + ieee80211_vht_updateparams(ni, + ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + ieee80211_setup_vht_rates(ni, ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + do_ht = 1; + } + } + + /* Finally do the node channel change */ + if (do_ht) { + ieee80211_ht_updateparams_final(ni, ni->ni_ies.htcap_ie, + ni->ni_ies.htinfo_ie); ieee80211_setup_htrates(ni, ni->ni_ies.htcap_ie, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, ni->ni_ies.htinfo_ie); } + /* XXX else check for ath FF? */ /* XXX QoS? Difficult given that WME config is specific to a master */ @@ -1102,8 +1193,10 @@ node_cleanup(struct ieee80211_node *ni) "power save mode off, %u sta's in ps mode", vap->iv_ps_sta); } /* - * Cleanup any HT-related state. + * Cleanup any VHT and HT-related state. */ + if (ni->ni_flags & IEEE80211_NODE_VHT) + ieee80211_vht_node_cleanup(ni); if (ni->ni_flags & IEEE80211_NODE_HT) ieee80211_ht_node_cleanup(ni); #ifdef IEEE80211_SUPPORT_SUPERG @@ -1423,6 +1516,7 @@ ieee80211_node_create_wds(struct ieee80211vap *vap, if (vap->iv_flags & IEEE80211_F_FF) ni->ni_flags |= IEEE80211_NODE_FF; #endif + /* XXX VHT */ if ((ic->ic_htcaps & IEEE80211_HTC_HT) && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { /* @@ -1431,6 +1525,9 @@ ieee80211_node_create_wds(struct ieee80211vap *vap, * ni_chan will be adjusted to an HT channel. */ ieee80211_ht_wds_init(ni); + if (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + printf("%s: TODO: vht_wds_init\n", __func__); + } } else { struct ieee80211_channel *c = ni->ni_chan; /* @@ -1638,7 +1735,7 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_scanparams *sp) { - int do_ht_setup = 0; + int do_ht_setup = 0, do_vht_setup = 0; ni->ni_esslen = sp->ssid[1]; memcpy(ni->ni_essid, sp->ssid + 2, sp->ssid[1]); @@ -1670,11 +1767,23 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, if (ni->ni_ies.htinfo_ie != NULL) ieee80211_parse_htinfo(ni, ni->ni_ies.htinfo_ie); + if (ni->ni_ies.vhtcap_ie != NULL) + ieee80211_parse_vhtcap(ni, ni->ni_ies.vhtcap_ie); + if (ni->ni_ies.vhtopmode_ie != NULL) + ieee80211_parse_vhtopmode(ni, ni->ni_ies.vhtopmode_ie); + if ((ni->ni_ies.htcap_ie != NULL) && (ni->ni_ies.htinfo_ie != NULL) && (ni->ni_vap->iv_flags_ht & IEEE80211_FHT_HT)) { do_ht_setup = 1; } + + if ((ni->ni_ies.vhtcap_ie != NULL) && + (ni->ni_ies.vhtopmode_ie != NULL) && + (ni->ni_vap->iv_flags_vht & IEEE80211_FVHT_VHT)) { + do_vht_setup = 1; + } + } /* NB: must be after ni_chan is setup */ @@ -1692,15 +1801,40 @@ ieee80211_init_neighbor(struct ieee80211_node *ni, ieee80211_ht_updateparams(ni, ni->ni_ies.htcap_ie, ni->ni_ies.htinfo_ie); + + if (do_vht_setup) { + if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { + printf("%s: BSS %6D: 2GHz channel, VHT info; ignoring\n", + __func__, + ni->ni_macaddr, + ":"); + } else { + ieee80211_vht_node_init(ni); + ieee80211_vht_updateparams(ni, + ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + ieee80211_setup_vht_rates(ni, + ni->ni_ies.vhtcap_ie, + ni->ni_ies.vhtopmode_ie); + } + } + + /* + * Finally do the channel upgrade/change based + * on the HT/VHT configuration. + */ + ieee80211_ht_updateparams_final(ni, ni->ni_ies.htcap_ie, + ni->ni_ies.htinfo_ie); ieee80211_setup_htrates(ni, ni->ni_ies.htcap_ie, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, ni->ni_ies.htinfo_ie); + ieee80211_node_setuptxparms(ni); ieee80211_ratectl_node_init(ni); - /* Reassociate; we're now 11n */ + /* Reassociate; we're now 11n/11ac */ /* * XXX TODO: this is the wrong thing to do - * we're calling it with isnew=1 so the ath(4) @@ -2365,6 +2499,7 @@ ieee80211_node_timeout(void *arg) IEEE80211_LOCK(ic); ieee80211_erp_timeout(ic); ieee80211_ht_timeout(ic); + ieee80211_vht_timeout(ic); IEEE80211_UNLOCK(ic); } callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, @@ -2462,8 +2597,12 @@ ieee80211_dump_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni) printf("\thtcap %x htparam %x htctlchan %u ht2ndchan %u\n", ni->ni_htcap, ni->ni_htparam, ni->ni_htctlchan, ni->ni_ht2ndchan); - printf("\thtopmode %x htstbc %x chw %u\n", + printf("\thtopmode %x htstbc %x htchw %u\n", ni->ni_htopmode, ni->ni_htstbc, ni->ni_chw); + printf("\tvhtcap %x freq1 %d freq2 %d vhtbasicmcs %x\n", + ni->ni_vhtcap, (int) ni->ni_vht_chan1, (int) ni->ni_vht_chan2, + (int) ni->ni_vht_basicmcs); + /* XXX VHT state */ } void @@ -2594,6 +2733,8 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) ieee80211_ht_node_join(ni); + if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) + ieee80211_vht_node_join(ni); if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && IEEE80211_IS_CHAN_FULL(ic->ic_bsschan)) ieee80211_node_join_11g(ni); @@ -2603,6 +2744,9 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) } else newassoc = 0; + /* + * XXX VHT - should log VHT channel width, etc + */ IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, "station associated at aid %d: %s preamble, %s slot time%s%s%s%s%s%s%s%s", IEEE80211_NODE_AID(ni), @@ -2610,6 +2754,7 @@ ieee80211_node_join(struct ieee80211_node *ni, int resp) ic->ic_flags & IEEE80211_F_SHSLOT ? "short" : "long", ic->ic_flags & IEEE80211_F_USEPROT ? ", protection" : "", ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", + /* XXX update for VHT string */ ni->ni_flags & IEEE80211_NODE_HT ? (ni->ni_chw == 40 ? ", HT40" : ", HT20") : "", ni->ni_flags & IEEE80211_NODE_AMPDU ? " (+AMPDU)" : "", @@ -2774,6 +2919,8 @@ ieee80211_node_leave(struct ieee80211_node *ni) vap->iv_sta_assoc--; ic->ic_sta_assoc--; + if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) + ieee80211_vht_node_leave(ni); if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) ieee80211_ht_node_leave(ni); if (IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan) && diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index c71f8541085b..09a9b00668a0 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #if defined(INET) || defined(INET6) #include @@ -764,6 +765,16 @@ ieee80211_send_setup( } *(uint16_t *)&wh->i_dur[0] = 0; + /* + * XXX TODO: this is what the TX lock is for. + * Here we're incrementing sequence numbers, and they + * need to be in lock-step with what the driver is doing + * both in TX ordering and crypto encap (IV increment.) + * + * If the driver does seqno itself, then we can skip + * assigning sequence numbers here, and we can avoid + * requiring the TX lock. + */ tap = &ni->ni_tx_ampdu[tid]; if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap)) m->m_flags |= M_AMPDU_MPDU; @@ -1542,6 +1553,11 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, if (is_amsdu) qos[0] |= IEEE80211_QOS_AMSDU; + /* + * XXX TODO TX lock is needed for atomic updates of sequence + * numbers. If the driver does it, then don't do it here; + * and we don't need the TX lock held. + */ if ((m->m_flags & M_AMPDU_MPDU) == 0) { /* * NB: don't assign a sequence # to potential @@ -1561,6 +1577,11 @@ ieee80211_encap(struct ieee80211vap *vap, struct ieee80211_node *ni, M_SEQNO_SET(m, seqno); } } else { + /* + * XXX TODO TX lock is needed for atomic updates of sequence + * numbers. If the driver does it, then don't do it here; + * and we don't need the TX lock held. + */ seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; *(uint16_t *)wh->i_seq = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); @@ -2065,6 +2086,7 @@ ieee80211_add_qos(uint8_t *frm, const struct ieee80211_node *ni) * Send a probe request frame with the specified ssid * and any optional information element data. */ +/* XXX VHT? */ int ieee80211_send_probereq(struct ieee80211_node *ni, const uint8_t sa[IEEE80211_ADDR_LEN], @@ -2111,6 +2133,7 @@ ieee80211_send_probereq(struct ieee80211_node *ni, * [tlv] RSN (optional) * [tlv] extended supported rates * [tlv] HT cap (optional) + * [tlv] VHT cap (optional) * [tlv] WPA (optional) * [tlv] user-specified ie's */ @@ -2119,7 +2142,8 @@ ieee80211_send_probereq(struct ieee80211_node *ni, 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE + sizeof(struct ieee80211_ie_htcap) - + sizeof(struct ieee80211_ie_htinfo) + + sizeof(struct ieee80211_ie_vhtcap) + + sizeof(struct ieee80211_ie_htinfo) /* XXX not needed? */ + sizeof(struct ieee80211_ie_wpa) + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) + sizeof(struct ieee80211_ie_wpa) @@ -2159,6 +2183,21 @@ ieee80211_send_probereq(struct ieee80211_node *ni, frm = ieee80211_add_htcap_ch(frm, vap, c); } + /* + * XXX TODO: need to figure out what/how to update the + * VHT channel. + */ +#if 0 + (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { + struct ieee80211_channel *c; + + c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, + vap->iv_flags_ht); + c = ieee80211_vht_adjust_channel(ic, c, vap->iv_flags_vht); + frm = ieee80211_add_vhtcap_ch(frm, vap, c); + } +#endif + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); @@ -2357,6 +2396,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) case IEEE80211_FC0_SUBTYPE_ASSOC_REQ: case IEEE80211_FC0_SUBTYPE_REASSOC_REQ: + /* XXX VHT? */ /* * asreq frame format * [2] capability information @@ -2368,6 +2408,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * [4] power capability (optional) * [28] supported channels (optional) * [tlv] HT capabilities + * [tlv] VHT capabilities * [tlv] WME (optional) * [tlv] Vendor OUI HT capabilities (optional) * [tlv] Atheros capabilities (if negotiated) @@ -2385,6 +2426,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) + 2 + 26 + sizeof(struct ieee80211_wme_info) + sizeof(struct ieee80211_ie_htcap) + + sizeof(struct ieee80211_ie_vhtcap) + 4 + sizeof(struct ieee80211_ie_htcap) #ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) @@ -2449,6 +2491,14 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) ni->ni_ies.htcap_ie[0] == IEEE80211_ELEMID_HTCAP) { frm = ieee80211_add_htcap(frm, ni); } + + if ((vap->iv_flags_vht & IEEE80211_FVHT_VHT) && + IEEE80211_IS_CHAN_VHT(ni->ni_chan) && + ni->ni_ies.vhtcap_ie != NULL && + ni->ni_ies.vhtcap_ie[0] == IEEE80211_ELEMID_VHT_CAP) { + frm = ieee80211_add_vhtcap(frm, ni); + } + frm = ieee80211_add_wpa(frm, vap); if ((ic->ic_flags & IEEE80211_F_WME) && ni->ni_ies.wme_ie != NULL) @@ -2492,6 +2542,8 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * [tlv] extended supported rates * [tlv] HT capabilities (standard, if STA enabled) * [tlv] HT information (standard, if STA enabled) + * [tlv] VHT capabilities (standard, if STA enabled) + * [tlv] VHT information (standard, if STA enabled) * [tlv] WME (if configured and STA enabled) * [tlv] HT capabilities (vendor OUI, if STA enabled) * [tlv] HT information (vendor OUI, if STA enabled) @@ -2507,6 +2559,8 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) + sizeof(struct ieee80211_ie_htcap) + 4 + sizeof(struct ieee80211_ie_htinfo) + 4 + + sizeof(struct ieee80211_ie_vhtcap) + + sizeof(struct ieee80211_ie_vht_operation) + sizeof(struct ieee80211_wme_param) #ifdef IEEE80211_SUPPORT_SUPERG + sizeof(struct ieee80211_ath_ie) @@ -2545,6 +2599,10 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) frm = ieee80211_add_htcap_vendor(frm, ni); frm = ieee80211_add_htinfo_vendor(frm, ni); } + if (ni->ni_flags & IEEE80211_NODE_VHT) { + frm = ieee80211_add_vhtcap(frm, ni); + frm = ieee80211_add_vhtinfo(frm, ni); + } #ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS)) frm = ieee80211_add_ath(frm, @@ -2600,6 +2658,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int type, int arg) * Space is left to prepend and 802.11 header at the * front but it's left to the caller to fill in. */ +/* XXX VHT? */ struct mbuf * ieee80211_alloc_proberesp(struct ieee80211_node *bss, int legacy) { @@ -2934,6 +2993,7 @@ ieee80211_tx_mgt_cb(struct ieee80211_node *ni, void *arg, int status) } } +/* XXX VHT? */ static void ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, struct ieee80211_node *ni) @@ -2946,6 +3006,10 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, /* * beacon frame format + * + * TODO: update to 802.11-2012; a lot of stuff has changed; + * vendor extensions should be at the end, etc. + * * [8] time stamp * [2] beacon interval * [2] cabability information @@ -2957,11 +3021,34 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, * [tlv] country (optional) * [3] power control (optional) * [5] channel switch announcement (CSA) (optional) + * XXX TODO: Quiet + * XXX TODO: IBSS DFS + * XXX TODO: TPC report * [tlv] extended rate phy (ERP) * [tlv] extended supported rates * [tlv] RSN parameters + * XXX TODO: BSSLOAD + * (XXX EDCA parameter set, QoS capability?) + * XXX TODO: AP channel report + * * [tlv] HT capabilities * [tlv] HT information + * XXX TODO: 20/40 BSS coexistence + * Mesh: + * XXX TODO: Meshid + * XXX TODO: mesh config + * XXX TODO: mesh awake window + * XXX TODO: beacon timing (mesh, etc) + * XXX TODO: MCCAOP Advertisement Overview + * XXX TODO: MCCAOP Advertisement + * XXX TODO: Mesh channel switch parameters + * VHT: + * XXX TODO: VHT capabilities + * XXX TODO: VHT operation + * XXX TODO: VHT transmit power envelope + * XXX TODO: channel switch wrapper element + * XXX TODO: extended BSS load element + * * XXX Vendor-specific OIDs (e.g. Atheros) * [tlv] WPA parameters * [tlv] WME parameters @@ -3055,6 +3142,16 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, bo->bo_htinfo = frm; frm = ieee80211_add_htinfo(frm, ni); } + + if (IEEE80211_IS_CHAN_VHT(ni->ni_chan)) { + frm = ieee80211_add_vhtcap(frm, ni); + bo->bo_vhtinfo = frm; + frm = ieee80211_add_vhtinfo(frm, ni); + /* Transmit power envelope */ + /* Channel switch wrapper element */ + /* Extended bss load element */ + } + frm = ieee80211_add_wpa(frm, vap); if (vap->iv_flags & IEEE80211_F_WME) { bo->bo_wme = frm; @@ -3065,6 +3162,7 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, frm = ieee80211_add_htcap_vendor(frm, ni); frm = ieee80211_add_htinfo_vendor(frm, ni); } + #ifdef IEEE80211_SUPPORT_SUPERG if (vap->iv_flags & IEEE80211_F_ATHEROS) { bo->bo_ath = frm; @@ -3082,6 +3180,8 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, bo->bo_appie_len = vap->iv_appie_beacon->ie_len; frm = add_appie(frm, vap->iv_appie_beacon); } + + /* XXX TODO: move meshid/meshconf up to before vendor extensions? */ #ifdef IEEE80211_SUPPORT_MESH if (vap->iv_opmode == IEEE80211_M_MBSS) { frm = ieee80211_add_meshid(frm, vap); @@ -3097,6 +3197,7 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, /* * Allocate a beacon frame and fillin the appropriate bits. */ +/* XXX VHT? */ struct mbuf * ieee80211_beacon_alloc(struct ieee80211_node *ni) { @@ -3110,6 +3211,9 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) /* * beacon frame format + * + * Note: This needs updating for 802.11-2012. + * * [8] time stamp * [2] beacon interval * [2] cabability information @@ -3126,6 +3230,8 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) * [tlv] RSN parameters * [tlv] HT capabilities * [tlv] HT information + * [tlv] VHT capabilities + * [tlv] VHT operation * [tlv] Vendor OUI HT capabilities (optional) * [tlv] Vendor OUI HT information (optional) * XXX Vendor-specific OIDs (e.g. Atheros) @@ -3138,6 +3244,7 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) * NB: we allocate the max space required for the TIM bitmap. * XXX how big is this? */ + /* XXX VHT? */ pktlen = 8 /* time stamp */ + sizeof(uint16_t) /* beacon interval */ + sizeof(uint16_t) /* capabilities */ @@ -3157,6 +3264,8 @@ ieee80211_beacon_alloc(struct ieee80211_node *ni) /* XXX conditional? */ + 4+2*sizeof(struct ieee80211_ie_htcap)/* HT caps */ + 4+2*sizeof(struct ieee80211_ie_htinfo)/* HT info */ + + sizeof(struct ieee80211_ie_vhtcap)/* VHT caps */ + + sizeof(struct ieee80211_ie_vht_operation)/* VHT info */ + (vap->iv_caps & IEEE80211_C_WME ? /* WME */ sizeof(struct ieee80211_wme_param) : 0) #ifdef IEEE80211_SUPPORT_SUPERG @@ -3242,6 +3351,15 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) } wh = mtod(m, struct ieee80211_frame *); + + /* + * XXX TODO Strictly speaking this should be incremented with the TX + * lock held so as to serialise access to the non-qos TID sequence + * number space. + * + * If the driver identifies it does its own TX seqno management then + * we can skip this (and still not do the TX seqno.) + */ seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]++; *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); @@ -3347,6 +3465,10 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) timoff = 0; timlen = 1; } + + /* + * TODO: validate this! + */ if (timlen != bo->bo_tim_len) { /* copy up/down trailer */ int adjust = tie->tim_bitmap+timlen @@ -3357,6 +3479,7 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) bo->bo_tim_trailer += adjust; bo->bo_erp += adjust; bo->bo_htinfo += adjust; + bo->bo_vhtinfo += adjust; #ifdef IEEE80211_SUPPORT_SUPERG bo->bo_ath += adjust; #endif @@ -3411,6 +3534,7 @@ ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) memmove(&csa[1], csa, bo->bo_csa_trailer_len); bo->bo_erp += sizeof(*csa); bo->bo_htinfo += sizeof(*csa); + bo->bo_vhtinfo += sizeof(*csa); bo->bo_wme += sizeof(*csa); #ifdef IEEE80211_SUPPORT_SUPERG bo->bo_ath += sizeof(*csa); diff --git a/sys/net80211/ieee80211_scan_sta.c b/sys/net80211/ieee80211_scan_sta.c index 82d65c6ecf73..29e4db849a90 100644 --- a/sys/net80211/ieee80211_scan_sta.c +++ b/sys/net80211/ieee80211_scan_sta.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include @@ -325,14 +326,33 @@ sta_add(struct ieee80211_scan_state *ss, } } else ise->se_chan = curchan; + + /* VHT demotion */ + if (IEEE80211_IS_CHAN_VHT(ise->se_chan) && sp->vhtcap == NULL) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N, + "%s: demoting VHT->HT %d/0x%08x\n", + __func__, ise->se_chan->ic_freq, ise->se_chan->ic_flags); + /* Demote legacy networks to a non-VHT channel. */ + c = ieee80211_find_channel(ic, ise->se_chan->ic_freq, + ise->se_chan->ic_flags & ~IEEE80211_CHAN_VHT); + KASSERT(c != NULL, + ("no non-VHT channel %u", ise->se_chan->ic_ieee)); + ise->se_chan = c; + } + + /* HT demotion */ if (IEEE80211_IS_CHAN_HT(ise->se_chan) && sp->htcap == NULL) { /* Demote legacy networks to a non-HT channel. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N, + "%s: demoting HT->legacy %d/0x%08x\n", + __func__, ise->se_chan->ic_freq, ise->se_chan->ic_flags); c = ieee80211_find_channel(ic, ise->se_chan->ic_freq, ise->se_chan->ic_flags & ~IEEE80211_CHAN_HT); KASSERT(c != NULL, ("no legacy channel %u", ise->se_chan->ic_ieee)); ise->se_chan = c; } + ise->se_fhdwell = sp->fhdwell; ise->se_fhindex = sp->fhindex; ise->se_erp = sp->erp; @@ -531,10 +551,11 @@ sweepchannels(struct ieee80211_scan_state *ss, struct ieee80211vap *vap, /* * Ignore dynamic turbo channels; we scan them * in normal mode (i.e. not boosted). Likewise - * for HT channels, they get scanned using + * for HT/VHT channels, they get scanned using * legacy rates. */ - if (IEEE80211_IS_CHAN_DTURBO(c) || IEEE80211_IS_CHAN_HT(c)) + if (IEEE80211_IS_CHAN_DTURBO(c) || IEEE80211_IS_CHAN_HT(c) || + IEEE80211_IS_CHAN_VHT(c)) continue; /* @@ -819,6 +840,9 @@ maxrate(const struct ieee80211_scan_entry *se) * that we assume compatibility/usability has already been checked * so we don't need to (e.g. validate whether privacy is supported). * Used to select the best scan candidate for association in a BSS. + * + * TODO: should we take 11n, 11ac into account when selecting the + * best? Right now it just compares frequency band and RSSI. */ static int sta_compare(const struct sta_entry *a, const struct sta_entry *b) @@ -1626,6 +1650,8 @@ adhoc_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) */ chan = ieee80211_ht_adjust_channel(ic, chan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, + chan, vap->iv_flags_vht); ieee80211_create_ibss(vap, chan); return 1; } @@ -1657,6 +1683,8 @@ adhoc_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) */ chan = ieee80211_ht_adjust_channel(ic, chan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, + chan, vap->iv_flags_vht); if (!ieee80211_sta_join(vap, chan, &selbs->base)) goto notfound; return 1; /* terminate scan */ @@ -1776,7 +1804,7 @@ static int ap_end(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_channel *bestchan; + struct ieee80211_channel *bestchan, *chan; KASSERT(vap->iv_opmode == IEEE80211_M_HOSTAP, ("wrong opmode %u", vap->iv_opmode)); @@ -1808,8 +1836,10 @@ ap_end(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) ss->ss_flags &= ~IEEE80211_SCAN_NOPICK; return 1; } - ieee80211_create_ibss(vap, - ieee80211_ht_adjust_channel(ic, bestchan, vap->iv_flags_ht)); + chan = ieee80211_ht_adjust_channel(ic, bestchan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, chan, vap->iv_flags_vht); + ieee80211_create_ibss(vap, chan); + return 1; } @@ -1881,10 +1911,14 @@ mesh_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) { struct ieee80211com *ic = vap->iv_ic; + /* XXX VHT */ chan = adhoc_pick_channel(ss, 0); - if (chan != NULL) + if (chan != NULL) { chan = ieee80211_ht_adjust_channel(ic, chan, vap->iv_flags_ht); + chan = ieee80211_vht_adjust_channel(ic, + chan, vap->iv_flags_vht); + } } else chan = vap->iv_des_chan; if (chan != NULL) { diff --git a/sys/net80211/ieee80211_sta.c b/sys/net80211/ieee80211_sta.c index dd9ef6e4d21a..f64232a2b804 100644 --- a/sys/net80211/ieee80211_sta.c +++ b/sys/net80211/ieee80211_sta.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #endif #include #include +#include #define IEEE80211_RATE2MBS(r) (((r) & IEEE80211_RATE_VAL) / 2) @@ -1330,8 +1331,9 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, struct ieee80211_frame *wh; uint8_t *frm, *efrm; uint8_t *rates, *xrates, *wme, *htcap, *htinfo; + uint8_t *vhtcap, *vhtopmode; uint8_t rate; - int ht_state_change = 0; + int ht_state_change = 0, do_ht = 0; wh = mtod(m0, struct ieee80211_frame *); frm = (uint8_t *)&wh[1]; @@ -1430,10 +1432,23 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, if (scan.htcap != NULL && scan.htinfo != NULL && (vap->iv_flags_ht & IEEE80211_FHT_HT)) { /* XXX state changes? */ - if (ieee80211_ht_updateparams(ni, + ieee80211_ht_updateparams(ni, + scan.htcap, scan.htinfo); + do_ht = 1; + } + if (scan.vhtcap != NULL && scan.vhtopmode != NULL && + (vap->iv_flags_vht & IEEE80211_FVHT_VHT)) { + /* XXX state changes? */ + ieee80211_vht_updateparams(ni, + scan.vhtcap, scan.vhtopmode); + do_ht = 1; + } + if (do_ht) { + if (ieee80211_ht_updateparams_final(ni, scan.htcap, scan.htinfo)) ht_state_change = 1; } + if (scan.quiet) ic->ic_set_quiet(ni, scan.quiet); @@ -1660,6 +1675,7 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, frm += 2; rates = xrates = wme = htcap = htinfo = NULL; + vhtcap = vhtopmode = NULL; while (efrm - frm > 1) { IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return); switch (*frm) { @@ -1693,6 +1709,12 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, } /* XXX Atheros OUI support */ break; + case IEEE80211_ELEMID_VHT_CAP: + vhtcap = frm; + break; + case IEEE80211_ELEMID_VHT_OPMODE: + vhtopmode = frm; + break; } frm += frm[1] + 2; } @@ -1737,9 +1759,30 @@ sta_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, int subtype, (vap->iv_flags_ht & IEEE80211_FHT_HT)) { ieee80211_ht_node_init(ni); ieee80211_ht_updateparams(ni, htcap, htinfo); + + if ((vhtcap != NULL) && (vhtopmode != NULL) & + (vap->iv_flags_vht & IEEE80211_FVHT_VHT)) { + /* + * Log if we get a VHT assoc/reassoc response. + * We aren't ready for 2GHz VHT support. + */ + if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) { + printf("%s: peer %6D: VHT on 2GHz, ignoring\n", + __func__, + ni->ni_macaddr, + ":"); + } else { + ieee80211_vht_node_init(ni); + ieee80211_vht_updateparams(ni, vhtcap, vhtopmode); + ieee80211_setup_vht_rates(ni, vhtcap, vhtopmode); + } + } + + ieee80211_ht_updateparams_final(ni, htcap, htinfo); ieee80211_setup_htrates(ni, htcap, IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, htinfo); + ieee80211_node_setuptxparms(ni); ieee80211_ratectl_node_init(ni); } From 321eb9ffbef9274fab016f4bcdd9171adef9ac5e Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Fri, 13 Jan 2017 07:08:14 +0000 Subject: [PATCH 054/126] [net80211] begin laying the groundwork for drivers to do their own sequence number management. I added IEEE80211_TX_LOCK() a few years ago because there were races between seqno allocation, driver queuing and crypto IV allocation. This meant that they'd appear out of sequence and the receiver would drop them, leading to terrible performance or flat out traffic hangs. This flag should be set by drivers that do their own sequence number allocation for all frames it needs to happen for, including beacon frames. Eventually this should lead to the driver taking care of locking for allocating seqno and other traffic-triggered events (eg addba setup.) --- sys/net80211/ieee80211_var.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 1b73d3929620..d946d9134571 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -629,11 +629,12 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive channel*/ #define IEEE80211_FEXT_UNIQMAC 0x00040000 /* CONF: user or computed mac */ #define IEEE80211_FEXT_SCAN_OFFLOAD 0x00080000 /* CONF: scan is fully offloaded */ +#define IEEE80211_FEXT_SEQNO_OFFLOAD 0x00100000 /* CONF: driver does seqno insertion/allocation */ #define IEEE80211_FEXT_BITS \ "\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ "\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \ - "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD" + "\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" /* ic_flags_ht/iv_flags_ht */ #define IEEE80211_FHT_NONHT_PR 0x00000001 /* STATUS: non-HT sta present */ From da6ee937aeccc8573aa40776c3917bd2cdb13ef6 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Fri, 13 Jan 2017 07:24:58 +0000 Subject: [PATCH 055/126] [net80211] add a macro to check this configuration option. --- sys/net80211/ieee80211_var.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index d946d9134571..48b9196846e3 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -95,6 +95,9 @@ */ #define IEEE80211_CONF_VHT(ic) ((ic)->ic_vhtcaps != 0) +#define IEEE80211_CONF_SEQNO_OFFLOAD(ic) \ + ((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD) + /* * 802.11 control state is split into a common portion that maps * 1-1 to a physical device and one or more "Virtual AP's" (VAP) From 373eea194da9874691704eb9b4e6a7509b00c9c2 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Fri, 13 Jan 2017 08:01:27 +0000 Subject: [PATCH 056/126] Purge varargs.h in favor of stdarg.h. --- usr.sbin/route6d/route6d.c | 45 -------------------------------------- 1 file changed, 45 deletions(-) diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index c6b499302e6c..e746acf5f575 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -57,11 +57,7 @@ static const char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 itoju #endif #include #include -#ifdef __STDC__ #include -#else -#include -#endif #include #include #include @@ -203,7 +199,6 @@ static volatile sig_atomic_t seenusr1; #define RRTF_SENDANYWAY 0x40000000 #define RRTF_CHANGED 0x80000000 -int main(int, char **); static void sighandler(int); static void ripalarm(void); static void riprecv(void); @@ -3457,22 +3452,12 @@ ripsuptrig(void) #endif static void -#ifdef __STDC__ fatal(const char *fmt, ...) -#else -fatal(fmt, va_alist) - char *fmt; - va_dcl -#endif { va_list ap; char buf[1024]; -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); perror(buf); @@ -3484,33 +3469,18 @@ fatal(fmt, va_alist) } static void -#ifdef __STDC__ tracet(int level, const char *fmt, ...) -#else -tracet(level, fmt, va_alist) - int level; - char *fmt; - va_dcl -#endif { va_list ap; if (level <= dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif fprintf(stderr, "%s: ", hms()); vfprintf(stderr, fmt, ap); va_end(ap); } if (dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif if (level > 0) vsyslog(LOG_DEBUG, fmt, ap); else @@ -3520,32 +3490,17 @@ tracet(level, fmt, va_alist) } static void -#ifdef __STDC__ trace(int level, const char *fmt, ...) -#else -trace(level, fmt, va_alist) - int level; - char *fmt; - va_dcl -#endif { va_list ap; if (level <= dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif vfprintf(stderr, fmt, ap); va_end(ap); } if (dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif if (level > 0) vsyslog(LOG_DEBUG, fmt, ap); else From 4902e14dc8a95935d4f28a03eaf33021432c9794 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 13 Jan 2017 08:31:55 +0000 Subject: [PATCH 057/126] Improve CAM_CDB_POINTER support. MFC after: 2 weeks --- sys/cam/cam_ccb.h | 7 +++++++ sys/cam/cam_periph.c | 5 +---- sys/cam/ctl/ctl_frontend_cam_sim.c | 3 +-- sys/cam/ctl/scsi_ctl.c | 10 ++++------ sys/cam/scsi/scsi_all.c | 22 +++++----------------- sys/cam/scsi/scsi_xpt.c | 4 ++-- 6 files changed, 20 insertions(+), 31 deletions(-) diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h index b638ab1dba9f..4cfe2e4fa34a 100644 --- a/sys/cam/cam_ccb.h +++ b/sys/cam/cam_ccb.h @@ -784,6 +784,13 @@ struct ccb_accept_tio { struct scsi_sense_data sense_data; }; +static __inline uint8_t * +atio_cdb_ptr(struct ccb_accept_tio *ccb) +{ + return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? + ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes); +} + /* Release SIM Queue */ struct ccb_relsim { struct ccb_hdr ccb_h; diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index ae4134504b9c..1bd7395e77ca 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -1930,10 +1930,7 @@ cam_periph_devctl_notify(union ccb *ccb) if (ccb->ccb_h.func_code == XPT_SCSI_IO) { sbuf_printf(&sb, "CDB=\""); - if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); - else - scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb); sbuf_printf(&sb, "\" "); } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { sbuf_printf(&sb, "ACB=\""); diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index 04f2226208c8..ef9aabaadbab 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) __func__, csio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len); ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index a8bc77b8e4e6..d03966ee82f3 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, union ccb *start_ccb) && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0], flags, dxfer_len, + atio_cdb_ptr(atio)[0], flags, dxfer_len, csio->sglist_cnt); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); @@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio *atio, uint32_t offset) { uint64_t lba; uint32_t num_blocks, nbc; - uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)? - atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes; + uint8_t *cmdbyt = atio_cdb_ptr(atio); nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */ @@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) __func__, atio->cdb_len, sizeof(io->scsiio.cdb)); } io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb)); - bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb, - io->scsiio.cdb_len); + bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len); #ifdef CTLFEDEBUG printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__, @@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) printf("%s: tag %04x no status or " "len cdb = %02x\n", __func__, atio->tag_id, - atio->cdb_io.cdb_bytes[0]); + atio_cdb_ptr(atio)[0]); printf("%s: tag %04x io status %#x\n", __func__, atio->tag_id, io->io_hdr.status); diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 192a8d4a5eeb..bf2ee2f69e9c 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -3617,15 +3617,9 @@ scsi_command_string(struct cam_device *device, struct ccb_scsiio *csio, #endif /* _KERNEL/!_KERNEL */ - if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb); - } else { - sbuf_printf(sb, "%s. CDB: ", - scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data)); - scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb); - } + sbuf_printf(sb, "%s. CDB: ", + scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data)); + scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb); #ifdef _KERNEL xpt_free_ccb((union ccb *)cgd); @@ -5030,7 +5024,6 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, struct ccb_getdev *cgd; #endif /* _KERNEL */ char path_str[64]; - uint8_t *cdb; #ifndef _KERNEL if (device == NULL) @@ -5128,14 +5121,9 @@ scsi_sense_sbuf(struct cam_device *device, struct ccb_scsiio *csio, sense = &csio->sense_data; } - if (csio->ccb_h.flags & CAM_CDB_POINTER) - cdb = csio->cdb_io.cdb_ptr; - else - cdb = csio->cdb_io.cdb_bytes; - scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb, - path_str, inq_data, cdb, csio->cdb_len); - + path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len); + #ifdef _KERNEL xpt_free_ccb((union ccb*)cgd); #endif /* _KERNEL/!_KERNEL */ diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index cb7205e3331b..065d433e5c76 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -3139,6 +3139,6 @@ scsi_proto_debug_out(union ccb *ccb) device = ccb->ccb_h.path->device; CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_CDB,("%s. CDB: %s\n", - scsi_op_desc(ccb->csio.cdb_io.cdb_bytes[0], &device->inq_data), - scsi_cdb_string(ccb->csio.cdb_io.cdb_bytes, cdb_str, sizeof(cdb_str)))); + scsi_op_desc(scsiio_cdb_ptr(&ccb->csio)[0], &device->inq_data), + scsi_cdb_string(scsiio_cdb_ptr(&ccb->csio), cdb_str, sizeof(cdb_str)))); } From 24209f012227c57a106aee5c06e7a16f60842d3b Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Fri, 13 Jan 2017 10:55:26 +0000 Subject: [PATCH 058/126] Ensure that the buffer length and the length provided in the IPv4 header match when using a raw socket to send IPv4 packets and providing the header. If they don't match, let send return -1 and set errno to EINVAL. Before this patch is was only enforced that the length in the header is not larger then the buffer length. PR: 212283 Reviewed by: ae, gnn MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9161 --- sys/netinet/raw_ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index d741cc7f8511..c8f944c9e252 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -508,7 +508,7 @@ rip_output(struct mbuf *m, struct socket *so, ...) * and don't allow packet length sizes that will crash. */ if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options) - || (ntohs(ip->ip_len) > m->m_pkthdr.len) + || (ntohs(ip->ip_len) != m->m_pkthdr.len) || (ntohs(ip->ip_len) < (ip->ip_hl << 2))) { INP_RUNLOCK(inp); m_freem(m); From 2f21ec0129dc3be555536d5177c5e0f4f8728f6b Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 13 Jan 2017 15:17:25 +0000 Subject: [PATCH 059/126] libgcc_s: add libc DT_NEEDED to fix underlinking PR: 216012 Reported by: jbeich MFC after: 1 week Sponsored by: The FreeBSD Foundation --- lib/libgcc_s/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libgcc_s/Makefile b/lib/libgcc_s/Makefile index e4887a631ded..78b6515996fb 100644 --- a/lib/libgcc_s/Makefile +++ b/lib/libgcc_s/Makefile @@ -8,6 +8,7 @@ MK_SSP= no WARNS?= 2 LDFLAGS+= -nodefaultlibs +LIBADD+= c VERSION_MAP= ${.CURDIR}/Version.map .include "../libcompiler_rt/Makefile.inc" From a6f63533a7045d56ea46bd68a14cbf4053e63aa5 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Fri, 13 Jan 2017 16:37:38 +0000 Subject: [PATCH 060/126] Check tty_gone() after allocating IO buffers. The tty lock has to be dropped then reacquired due to using M_WAITOK, which opens a window in which the tty device can disappear. Check for this and return ENXIO back up the call chain so that callers can cope. This closes a race where TF_GONE would get set while buffers were being allocated as part of ttydev_open(), causing a subsequent call to ttydevsw_modem() later in ttydev_open() to assert. Reported by: pho Reviewed by: kib --- sys/kern/tty.c | 27 ++++++++++++++++++++++----- sys/kern/tty_inq.c | 8 +++++++- sys/kern/tty_outq.c | 8 +++++++- sys/sys/ttyqueue.h | 4 ++-- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 499bd13a38a4..9c2be5d18236 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -105,25 +105,38 @@ SYSCTL_INT(_kern, OID_AUTO, tty_drainwait, CTLFLAG_RWTUN, #define TTYBUF_MAX 65536 -static void +/* + * Allocate buffer space if necessary, and set low watermarks, based on speed. + * Note that the ttyxxxq_setsize() functions may drop and then reacquire the tty + * lock during memory allocation. They will return ENXIO if the tty disappears + * while unlocked. + */ +static int tty_watermarks(struct tty *tp) { size_t bs = 0; + int error; /* Provide an input buffer for 0.2 seconds of data. */ if (tp->t_termios.c_cflag & CREAD) bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX); - ttyinq_setsize(&tp->t_inq, tp, bs); + error = ttyinq_setsize(&tp->t_inq, tp, bs); + if (error != 0) + return (error); /* Set low watermark at 10% (when 90% is available). */ tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10; /* Provide an output buffer for 0.2 seconds of data. */ bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX); - ttyoutq_setsize(&tp->t_outq, tp, bs); + error = ttyoutq_setsize(&tp->t_outq, tp, bs); + if (error != 0) + return (error); /* Set low watermark at 10% (when 90% is available). */ tp->t_outlow = (ttyoutq_getallocatedsize(&tp->t_outq) * 9) / 10; + + return (0); } static int @@ -318,7 +331,9 @@ ttydev_open(struct cdev *dev, int oflags, int devtype __unused, goto done; ttydisc_open(tp); - tty_watermarks(tp); /* XXXGL: drops lock */ + error = tty_watermarks(tp); + if (error != 0) + goto done; } /* Wait for Carrier Detect. */ @@ -1627,7 +1642,9 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, int fflag, tp->t_termios.c_ospeed = t->c_ospeed; /* Baud rate has changed - update watermarks. */ - tty_watermarks(tp); + error = tty_watermarks(tp); + if (error) + return (error); } /* Copy new non-device driver parameters. */ diff --git a/sys/kern/tty_inq.c b/sys/kern/tty_inq.c index 97017ac75a41..163b19459fe9 100644 --- a/sys/kern/tty_inq.c +++ b/sys/kern/tty_inq.c @@ -112,7 +112,7 @@ static uma_zone_t ttyinq_zone; TTYINQ_INSERT_TAIL(ti, tib); \ } while (0) -void +int ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size) { struct ttyinq_block *tib; @@ -134,8 +134,14 @@ ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t size) tib = uma_zalloc(ttyinq_zone, M_WAITOK); tty_lock(tp); + if (tty_gone(tp)) { + uma_zfree(ttyinq_zone, tib); + return (ENXIO); + } + TTYINQ_INSERT_TAIL(ti, tib); } + return (0); } void diff --git a/sys/kern/tty_outq.c b/sys/kern/tty_outq.c index 5d40abe1a853..3f86e11b9b30 100644 --- a/sys/kern/tty_outq.c +++ b/sys/kern/tty_outq.c @@ -89,7 +89,7 @@ ttyoutq_flush(struct ttyoutq *to) to->to_end = 0; } -void +int ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t size) { struct ttyoutq_block *tob; @@ -111,8 +111,14 @@ ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t size) tob = uma_zalloc(ttyoutq_zone, M_WAITOK); tty_lock(tp); + if (tty_gone(tp)) { + uma_zfree(ttyoutq_zone, tob); + return (ENXIO); + } + TTYOUTQ_INSERT_TAIL(to, tob); } + return (0); } void diff --git a/sys/sys/ttyqueue.h b/sys/sys/ttyqueue.h index 2d1a565af965..c8d85d6280d5 100644 --- a/sys/sys/ttyqueue.h +++ b/sys/sys/ttyqueue.h @@ -69,7 +69,7 @@ struct ttyoutq { #ifdef _KERNEL /* Input queue handling routines. */ -void ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len); +int ttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len); void ttyinq_free(struct ttyinq *ti); int ttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio, size_t readlen, size_t flushlen); @@ -136,7 +136,7 @@ void ttyinq_line_iterate_from_reprintpos(struct ttyinq *ti, /* Output queue handling routines. */ void ttyoutq_flush(struct ttyoutq *to); -void ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len); +int ttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len); void ttyoutq_free(struct ttyoutq *to); size_t ttyoutq_read(struct ttyoutq *to, void *buf, size_t len); int ttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio); From b632b0008778cad9a75b9cd5f0db3d0d535fb62f Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Fri, 13 Jan 2017 16:46:01 +0000 Subject: [PATCH 061/126] fstyp.8: Move initial exFAT blurb to the -u section Didn't notice the second list in r312003. Reported by: trasz@ --- usr.sbin/fstyp/fstyp.8 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/fstyp/fstyp.8 b/usr.sbin/fstyp/fstyp.8 index 9bd27fcef2d8..03cf247a9dfa 100644 --- a/usr.sbin/fstyp/fstyp.8 +++ b/usr.sbin/fstyp/fstyp.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2017 +.Dd January 13, 2017 .Dt FSTYP 8 .Os .Sh NAME @@ -43,7 +43,7 @@ The .Nm utility is used to determine the filesystem type on a given device. -It can recognize ISO-9660, exFAT, Ext2, FAT, NTFS, and UFS filesystems. +It can recognize ISO-9660, Ext2, FAT, NTFS, and UFS filesystems. When the .Fl u flag is specified, @@ -51,9 +51,10 @@ flag is specified, also recognizes certain additional metadata formats that cannot be handled using .Xr mount 8 , -such as ZFS pools and +such as exFAT filesystems, .Xr geli 8 -providers. +providers, and +ZFS pools. .Pp The filesystem name is printed to the standard output as, respectively: From 0f7ddf91e98ae4906294bd21bf397f84b331c67c Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 13 Jan 2017 16:54:44 +0000 Subject: [PATCH 062/126] Use getsock_cap() instead of deprecated fgetsock(). Reviewed by: tuexen --- sys/netinet/sctp_syscalls.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/netinet/sctp_syscalls.c b/sys/netinet/sctp_syscalls.c index eea70e23d208..66df3141ec5a 100644 --- a/sys/netinet/sctp_syscalls.c +++ b/sys/netinet/sctp_syscalls.c @@ -121,17 +121,18 @@ sys_sctp_peeloff(td, uap) } */ *uap; { #if (defined(INET) || defined(INET6)) && defined(SCTP) - struct file *nfp = NULL; + struct file *headfp, *nfp = NULL; struct socket *head, *so; cap_rights_t rights; u_int fflag; int error, fd; AUDIT_ARG_FD(uap->sd); - error = fgetsock(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), - &head, &fflag); + error = getsock_cap(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), + &headfp, &fflag, NULL); if (error != 0) goto done2; + head = headfp->f_data; if (head->so_proto->pr_protocol != IPPROTO_SCTP) { error = EOPNOTSUPP; goto done; @@ -196,7 +197,7 @@ sys_sctp_peeloff(td, uap) done: if (nfp != NULL) fdrop(nfp, td); - fputsock(head); + fdrop(headfp, td); done2: return (error); #else /* SCTP */ From d5b937680cc3ce4df8540b20d66e321c33c26273 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Fri, 13 Jan 2017 17:03:23 +0000 Subject: [PATCH 063/126] Correct the comments about how much buffer is allocated. --- sys/kern/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 9c2be5d18236..b0a535cb67e3 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -117,7 +117,7 @@ tty_watermarks(struct tty *tp) size_t bs = 0; int error; - /* Provide an input buffer for 0.2 seconds of data. */ + /* Provide an input buffer for 2 seconds of data. */ if (tp->t_termios.c_cflag & CREAD) bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX); error = ttyinq_setsize(&tp->t_inq, tp, bs); @@ -127,7 +127,7 @@ tty_watermarks(struct tty *tp) /* Set low watermark at 10% (when 90% is available). */ tp->t_inlow = (ttyinq_getallocatedsize(&tp->t_inq) * 9) / 10; - /* Provide an output buffer for 0.2 seconds of data. */ + /* Provide an output buffer for 2 seconds of data. */ bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX); error = ttyoutq_setsize(&tp->t_outq, tp, bs); if (error != 0) From f8f24e9ec21e9436d4b5128a5d712527789b26fd Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 13 Jan 2017 18:36:46 +0000 Subject: [PATCH 064/126] Use getsock_cap() instead of deprecated fgetsock(). Reviewed by: Daniel Braniss --- sys/dev/iscsi_initiator/isc_soc.c | 1 - sys/dev/iscsi_initiator/iscsi.c | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sys/dev/iscsi_initiator/isc_soc.c b/sys/dev/iscsi_initiator/isc_soc.c index 228267716b58..1e25f7268360 100644 --- a/sys/dev/iscsi_initiator/isc_soc.c +++ b/sys/dev/iscsi_initiator/isc_soc.c @@ -680,7 +680,6 @@ isc_stop_receiver(isc_session_t *sp) if(sp->fp != NULL) fdrop(sp->fp, sp->td); - fputsock(sp->soc); sp->soc = NULL; sp->fp = NULL; diff --git a/sys/dev/iscsi_initiator/iscsi.c b/sys/dev/iscsi_initiator/iscsi.c index e607f18a7296..ac3d1cc15547 100644 --- a/sys/dev/iscsi_initiator/iscsi.c +++ b/sys/dev/iscsi_initiator/iscsi.c @@ -388,20 +388,14 @@ i_setsoc(isc_session_t *sp, int fd, struct thread *td) if(sp->soc != NULL) isc_stop_receiver(sp); - error = fget(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), &sp->fp); + error = getsock_cap(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), + &sp->fp, NULL, NULL); if(error) return error; - error = fgetsock(td, fd, cap_rights_init(&rights, CAP_SOCK_CLIENT), - &sp->soc, 0); - if(error == 0) { - sp->td = td; - isc_start_receiver(sp); - } - else { - fdrop(sp->fp, td); - sp->fp = NULL; - } + sp->soc = sp->fp->f_data; + sp->td = td; + isc_start_receiver(sp); return error; } From b44047f3dff9ac189d943d3962e79fe50548413a Mon Sep 17 00:00:00 2001 From: Warren Block Date: Fri, 13 Jan 2017 19:41:02 +0000 Subject: [PATCH 065/126] Update the shm_open.2 man page to reflect objective reality. PR: 215612 Submitted by: rwatson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9066 --- lib/libc/sys/shm_open.2 | 53 ++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2 index b56f717b76d5..f77eb49736a4 100644 --- a/lib/libc/sys/shm_open.2 +++ b/lib/libc/sys/shm_open.2 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2013 +.Dd January 13, 2017 .Dt SHM_OPEN 2 .Os .Sh NAME @@ -171,7 +171,8 @@ and .Dv O_TRUNC flags may be used in portable programs. .Pp -The result of using +.Tn POSIX +specifications state that the result of using .Xr open 2 , .Xr read 2 , or @@ -179,19 +180,43 @@ or on a shared memory object, or on the descriptor returned by .Fn shm_open , is undefined. -It is also undefined whether the shared memory object itself, or its -contents, persist across reboots. -.Pp -In FreeBSD, +However, the +.Fx +kernel implementation explicitly includes support for .Xr read 2 and -.Xr write 2 -on a shared memory object will fail with -.Er EOPNOTSUPP -and neither shared memory objects nor their contents persist across reboots. +.Xr write 2 . +.Pp +Neither shared memory objects nor their contents persist across reboots. +.Pp +Writes do not extend shared memory objects, so +.Xr ftruncate 2 +must be called before any data can be written. +See +.Sx EXAMPLES . +.Sh EXAMPLES +This example fails without the call to +.Xr ftruncate 2 : +.Bd -literal -compact + + uint8_t buffer[getpagesize()]; + ssize_t len; + int fd; + + fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600); + if (fd < 0) + err(EX_OSERR, "%s: shm_open", __func__); + if (ftruncate(fd, getpagesize()) < 0) + err(EX_IOERR, "%s: ftruncate", __func__); + len = pwrite(fd, buffer, getpagesize(), 0); + if (len < 0) + err(EX_IOERR, "%s: pwrite", __func__); + if (len != getpagesize()) + errx(EX_IOERR, "%s: pwrite length mismatch", __func__); +.Ed .Sh ERRORS -The following errors are defined for -.Fn shm_open : +.Fn shm_open +fails with these error codes for these conditions: .Bl -tag -width Er .It Bq Er EINVAL A flag other than @@ -235,8 +260,8 @@ are specified and the named shared memory object does exist. The required permissions (for reading or reading and writing) are denied. .El .Pp -The following errors are defined for -.Fn shm_unlink : +.Fn shm_unlink +fails with these error codes for these conditions: .Bl -tag -width Er .It Bq Er EFAULT The From e2c14d90df0643821551383be83fad03cfbcc226 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 13 Jan 2017 21:52:53 +0000 Subject: [PATCH 066/126] Trim a few comments on platforms that did not implement mmap of /dev/kmem. After r307332, no platforms implement mmap for /dev/kmem, so the lack of it for these platforms is no longer unique. --- sys/mips/mips/mem.c | 6 ------ sys/sparc64/sparc64/mem.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/mips/mips/mem.c b/sys/mips/mips/mem.c index 08bb6b094c4a..30f4b34f57af 100644 --- a/sys/mips/mips/mem.c +++ b/sys/mips/mips/mem.c @@ -151,12 +151,6 @@ int memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) { - /* - * /dev/mem is the only one that makes sense through this - * interface. For /dev/kmem any physaddr we return here - * could be transient and hence incorrect or invalid at - * a later time. - */ if (dev2unit(dev) != CDEV_MINOR_MEM) return (-1); diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index 6bd52253666c..a25bef49f3d2 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * Memory special file * - * NOTE: other architectures support mmap()'ing the mem and kmem devices; this + * NOTE: other architectures support mmap()'ing the mem device; this * might cause illegal aliases to be created for the locked kernel page(s), so * it is not implemented. */ From 4fce19da8d30be0bd4b2af4ae9d6c60861c52b03 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 13 Jan 2017 22:16:41 +0000 Subject: [PATCH 067/126] Remove deprecated fgetsock() and fputsock(). --- sys/kern/kern_descrip.c | 56 ----------------------------------------- sys/sys/file.h | 6 ----- sys/sys/param.h | 2 +- 3 files changed, 1 insertion(+), 63 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index f470b045de66..fd6c796da14d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -2839,61 +2838,6 @@ fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, } #endif -/* - * Like fget() but loads the underlying socket, or returns an error if the - * descriptor does not represent a socket. - * - * We bump the ref count on the returned socket. XXX Also obtain the SX lock - * in the future. - * - * Note: fgetsock() and fputsock() are deprecated, as consumers should rely - * on their file descriptor reference to prevent the socket from being free'd - * during use. - */ -int -fgetsock(struct thread *td, int fd, cap_rights_t *rightsp, struct socket **spp, - u_int *fflagp) -{ - struct file *fp; - int error; - - *spp = NULL; - if (fflagp != NULL) - *fflagp = 0; - if ((error = _fget(td, fd, &fp, 0, rightsp, NULL)) != 0) - return (error); - if (fp->f_type != DTYPE_SOCKET) { - error = ENOTSOCK; - } else { - *spp = fp->f_data; - if (fflagp) - *fflagp = fp->f_flag; - SOCK_LOCK(*spp); - soref(*spp); - SOCK_UNLOCK(*spp); - } - fdrop(fp, td); - - return (error); -} - -/* - * Drop the reference count on the socket and XXX release the SX lock in the - * future. The last reference closes the socket. - * - * Note: fputsock() is deprecated, see comment for fgetsock(). - */ -void -fputsock(struct socket *so) -{ - - ACCEPT_LOCK(); - SOCK_LOCK(so); - CURVNET_SET(so->so_vnet); - sorele(so); - CURVNET_RESTORE(); -} - /* * Handle the last reference to a file being closed. */ diff --git a/sys/sys/file.h b/sys/sys/file.h index c30eb0584f70..353c92f365a9 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -50,8 +50,6 @@ struct thread; struct uio; struct knote; struct vnode; -struct socket; - #endif /* _KERNEL */ @@ -267,10 +265,6 @@ int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp, int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, struct vnode **vpp); -int fgetsock(struct thread *td, int fd, cap_rights_t *rightsp, - struct socket **spp, u_int *fflagp); -void fputsock(struct socket *sp); - static __inline int _fnoop(void) { diff --git a/sys/sys/param.h b/sys/sys/param.h index b182fa39378d..07b11e2daf5c 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200019 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200020 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From a5deb9babb3142d71565059926a1ed2959e2ac75 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 01:01:02 +0000 Subject: [PATCH 068/126] Note that sys/types.h is required on FreeBSD for kqueue(2), unlike NetBSD MFC after: 12 days X-MFC with: r305358 Sponsored by: Dell EMC Isilon --- contrib/netbsd-tests/lib/libc/gen/t_sleep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c index 5e364569fbc2..e85867a3f4c1 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_sleep.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_sleep.c @@ -27,6 +27,7 @@ */ #ifdef __FreeBSD__ +/* kqueue(2) on FreeBSD requires sys/types.h for uintptr_t; NetBSD doesn't. */ #include #endif #include From 47f2efe4fbcda07850d40f422455cba90714146c Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Sat, 14 Jan 2017 01:03:20 +0000 Subject: [PATCH 069/126] Revert r310994 Don't implement some terrible hack on a test by test basis. The framework fix is straightforward and can be chased up in the original bug. Reviewed by: ngie ("be my guest") --- tests/sys/vfs/lookup_cap_dotdot.c | 174 ++++++++++-------------------- 1 file changed, 56 insertions(+), 118 deletions(-) diff --git a/tests/sys/vfs/lookup_cap_dotdot.c b/tests/sys/vfs/lookup_cap_dotdot.c index e14b5887a75e..88b13e59abe2 100644 --- a/tests/sys/vfs/lookup_cap_dotdot.c +++ b/tests/sys/vfs/lookup_cap_dotdot.c @@ -31,27 +31,23 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include #include #include #include "freebsd_test_suite/macros.h" -static char *abspath; -static int dirfd = -1; - -typedef void (*child_test_fn_t)(void); +static int dirfd = -1; +static char *abspath; static void -touchat(int _dirfd, const char *name) +touchat(int dirfd, const char *name) { int fd; - ATF_REQUIRE((fd = openat(_dirfd, name, O_CREAT | O_TRUNC | O_WRONLY, + ATF_REQUIRE((fd = openat(dirfd, name, O_CREAT | O_TRUNC | O_WRONLY, 0777)) >= 0); ATF_REQUIRE(close(fd) == 0); } @@ -82,43 +78,10 @@ prepare_dotdot_tests(void) static void check_capsicum(void) { - ATF_REQUIRE_FEATURE("security_capabilities"); ATF_REQUIRE_FEATURE("security_capability_mode"); } -static void -run_capsicum_test(child_test_fn_t test_func) -{ - int child_exit_code, child_status; - pid_t child_pid; - - check_capsicum(); - prepare_dotdot_tests(); - - ATF_REQUIRE_MSG((child_pid = fork()) != -1, - "fork failed: %s", strerror(errno)); - - if (child_pid == 0) { - test_func(); - _exit(0); - } - - ATF_REQUIRE_MSG(waitpid(child_pid, &child_status, 0) != -1, - "waitpid failed: %s", strerror(errno)); - if (WIFEXITED(child_status)) { - child_exit_code = WEXITSTATUS(child_status); - ATF_REQUIRE_MSG(child_exit_code == 0, - "child exited with non-zero exit code: %d", - child_exit_code); - } else if (WIFSIGNALED(child_status)) - atf_tc_fail("child exited with signal: %d", - WTERMSIG(child_status)); - else - atf_tc_fail("child exited with unexpected status: %d", - child_status); -} - /* * Positive tests */ @@ -130,7 +93,6 @@ ATF_TC_HEAD(openat__basic_positive, tc) ATF_TC_BODY(openat__basic_positive, tc) { - prepare_dotdot_tests(); ATF_REQUIRE(openat(dirfd, "d1/d2/d3/f3", O_RDONLY) >= 0); @@ -152,22 +114,21 @@ ATF_TC_HEAD(lookup_cap_dotdot__basic, tc) "Validate cap-mode (testdir)/d1/.. lookup"); } -static void -lookup_cap_dotdot__basic_child(void) -{ - cap_rights_t rights; - - cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); - - assert(cap_rights_limit(dirfd, &rights) >= 0); - assert(cap_enter() >= 0); - assert(openat(dirfd, "d1/..", O_RDONLY) >= 0); -} - ATF_TC_BODY(lookup_cap_dotdot__basic, tc) { + cap_rights_t rights; + int fd; - run_capsicum_test(lookup_cap_dotdot__basic_child); + check_capsicum(); + prepare_dotdot_tests(); + + cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); + ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); + + ATF_REQUIRE(cap_enter() >= 0); + + ATF_REQUIRE_MSG(openat(dirfd, "d1/..", O_RDONLY) >= 0, "%s", + strerror(errno)); } ATF_TC(lookup_cap_dotdot__advanced); @@ -177,26 +138,23 @@ ATF_TC_HEAD(lookup_cap_dotdot__advanced, tc) "Validate cap-mode (testdir)/d1/.. lookup"); } -static void -lookup_cap_dotdot__advanced_child(void) -{ - cap_rights_t rights; - - cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); - assert(cap_rights_limit(dirfd, &rights) >= 0); - - assert(cap_enter() >= 0); - - assert(openat(dirfd, "d1/d2/d3/../../f1", O_RDONLY) >= 0); - assert(openat(dirfd, "l3/../../f1", O_RDONLY) >= 0); - assert(openat(dirfd, "l3/ld1", O_RDONLY) >= 0); - assert(openat(dirfd, "l3/lf1", O_RDONLY) >= 0); -} - ATF_TC_BODY(lookup_cap_dotdot__advanced, tc) { + cap_rights_t rights; + int fd; - run_capsicum_test(lookup_cap_dotdot__advanced_child); + check_capsicum(); + prepare_dotdot_tests(); + + cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); + ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); + + ATF_REQUIRE(cap_enter() >= 0); + + ATF_REQUIRE(openat(dirfd, "d1/d2/d3/../../f1", O_RDONLY) >= 0); + ATF_REQUIRE(openat(dirfd, "l3/../../f1", O_RDONLY) >= 0); + ATF_REQUIRE(openat(dirfd, "l3/ld1", O_RDONLY) >= 0); + ATF_REQUIRE(openat(dirfd, "l3/lf1", O_RDONLY) >= 0); } /* @@ -210,7 +168,6 @@ ATF_TC_HEAD(openat__basic_negative, tc) ATF_TC_BODY(openat__basic_negative, tc) { - prepare_dotdot_tests(); ATF_REQUIRE_ERRNO(ENOENT, @@ -225,43 +182,32 @@ ATF_TC_HEAD(capmode__negative, tc) atf_tc_set_md_var(tc, "descr", "Negative Capability mode testcases"); } -static void -capmode__negative_child(void) +ATF_TC_BODY(capmode__negative, tc) { int subdirfd; - assert(cap_enter() == 0); + check_capsicum(); + prepare_dotdot_tests(); + + ATF_REQUIRE(cap_enter() == 0); /* open() not permitted in capability mode */ - assert(open("testdir", O_RDONLY) < 0); - assert(errno == ECAPMODE); + ATF_REQUIRE_ERRNO(ECAPMODE, open("testdir", O_RDONLY) < 0); /* AT_FDCWD not permitted in capability mode */ - assert(openat(AT_FDCWD, "d1/f1", O_RDONLY) < 0); - assert(errno == ECAPMODE); + ATF_REQUIRE_ERRNO(ECAPMODE, openat(AT_FDCWD, "d1/f1", O_RDONLY) < 0); /* Relative path above dirfd not capable */ - assert(openat(dirfd, "..", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - - assert((subdirfd = openat(dirfd, "l3", O_RDONLY)) >= 0); - assert(openat(subdirfd, "../../f1", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - (void)close(subdirfd); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "..", O_RDONLY) < 0); + ATF_REQUIRE((subdirfd = openat(dirfd, "l3", O_RDONLY)) >= 0); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, + openat(subdirfd, "../../f1", O_RDONLY) < 0); /* Absolute paths not capable */ - assert(openat(dirfd, abspath, O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, abspath, O_RDONLY) < 0); /* Symlink above dirfd */ - assert(openat(dirfd, "lup/f1", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); -} - -ATF_TC_BODY(capmode__negative, tc) -{ - - run_capsicum_test(capmode__negative_child); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "lup/f1", O_RDONLY) < 0); } ATF_TC(lookup_cap_dotdot__negative); @@ -271,30 +217,22 @@ ATF_TC_HEAD(lookup_cap_dotdot__negative, tc) "Validate cap-mode (testdir)/.. lookup fails"); } -static void -lookup_cap_dotdot__negative_child(void) -{ - cap_rights_t rights; - - cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); - assert(cap_rights_limit(dirfd, &rights) >= 0); - - assert(cap_enter() >= 0); - - assert(openat(dirfd, "..", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - - assert(openat(dirfd, "d1/../..", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); - - assert(openat(dirfd, "../testdir/d1/f1", O_RDONLY) < 0); - assert(errno == ENOTCAPABLE); -} - ATF_TC_BODY(lookup_cap_dotdot__negative, tc) { + cap_rights_t rights; + int fd; - run_capsicum_test(lookup_cap_dotdot__negative_child); + check_capsicum(); + prepare_dotdot_tests(); + + cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); + ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); + + ATF_REQUIRE(cap_enter() >= 0); + + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "..", O_RDONLY) < 0); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "d1/../..", O_RDONLY) < 0); + ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "../testdir/d1/f1", O_RDONLY) < 0); } ATF_TP_ADD_TCS(tp) From 4a6ace7328b83a22f1f2f487b3e151858f2f2909 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Sat, 14 Jan 2017 01:08:04 +0000 Subject: [PATCH 070/126] Fix broken fstyp exfat testcase Introduced in r312010. It helps to read the documentation before trying to test something. --- usr.sbin/fstyp/tests/fstyp_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/fstyp/tests/fstyp_test.sh b/usr.sbin/fstyp/tests/fstyp_test.sh index 5b3bfa71c1a4..e7a4108b5fd4 100755 --- a/usr.sbin/fstyp/tests/fstyp_test.sh +++ b/usr.sbin/fstyp/tests/fstyp_test.sh @@ -64,7 +64,7 @@ exfat_head() { } exfat_body() { bzcat $(atf_get_srcdir)/dfr-01-xfat.img.bz2 > exfat.img - atf_check -s exit:0 -o inline:"exfat\n" fstyp exfat.img + atf_check -s exit:0 -o inline:"exfat\n" fstyp -u exfat.img } atf_test_case empty From 63eca8f1dd7adca4324e0cc05fa66fe441507bd7 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 01:37:03 +0000 Subject: [PATCH 071/126] Conditionalize libwrap support into inetd based on MK_TCP_WRAPPERS This will allow inetd to stand by itself without libwrap. MFC after: 2 weeks Relnotes: yes Reviewed by: hrs (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D9056 --- usr.sbin/inetd/Makefile | 7 ++++++- usr.sbin/inetd/inetd.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/usr.sbin/inetd/Makefile b/usr.sbin/inetd/Makefile index 6174592b34bb..da390081a873 100644 --- a/usr.sbin/inetd/Makefile +++ b/usr.sbin/inetd/Makefile @@ -16,7 +16,12 @@ CFLAGS+= -DLOGIN_CAP CFLAGS+= -DINET6 .endif -LIBADD= util wrap +LIBADD= util + +.if ${MK_TCP_WRAPPERS} != "no" +CFLAGS+= -DLIBWRAP +LIBADD+= wrap +.endif # XXX for src/release/picobsd .if !defined(RELEASE_CRUNCH) diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 5788497c1e25..e538b871172a 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -336,9 +336,11 @@ main(int argc, char **argv) #ifdef LOGIN_CAP login_cap_t *lc = NULL; #endif +#ifdef LIBWRAP struct request_info req; int denied; char *service = NULL; +#endif struct sockaddr_storage peer; int i; struct addrinfo hints, *res; @@ -748,6 +750,7 @@ main(int argc, char **argv) _exit(0); } } +#ifdef LIBWRAP if (ISWRAP(sep)) { inetd_setproctitle("wrapping", ctrl); service = sep->se_server_name ? @@ -776,6 +779,7 @@ main(int argc, char **argv) (whichaf(&req) == AF_INET6) ? "6" : ""); } } +#endif if (sep->se_bi) { (*sep->se_bi->bi_fn)(ctrl, sep); } else { From a72f1252fc5ae69e7e7690fce28695d5e6e37db1 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 02:26:46 +0000 Subject: [PATCH 072/126] Commit more accepted upstream changes from /tests/... This includes a number of accepted patches for: - lib/libc/sys - lib/libm christos was also nice enough to do the heavy lifting with the h_macros.h #includes so testcases which use h_macros.h now can work more easily with the FreeBSD tree's layout for contrib/netbsd-tests vs the testcases. --- dev/cgd/t_cgd_3des.c | 4 +- dev/cgd/t_cgd_aes.c | 4 +- dev/cgd/t_cgd_blowfish.c | 4 +- dev/scsipi/t_cd.c | 4 +- dev/sysmon/t_swwdog.c | 4 +- fs/common/h_fsmacros.h | 4 +- fs/ffs/h_quota2_tests.c | 4 +- fs/ffs/t_fifos.c | 4 +- fs/ffs/t_mount.c | 4 +- fs/ffs/t_quota2_1.c | 4 +- fs/ffs/t_quota2_remount.c | 4 +- fs/ffs/t_snapshot.c | 4 +- fs/ffs/t_snapshot_log.c | 4 +- fs/ffs/t_snapshot_v2.c | 4 +- fs/hfs/t_pathconvert.c | 4 +- fs/kernfs/t_basic.c | 4 +- fs/lfs/t_pr.c | 4 +- fs/msdosfs/t_snapshot.c | 4 +- fs/nfs/t_mountd.c | 4 +- fs/nullfs/t_basic.c | 4 +- fs/ptyfs/t_nullpts.c | 4 +- fs/ptyfs/t_ptyfs.c | 4 +- fs/puffs/t_basic.c | 4 +- fs/puffs/t_fuzz.c | 4 +- fs/puffs/t_io.c | 4 +- fs/tmpfs/t_renamerace.c | 4 +- fs/umapfs/t_basic.c | 4 +- fs/union/t_pr.c | 4 +- fs/vfs/t_full.c | 4 +- fs/vfs/t_io.c | 4 +- fs/vfs/t_renamerace.c | 4 +- fs/vfs/t_ro.c | 4 +- fs/vfs/t_union.c | 4 +- fs/vfs/t_unpriv.c | 4 +- fs/vfs/t_vfsops.c | 4 +- fs/vfs/t_vnops.c | 4 +- include/sys/t_socket.c | 4 +- kernel/kqueue/read/t_fifo.c | 6 +- kernel/kqueue/read/t_file.c | 6 +- kernel/kqueue/read/t_file2.c | 6 +- kernel/kqueue/read/t_pipe.c | 6 +- kernel/kqueue/read/t_ttypty.c | 6 +- kernel/kqueue/t_ioctl.c | 6 +- kernel/kqueue/t_proc1.c | 6 +- kernel/kqueue/t_proc2.c | 6 +- kernel/kqueue/t_proc3.c | 6 +- kernel/kqueue/t_sig.c | 6 +- kernel/kqueue/write/t_fifo.c | 6 +- kernel/kqueue/write/t_pipe.c | 6 +- kernel/kqueue/write/t_ttypty.c | 6 +- kernel/t_extent.c | 6 +- kernel/t_filedesc.c | 6 +- kernel/t_lock.c | 6 +- kernel/t_ptrace.c | 6 +- kernel/t_ptrace_wait.c | 206 ++++++++++++++++++++++++-- kernel/t_pty.c | 6 +- kernel/t_rnd.c | 6 +- lib/libc/gen/t_glob.c | 6 +- lib/libc/regex/debug.c | 7 +- lib/libc/regex/t_exhaust.c | 20 ++- lib/libc/regex/t_regex_att.c | 6 +- lib/libc/sys/t_clock_gettime.c | 9 +- lib/libc/sys/t_connect.c | 7 +- lib/libc/sys/t_dup.c | 5 +- lib/libc/sys/t_getrusage.c | 6 +- lib/libc/sys/t_link.c | 5 +- lib/libc/sys/t_listen.c | 4 +- lib/libc/sys/t_mmap.c | 7 +- lib/libc/sys/t_msgctl.c | 5 +- lib/libc/sys/t_msgrcv.c | 5 +- lib/libc/sys/t_msgsnd.c | 5 +- lib/libc/sys/t_nanosleep.c | 6 +- lib/libc/sys/t_pipe.c | 7 +- lib/libc/sys/t_pipe2.c | 15 +- lib/libc/sys/t_posix_fadvise.c | 6 +- lib/libc/sys/t_revoke.c | 5 +- lib/libc/sys/t_select.c | 10 +- lib/libc/sys/t_setrlimit.c | 5 +- lib/libc/sys/t_sigaction.c | 10 +- lib/libc/sys/t_sigqueue.c | 21 ++- lib/libc/sys/t_socketpair.c | 6 +- lib/libc/sys/t_stat.c | 6 +- lib/libc/sys/t_truncate.c | 10 +- lib/libc/sys/t_umask.c | 5 +- lib/libc/sys/t_unlink.c | 9 +- lib/libc/sys/t_wait.c | 7 +- lib/libc/sys/t_write.c | 8 +- lib/libm/t_ilogb.c | 9 +- lib/libm/t_scalbn.c | 7 +- lib/libposix/t_rename.c | 6 +- lib/librumpclient/t_fd.c | 4 +- lib/semaphore/sem.c | 4 +- libexec/ld.elf_so/t_dlerror-cleared.c | 4 +- libexec/ld.elf_so/t_dlerror-false.c | 4 +- libexec/ld.elf_so/t_dlinfo.c | 4 +- libexec/ld.elf_so/t_ifunc.c | 4 +- modules/t_builtin.c | 4 +- net/bpf/t_bpf.c | 6 +- net/bpf/t_mbuf.c | 6 +- net/bpfilter/t_bpfilter.c | 6 +- net/bpfjit/t_bpfjit.c | 6 +- net/bpfjit/t_cop.c | 6 +- net/bpfjit/t_extmem.c | 6 +- net/bpfjit/t_mbuf.c | 6 +- net/carp/t_basic.c | 6 +- net/config/netconfig.c | 6 +- net/icmp/t_forward.c | 6 +- net/icmp/t_ping.c | 6 +- net/if_loop/t_pr.c | 6 +- net/ndp/t_ra.sh | 80 ++++++---- net/net/t_raw.c | 4 +- rump/modautoload/t_modautoload.c | 4 +- rump/rumpkern/t_kern.c | 4 +- rump/rumpkern/t_lwproc.c | 4 +- rump/rumpkern/t_modcmd.c | 4 +- rump/rumpkern/t_modlinkset.c | 4 +- rump/rumpkern/t_signals.c | 4 +- rump/rumpkern/t_threads.c | 4 +- rump/rumpkern/t_tsleep.c | 4 +- rump/rumpkern/t_vm.c | 4 +- rump/rumpvfs/t_basic.c | 4 +- rump/rumpvfs/t_etfs.c | 4 +- rump/rumpvfs/t_p2kifs.c | 4 +- 123 files changed, 607 insertions(+), 348 deletions(-) diff --git a/dev/cgd/t_cgd_3des.c b/dev/cgd/t_cgd_3des.c index 91e81f45ec5e..a79ac740d45d 100644 --- a/dev/cgd/t_cgd_3des.c +++ b/dev/cgd/t_cgd_3des.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cgd_3des.c,v 1.1 2016/11/11 07:39:58 alnsn Exp $ */ +/* $NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. * All rights reserved. @@ -48,7 +48,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define SECSIZE 512 diff --git a/dev/cgd/t_cgd_aes.c b/dev/cgd/t_cgd_aes.c index 9416333a2d71..edda1eb71aa1 100644 --- a/dev/cgd/t_cgd_aes.c +++ b/dev/cgd/t_cgd_aes.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $ */ +/* $NetBSD: t_cgd_aes.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc @@ -49,7 +49,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define SECSIZE 512 diff --git a/dev/cgd/t_cgd_blowfish.c b/dev/cgd/t_cgd_blowfish.c index 958ebaccf6ad..93aa834aaa41 100644 --- a/dev/cgd/t_cgd_blowfish.c +++ b/dev/cgd/t_cgd_blowfish.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cgd_blowfish.c,v 1.1 2016/11/10 23:44:36 alnsn Exp $ */ +/* $NetBSD: t_cgd_blowfish.c,v 1.2 2017/01/13 21:30:39 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. * All rights reserved. @@ -48,7 +48,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define SECSIZE 512 diff --git a/dev/scsipi/t_cd.c b/dev/scsipi/t_cd.c index 58e61a564ea0..6e856de187ca 100644 --- a/dev/scsipi/t_cd.c +++ b/dev/scsipi/t_cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cd.c,v 1.7 2014/04/25 00:24:39 pooka Exp $ */ +/* $NetBSD: t_cd.c,v 1.8 2017/01/13 21:30:39 christos Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -39,7 +39,7 @@ #include "scsitest.h" -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(noisyeject); ATF_TC_HEAD(noisyeject, tc) diff --git a/dev/sysmon/t_swwdog.c b/dev/sysmon/t_swwdog.c index 1635884447ea..5e5fd991e1ba 100644 --- a/dev/sysmon/t_swwdog.c +++ b/dev/sysmon/t_swwdog.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_swwdog.c,v 1.6 2015/04/23 04:49:37 pgoyette Exp $ */ +/* $NetBSD: t_swwdog.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -43,7 +43,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" static volatile sig_atomic_t tcount; diff --git a/fs/common/h_fsmacros.h b/fs/common/h_fsmacros.h index b295cf28104c..eb8376873b2f 100644 --- a/fs/common/h_fsmacros.h +++ b/fs/common/h_fsmacros.h @@ -1,4 +1,4 @@ -/* $NetBSD: h_fsmacros.h,v 1.40 2015/08/29 19:19:43 dholland Exp $ */ +/* $NetBSD: h_fsmacros.h,v 1.41 2017/01/13 21:30:39 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" #define FSPROTOS(_fs_) \ int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \ diff --git a/fs/ffs/h_quota2_tests.c b/fs/ffs/h_quota2_tests.c index 59f3ea3b0917..71cf3b4958f1 100644 --- a/fs/ffs/h_quota2_tests.c +++ b/fs/ffs/h_quota2_tests.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.4 2012/09/30 21:26:57 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */ /* * rump server for advanced quota tests @@ -22,7 +22,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" int background = 0; diff --git a/fs/ffs/t_fifos.c b/fs/ffs/t_fifos.c index fe1d4254a352..10b50bbd792d 100644 --- a/fs/ffs/t_fifos.c +++ b/fs/ffs/t_fifos.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fifos.c,v 1.5 2010/11/07 17:51:17 jmmv Exp $ */ +/* $NetBSD: t_fifos.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */ #include #include @@ -17,7 +17,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC_WITH_CLEANUP(fifos); ATF_TC_HEAD(fifos, tc) diff --git a/fs/ffs/t_mount.c b/fs/ffs/t_mount.c index 6a8f74f455f8..20960953406b 100644 --- a/fs/ffs/t_mount.c +++ b/fs/ffs/t_mount.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mount.c,v 1.13 2012/11/27 16:01:49 jakllsch Exp $ */ +/* $NetBSD: t_mount.c,v 1.14 2017/01/13 21:30:39 christos Exp $ */ /* * Basic tests for mounting @@ -25,7 +25,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(48Kimage); ATF_TC_HEAD(48Kimage, tc) diff --git a/fs/ffs/t_quota2_1.c b/fs/ffs/t_quota2_1.c index 333f3c712708..22cd5d24512a 100644 --- a/fs/ffs/t_quota2_1.c +++ b/fs/ffs/t_quota2_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_quota2_1.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */ +/* $NetBSD: t_quota2_1.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */ /* * Basic tests for quota2 @@ -18,7 +18,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" static void do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log) diff --git a/fs/ffs/t_quota2_remount.c b/fs/ffs/t_quota2_remount.c index f648856bbf70..d843cf891b4b 100644 --- a/fs/ffs/t_quota2_remount.c +++ b/fs/ffs/t_quota2_remount.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_quota2_remount.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */ +/* $NetBSD: t_quota2_remount.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */ /* * Basic tests for quota2 @@ -19,7 +19,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" static void do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log) diff --git a/fs/ffs/t_snapshot.c b/fs/ffs/t_snapshot.c index 180a8ccd92b0..f661bec2634c 100644 --- a/fs/ffs/t_snapshot.c +++ b/fs/ffs/t_snapshot.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot.c,v 1.6 2013/02/06 09:05:01 hannken Exp $ */ +/* $NetBSD: t_snapshot.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */ #include #include @@ -15,7 +15,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "ffs.img" #define NEWFS "newfs -F -s 10000 " IMGNAME diff --git a/fs/ffs/t_snapshot_log.c b/fs/ffs/t_snapshot_log.c index e1ce17e1006a..31b28e53df2d 100644 --- a/fs/ffs/t_snapshot_log.c +++ b/fs/ffs/t_snapshot_log.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot_log.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */ +/* $NetBSD: t_snapshot_log.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */ #include #include @@ -15,7 +15,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "ffs.img" #define NEWFS "newfs -F -s 10000 " IMGNAME diff --git a/fs/ffs/t_snapshot_v2.c b/fs/ffs/t_snapshot_v2.c index 393f3d41a6c3..b27929cb12d8 100644 --- a/fs/ffs/t_snapshot_v2.c +++ b/fs/ffs/t_snapshot_v2.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot_v2.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */ +/* $NetBSD: t_snapshot_v2.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */ #include #include @@ -15,7 +15,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "ffs.img" #define NEWFS "newfs -F -s 10000 -O 2 " IMGNAME diff --git a/fs/hfs/t_pathconvert.c b/fs/hfs/t_pathconvert.c index 307de709be8b..056726a1a6c2 100644 --- a/fs/hfs/t_pathconvert.c +++ b/fs/hfs/t_pathconvert.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pathconvert.c,v 1.5 2011/02/25 20:54:18 martin Exp $ */ +/* $NetBSD: t_pathconvert.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -18,7 +18,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(colonslash); ATF_TC_HEAD(colonslash, tc) diff --git a/fs/kernfs/t_basic.c b/fs/kernfs/t_basic.c index e5ba4a77e1b7..77acd1149c66 100644 --- a/fs/kernfs/t_basic.c +++ b/fs/kernfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.3 2010/05/31 23:44:54 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -20,7 +20,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(getdents); ATF_TC_HEAD(getdents, tc) diff --git a/fs/lfs/t_pr.c b/fs/lfs/t_pr.c index 97cb1dbbbf77..ed676d8bf9b0 100644 --- a/fs/lfs/t_pr.c +++ b/fs/lfs/t_pr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.6 2011/02/22 18:41:05 pooka Exp $ */ +/* $NetBSD: t_pr.c,v 1.7 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -17,7 +17,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(mknod); ATF_TC_HEAD(mknod, tc) diff --git a/fs/msdosfs/t_snapshot.c b/fs/msdosfs/t_snapshot.c index 8b5708f843a3..449e62545ab7 100644 --- a/fs/msdosfs/t_snapshot.c +++ b/fs/msdosfs/t_snapshot.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot.c,v 1.3 2014/06/10 13:15:18 martin Exp $ */ +/* $NetBSD: t_snapshot.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -17,7 +17,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "msdosfs.img" #define NEWFS "newfs_msdos -C 5M " IMGNAME diff --git a/fs/nfs/t_mountd.c b/fs/nfs/t_mountd.c index b6c15287791c..6272587d71a0 100644 --- a/fs/nfs/t_mountd.c +++ b/fs/nfs/t_mountd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mountd.c,v 1.5 2012/02/24 13:53:46 joerg Exp $ */ +/* $NetBSD: t_mountd.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" ATF_TC(mountdhup); diff --git a/fs/nullfs/t_basic.c b/fs/nullfs/t_basic.c index 21dfccdb80f1..d54f7739bafc 100644 --- a/fs/nullfs/t_basic.c +++ b/fs/nullfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.3 2010/06/09 08:37:16 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -18,7 +18,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(basic); ATF_TC_HEAD(basic, tc) diff --git a/fs/ptyfs/t_nullpts.c b/fs/ptyfs/t_nullpts.c index 9265f32ffa0a..fcc7e47f6215 100644 --- a/fs/ptyfs/t_nullpts.c +++ b/fs/ptyfs/t_nullpts.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_nullpts.c,v 1.5 2011/01/10 11:11:04 hannken Exp $ */ +/* $NetBSD: t_nullpts.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -19,7 +19,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" static void mountptyfs(const char *mp, int flags) diff --git a/fs/ptyfs/t_ptyfs.c b/fs/ptyfs/t_ptyfs.c index 90001b92ee94..108c344c343c 100644 --- a/fs/ptyfs/t_ptyfs.c +++ b/fs/ptyfs/t_ptyfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptyfs.c,v 1.1 2010/06/11 23:52:38 pooka Exp $ */ +/* $NetBSD: t_ptyfs.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -17,7 +17,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" static void mountptyfs(const char *mp, int flags) diff --git a/fs/puffs/t_basic.c b/fs/puffs/t_basic.c index 735108d64f44..4b5b7b81b2a4 100644 --- a/fs/puffs/t_basic.c +++ b/fs/puffs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */ +/* $NetBSD: t_basic.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -20,7 +20,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" /* diff --git a/fs/puffs/t_fuzz.c b/fs/puffs/t_fuzz.c index 1d249c0a8be1..b2e000d07e5c 100644 --- a/fs/puffs/t_fuzz.c +++ b/fs/puffs/t_fuzz.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fuzz.c,v 1.5 2012/04/21 01:03:46 manu Exp $ */ +/* $NetBSD: t_fuzz.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #define ITERATIONS 100 diff --git a/fs/puffs/t_io.c b/fs/puffs/t_io.c index 37c386c83d5a..72b5d85e23ff 100644 --- a/fs/puffs/t_io.c +++ b/fs/puffs/t_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_io.c,v 1.1 2010/11/12 17:33:28 pooka Exp $ */ +/* $NetBSD: t_io.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -20,7 +20,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" #define MAKEOPTS(...) \ diff --git a/fs/tmpfs/t_renamerace.c b/fs/tmpfs/t_renamerace.c index 044937a930c8..d7c10e4c6679 100644 --- a/fs/tmpfs/t_renamerace.c +++ b/fs/tmpfs/t_renamerace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_renamerace.c,v 1.13 2011/08/18 21:44:55 riastradh Exp $ */ +/* $NetBSD: t_renamerace.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */ /* * Modified for rump and atf from a program supplied @@ -23,7 +23,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(renamerace2); ATF_TC_HEAD(renamerace2, tc) diff --git a/fs/umapfs/t_basic.c b/fs/umapfs/t_basic.c index 259f6fe8c11b..c9b2d9b7a5dc 100644 --- a/fs/umapfs/t_basic.c +++ b/fs/umapfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.4 2010/07/19 15:35:39 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.5 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -20,7 +20,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(basic); ATF_TC_HEAD(basic, tc) diff --git a/fs/union/t_pr.c b/fs/union/t_pr.c index 2d0c0c84db49..fc70bcadf36b 100644 --- a/fs/union/t_pr.c +++ b/fs/union/t_pr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.8 2011/08/10 06:27:02 hannken Exp $ */ +/* $NetBSD: t_pr.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -17,7 +17,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(multilayer); ATF_TC_HEAD(multilayer, tc) diff --git a/fs/vfs/t_full.c b/fs/vfs/t_full.c index f338a0221f0a..51347deca70d 100644 --- a/fs/vfs/t_full.c +++ b/fs/vfs/t_full.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_full.c,v 1.8 2013/03/16 05:45:37 jmmv Exp $ */ +/* $NetBSD: t_full.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" /* * Write this much over the image size. This is to force an NFS commit, diff --git a/fs/vfs/t_io.c b/fs/vfs/t_io.c index 23c3a157f802..b7f652936e10 100644 --- a/fs/vfs/t_io.c +++ b/fs/vfs/t_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_io.c,v 1.16 2015/04/04 12:34:44 riastradh Exp $ */ +/* $NetBSD: t_io.c,v 1.17 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define TESTSTR "this is a string. collect enough and you'll have Em" #define TESTSZ sizeof(TESTSTR) diff --git a/fs/vfs/t_renamerace.c b/fs/vfs/t_renamerace.c index 809c380c5e22..63cfb4479c89 100644 --- a/fs/vfs/t_renamerace.c +++ b/fs/vfs/t_renamerace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_renamerace.c,v 1.33 2016/05/04 08:30:22 dholland Exp $ */ +/* $NetBSD: t_renamerace.c,v 1.34 2017/01/13 21:30:40 christos Exp $ */ /* * Modified for rump and atf from a program supplied @@ -34,7 +34,7 @@ #define FSTEST_IMGSIZE (50000 * 512) #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" static volatile int quittingtime; pid_t wrkpid; diff --git a/fs/vfs/t_ro.c b/fs/vfs/t_ro.c index b1e1179956b0..f7f45813e7b7 100644 --- a/fs/vfs/t_ro.c +++ b/fs/vfs/t_ro.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ro.c,v 1.5 2011/02/22 21:23:19 yamt Exp $ */ +/* $NetBSD: t_ro.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define AFILE "testfile" #define ADIR "testdir" diff --git a/fs/vfs/t_union.c b/fs/vfs/t_union.c index bdcef939354e..5da1ea1ff39b 100644 --- a/fs/vfs/t_union.c +++ b/fs/vfs/t_union.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_union.c,v 1.8 2011/08/07 06:01:51 hannken Exp $ */ +/* $NetBSD: t_union.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */ #include #include @@ -17,7 +17,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" #define MSTR "magic bus" diff --git a/fs/vfs/t_unpriv.c b/fs/vfs/t_unpriv.c index 6da771b45bcd..6536c21d9572 100644 --- a/fs/vfs/t_unpriv.c +++ b/fs/vfs/t_unpriv.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_unpriv.c,v 1.12 2015/04/09 19:51:13 riastradh Exp $ */ +/* $NetBSD: t_unpriv.c,v 1.13 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define USES_OWNER \ if (FSTYPE_MSDOS(tc)) \ diff --git a/fs/vfs/t_vfsops.c b/fs/vfs/t_vfsops.c index 1bcee89e573d..bbed9f9d3089 100644 --- a/fs/vfs/t_vfsops.c +++ b/fs/vfs/t_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vfsops.c,v 1.11 2011/04/04 19:16:58 hannken Exp $ */ +/* $NetBSD: t_vfsops.c,v 1.12 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" static void tmount(const atf_tc_t *tc, const char *path) diff --git a/fs/vfs/t_vnops.c b/fs/vfs/t_vnops.c index 978fadb04c26..7da53c8d4386 100644 --- a/fs/vfs/t_vnops.c +++ b/fs/vfs/t_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */ +/* $NetBSD: t_vnops.c,v 1.59 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ #include #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define TESTFILE "afile" diff --git a/include/sys/t_socket.c b/include/sys/t_socket.c index f60941c1ab1a..9db224780180 100644 --- a/include/sys/t_socket.c +++ b/include/sys/t_socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_socket.c,v 1.4 2015/02/27 08:30:30 martin Exp $ */ +/* $NetBSD: t_socket.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */ #include #include @@ -18,7 +18,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(cmsg_sendfd_bounds); ATF_TC_HEAD(cmsg_sendfd_bounds, tc) diff --git a/kernel/kqueue/read/t_fifo.c b/kernel/kqueue/read/t_fifo.c index 5908547693c5..290fda74dd4a 100644 --- a/kernel/kqueue/read/t_fifo.c +++ b/kernel/kqueue/read/t_fifo.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */ +/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); +__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" #define FIFONAME "fifo" diff --git a/kernel/kqueue/read/t_file.c b/kernel/kqueue/read/t_file.c index 233517297964..6200f74134d9 100644 --- a/kernel/kqueue/read/t_file.c +++ b/kernel/kqueue/read/t_file.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */ +/* $NetBSD: t_file.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); +__RCSID("$NetBSD: t_file.c,v 1.4 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_file.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" #define FILENAME "file" #define NLINES 5 diff --git a/kernel/kqueue/read/t_file2.c b/kernel/kqueue/read/t_file2.c index c77d2830e93d..733caebbf1e4 100644 --- a/kernel/kqueue/read/t_file2.c +++ b/kernel/kqueue/read/t_file2.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */ +/* $NetBSD: t_file2.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); +__RCSID("$NetBSD: t_file2.c,v 1.4 2017/01/13 21:30:41 christos Exp $"); #include @@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_file2.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" ATF_TC(file2); ATF_TC_HEAD(file2, tc) diff --git a/kernel/kqueue/read/t_pipe.c b/kernel/kqueue/read/t_pipe.c index d8e05f262e38..7cb3eab89ccc 100644 --- a/kernel/kqueue/read/t_pipe.c +++ b/kernel/kqueue/read/t_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); +__RCSID("$NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include @@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" ATF_TC(pipe); ATF_TC_HEAD(pipe, tc) diff --git a/kernel/kqueue/read/t_ttypty.c b/kernel/kqueue/read/t_ttypty.c index 3a42fd3927fb..89b1dc2ec4ca 100644 --- a/kernel/kqueue/read/t_ttypty.c +++ b/kernel/kqueue/read/t_ttypty.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); +__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" static void h_check(bool check_master) diff --git a/kernel/kqueue/t_ioctl.c b/kernel/kqueue/t_ioctl.c index d996fdfbd575..78b058733457 100644 --- a/kernel/kqueue/t_ioctl.c +++ b/kernel/kqueue/t_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ +/* $NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +__RCSID("$NetBSD: t_ioctl.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -42,7 +42,7 @@ __RCSID("$NetBSD: t_ioctl.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(kfilter_byfilter); ATF_TC_HEAD(kfilter_byfilter, tc) diff --git a/kernel/kqueue/t_proc1.c b/kernel/kqueue/t_proc1.c index 07d5a3c0279d..947e6e317a0a 100644 --- a/kernel/kqueue/t_proc1.c +++ b/kernel/kqueue/t_proc1.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ +/* $NetBSD: t_proc1.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +__RCSID("$NetBSD: t_proc1.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); /* * this also used to trigger problem fixed in @@ -51,7 +51,7 @@ __RCSID("$NetBSD: t_proc1.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); #include -#include "../../h_macros.h" +#include "h_macros.h" static int child(void) diff --git a/kernel/kqueue/t_proc2.c b/kernel/kqueue/t_proc2.c index e70fcb279d1a..2d905ed740d9 100644 --- a/kernel/kqueue/t_proc2.c +++ b/kernel/kqueue/t_proc2.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ +/* $NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +__RCSID("$NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); #include -#include "../../h_macros.h" +#include "h_macros.h" static void child_two(void) diff --git a/kernel/kqueue/t_proc3.c b/kernel/kqueue/t_proc3.c index b77510becec7..6def4094b1bf 100644 --- a/kernel/kqueue/t_proc3.c +++ b/kernel/kqueue/t_proc3.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $ */ +/* $NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +__RCSID("$NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(proc3); ATF_TC_HEAD(proc3, tc) diff --git a/kernel/kqueue/t_sig.c b/kernel/kqueue/t_sig.c index 4fc075847c89..e0efe825a46b 100644 --- a/kernel/kqueue/t_sig.c +++ b/kernel/kqueue/t_sig.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $ */ +/* $NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $"); +__RCSID("$NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $"); #include -#include "../../h_macros.h" +#include "h_macros.h" #define NSIGNALS 5 diff --git a/kernel/kqueue/write/t_fifo.c b/kernel/kqueue/write/t_fifo.c index 82b256cb625c..fe375b8fa943 100644 --- a/kernel/kqueue/write/t_fifo.c +++ b/kernel/kqueue/write/t_fifo.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $ */ +/* $NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); +__RCSID("$NetBSD: t_fifo.c,v 1.4 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_fifo.c,v 1.3 2010/11/07 17:51:20 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" #define FIFONAME "fifo" diff --git a/kernel/kqueue/write/t_pipe.c b/kernel/kqueue/write/t_pipe.c index 459a1f7ad0b2..5b2ca8c22f5e 100644 --- a/kernel/kqueue/write/t_pipe.c +++ b/kernel/kqueue/write/t_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); +__RCSID("$NetBSD: t_pipe.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -44,7 +44,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" ATF_TC(pipe1); ATF_TC_HEAD(pipe1, tc) diff --git a/kernel/kqueue/write/t_ttypty.c b/kernel/kqueue/write/t_ttypty.c index 6983910f9573..45a67500f5b8 100644 --- a/kernel/kqueue/write/t_ttypty.c +++ b/kernel/kqueue/write/t_ttypty.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $ */ +/* $NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $"); +__RCSID("$NetBSD: t_ttypty.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_ttypty.c,v 1.1 2009/02/20 21:39:58 jmmv Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" static void h_check(bool check_master) diff --git a/kernel/t_extent.c b/kernel/t_extent.c index faefafae5f8d..57dfc2b6780f 100644 --- a/kernel/t_extent.c +++ b/kernel/t_extent.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $ */ +/* $NetBSD: t_extent.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $"); +__RCSID("$NetBSD: t_extent.c,v 1.5 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -41,7 +41,7 @@ __RCSID("$NetBSD: t_extent.c,v 1.4 2012/01/27 18:53:10 para Exp $"); #include -#include "../h_macros.h" +#include "h_macros.h" static int ret; static struct extent *ex; diff --git a/kernel/t_filedesc.c b/kernel/t_filedesc.c index 6b367ee701c7..a938d6f0b178 100644 --- a/kernel/t_filedesc.c +++ b/kernel/t_filedesc.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $ */ +/* $NetBSD: t_filedesc.c,v 1.6 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $"); +__RCSID("$NetBSD: t_filedesc.c,v 1.6 2017/01/13 21:30:41 christos Exp $"); #include @@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_filedesc.c,v 1.5 2012/03/18 09:46:50 jruoho Exp $"); #include #include -#include "../h_macros.h" +#include "h_macros.h" ATF_TC(getfilerace); ATF_TC_HEAD(getfilerace, tc) diff --git a/kernel/t_lock.c b/kernel/t_lock.c index 3704afb14bc0..bd83abe97933 100644 --- a/kernel/t_lock.c +++ b/kernel/t_lock.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ +/* $NetBSD: t_lock.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); +__RCSID("$NetBSD: t_lock.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include @@ -38,7 +38,7 @@ __RCSID("$NetBSD: t_lock.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); #include -#include "../h_macros.h" +#include "h_macros.h" __cpu_simple_lock_t lk; volatile int handled = 0; diff --git a/kernel/t_ptrace.c b/kernel/t_ptrace.c index 074a953a93e7..dc0bbdb6e14b 100644 --- a/kernel/t_ptrace.c +++ b/kernel/t_ptrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $ */ +/* $NetBSD: t_ptrace.c,v 1.18 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace.c,v 1.18 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_ptrace.c,v 1.17 2016/11/13 22:59:31 kamil Exp $"); #include -#include "../h_macros.h" +#include "h_macros.h" /* * A child process cannot call atf functions and expect them to magically diff --git a/kernel/t_ptrace_wait.c b/kernel/t_ptrace_wait.c index e502a034eb1b..d8935904c516 100644 --- a/kernel/t_ptrace_wait.c +++ b/kernel/t_ptrace_wait.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.57 2017/01/13 23:22:12 kamil Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.57 2017/01/13 23:22:12 kamil Exp $"); #include #include @@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $"); #include -#include "../h_macros.h" +#include "h_macros.h" #include "t_ptrace_wait.h" #include "msg.h" @@ -65,6 +65,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.53 2017/01/10 05:08:24 kamil Exp $"); #define PARENT_FROM_CHILD(info, fds, msg) \ ATF_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, sizeof(msg)) == 0) + ATF_TC(traceme1); ATF_TC_HEAD(traceme1, tc) { @@ -1296,12 +1297,6 @@ ATF_TC_BODY(vfork1, tc) ptrace_event_t event; const int elen = sizeof(event); - /* - * ptrace(2) command PT_SET_EVENT_MASK: option PTRACE_VFORK unsupported - */ -#ifndef PTRACE_VFORK -#define PTRACE_VFORK 0 -#endif atf_tc_expect_fail("PR kern/51630"); printf("Before forking process PID=%d\n", getpid()); @@ -1483,6 +1478,196 @@ ATF_TC_BODY(vfork2, tc) TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); } +ATF_TC(vforkdone1); +ATF_TC_HEAD(vforkdone1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_VFORK_DONE"); +} + +ATF_TC_BODY(vforkdone1, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = vfork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Enable PTRACE_VFORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_VFORK_DONE; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK_DONE); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_VFORK_DONE event with forkee %d\n", child2); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(vforkdone2); +ATF_TC_HEAD(vforkdone2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that vfork(2) is intercepted by ptrace(2) with EVENT_MASK " + "set to PTRACE_FORK | PTRACE_VFORK_DONE"); +} + +ATF_TC_BODY(vforkdone2, tc) +{ + const int exitval = 5; + const int exitval2 = 15; + const int sigval = SIGSTOP; + pid_t child, child2, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_state_t state; + const int slen = sizeof(state); + ptrace_event_t event; + const int elen = sizeof(event); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + FORKEE_ASSERT((child2 = vfork()) != 1); + + if (child2 == 0) + _exit(exitval2); + + FORKEE_REQUIRE_SUCCESS + (wpid = TWAIT_GENERIC(child2, &status, 0), child2); + + forkee_status_exited(status, exitval2); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Enable PTRACE_VFORK in EVENT_MASK for the child %d\n", child); + event.pe_set_event = PTRACE_FORK | PTRACE_VFORK_DONE; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child %d\n", TWAIT_FNAME, child); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + ATF_REQUIRE(ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); + ATF_REQUIRE_EQ(state.pe_report_event, PTRACE_VFORK_DONE); + + child2 = state.pe_other_pid; + printf("Reported PTRACE_VFORK_DONE event with forkee %d\n", child2); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected stopped " + "SIGCHLD\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGCHLD); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child - expected exited\n", + TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child - expected no process\n", + TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + ATF_TC(io_read_d1); ATF_TC_HEAD(io_read_d1, tc) { @@ -5015,6 +5200,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC_HAVE_PID(tp, vfork1); ATF_TP_ADD_TC(tp, vfork2); + ATF_TP_ADD_TC(tp, vforkdone1); + ATF_TP_ADD_TC(tp, vforkdone2); + ATF_TP_ADD_TC(tp, io_read_d1); ATF_TP_ADD_TC(tp, io_read_d2); ATF_TP_ADD_TC(tp, io_read_d3); diff --git a/kernel/t_pty.c b/kernel/t_pty.c index fccfc17b6eda..3b079ef616ba 100644 --- a/kernel/t_pty.c +++ b/kernel/t_pty.c @@ -1,4 +1,4 @@ -/* $Id: t_pty.c,v 1.1 2011/09/24 15:53:01 christos Exp $ */ +/* $Id: t_pty.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /* * Allocates a pty(4) device, and sends the specified number of packets of the @@ -9,7 +9,7 @@ */ #include -__RCSID("$NetBSD: t_pty.c,v 1.1 2011/09/24 15:53:01 christos Exp $"); +__RCSID("$NetBSD: t_pty.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -35,7 +35,7 @@ static __dead void usage(const char *); static void parse_args(int, char **); #else #include -#include "../h_macros.h" +#include "h_macros.h" #endif static int pty_open(void); diff --git a/kernel/t_rnd.c b/kernel/t_rnd.c index 86461308daa4..ae9ef5572023 100644 --- a/kernel/t_rnd.c +++ b/kernel/t_rnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $ */ +/* $NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $"); +__RCSID("$NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -39,7 +39,7 @@ __RCSID("$NetBSD: t_rnd.c,v 1.9 2016/05/22 04:34:44 riastradh Exp $"); #include #include -#include "../h_macros.h" +#include "h_macros.h" ATF_TC(RNDADDDATA); ATF_TC_HEAD(RNDADDDATA, tc) diff --git a/lib/libc/gen/t_glob.c b/lib/libc/gen/t_glob.c index ff62b638e12c..d741d939a43d 100644 --- a/lib/libc/gen/t_glob.c +++ b/lib/libc/gen/t_glob.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $ */ +/* $NetBSD: t_glob.c,v 1.4 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. * All rights reserved. @@ -32,7 +32,7 @@ */ #include -__RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $"); +__RCSID("$NetBSD: t_glob.c,v 1.4 2017/01/13 21:30:41 christos Exp $"); #include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $"); #include #include -#include "../../../h_macros.h" +#include "h_macros.h" #ifdef DEBUG diff --git a/lib/libc/regex/debug.c b/lib/libc/regex/debug.c index c1528b9e8c95..e9ad4316198f 100644 --- a/lib/libc/regex/debug.c +++ b/lib/libc/regex/debug.c @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.2 2011/10/10 04:32:41 christos Exp $ */ +/* $NetBSD: debug.c,v 1.3 2017/01/14 00:50:56 christos Exp $ */ /*- * Copyright (c) 1993 The NetBSD Foundation, Inc. @@ -26,14 +26,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include #include #include #include - -#include +#include +#include /* Don't sort these! */ #include "utils.h" diff --git a/lib/libc/regex/t_exhaust.c b/lib/libc/regex/t_exhaust.c index 468492c293aa..f9bd276f63d6 100644 --- a/lib/libc/regex/t_exhaust.c +++ b/lib/libc/regex/t_exhaust.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $ */ +/* $NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,14 +37,15 @@ */ #include -__RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $"); +__RCSID("$NetBSD: t_exhaust.c,v 1.8 2017/01/14 00:50:56 christos Exp $"); -#include -#include -#include -#include -#include +#include #include +#include +#include +#include +#include +#include #ifndef REGEX_MAXSIZE #define REGEX_MAXSIZE 9999 @@ -176,14 +177,17 @@ ATF_TC_HEAD(regcomp_too_big, tc) " crash, but return a proper error code"); // libtre needs it. atf_tc_set_md_var(tc, "timeout", "600"); - atf_tc_set_md_var(tc, "require.memory", "120M"); + atf_tc_set_md_var(tc, "require.memory", "64M"); } ATF_TC_BODY(regcomp_too_big, tc) { regex_t re; + struct rlimit limit; int e; + limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024; + ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1); for (size_t i = 0; i < __arraycount(tests); i++) { char *d = (*tests[i].pattern)(REGEX_MAXSIZE); e = regcomp(&re, d, tests[i].type); diff --git a/lib/libc/regex/t_regex_att.c b/lib/libc/regex/t_regex_att.c index beaeb04043bf..0425b6f2c58c 100644 --- a/lib/libc/regex/t_regex_att.c +++ b/lib/libc/regex/t_regex_att.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $ */ +/* $NetBSD: t_regex_att.c,v 1.2 2017/01/14 00:50:56 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $"); +__RCSID("$NetBSD: t_regex_att.c,v 1.2 2017/01/14 00:50:56 christos Exp $"); #include @@ -374,7 +374,7 @@ checkmatches(const char *matches, size_t nm, const regmatch_t *pm, " cur=%d, max=%zu", res, l, len - off); off += l; } - ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno); + ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno); free(res); } diff --git a/lib/libc/sys/t_clock_gettime.c b/lib/libc/sys/t_clock_gettime.c index 69890fdf0523..a319b09bce73 100644 --- a/lib/libc/sys/t_clock_gettime.c +++ b/lib/libc/sys/t_clock_gettime.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $ */ +/* $NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,22 +58,23 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $"); +__RCSID("$NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include -#include #include #include +#include #include +#include #include #include #include #include -#include "../../../h_macros.h" +#include "h_macros.h" #define MINPOSDIFF 15000000 /* 15 ms for now */ #define TIMEOUT 5 diff --git a/lib/libc/sys/t_connect.c b/lib/libc/sys/t_connect.c index 9981090a5a70..a920d3def0ff 100644 --- a/lib/libc/sys/t_connect.c +++ b/lib/libc/sys/t_connect.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_connect.c,v 1.2 2015/04/05 23:17:41 rtr Exp $ */ +/* $NetBSD: t_connect.c,v 1.3 2017/01/13 20:09:48 christos Exp $ */ /* * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -26,6 +26,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -52,6 +53,9 @@ ATF_TC_BODY(connect_low_port, tc) slist = socket(AF_INET, SOCK_STREAM, 0); sd = socket(AF_INET, SOCK_STREAM, 0); + ATF_REQUIRE(sd > 0); + ATF_REQUIRE(slist > 0); + /* bind listening socket */ memset(&sinlist, 0, sizeof(sinlist)); sinlist.sin_family = AF_INET; @@ -88,6 +92,7 @@ ATF_TC_BODY(connect_low_port, tc) ATF_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX); close(sd); + close(slist); } ATF_TC(connect_foreign_family); diff --git a/lib/libc/sys/t_dup.c b/lib/libc/sys/t_dup.c index a2623c09e7ef..93ad718c5497 100644 --- a/lib/libc/sys/t_dup.c +++ b/lib/libc/sys/t_dup.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $ */ +/* $NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $"); +__RCSID("$NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $"); #include #include @@ -39,6 +39,7 @@ __RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/18 07:00:51 jruoho Exp $"); #include #include #include +#include #include #include #include diff --git a/lib/libc/sys/t_getrusage.c b/lib/libc/sys/t_getrusage.c index 3aebb3dde9b9..90d74acf7b14 100644 --- a/lib/libc/sys/t_getrusage.c +++ b/lib/libc/sys/t_getrusage.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_getrusage.c,v 1.4 2016/08/05 15:01:39 scole Exp $ */ +/* $NetBSD: t_getrusage.c,v 1.5 2017/01/13 20:31:06 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_getrusage.c,v 1.4 2016/08/05 15:01:39 scole Exp $"); +__RCSID("$NetBSD: t_getrusage.c,v 1.5 2017/01/13 20:31:06 christos Exp $"); #include #include @@ -47,7 +47,7 @@ static void sighandler(int); static const size_t maxiter = 2000; static void -sighandler(int signo) +sighandler(int signo __unused) { /* Nothing. */ } diff --git a/lib/libc/sys/t_link.c b/lib/libc/sys/t_link.c index b58c4c9e6d8f..a6d894cc0894 100644 --- a/lib/libc/sys/t_link.c +++ b/lib/libc/sys/t_link.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $ */ +/* $NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $"); +__RCSID("$NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $"); #include #include @@ -37,6 +37,7 @@ __RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $"); #include #include #include +#include #include #include #include diff --git a/lib/libc/sys/t_listen.c b/lib/libc/sys/t_listen.c index 71201d30af91..9f3f9b8413e2 100644 --- a/lib/libc/sys/t_listen.c +++ b/lib/libc/sys/t_listen.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_listen.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $ */ +/* $NetBSD: t_listen.c,v 1.5 2017/01/13 20:41:50 christos Exp $ */ /* * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. @@ -26,6 +26,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -106,6 +107,7 @@ ATF_TC_BODY(listen_low_port, tc) int sd, val; sd = socket(AF_INET, SOCK_STREAM, 0); + ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno)); val = IP_PORTRANGE_LOW; if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val, diff --git a/lib/libc/sys/t_mmap.c b/lib/libc/sys/t_mmap.c index 963b3c5cebeb..3dc1e7f92fe3 100644 --- a/lib/libc/sys/t_mmap.c +++ b/lib/libc/sys/t_mmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $ */ +/* $NetBSD: t_mmap.c,v 1.11 2017/01/13 20:43:11 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ * SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $"); +__RCSID("$NetBSD: t_mmap.c,v 1.11 2017/01/13 20:43:11 christos Exp $"); #include #include @@ -444,6 +444,7 @@ ATF_TC_BODY(mmap_truncate, tc) ATF_REQUIRE(ftruncate(fd, page / 12) == 0); ATF_REQUIRE(ftruncate(fd, page / 64) == 0); + (void)munmap(map, page); ATF_REQUIRE(close(fd) == 0); } @@ -496,6 +497,8 @@ ATF_TC_BODY(mmap_truncate_signal, tc) prevent the access to be optimized out */ ATF_REQUIRE(i == 0); ATF_REQUIRE(sta == 0); + (void)munmap(map, page); + (void)close(fd); return; } diff --git a/lib/libc/sys/t_msgctl.c b/lib/libc/sys/t_msgctl.c index 1e74d60703ed..9f99980ae4ca 100644 --- a/lib/libc/sys/t_msgctl.c +++ b/lib/libc/sys/t_msgctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $ */ +/* $NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $"); +__RCSID("$NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $"); #include #include @@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/02/27 00:59:50 joerg Exp $"); #include #include +#include #include #include #include diff --git a/lib/libc/sys/t_msgrcv.c b/lib/libc/sys/t_msgrcv.c index e32be262aa15..522ceb82cd38 100644 --- a/lib/libc/sys/t_msgrcv.c +++ b/lib/libc/sys/t_msgrcv.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $ */ +/* $NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $"); +__RCSID("$NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $"); #include #include @@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $"); #include #include +#include #include #include #include diff --git a/lib/libc/sys/t_msgsnd.c b/lib/libc/sys/t_msgsnd.c index 54937897435f..598882131a7d 100644 --- a/lib/libc/sys/t_msgsnd.c +++ b/lib/libc/sys/t_msgsnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $ */ +/* $NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $"); +__RCSID("$NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $"); #include #include @@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $"); #include #include +#include #include #include #include diff --git a/lib/libc/sys/t_nanosleep.c b/lib/libc/sys/t_nanosleep.c index 317d66766408..1ad6661c808f 100644 --- a/lib/libc/sys/t_nanosleep.c +++ b/lib/libc/sys/t_nanosleep.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $ */ +/* $NetBSD: t_nanosleep.c,v 1.4 2017/01/13 21:15:14 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $"); +__RCSID("$NetBSD: t_nanosleep.c,v 1.4 2017/01/13 21:15:14 christos Exp $"); #include #include @@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 2013/03/31 16:47:16 christos Exp $"); #include static void -handler(int signo) +handler(int signo __unused) { /* Nothing. */ } diff --git a/lib/libc/sys/t_pipe.c b/lib/libc/sys/t_pipe.c index b30b94df702f..df8f1edd1d16 100644 --- a/lib/libc/sys/t_pipe.c +++ b/lib/libc/sys/t_pipe.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $ */ +/* $NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $"); +__RCSID("$NetBSD: t_pipe.c,v 1.5 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_pipe.c,v 1.3 2011/10/31 15:41:31 christos Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" static pid_t pid; static int nsiginfo = 0; @@ -153,6 +153,7 @@ ATF_TC_BODY(pipe_restart, tc) ATF_REQUIRE_EQ(WEXITSTATUS(st), 0); } + free(f); } ATF_TP_ADD_TCS(tp) diff --git a/lib/libc/sys/t_pipe2.c b/lib/libc/sys/t_pipe2.c index 51f22406a01b..12a9394b7f2b 100644 --- a/lib/libc/sys/t_pipe2.c +++ b/lib/libc/sys/t_pipe2.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pipe2.c,v 1.8 2012/05/16 13:54:28 jruoho Exp $ */ +/* $NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_pipe2.c,v 1.8 2012/05/16 13:54:28 jruoho Exp $"); +__RCSID("$NetBSD: t_pipe2.c,v 1.9 2017/01/13 21:19:45 christos Exp $"); #include #include @@ -53,7 +53,8 @@ run(int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); - ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1); + ATF_REQUIRE_MSG(closefrom(3) != -1, "closefrom failed: %s", + strerror(errno)); ATF_REQUIRE(pipe2(fd, flags) == 0); @@ -110,9 +111,10 @@ ATF_TC_BODY(pipe2_consume, tc) { struct rlimit rl; int err, filedes[2]; + int old; - err = fcntl(4, F_CLOSEM); - ATF_REQUIRE(err == 0); + ATF_REQUIRE_MSG(closefrom(4) != -1, "closefrom failed: %s", + strerror(errno)); err = getrlimit(RLIMIT_NOFILE, &rl); ATF_REQUIRE(err == 0); @@ -121,12 +123,15 @@ ATF_TC_BODY(pipe2_consume, tc) * file descriptor limit in the middle of a pipe2() call - i.e. * before the call only a single descriptor may be openend. */ + old = rl.rlim_cur; rl.rlim_cur = 4; err = setrlimit(RLIMIT_NOFILE, &rl); ATF_REQUIRE(err == 0); err = pipe2(filedes, O_CLOEXEC); ATF_REQUIRE(err == -1); + rl.rlim_cur = old; + err = setrlimit(RLIMIT_NOFILE, &rl); } ATF_TC(pipe2_nonblock); diff --git a/lib/libc/sys/t_posix_fadvise.c b/lib/libc/sys/t_posix_fadvise.c index da4e7461c8af..813bfb8cba11 100644 --- a/lib/libc/sys/t_posix_fadvise.c +++ b/lib/libc/sys/t_posix_fadvise.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $ */ +/* $NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $"); +__RCSID("$NetBSD: t_posix_fadvise.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); #include @@ -68,7 +68,7 @@ __RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2011/10/15 06:10:26 jruoho Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" #include #include diff --git a/lib/libc/sys/t_revoke.c b/lib/libc/sys/t_revoke.c index 10fd6d64a00b..2fb1ae83fdda 100644 --- a/lib/libc/sys/t_revoke.c +++ b/lib/libc/sys/t_revoke.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_revoke.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */ +/* $NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_revoke.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $"); +__RCSID("$NetBSD: t_revoke.c,v 1.2 2017/01/13 21:15:57 christos Exp $"); #include #include @@ -167,6 +167,7 @@ ATF_TC_BODY(revoke_perm, tc) if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) atf_tc_fail("revoke(2) did not obey permissions"); + (void)close(fd); ATF_REQUIRE(unlink(path) == 0); } diff --git a/lib/libc/sys/t_select.c b/lib/libc/sys/t_select.c index 4316acf133d9..04a684a8cdea 100644 --- a/lib/libc/sys/t_select.c +++ b/lib/libc/sys/t_select.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_select.c,v 1.3 2012/03/18 07:00:52 jruoho Exp $ */ +/* $NetBSD: t_select.c,v 1.4 2017/01/13 21:18:33 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -47,13 +47,13 @@ static sig_atomic_t keep_going = 1; static void -sig_handler(int signum) +sig_handler(int signum __unused) { keep_going = 0; } static void -sigchld(int signum) +sigchld(int signum __unused) { } @@ -82,7 +82,7 @@ prmask(const sigset_t *m, char *buf, size_t len) return buf; } -static void +static __dead void child(const struct timespec *ts) { struct sigaction sa; @@ -127,6 +127,7 @@ child(const struct timespec *ts) "after timeout %s != %s", prmask(&nset, nbuf, sizeof(nbuf)), prmask(&oset, obuf, sizeof(obuf))); + _exit(0); } ATF_TC(pselect_sigmask); @@ -146,6 +147,7 @@ ATF_TC_BODY(pselect_sigmask, tc) switch (pid = fork()) { case 0: child(NULL); + /*NOTREACHED*/ case -1: err(1, "fork"); default: diff --git a/lib/libc/sys/t_setrlimit.c b/lib/libc/sys/t_setrlimit.c index a38943e12458..bf7ae488f01d 100644 --- a/lib/libc/sys/t_setrlimit.c +++ b/lib/libc/sys/t_setrlimit.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $ */ +/* $NetBSD: t_setrlimit.c,v 1.6 2017/01/13 21:16:38 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_setrlimit.c,v 1.5 2016/07/13 09:53:16 njoly Exp $"); +__RCSID("$NetBSD: t_setrlimit.c,v 1.6 2017/01/13 21:16:38 christos Exp $"); #include #include @@ -122,6 +122,7 @@ ATF_TC_BODY(setrlimit_basic, tc) if (lim != 0) atf_tc_fail("failed to set limit (%d)", lim); + free(buf); } ATF_TC(setrlimit_current); diff --git a/lib/libc/sys/t_sigaction.c b/lib/libc/sys/t_sigaction.c index f0e68bae77b9..4bbf421c6204 100644 --- a/lib/libc/sys/t_sigaction.c +++ b/lib/libc/sys/t_sigaction.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $ */ +/* $NetBSD: t_sigaction.c,v 1.5 2017/01/13 21:30:41 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2010\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $"); +__RCSID("$NetBSD: t_sigaction.c,v 1.5 2017/01/13 21:30:41 christos Exp $"); #include @@ -41,12 +41,12 @@ __RCSID("$NetBSD: t_sigaction.c,v 1.3 2014/11/04 00:20:19 justin Exp $"); #include -#include "../../../h_macros.h" +#include "h_macros.h" static bool handler_called = false; static void -handler(int signo) +handler(int signo __unused) { handler_called = true; } @@ -79,7 +79,7 @@ wait_and_check_child(const pid_t pid, const char *fail_message) } static void -catch(int sig) +catch(int sig __unused) { return; } diff --git a/lib/libc/sys/t_sigqueue.c b/lib/libc/sys/t_sigqueue.c index f48d7919f0f7..317ee591162a 100644 --- a/lib/libc/sys/t_sigqueue.c +++ b/lib/libc/sys/t_sigqueue.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $ */ +/* $NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,12 +30,13 @@ */ #include -__RCSID("$NetBSD: t_sigqueue.c,v 1.6 2016/08/04 06:43:43 christos Exp $"); - +__RCSID("$NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $"); #include +#include #include #include +#include #include #include #include @@ -46,7 +47,7 @@ static void handler(int, siginfo_t *, void *); static int value; static void -handler(int signo, siginfo_t *info, void *data) +handler(int signo __unused, siginfo_t *info, void *data __unused) { value = info->si_value.sival_int; kill(0, SIGINFO); @@ -107,9 +108,10 @@ static sig_atomic_t count = 0; static int delivered[CNT]; static void -myhandler(int signo, siginfo_t *info, void *context) +myhandler(int signo, siginfo_t *info, void *context __unused) { delivered[count++] = signo; + printf("Signal #%zu: signo: %d\n", (size_t)count, signo); } static int @@ -176,7 +178,8 @@ ATF_TC_BODY(sigqueue_rt, tc) sigset_t mask, orig; sigemptyset(&mask); for (size_t i = 0; i < CNT; i++) - sigaddset(&mask, signals[i]); + if (sigaddset(&mask, signals[i]) == -1) + warn("sigaddset"); ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1); @@ -185,13 +188,17 @@ ATF_TC_BODY(sigqueue_rt, tc) ATF_REQUIRE(sigprocmask(SIG_UNBLOCK, &mask, &orig) != -1); sleep(1); - ATF_REQUIRE_MSG((size_t)count == ndelivered, + ATF_CHECK_MSG((size_t)count == ndelivered, "count %zu != ndelivered %zu", (size_t)count, ndelivered); for (size_t i = 0; i < ndelivered; i++) ATF_REQUIRE_MSG(ordered[i] == delivered[i], "%zu: ordered %d != delivered %d", i, ordered[i], delivered[i]); + if ((size_t)count > ndelivered) + for (size_t i = ndelivered; i < (size_t)count; i++) + printf("Undelivered signal #%zu: %d\n", i, ordered[i]); + for (size_t i = 0; i < ndelivered; i++) ATF_REQUIRE(sigaction(signals[i], &oact[i], NULL) != -1); } diff --git a/lib/libc/sys/t_socketpair.c b/lib/libc/sys/t_socketpair.c index 532629c3998d..266d738ccb0f 100644 --- a/lib/libc/sys/t_socketpair.c +++ b/lib/libc/sys/t_socketpair.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_socketpair.c,v 1.1 2011/11/05 18:19:02 jruoho Exp $ */ +/* $NetBSD: t_socketpair.c,v 1.2 2017/01/13 20:04:52 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_socketpair.c,v 1.1 2011/11/05 18:19:02 jruoho Exp $"); +__RCSID("$NetBSD: t_socketpair.c,v 1.2 2017/01/13 20:04:52 christos Exp $"); #include #include @@ -63,7 +63,7 @@ run(int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); - ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1); + ATF_REQUIRE(closefrom(3) != -1); ATF_REQUIRE(socketpair(AF_UNIX, SOCK_DGRAM | flags, 0, fd) == 0); diff --git a/lib/libc/sys/t_stat.c b/lib/libc/sys/t_stat.c index 0312e2f2f6db..adb32bb11efc 100644 --- a/lib/libc/sys/t_stat.c +++ b/lib/libc/sys/t_stat.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $ */ +/* $NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,13 +29,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_stat.c,v 1.4 2012/03/17 08:37:08 jruoho Exp $"); +__RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $"); #include #include #include #include +#include #include #include @@ -392,6 +393,7 @@ ATF_TC_BODY(stat_symlink, tc) if (sa.st_mode == sb.st_mode) atf_tc_fail("inconsistencies between stat(2) and lstat(2)"); + (void)close(fd); ATF_REQUIRE(unlink(path) == 0); ATF_REQUIRE(unlink(pathlink) == 0); } diff --git a/lib/libc/sys/t_truncate.c b/lib/libc/sys/t_truncate.c index 50a9cbaad4ec..5b96a20c9da9 100644 --- a/lib/libc/sys/t_truncate.c +++ b/lib/libc/sys/t_truncate.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $ */ +/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,13 +29,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $"); +__RCSID("$NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $"); #include #include #include #include +#include #include #include #include @@ -149,6 +150,7 @@ ATF_TC_HEAD(truncate_err, tc) ATF_TC_BODY(truncate_err, tc) { + char buf[PATH_MAX]; errno = 0; ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1); @@ -160,7 +162,9 @@ ATF_TC_BODY(truncate_err, tc) ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1); errno = 0; - ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1); + snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned", + atf_tc_get_config_var(tc, "srcdir")); + ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1); } ATF_TP_ADD_TCS(tp) diff --git a/lib/libc/sys/t_umask.c b/lib/libc/sys/t_umask.c index 748cbdcf1ada..fb3e405b5aa2 100644 --- a/lib/libc/sys/t_umask.c +++ b/lib/libc/sys/t_umask.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_umask.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $ */ +/* $NetBSD: t_umask.c,v 1.2 2017/01/13 19:34:19 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_umask.c,v 1.1 2011/07/07 06:57:54 jruoho Exp $"); +__RCSID("$NetBSD: t_umask.c,v 1.2 2017/01/13 19:34:19 christos Exp $"); #include #include @@ -129,6 +129,7 @@ ATF_TC_BODY(umask_open, tc) if (fd < 0) continue; + (void)close(fd); (void)memset(&st, 0, sizeof(struct stat)); if (stat(path, &st) != 0) { diff --git a/lib/libc/sys/t_unlink.c b/lib/libc/sys/t_unlink.c index 38bff4cf9a5c..6b05a0859b08 100644 --- a/lib/libc/sys/t_unlink.c +++ b/lib/libc/sys/t_unlink.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $ */ +/* $NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_unlink.c,v 1.2 2014/04/21 18:05:17 martin Exp $"); +__RCSID("$NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $"); #include @@ -107,8 +107,11 @@ ATF_TC_HEAD(unlink_fifo, tc) ATF_TC_BODY(unlink_fifo, tc) { + int fd; - ATF_REQUIRE(mkfifo(path, 0666) == 0); + ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0, + "mkfifo failed: %s", strerror(errno)); + (void)close(fd); ATF_REQUIRE(unlink(path) == 0); errno = 0; diff --git a/lib/libc/sys/t_wait.c b/lib/libc/sys/t_wait.c index 163709bf3e78..fb8d6357904a 100644 --- a/lib/libc/sys/t_wait.c +++ b/lib/libc/sys/t_wait.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $ */ +/* $NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -29,16 +29,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $"); +__RCSID("$NetBSD: t_wait.c,v 1.8 2017/01/13 19:28:55 christos Exp $"); #include #include -#include #include +#include #include #include #include +#include #include #include diff --git a/lib/libc/sys/t_write.c b/lib/libc/sys/t_write.c index 2b1324a0f900..576ce7e7c0b5 100644 --- a/lib/libc/sys/t_write.c +++ b/lib/libc/sys/t_write.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $ */ +/* $NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $ */ /*- * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. @@ -29,15 +29,15 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $"); +__RCSID("$NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $"); #include -#include #include #include #include #include +#include #include #include #include @@ -49,7 +49,7 @@ static bool fail = false; static const char *path = "write"; static void -sighandler(int signo) +sighandler(int signo __unused) { fail = false; } diff --git a/lib/libm/t_ilogb.c b/lib/libm/t_ilogb.c index 8e3d2990ce79..1d35cb64127b 100644 --- a/lib/libm/t_ilogb.c +++ b/lib/libm/t_ilogb.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ilogb.c,v 1.6 2016/08/26 08:01:55 christos Exp $ */ +/* $NetBSD: t_ilogb.c,v 1.7 2017/01/13 19:23:40 christos Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -28,15 +28,18 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include +__RCSID("$NetBSD: t_ilogb.c,v 1.7 2017/01/13 19:23:40 christos Exp $"); #include #include +#include #include #ifndef __HAVE_FENV -# define ATF_CHECK_RAISED_INVALID -# define ATF_CHECK_RAISED_NOTHING +# define ATF_CHECK_RAISED_INVALID +# define ATF_CHECK_RAISED_NOTHING #else # define ATF_CHECK_RAISED_INVALID do { \ diff --git a/lib/libm/t_scalbn.c b/lib/libm/t_scalbn.c index 586c2c3bc621..4bf00c3415d1 100644 --- a/lib/libm/t_scalbn.c +++ b/lib/libm/t_scalbn.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_scalbn.c,v 1.11 2014/03/03 10:39:08 martin Exp $ */ +/* $NetBSD: t_scalbn.c,v 1.14 2017/01/13 21:09:12 agc Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_scalbn.c,v 1.11 2014/03/03 10:39:08 martin Exp $"); +__RCSID("$NetBSD: t_scalbn.c,v 1.14 2017/01/13 21:09:12 agc Exp $"); #include #include @@ -81,6 +81,7 @@ ATF_TC_BODY(scalbn_val, tc) double rv; for (i = 0; i < tcnt; i++) { + errno = 0; rv = scalbn(tests[i].inval, tests[i].exp); ATF_CHECK_EQ_MSG(errno, tests[i].error, "test %zu: errno %d instead of %d", i, errno, @@ -222,6 +223,7 @@ ATF_TC_BODY(scalbnf_val, tc) double rv; for (i = 0; i < tcnt; i++) { + errno = 0; rv = scalbnf(tests[i].inval, tests[i].exp); ATF_CHECK_EQ_MSG(errno, tests[i].error, "test %zu: errno %d instead of %d", i, errno, @@ -366,6 +368,7 @@ ATF_TC_BODY(scalbnl_val, tc) long double rv; for (i = 0; i < tcnt; i++) { + errno = 0; rv = scalbnl(tests[i].inval, tests[i].exp); ATF_CHECK_EQ_MSG(errno, tests[i].error, "test %zu: errno %d instead of %d", i, errno, diff --git a/lib/libposix/t_rename.c b/lib/libposix/t_rename.c index 85b2b95b3a68..8c18ec50168d 100644 --- a/lib/libposix/t_rename.c +++ b/lib/libposix/t_rename.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_rename.c,v 1.2 2011/05/16 00:03:36 christos Exp $ */ +/* $NetBSD: t_rename.c,v 1.3 2017/01/13 21:30:41 christos Exp $ */ /* * Copyright (c) 2001, 2008, 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2008, 2010\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_rename.c,v 1.2 2011/05/16 00:03:36 christos Exp $"); +__RCSID("$NetBSD: t_rename.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include @@ -43,7 +43,7 @@ __RCSID("$NetBSD: t_rename.c,v 1.2 2011/05/16 00:03:36 christos Exp $"); #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(rename); ATF_TC_HEAD(rename, tc) diff --git a/lib/librumpclient/t_fd.c b/lib/librumpclient/t_fd.c index 6e6d9470e7a1..70182ab8c515 100644 --- a/lib/librumpclient/t_fd.c +++ b/lib/librumpclient/t_fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fd.c,v 1.5 2016/08/10 21:10:18 kre Exp $ */ +/* $NetBSD: t_fd.c,v 1.6 2017/01/13 21:30:41 christos Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC_WITH_CLEANUP(bigenough); ATF_TC_HEAD(bigenough, tc) diff --git a/lib/semaphore/sem.c b/lib/semaphore/sem.c index 5967b88d3fff..6af9b0d97bd3 100644 --- a/lib/semaphore/sem.c +++ b/lib/semaphore/sem.c @@ -1,4 +1,4 @@ -/* $NetBSD: sem.c,v 1.10 2012/03/09 14:25:34 joerg Exp $ */ +/* $NetBSD: sem.c,v 1.11 2017/01/13 21:30:42 christos Exp $ */ /* * Common code for semaphore tests. This can be included both into @@ -21,7 +21,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(postwait); ATF_TC_HEAD(postwait, tc) diff --git a/libexec/ld.elf_so/t_dlerror-cleared.c b/libexec/ld.elf_so/t_dlerror-cleared.c index 03940c2de013..47c7f55bb285 100644 --- a/libexec/ld.elf_so/t_dlerror-cleared.c +++ b/libexec/ld.elf_so/t_dlerror-cleared.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlerror-cleared.c,v 1.1 2010/12/14 05:57:32 skrll Exp $ */ +/* $NetBSD: t_dlerror-cleared.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(rtld_dlerror_cleared); ATF_TC_HEAD(rtld_dlerror_cleared, tc) diff --git a/libexec/ld.elf_so/t_dlerror-false.c b/libexec/ld.elf_so/t_dlerror-false.c index 8b80c260d630..31b96e8c18c1 100644 --- a/libexec/ld.elf_so/t_dlerror-false.c +++ b/libexec/ld.elf_so/t_dlerror-false.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlerror-false.c,v 1.1 2010/12/14 05:57:32 skrll Exp $ */ +/* $NetBSD: t_dlerror-false.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(rtld_dlerror_false); ATF_TC_HEAD(rtld_dlerror_false, tc) diff --git a/libexec/ld.elf_so/t_dlinfo.c b/libexec/ld.elf_so/t_dlinfo.c index a15ba5d5a909..7b12528f9f54 100644 --- a/libexec/ld.elf_so/t_dlinfo.c +++ b/libexec/ld.elf_so/t_dlinfo.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlinfo.c,v 1.4 2011/03/25 14:47:31 pooka Exp $ */ +/* $NetBSD: t_dlinfo.c,v 1.5 2017/01/13 21:30:42 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(rtld_dlinfo_linkmap_self); ATF_TC_HEAD(rtld_dlinfo_linkmap_self, tc) diff --git a/libexec/ld.elf_so/t_ifunc.c b/libexec/ld.elf_so/t_ifunc.c index 1c85672af5f7..68468d4483d4 100644 --- a/libexec/ld.elf_so/t_ifunc.c +++ b/libexec/ld.elf_so/t_ifunc.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ifunc.c,v 1.1 2014/08/25 20:40:53 joerg Exp $ */ +/* $NetBSD: t_ifunc.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(rtld_ifunc); diff --git a/modules/t_builtin.c b/modules/t_builtin.c index 0d9a3f0dc129..79845b85c553 100644 --- a/modules/t_builtin.c +++ b/modules/t_builtin.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_builtin.c,v 1.2 2010/11/03 16:10:23 christos Exp $ */ +/* $NetBSD: t_builtin.c,v 1.3 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. All rights reserved. @@ -39,7 +39,7 @@ #include #include -#include "../h_macros.h" +#include "h_macros.h" #define MYMP "/mnt" #define HZFILE MYMP "/hz" diff --git a/net/bpf/t_bpf.c b/net/bpf/t_bpf.c index 95ca2fc48de7..5d7716c9738d 100644 --- a/net/bpf/t_bpf.c +++ b/net/bpf/t_bpf.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $ */ +/* $NetBSD: t_bpf.c,v 1.6 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $"); +__RCSID("$NetBSD: t_bpf.c,v 1.6 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_bpf.c,v 1.5 2012/08/14 19:40:30 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" ATF_TC(bpfwriteleak); diff --git a/net/bpf/t_mbuf.c b/net/bpf/t_mbuf.c index 965dd02e285b..2076dc26aead 100644 --- a/net/bpf/t_mbuf.c +++ b/net/bpf/t_mbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $ */ +/* $NetBSD: t_mbuf.c,v 1.3 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $"); +__RCSID("$NetBSD: t_mbuf.c,v 1.3 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_mbuf.c,v 1.2 2014/07/08 21:44:26 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" static bool test_ldb_abs(size_t split) diff --git a/net/bpfilter/t_bpfilter.c b/net/bpfilter/t_bpfilter.c index 460b43e62d9b..15a9ab6e2c16 100644 --- a/net/bpfilter/t_bpfilter.c +++ b/net/bpfilter/t_bpfilter.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $ */ +/* $NetBSD: t_bpfilter.c,v 1.11 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $"); +__RCSID("$NetBSD: t_bpfilter.c,v 1.11 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -53,7 +53,7 @@ __RCSID("$NetBSD: t_bpfilter.c,v 1.10 2015/02/11 23:39:07 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" diff --git a/net/bpfjit/t_bpfjit.c b/net/bpfjit/t_bpfjit.c index 58db1e06a083..06c3d97b734f 100644 --- a/net/bpfjit/t_bpfjit.c +++ b/net/bpfjit/t_bpfjit.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $ */ +/* $NetBSD: t_bpfjit.c,v 1.12 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2011-2012, 2014-2015 Alexander Nasonov. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $"); +__RCSID("$NetBSD: t_bpfjit.c,v 1.12 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -49,7 +49,7 @@ __RCSID("$NetBSD: t_bpfjit.c,v 1.11 2015/02/14 22:34:33 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" static uint8_t deadbeef_at_5[16] = { diff --git a/net/bpfjit/t_cop.c b/net/bpfjit/t_cop.c index 5a007e6510a5..502c588e4a9b 100644 --- a/net/bpfjit/t_cop.c +++ b/net/bpfjit/t_cop.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $ */ +/* $NetBSD: t_cop.c,v 1.4 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $"); +__RCSID("$NetBSD: t_cop.c,v 1.4 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_cop.c,v 1.3 2014/07/13 21:35:33 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" static uint32_t retA(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A); static uint32_t retBL(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A); diff --git a/net/bpfjit/t_extmem.c b/net/bpfjit/t_extmem.c index 915c4366467e..51761ec06128 100644 --- a/net/bpfjit/t_extmem.c +++ b/net/bpfjit/t_extmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $ */ +/* $NetBSD: t_extmem.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $"); +__RCSID("$NetBSD: t_extmem.c,v 1.2 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_extmem.c,v 1.1 2014/07/09 13:49:49 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" static uint32_t retM(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A); diff --git a/net/bpfjit/t_mbuf.c b/net/bpfjit/t_mbuf.c index 489ef802d9ab..d3a2b994c5a9 100644 --- a/net/bpfjit/t_mbuf.c +++ b/net/bpfjit/t_mbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $ */ +/* $NetBSD: t_mbuf.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2014 Alexander Nasonov. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $"); +__RCSID("$NetBSD: t_mbuf.c,v 1.2 2017/01/13 21:30:42 christos Exp $"); #include #include @@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_mbuf.c,v 1.1 2014/07/08 21:45:55 alnsn Exp $"); #undef m_data #include -#include "../../h_macros.h" +#include "h_macros.h" static bool test_ldb_abs(size_t split) diff --git a/net/carp/t_basic.c b/net/carp/t_basic.c index fe2e6b5f2f66..681b8bb179a7 100644 --- a/net/carp/t_basic.c +++ b/net/carp/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $ */ +/* $NetBSD: t_basic.c,v 1.6 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $"); +__RCSID("$NetBSD: t_basic.c,v 1.6 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include @@ -52,7 +52,7 @@ __RCSID("$NetBSD: t_basic.c,v 1.5 2011/06/26 13:13:31 christos Exp $"); #include #include "../config/netconfig.c" -#include "../../h_macros.h" +#include "h_macros.h" static bool oknow = false; diff --git a/net/config/netconfig.c b/net/config/netconfig.c index c2f9dd477896..6fe37cc23da3 100644 --- a/net/config/netconfig.c +++ b/net/config/netconfig.c @@ -1,4 +1,4 @@ -/* $NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $ */ +/* $NetBSD: netconfig.c,v 1.9 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $"); +__RCSID("$NetBSD: netconfig.c,v 1.9 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include @@ -53,7 +53,7 @@ __RCSID("$NetBSD: netconfig.c,v 1.8 2013/07/03 19:13:33 pooka Exp $"); #include #include -#include "../../h_macros.h" +#include "h_macros.h" int noatf; diff --git a/net/icmp/t_forward.c b/net/icmp/t_forward.c index d4180271b449..346614c07151 100644 --- a/net/icmp/t_forward.c +++ b/net/icmp/t_forward.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $ */ +/* $NetBSD: t_forward.c,v 1.10 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $"); +__RCSID("$NetBSD: t_forward.c,v 1.10 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include @@ -57,7 +57,7 @@ __RCSID("$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $"); #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" /* diff --git a/net/icmp/t_ping.c b/net/icmp/t_ping.c index 68a00c7c2237..b3327e10e9e2 100644 --- a/net/icmp/t_ping.c +++ b/net/icmp/t_ping.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $ */ +/* $NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $"); +__RCSID("$NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include @@ -52,7 +52,7 @@ __RCSID("$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $"); #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../config/netconfig.c" ATF_TC(simpleping); diff --git a/net/if_loop/t_pr.c b/net/if_loop/t_pr.c index a22953f933b2..ee4f68472c82 100644 --- a/net/if_loop/t_pr.c +++ b/net/if_loop/t_pr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $ */ +/* $NetBSD: t_pr.c,v 1.8 2017/01/13 21:30:42 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $"); +__RCSID("$NetBSD: t_pr.c,v 1.8 2017/01/13 21:30:42 christos Exp $"); #endif /* not lint */ #include @@ -50,7 +50,7 @@ __RCSID("$NetBSD: t_pr.c,v 1.7 2012/03/18 09:46:50 jruoho Exp $"); #include #include "../config/netconfig.c" -#include "../../h_macros.h" +#include "h_macros.h" /* * Prepare rump, configure interface and route to cause fragmentation diff --git a/net/ndp/t_ra.sh b/net/ndp/t_ra.sh index b2345704f462..69f227af498e 100755 --- a/net/ndp/t_ra.sh +++ b/net/ndp/t_ra.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_ra.sh,v 1.20 2017/01/11 03:15:44 ozaki-r Exp $ +# $NetBSD: t_ra.sh,v 1.24 2017/01/13 08:11:01 ozaki-r Exp $ # # Copyright (c) 2015 Internet Initiative Japan Inc. # All rights reserved. @@ -127,7 +127,8 @@ check_entries() -o match:"$ll_srv%shmif0 +$mac_srv +shmif0 +(23h59m|1d0h0m)..s S R" \ rump.ndp -n -a atf_check -s exit:0 -o match:$addr_prefix rump.ndp -n -a - atf_check -s exit:0 -o match:"$addr_prefix.+" \ + atf_check -s exit:0 \ + -o match:"$addr_prefix.+<(TENTATIVE,)?AUTOCONF>" \ rump.ifconfig shmif0 inet6 unset RUMP_SERVER } @@ -603,60 +604,75 @@ ra_temporary_address_head() atf_set "require.progs" "rump_server rump.rtadvd rump.ndp rump.ifconfig" } +check_echo_request_pkt() +{ + local pkt="$2 > $3: .+ echo request" + + extract_new_packets $1 > ./out + $DEBUG && echo $pkt + $DEBUG && cat ./out + atf_check -s exit:0 -o match:"$pkt" cat ./out +} + ra_temporary_address_body() { + local ip_auto= ip_temp= rump_server_fs_start $RUMPSRV netinet6 rump_server_start $RUMPCLI netinet6 - setup_shmif0 ${RUMPSRV} ${IP6SRV} + setup_shmif0 $RUMPSRV $IP6SRV init_server $RUMPSRV + setup_shmif0 $RUMPCLI $IP6CLI - setup_shmif0 ${RUMPCLI} ${IP6CLI} - export RUMP_SERVER=${RUMPCLI} - $DEBUG && rump.ndp -n -a - atf_check -s exit:0 -o match:'= 0' \ - rump.sysctl net.inet6.ip6.accept_rtadv - atf_check -s exit:0 -o match:'= 0' \ - rump.sysctl net.inet6.ip6.use_tempaddr - unset RUMP_SERVER - - create_rtadvdconfig - start_rtadvd $RUMPSRV $PIDFILE - sleep $WAITTIME - - export RUMP_SERVER=${RUMPCLI} - atf_check -s exit:0 -o empty rump.ndp -r - atf_check -s exit:0 -o not-match:'advertised' rump.ndp -p - atf_check -s exit:0 -o match:'linkmtu=0' rump.ndp -n -i shmif0 - atf_check -s exit:0 -o not-match:'S R' rump.ndp -n -a - atf_check -s exit:0 -o not-match:'fc00:1:' rump.ndp -n -a - atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6 - unset RUMP_SERVER - - atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` - wait_term ${PIDFILE} - - export RUMP_SERVER=${RUMPCLI} + export RUMP_SERVER=$RUMPCLI atf_check -s exit:0 -o match:'0.->.1' \ rump.sysctl -w net.inet6.ip6.accept_rtadv=1 atf_check -s exit:0 -o match:'0.->.1' \ rump.sysctl -w net.inet6.ip6.use_tempaddr=1 unset RUMP_SERVER + create_rtadvdconfig start_rtadvd $RUMPSRV $PIDFILE sleep $WAITTIME check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX + export RUMP_SERVER=$RUMPCLI + # Check temporary address - export RUMP_SERVER=${RUMPCLI} - atf_check -s exit:0 -o match:"$IP6SRV_PREFIX.+" \ + atf_check -s exit:0 \ + -o match:"$IP6SRV_PREFIX.+<(TENTATIVE,)?AUTOCONF,TEMPORARY>" \ rump.ifconfig shmif0 inet6 + + # + # Testing net.inet6.ip6.prefer_tempaddr + # + atf_check -s exit:0 rump.ifconfig -w 10 + $DEBUG && rump.ifconfig shmif0 + ip_auto=$(rump.ifconfig shmif0 |awk '// {sub(/\/[0-9]*/, ""); print $2;}') + ip_temp=$(rump.ifconfig shmif0 |awk '// {sub(/\/[0-9]*/, ""); print $2;}') + $DEBUG && echo $ip_auto $ip_temp + + # Ignore old packets + extract_new_packets bus1 > /dev/null + + atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV + # autoconf (non-temporal) address should be used as the source address + check_echo_request_pkt bus1 $ip_auto $IP6SRV + + # Enable net.inet6.ip6.prefer_tempaddr + atf_check -s exit:0 -o match:'0.->.1' \ + rump.sysctl -w net.inet6.ip6.prefer_tempaddr=1 + + atf_check -s exit:0 -o ignore rump.ping6 -n -X 2 -c 1 $IP6SRV + # autoconf, temporal address should be used as the source address + check_echo_request_pkt bus1 $ip_temp $IP6SRV + unset RUMP_SERVER atf_check -s exit:0 kill -TERM `cat ${PIDFILE}` - wait_term ${PIDFILE} + wait_term $PIDFILE rump_server_destroy_ifaces } diff --git a/net/net/t_raw.c b/net/net/t_raw.c index ef3262dfa372..5c483a180de5 100644 --- a/net/net/t_raw.c +++ b/net/net/t_raw.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_raw.c,v 1.1 2011/01/11 10:51:45 pooka Exp $ */ +/* $NetBSD: t_raw.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ #include #include @@ -12,7 +12,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(PRU_SENSE); ATF_TC_HEAD(PRU_SENSE, tc) diff --git a/rump/modautoload/t_modautoload.c b/rump/modautoload/t_modautoload.c index 2c21a90b664b..b45dae540993 100644 --- a/rump/modautoload/t_modautoload.c +++ b/rump/modautoload/t_modautoload.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_modautoload.c,v 1.5 2016/09/14 03:19:11 ozaki-r Exp $ */ +/* $NetBSD: t_modautoload.c,v 1.6 2017/01/13 21:30:42 christos Exp $ */ #include #include @@ -20,7 +20,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(modautoload); ATF_TC_HEAD(modautoload, tc) diff --git a/rump/rumpkern/t_kern.c b/rump/rumpkern/t_kern.c index fcaf1f8178de..15b258605ba9 100644 --- a/rump/rumpkern/t_kern.c +++ b/rump/rumpkern/t_kern.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_kern.c,v 1.3 2012/01/30 13:05:52 njoly Exp $ */ +/* $NetBSD: t_kern.c,v 1.4 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../kernspace/kernspace.h" #define LOCKFUN(_name_, _descr_,_needld_, _expect_) \ diff --git a/rump/rumpkern/t_lwproc.c b/rump/rumpkern/t_lwproc.c index 6e78d0219e2b..f31997982c79 100644 --- a/rump/rumpkern/t_lwproc.c +++ b/rump/rumpkern/t_lwproc.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_lwproc.c,v 1.8 2017/01/10 22:36:29 christos Exp $ */ +/* $NetBSD: t_lwproc.c,v 1.9 2017/01/13 21:30:43 christos Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(makelwp); ATF_TC_HEAD(makelwp, tc) diff --git a/rump/rumpkern/t_modcmd.c b/rump/rumpkern/t_modcmd.c index 032e31296a98..e48bcb53dbf7 100644 --- a/rump/rumpkern/t_modcmd.c +++ b/rump/rumpkern/t_modcmd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_modcmd.c,v 1.9 2010/05/31 23:51:28 pooka Exp $ */ +/* $NetBSD: t_modcmd.c,v 1.10 2017/01/13 21:30:43 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" /* * We verify that modules can be loaded and unloaded. * tmpfs was chosen because it does not depend on an image. diff --git a/rump/rumpkern/t_modlinkset.c b/rump/rumpkern/t_modlinkset.c index a4d34bb913fd..7d725dc7cc07 100644 --- a/rump/rumpkern/t_modlinkset.c +++ b/rump/rumpkern/t_modlinkset.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_modlinkset.c,v 1.2 2009/11/06 15:26:54 pooka Exp $ */ +/* $NetBSD: t_modlinkset.c,v 1.3 2017/01/13 21:30:43 christos Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(modlinkset); ATF_TC_HEAD(modlinkset, tc) diff --git a/rump/rumpkern/t_signals.c b/rump/rumpkern/t_signals.c index e113af29a1fa..ba0c0ea36fb2 100644 --- a/rump/rumpkern/t_signals.c +++ b/rump/rumpkern/t_signals.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_signals.c,v 1.2 2011/02/20 19:45:45 pooka Exp $ */ +/* $NetBSD: t_signals.c,v 1.3 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include #include "../kernspace/kernspace.h" -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(sigraise); ATF_TC_HEAD(sigraise, tc) diff --git a/rump/rumpkern/t_threads.c b/rump/rumpkern/t_threads.c index 24155ec7ca14..2931fa60d148 100644 --- a/rump/rumpkern/t_threads.c +++ b/rump/rumpkern/t_threads.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_threads.c,v 1.1 2010/05/31 23:36:12 pooka Exp $ */ +/* $NetBSD: t_threads.c,v 1.2 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../kernspace/kernspace.h" ATF_TC(threadjoin); diff --git a/rump/rumpkern/t_tsleep.c b/rump/rumpkern/t_tsleep.c index efd9f4c4b270..126a89de5280 100644 --- a/rump/rumpkern/t_tsleep.c +++ b/rump/rumpkern/t_tsleep.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_tsleep.c,v 1.1 2010/05/31 23:36:12 pooka Exp $ */ +/* $NetBSD: t_tsleep.c,v 1.2 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../kernspace/kernspace.h" ATF_TC(tsleep); diff --git a/rump/rumpkern/t_vm.c b/rump/rumpkern/t_vm.c index 4445983dcb56..ddb005c8eeae 100644 --- a/rump/rumpkern/t_vm.c +++ b/rump/rumpkern/t_vm.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vm.c,v 1.3 2012/03/17 18:00:28 hannken Exp $ */ +/* $NetBSD: t_vm.c,v 1.4 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" #include "../kernspace/kernspace.h" ATF_TC(busypage); diff --git a/rump/rumpvfs/t_basic.c b/rump/rumpvfs/t_basic.c index c136558b579b..278d99eb31c3 100644 --- a/rump/rumpvfs/t_basic.c +++ b/rump/rumpvfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.2 2011/02/22 13:25:18 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.3 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(lseekrv); ATF_TC_HEAD(lseekrv, tc) diff --git a/rump/rumpvfs/t_etfs.c b/rump/rumpvfs/t_etfs.c index 787f5e6eb9df..5935bead8ee6 100644 --- a/rump/rumpvfs/t_etfs.c +++ b/rump/rumpvfs/t_etfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_etfs.c,v 1.10 2014/05/12 15:33:12 christos Exp $ */ +/* $NetBSD: t_etfs.c,v 1.11 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(reregister_reg); ATF_TC_HEAD(reregister_reg, tc) diff --git a/rump/rumpvfs/t_p2kifs.c b/rump/rumpvfs/t_p2kifs.c index c94e5e19200e..ec2423cf5b95 100644 --- a/rump/rumpvfs/t_p2kifs.c +++ b/rump/rumpvfs/t_p2kifs.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_p2kifs.c,v 1.5 2016/01/25 11:45:57 pooka Exp $ */ +/* $NetBSD: t_p2kifs.c,v 1.6 2017/01/13 21:30:43 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include #include -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(makecn); ATF_TC_HEAD(makecn, tc) From 5c9ce2504ad01f0abb1df27d5bbf01cd4ffaaa8f Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Sat, 14 Jan 2017 02:29:25 +0000 Subject: [PATCH 073/126] Follow-up to r312103: Revert r310995 as well. --- tests/sys/vfs/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/sys/vfs/Makefile b/tests/sys/vfs/Makefile index 43fde788f652..9e2d79ef773a 100644 --- a/tests/sys/vfs/Makefile +++ b/tests/sys/vfs/Makefile @@ -9,6 +9,4 @@ CFLAGS.lookup_cap_dotdot.c+= -I${SRCTOP}/tests PLAIN_TESTS_SH+= trailing_slash -WARNS?= 6 - .include From 36b9e15c6635b5b7603689e59e9ccfb6483d528a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 03:54:23 +0000 Subject: [PATCH 074/126] Delete trailing whitespace and use __arraycount instead of nitems in contrib code MFC after: 1 week --- .../lib/libc/gen/posix_spawn/t_spawnattr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c index 78313cd8f809..2085b9e06394 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c @@ -60,16 +60,16 @@ get_different_scheduler(void) /* get current schedule policy */ scheduler = sched_getscheduler(0); - for (i = 0; i < nitems(schedulers); i++) { + for (i = 0; i < __arraycount(schedulers); i++) { if (schedulers[i] == scheduler) break; } - ATF_REQUIRE_MSG(i < nitems(schedulers), + ATF_REQUIRE_MSG(i < __arraycount(schedulers), "Unknown current scheduler %d", scheduler); - + /* new scheduler */ i++; - if (i >= nitems(schedulers)) + if (i >= __arraycount(schedulers)) i = 0; return schedulers[i]; } @@ -85,7 +85,7 @@ get_different_priority(int scheduler) sched_getparam(0, ¶m); priority = param.sched_priority; - + /* * Change numerical value of the priority, to ensure that it * was set for the spawned child. @@ -127,7 +127,7 @@ ATF_TC_BODY(t_spawnattr, tc) scheduler = get_different_scheduler(); priority = get_different_priority(scheduler); sp.sched_priority = priority; - + sigemptyset(&sig); sigaddset(&sig, SIGUSR1); From 02820e5e4e69197a3816f11d8333bb5e277bfb12 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:00:26 +0000 Subject: [PATCH 075/126] Bump WARNS up to 6 again Has not been tested (can't be after r312103 without cem's hacks to atf/kyua)! --- tests/sys/vfs/Makefile | 2 ++ tests/sys/vfs/lookup_cap_dotdot.c | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/sys/vfs/Makefile b/tests/sys/vfs/Makefile index 9e2d79ef773a..43fde788f652 100644 --- a/tests/sys/vfs/Makefile +++ b/tests/sys/vfs/Makefile @@ -9,4 +9,6 @@ CFLAGS.lookup_cap_dotdot.c+= -I${SRCTOP}/tests PLAIN_TESTS_SH+= trailing_slash +WARNS?= 6 + .include diff --git a/tests/sys/vfs/lookup_cap_dotdot.c b/tests/sys/vfs/lookup_cap_dotdot.c index 88b13e59abe2..c1a90cc2af5f 100644 --- a/tests/sys/vfs/lookup_cap_dotdot.c +++ b/tests/sys/vfs/lookup_cap_dotdot.c @@ -43,11 +43,11 @@ static int dirfd = -1; static char *abspath; static void -touchat(int dirfd, const char *name) +touchat(int _dirfd, const char *name) { int fd; - ATF_REQUIRE((fd = openat(dirfd, name, O_CREAT | O_TRUNC | O_WRONLY, + ATF_REQUIRE((fd = openat(_dirfd, name, O_CREAT | O_TRUNC | O_WRONLY, 0777)) >= 0); ATF_REQUIRE(close(fd) == 0); } @@ -117,7 +117,6 @@ ATF_TC_HEAD(lookup_cap_dotdot__basic, tc) ATF_TC_BODY(lookup_cap_dotdot__basic, tc) { cap_rights_t rights; - int fd; check_capsicum(); prepare_dotdot_tests(); @@ -141,7 +140,6 @@ ATF_TC_HEAD(lookup_cap_dotdot__advanced, tc) ATF_TC_BODY(lookup_cap_dotdot__advanced, tc) { cap_rights_t rights; - int fd; check_capsicum(); prepare_dotdot_tests(); @@ -220,7 +218,6 @@ ATF_TC_HEAD(lookup_cap_dotdot__negative, tc) ATF_TC_BODY(lookup_cap_dotdot__negative, tc) { cap_rights_t rights; - int fd; check_capsicum(); prepare_dotdot_tests(); From 5fea45956e719fabbd1cc392944172da3c2ecc88 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:09:01 +0000 Subject: [PATCH 076/126] Fix -Wsign-compare warnings The loop index (i) doesn't need to be size_t as its comparison is signed MFC after: 1 week Sponsored by: Dell EMC Isilon --- tests/sys/vm/mmap_test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/sys/vm/mmap_test.c b/tests/sys/vm/mmap_test.c index 8ed873896f03..afabb5c41b83 100644 --- a/tests/sys/vm/mmap_test.c +++ b/tests/sys/vm/mmap_test.c @@ -184,8 +184,7 @@ ATF_TC_WITHOUT_HEAD(mmap__dev_zero_private); ATF_TC_BODY(mmap__dev_zero_private, tc) { char *p1, *p2, *p3; - size_t i; - int fd, pagesize; + int fd, i, pagesize; ATF_REQUIRE((pagesize = getpagesize()) > 0); ATF_REQUIRE((fd = open("/dev/zero", O_RDONLY)) >= 0); @@ -197,7 +196,7 @@ ATF_TC_BODY(mmap__dev_zero_private, tc) ATF_REQUIRE(p2 != MAP_FAILED); for (i = 0; i < pagesize; i++) - ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]); + ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%d] is %x", i, p1[i]); ATF_REQUIRE(memcmp(p1, p2, pagesize) == 0); @@ -224,8 +223,7 @@ ATF_TC_WITHOUT_HEAD(mmap__dev_zero_shared); ATF_TC_BODY(mmap__dev_zero_shared, tc) { char *p1, *p2, *p3; - size_t i; - int fd, pagesize; + int fd, i, pagesize; ATF_REQUIRE((pagesize = getpagesize()) > 0); ATF_REQUIRE((fd = open("/dev/zero", O_RDWR)) >= 0); @@ -237,7 +235,7 @@ ATF_TC_BODY(mmap__dev_zero_shared, tc) ATF_REQUIRE(p2 != MAP_FAILED); for (i = 0; i < pagesize; i++) - ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%zu] is %x", i, p1[i]); + ATF_REQUIRE_EQ_MSG(0, p1[i], "byte at p1[%d] is %x", i, p1[i]); ATF_REQUIRE(memcmp(p1, p2, pagesize) == 0); From 54ff563fb9bdd13a0fb0f6cce8c0eb54f69de019 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:10:04 +0000 Subject: [PATCH 077/126] Remove unused vars to fix -Wunused issues MFC after: 3 days Sponsored by: Dell EMC Isilon --- tests/sys/file/ftruncate_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/file/ftruncate_test.c b/tests/sys/file/ftruncate_test.c index 7eaba14e2bfa..b657acad7fcb 100644 --- a/tests/sys/file/ftruncate_test.c +++ b/tests/sys/file/ftruncate_test.c @@ -57,7 +57,7 @@ static off_t lengths[] = {0, 1, 2, 3, 4, 127, 128, 129, 511, 512, 513, 1023, static int lengths_count = sizeof(lengths) / sizeof(off_t); int -main(int argc, char *argv[]) +main(void) { int error, fd, fds[2], i, read_only_fd; char path[PATH_MAX]; From 5e8fcdfe1bf6ca477d41181f53af9795ac4e70c5 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:13:28 +0000 Subject: [PATCH 078/126] Fix -Wunused on gcc 4.9 (x was set but not used) MFC after: 3 days Sponsored by: Dell EMC Isilon --- sys/kern/subr_unit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c index 5a627625cb6c..6d7f69e65015 100644 --- a/sys/kern/subr_unit.c +++ b/sys/kern/subr_unit.c @@ -986,7 +986,7 @@ main(int argc, char **argv) long count = 10000; /* Number of unrs to test */ long reps = 1, m; int ch; - u_int i, x, j; + u_int i, j; verbose = false; @@ -999,7 +999,7 @@ main(int argc, char **argv) usage(argv); exit(2); } - + break; case 'v': verbose = true; @@ -1026,7 +1026,6 @@ main(int argc, char **argv) printf("sizeof(struct unrb) %zu\n", sizeof(struct unrb)); printf("sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr)); printf("NBITS %lu\n", (unsigned long)NBITS); - x = 1; for (m = 0; m < count * reps; m++) { j = random(); i = (j >> 1) % count; From 66db8cca1acb33e3ddde098563a68d2fbc5ab1fe Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:16:13 +0000 Subject: [PATCH 079/126] Clean up trailing whitespace MFC after: 3 days Sponsored by: Dell EMC Isilon --- sys/kern/subr_unit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/kern/subr_unit.c b/sys/kern/subr_unit.c index 6d7f69e65015..3d510775b9ef 100644 --- a/sys/kern/subr_unit.c +++ b/sys/kern/subr_unit.c @@ -216,7 +216,7 @@ ub_full(struct unrb *ub, int len) * Consistency check function. * * Checks the internal consistency as well as we can. - * + * * Called at all boundaries of this API. */ static void @@ -240,7 +240,7 @@ check_unrhdr(struct unrhdr *uh, int line) w = 0; bit_count(ub->map, 0, up->len, &w); y += w; - } else if (up->ptr != NULL) + } else if (up->ptr != NULL) y += up->len; } KASSERT (y == uh->busy, @@ -375,7 +375,7 @@ is_bitmap(struct unrhdr *uh, struct unr *up) /* * Look for sequence of items which can be combined into a bitmap, if * multiple are present, take the one which saves most memory. - * + * * Return (1) if a sequence was found to indicate that another call * might be able to do more. Return (0) if we found no suitable sequence. * @@ -591,7 +591,7 @@ alloc_unrl(struct unrhdr *uh) } /* - * We can always allocate from the first list element, so if we have + * We can always allocate from the first list element, so if we have * nothing on the list, we must have run out of unit numbers. */ if (up == NULL) @@ -803,7 +803,7 @@ free_unrl(struct unrhdr *uh, u_int item, void **p1, void **p2) /* Handle bitmap items */ if (is_bitmap(uh, up)) { ub = up->ptr; - + KASSERT(bit_test(ub->map, item) != 0, ("UNR: Freeing free item %d (bitmap)\n", item)); bit_clear(ub->map, item); @@ -909,7 +909,7 @@ print_unr(struct unrhdr *uh, struct unr *up) for (x = 0; x < up->len; x++) { if (bit_test(ub->map, x)) printf("#"); - else + else printf(" "); } printf("]\n"); From de81acbd15cfd7f929366b471a1d9cf06bbaa93a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:20:06 +0000 Subject: [PATCH 080/126] Enable WARNS?= 6 across all of tests/sys MFC after: 1 week Sponsored by: Dell EMC Isilon --- tests/sys/Makefile.inc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/sys/Makefile.inc diff --git a/tests/sys/Makefile.inc b/tests/sys/Makefile.inc new file mode 100644 index 000000000000..f3418421919d --- /dev/null +++ b/tests/sys/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +WARNS?= 6 From bf8f6d7c8d96ad575f72b916ccfdc4c3013ab75e Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 04:20:42 +0000 Subject: [PATCH 081/126] Remove WARNS set globally by ../Makefile.inc now Sponsored by: Dell EMC Isilon --- tests/sys/vfs/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/sys/vfs/Makefile b/tests/sys/vfs/Makefile index 43fde788f652..9e2d79ef773a 100644 --- a/tests/sys/vfs/Makefile +++ b/tests/sys/vfs/Makefile @@ -9,6 +9,4 @@ CFLAGS.lookup_cap_dotdot.c+= -I${SRCTOP}/tests PLAIN_TESTS_SH+= trailing_slash -WARNS?= 6 - .include From dfa7f3a543093b56c96d0d66c817a1d89bfdcbda Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 05:02:53 +0000 Subject: [PATCH 082/126] Fix -Wformat issue with zero-length format string passed to err(3) MFC after: 3 days Tested with: clang, gcc 4.2.1, gcc 4.9 Sponsored by: Dell EMC Isilon --- tests/sys/kern/execve/execve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/kern/execve/execve_helper.c b/tests/sys/kern/execve/execve_helper.c index 164a8f3fc61e..6321dbf36371 100644 --- a/tests/sys/kern/execve/execve_helper.c +++ b/tests/sys/kern/execve/execve_helper.c @@ -50,5 +50,5 @@ main(int argc, char **argv) } execve(argv[1], &argv[1], NULL); - err(1, ""); + err(1, "%s", ""); } From d467b2ee0c4660122158fed71e90c568599b087a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 05:06:14 +0000 Subject: [PATCH 083/126] encode_long, encode_timeval: mechanically replace `exp` with `exponent` This helps fix a -Wshadow issue with exp(3) with tests/sys/acct/acct_test, which include math.h, which in turn defines exp(3) MFC after: 2 weeks Tested with: clang, gcc 4.2.1, gcc 4.9 Sponsored by: Dell EMC Isilon --- sys/kern/kern_acct.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 622a6a49ea19..5d17642e625b 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -469,8 +469,8 @@ static uint32_t encode_timeval(struct timeval tv) { int log2_s; - int val, exp; /* Unnormalized value and exponent */ - int norm_exp; /* Normalized exponent */ + int val, exponent; /* Unnormalized value and exponent */ + int norm_exponent; /* Normalized exponent */ int shift; /* @@ -481,7 +481,7 @@ encode_timeval(struct timeval tv) if (tv.tv_sec == 0) { if (tv.tv_usec == 0) return (0); - exp = 0; + exponent = 0; val = tv.tv_usec; } else { /* @@ -490,24 +490,24 @@ encode_timeval(struct timeval tv) */ log2_s = fls(tv.tv_sec) - 1; if (log2_s + LOG2_1M < CALC_BITS) { - exp = 0; + exponent = 0; val = 1000000 * tv.tv_sec + tv.tv_usec; } else { - exp = log2_s + LOG2_1M - CALC_BITS; + exponent = log2_s + LOG2_1M - CALC_BITS; val = (unsigned int)(((uint64_t)1000000 * tv.tv_sec + - tv.tv_usec) >> exp); + tv.tv_usec) >> exponent); } } /* Now normalize and pack the value into an IEEE-754 float. */ - norm_exp = fls(val) - 1; - shift = FLT_MANT_DIG - norm_exp - 1; + norm_exponent = fls(val) - 1; + shift = FLT_MANT_DIG - norm_exponent - 1; #ifdef ACCT_DEBUG printf("val=%d exp=%d shift=%d log2(val)=%d\n", - val, exp, shift, norm_exp); - printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exp, + val, exponent, shift, norm_exponent); + printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exponent + norm_exponent, ((shift > 0 ? (val << shift) : (val >> -shift)) & MANT_MASK)); #endif - return (((FLT_MAX_EXP - 1 + exp + norm_exp) << (FLT_MANT_DIG - 1)) | + return (((FLT_MAX_EXP - 1 + exponent + norm_exponent) << (FLT_MANT_DIG - 1)) | ((shift > 0 ? val << shift : val >> -shift) & MANT_MASK)); } @@ -518,7 +518,7 @@ encode_timeval(struct timeval tv) static uint32_t encode_long(long val) { - int norm_exp; /* Normalized exponent */ + int norm_exponent; /* Normalized exponent */ int shift; if (val == 0) @@ -529,15 +529,15 @@ encode_long(long val) val); val = LONG_MAX; } - norm_exp = fls(val) - 1; - shift = FLT_MANT_DIG - norm_exp - 1; + norm_exponent = fls(val) - 1; + shift = FLT_MANT_DIG - norm_exponent - 1; #ifdef ACCT_DEBUG printf("val=%d shift=%d log2(val)=%d\n", - val, shift, norm_exp); - printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exp, + val, shift, norm_exponent); + printf("exp=%x mant=%x\n", FLT_MAX_EXP - 1 + exp + norm_exponent, ((shift > 0 ? (val << shift) : (val >> -shift)) & MANT_MASK)); #endif - return (((FLT_MAX_EXP - 1 + norm_exp) << (FLT_MANT_DIG - 1)) | + return (((FLT_MAX_EXP - 1 + norm_exponent) << (FLT_MANT_DIG - 1)) | ((shift > 0 ? val << shift : val >> -shift) & MANT_MASK)); } From f614ceaf4a7c083c5f7da36c8cbef95d04357117 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 05:18:18 +0000 Subject: [PATCH 084/126] Fix warnings - Staticize test_num - Promote i to size_t to deal with -Wsign-compare issues Tested with: clang, gcc, gcc49 MFC after: 1 week Sponsored by: Dell EMC Isilon --- tests/sys/mac/bsdextended/ugidfw_test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/sys/mac/bsdextended/ugidfw_test.c b/tests/sys/mac/bsdextended/ugidfw_test.c index aab8553c89e2..31280e972fbd 100644 --- a/tests/sys/mac/bsdextended/ugidfw_test.c +++ b/tests/sys/mac/bsdextended/ugidfw_test.c @@ -71,7 +71,7 @@ static const char *test_groups[] = { "bin", }; -int test_num; +static int test_num; /* * List of test strings that must go in (and come out) of libugidfw intact. @@ -149,7 +149,8 @@ test_libugidfw_strings(void) struct mac_bsdextended_rule rule; char errorstr[256]; char rulestr[256]; - int error, i; + size_t i; + int error; for (i = 0; i < nitems(test_users); i++, test_num++) { if (getpwnam(test_users[i]) == NULL) @@ -171,7 +172,7 @@ test_libugidfw_strings(void) error = bsde_parse_rule_string(test_strings[i], &rule, sizeof(errorstr), errorstr); if (error == -1) - printf("not ok %d # bsde_parse_rule_string: '%s' (%d) " + printf("not ok %d # bsde_parse_rule_string: '%s' (%zu) " "failed: %s\n", test_num, test_strings[i], i, errorstr); else printf("ok %d\n", test_num); From dcdb30d8f8af06be96ef82a142171d900b3e3a6a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 05:24:35 +0000 Subject: [PATCH 085/126] Follow up to r312118 State that execve failed instead of just printing out the program name and strerror(errno) via err(3). MFC after: 3 days X-MFC with: r312118 Sponsored by: Dell EMC Isilon --- tests/sys/kern/execve/execve_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/kern/execve/execve_helper.c b/tests/sys/kern/execve/execve_helper.c index 6321dbf36371..989b3e4b9761 100644 --- a/tests/sys/kern/execve/execve_helper.c +++ b/tests/sys/kern/execve/execve_helper.c @@ -50,5 +50,5 @@ main(int argc, char **argv) } execve(argv[1], &argv[1], NULL); - err(1, "%s", ""); + err(1, "execve failed"); } From 792bbaba989533a1fc93823df1720c8c4aaf0442 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 06:16:57 +0000 Subject: [PATCH 086/126] Remove contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind This should have been pruned in r305358 MFC after: 3 days Sponsored by: Dell EMC Isilon --- .../fs/nfs/nfsservice/rpcbind/check_bound.c | 231 --- .../fs/nfs/nfsservice/rpcbind/pmap_svc.c | 366 ----- .../fs/nfs/nfsservice/rpcbind/rpcb_stat.c | 206 --- .../fs/nfs/nfsservice/rpcbind/rpcb_svc.c | 232 --- .../fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c | 455 ----- .../fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c | 1460 ----------------- .../fs/nfs/nfsservice/rpcbind/rpcbind.8 | 127 -- .../fs/nfs/nfsservice/rpcbind/rpcbind.c | 613 ------- .../fs/nfs/nfsservice/rpcbind/rpcbind.h | 146 -- .../fs/nfs/nfsservice/rpcbind/security.c | 282 ---- .../fs/nfs/nfsservice/rpcbind/util.c | 401 ----- 11 files changed, 4519 deletions(-) delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c delete mode 100644 contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c deleted file mode 100644 index 2ea7c31d16ca..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/check_bound.c +++ /dev/null @@ -1,231 +0,0 @@ -/* $NetBSD: check_bound.c,v 1.1 2010/07/26 15:53:00 pooka Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)check_bound.c 1.15 93/07/05 SMI" */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)check_bound.c 1.11 89/04/21 Copyr 1989 Sun Micro"; -#endif -#endif - -/* - * check_bound.c - * Checks to see whether the program is still bound to the - * claimed address and returns the univeral merged address - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "rpcbind.h" - -struct fdlist { - int fd; - struct netconfig *nconf; - struct fdlist *next; - int check_binding; -}; - -static struct fdlist *fdhead; /* Link list of the check fd's */ -static struct fdlist *fdtail; -static const char emptystring[] = ""; - -static bool_t check_bound(struct fdlist *, const char *uaddr); - -/* - * Returns 1 if the given address is bound for the given addr & transport - * For all error cases, we assume that the address is bound - * Returns 0 for success. - */ -static bool_t -check_bound(struct fdlist *fdl, const char *uaddr) -{ - int fd; - struct netbuf *na; - int ans; - - if (fdl->check_binding == FALSE) - return (TRUE); - - na = uaddr2taddr(fdl->nconf, uaddr); - if (!na) - return (TRUE); /* punt, should never happen */ - - fd = __rpc_nconf2fd(fdl->nconf); - if (fd < 0) { - free(na); - return (TRUE); - } - - ans = bind(fd, (struct sockaddr *)na->buf, na->len); - - rump_sys_close(fd); - free(na); - - return (ans == 0 ? FALSE : TRUE); -} - -int -add_bndlist(struct netconfig *nconf, struct netbuf *baddr) -{ - struct fdlist *fdl; - struct netconfig *newnconf; - - newnconf = getnetconfigent(nconf->nc_netid); - if (newnconf == NULL) - return (-1); - fdl = (struct fdlist *)malloc((u_int)sizeof (struct fdlist)); - if (fdl == NULL) { - freenetconfigent(newnconf); - syslog(LOG_ERR, "no memory!"); - return (-1); - } - fdl->nconf = newnconf; - fdl->next = NULL; - if (fdhead == NULL) { - fdhead = fdl; - fdtail = fdl; - } else { - fdtail->next = fdl; - fdtail = fdl; - } - /* XXX no bound checking for now */ - fdl->check_binding = FALSE; - - return 0; -} - -bool_t -is_bound(const char *netid, const char *uaddr) -{ - struct fdlist *fdl; - - for (fdl = fdhead; fdl; fdl = fdl->next) - if (strcmp(fdl->nconf->nc_netid, netid) == 0) - break; - if (fdl == NULL) - return (TRUE); - return (check_bound(fdl, uaddr)); -} - -/* - * Returns NULL if there was some system error. - * Returns "" if the address was not bound, i.e the server crashed. - * Returns the merged address otherwise. - */ -char * -mergeaddr(SVCXPRT *xprt, char *netid, char *uaddr, char *saddr) -{ - struct fdlist *fdl; - char *c_uaddr, *s_uaddr, *m_uaddr, *allocated_uaddr = NULL; - - for (fdl = fdhead; fdl; fdl = fdl->next) - if (strcmp(fdl->nconf->nc_netid, netid) == 0) - break; - if (fdl == NULL) - return (NULL); - if (check_bound(fdl, uaddr) == FALSE) - /* that server died */ - return strdup(emptystring); - /* - * If saddr is not NULL, the remote client may have included the - * address by which it contacted us. Use that for the "client" uaddr, - * otherwise use the info from the SVCXPRT. - */ - if (saddr != NULL) { - c_uaddr = saddr; - } else { - c_uaddr = taddr2uaddr(fdl->nconf, svc_getrpccaller(xprt)); - if (c_uaddr == NULL) { - syslog(LOG_ERR, "taddr2uaddr failed for %s", - fdl->nconf->nc_netid); - return (NULL); - } - allocated_uaddr = c_uaddr; - } - -#ifdef RPCBIND_DEBUG - if (debugging) { - if (saddr == NULL) { - fprintf(stderr, "mergeaddr: client uaddr = %s\n", - c_uaddr); - } else { - fprintf(stderr, "mergeaddr: contact uaddr = %s\n", - c_uaddr); - } - } -#endif - s_uaddr = uaddr; - /* - * This is all we should need for IP 4 and 6 - */ - m_uaddr = addrmerge(svc_getrpccaller(xprt), s_uaddr, c_uaddr, netid); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "mergeaddr: uaddr = %s, merged uaddr = %s\n", - uaddr, m_uaddr); -#endif - if (allocated_uaddr != NULL) - free(allocated_uaddr); - return (m_uaddr); -} - -/* - * Returns a netconf structure from its internal list. This - * structure should not be freed. - */ -struct netconfig * -rpcbind_get_conf(const char *netid) -{ - struct fdlist *fdl; - - for (fdl = fdhead; fdl; fdl = fdl->next) - if (strcmp(fdl->nconf->nc_netid, netid) == 0) - break; - if (fdl == NULL) - return (NULL); - return (fdl->nconf); -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c deleted file mode 100644 index 3f9eb4731ce1..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c +++ /dev/null @@ -1,366 +0,0 @@ -/* $NetBSD: pmap_svc.c,v 1.2 2013/10/19 17:45:00 christos Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)pmap_svc.c 1.14 93/07/05 SMI" */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)pmap_svc.c 1.23 89/04/05 Copyr 1984 Sun Micro"; -#endif -#endif - -/* - * pmap_svc.c - * The server procedure for the version 2 portmapper. - * All the portmapper related interface from the portmap side. - */ - -#ifdef PORTMAP -#include -#include -#include -#include -#include -#include -#ifdef RPCBIND_DEBUG -#include -#endif -#include "rpcbind.h" - -static struct pmaplist *find_service_pmap(rpcprog_t, rpcvers_t, rpcprot_t); -static bool_t pmapproc_change(struct svc_req *, SVCXPRT *, u_long); -static bool_t pmapproc_getport(struct svc_req *, SVCXPRT *); -static bool_t pmapproc_dump(struct svc_req *, SVCXPRT *); - -/* - * Called for all the version 2 inquiries. - */ -void -pmap_service(struct svc_req *rqstp, SVCXPRT *xprt) -{ - rpcbs_procinfo(RPCBVERS_2_STAT, rqstp->rq_proc); - switch (rqstp->rq_proc) { - case PMAPPROC_NULL: - /* - * Null proc call - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "PMAPPROC_NULL\n"); -#endif - check_access(xprt, rqstp->rq_proc, NULL, PMAPVERS); - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_void, NULL)) && - debugging) { - if (doabort) { - rpcbind_abort(); - } - } - break; - - case PMAPPROC_SET: - /* - * Set a program, version to port mapping - */ - pmapproc_change(rqstp, xprt, rqstp->rq_proc); - break; - - case PMAPPROC_UNSET: - /* - * Remove a program, version to port mapping. - */ - pmapproc_change(rqstp, xprt, rqstp->rq_proc); - break; - - case PMAPPROC_GETPORT: - /* - * Lookup the mapping for a program, version and return its - * port number. - */ - pmapproc_getport(rqstp, xprt); - break; - - case PMAPPROC_DUMP: - /* - * Return the current set of mapped program, version - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "PMAPPROC_DUMP\n"); -#endif - pmapproc_dump(rqstp, xprt); - break; - - case PMAPPROC_CALLIT: - /* - * Calls a procedure on the local machine. If the requested - * procedure is not registered this procedure does not return - * error information!! - * This procedure is only supported on rpc/udp and calls via - * rpc/udp. It passes null authentication parameters. - */ - rpcbproc_callit_com(rqstp, xprt, PMAPPROC_CALLIT, PMAPVERS); - break; - - default: - svcerr_noproc(xprt); - break; - } -} - -/* - * returns the item with the given program, version number. If that version - * number is not found, it returns the item with that program number, so that - * the port number is now returned to the caller. The caller when makes a - * call to this program, version number, the call will fail and it will - * return with PROGVERS_MISMATCH. The user can then determine the highest - * and the lowest version number for this program using clnt_geterr() and - * use those program version numbers. - */ -static struct pmaplist * -find_service_pmap(rpcprog_t prog, rpcvers_t vers, rpcprot_t prot) -{ - register struct pmaplist *hit = NULL; - register struct pmaplist *pml; - - for (pml = list_pml; pml != NULL; pml = pml->pml_next) { - if ((pml->pml_map.pm_prog != prog) || - (pml->pml_map.pm_prot != prot)) - continue; - hit = pml; - if (pml->pml_map.pm_vers == vers) - break; - } - return (hit); -} - -static bool_t -pmapproc_change(struct svc_req *rqstp, SVCXPRT *xprt, unsigned long op) -{ - struct pmap reg; - RPCB rpcbreg; - long ans; - struct sockcred *sc; - char uidbuf[32]; - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s request for (%lu, %lu) : ", - op == PMAPPROC_SET ? "PMAP_SET" : "PMAP_UNSET", - reg.pm_prog, reg.pm_vers); -#endif - - if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) { - svcerr_decode(xprt); - return (FALSE); - } - - if (!check_access(xprt, op, ®, PMAPVERS)) { - svcerr_weakauth(xprt); - return FALSE; - } - - (void)svc_getcaller(xprt); - sc = __svc_getcallercreds(xprt); - - /* - * Can't use getpwnam here. We might end up calling ourselves - * and looping. - */ - if (sc == NULL) - rpcbreg.r_owner = __UNCONST(rpcbind_unknown); - else if (sc->sc_uid == 0) - rpcbreg.r_owner = __UNCONST(rpcbind_superuser); - else { - /* r_owner will be strdup-ed later */ - snprintf(uidbuf, sizeof uidbuf, "%d", sc->sc_uid); - rpcbreg.r_owner = uidbuf; - } - - rpcbreg.r_prog = reg.pm_prog; - rpcbreg.r_vers = reg.pm_vers; - - if (op == PMAPPROC_SET) { - char buf[32]; - - snprintf(buf, sizeof(buf), "0.0.0.0.%d.%d", - (int)((reg.pm_port >> 8) & 0xff), - (int)(reg.pm_port & 0xff)); - rpcbreg.r_addr = buf; - if (reg.pm_prot == IPPROTO_UDP) { - rpcbreg.r_netid = __UNCONST(udptrans); - } else if (reg.pm_prot == IPPROTO_TCP) { - rpcbreg.r_netid = __UNCONST(tcptrans); - } else { - ans = FALSE; - goto done_change; - } - ans = map_set(&rpcbreg, rpcbreg.r_owner); - } else if (op == PMAPPROC_UNSET) { - bool_t ans1, ans2; - - rpcbreg.r_addr = NULL; - rpcbreg.r_netid = __UNCONST(tcptrans); - ans1 = map_unset(&rpcbreg, rpcbreg.r_owner); - rpcbreg.r_netid = __UNCONST(udptrans); - ans2 = map_unset(&rpcbreg, rpcbreg.r_owner); - ans = ans1 || ans2; - } else { - ans = FALSE; - } -done_change: - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_long, (caddr_t) &ans)) && - debugging) { - fprintf(stderr, "portmap: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed"); -#endif - if (op == PMAPPROC_SET) - rpcbs_set(RPCBVERS_2_STAT, ans); - else - rpcbs_unset(RPCBVERS_2_STAT, ans); - return (TRUE); -} - -/* ARGSUSED */ -static bool_t -pmapproc_getport(struct svc_req *rqstp, SVCXPRT *xprt) -{ - struct pmap reg; - long lport; - int port = 0; - struct pmaplist *fnd; -#ifdef RPCBIND_DEBUG - char *uaddr; -#endif - - if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)®)) { - svcerr_decode(xprt); - return (FALSE); - } - - if (!check_access(xprt, PMAPPROC_GETPORT, ®, PMAPVERS)) { - svcerr_weakauth(xprt); - return FALSE; - } - -#ifdef RPCBIND_DEBUG - if (debugging) { - uaddr = taddr2uaddr(rpcbind_get_conf(xprt->xp_netid), - svc_getrpccaller(xprt)); - fprintf(stderr, "PMAP_GETPORT req for (%lu, %lu, %s) from %s :", - reg.pm_prog, reg.pm_vers, - reg.pm_prot == IPPROTO_UDP ? "udp" : "tcp", uaddr); - free(uaddr); - } -#endif - fnd = find_service_pmap(reg.pm_prog, reg.pm_vers, reg.pm_prot); - if (fnd) { - char serveuaddr[32]; - int h1, h2, h3, h4, p1, p2; - const char *netid, *ua; - - if (reg.pm_prot == IPPROTO_UDP) { - ua = udp_uaddr; - netid = udptrans; - } else { - ua = tcp_uaddr; /* To get the len */ - netid = tcptrans; - } - if (ua == NULL) { - goto sendreply; - } - if (sscanf(ua, "%d.%d.%d.%d.%d.%d", &h1, &h2, &h3, - &h4, &p1, &p2) == 6) { - p1 = (fnd->pml_map.pm_port >> 8) & 0xff; - p2 = (fnd->pml_map.pm_port) & 0xff; - snprintf(serveuaddr, sizeof(serveuaddr), - "%d.%d.%d.%d.%d.%d", h1, h2, h3, h4, p1, p2); - if (is_bound(netid, serveuaddr)) { - port = fnd->pml_map.pm_port; - } else { /* this service is dead; delete it */ - delete_prog(reg.pm_prog); - } - } - } -sendreply: - lport = port; - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_long, (caddr_t)&lport)) && - debugging) { - (void) fprintf(stderr, "portmap: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "port = %d\n", port); -#endif - rpcbs_getaddr(RPCBVERS_2_STAT, reg.pm_prog, reg.pm_vers, - reg.pm_prot == IPPROTO_UDP ? udptrans : tcptrans, - port ? udptrans : ""); - - return (TRUE); -} - -/* ARGSUSED */ -static bool_t -pmapproc_dump(struct svc_req *rqstp, SVCXPRT *xprt) -{ - if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) { - svcerr_decode(xprt); - return (FALSE); - } - - if (!check_access(xprt, PMAPPROC_DUMP, NULL, PMAPVERS)) { - svcerr_weakauth(xprt); - return FALSE; - } - - if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr, - (caddr_t)&list_pml)) && debugging) { - if (debugging) - (void) fprintf(stderr, "portmap: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } - return (TRUE); -} - -#endif /* PORTMAP */ diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c deleted file mode 100644 index 5bc5a0fde55a..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c +++ /dev/null @@ -1,206 +0,0 @@ -/* $NetBSD: rpcb_stat.c,v 1.1 2010/07/26 15:53:00 pooka Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* #pragma ident "@(#)rpcb_stat.c 1.7 94/04/25 SMI" */ - -/* - * rpcb_stat.c - * Allows for gathering of statistics - * - * Copyright (c) 1990 by Sun Microsystems, Inc. - */ - -#include -#include -#include -#include -#include -#ifdef PORTMAP -#include -#endif -#include -#include -#include "rpcbind.h" - -static rpcb_stat_byvers inf; - -void -rpcbs_init(void) -{ - -} - -void -rpcbs_procinfo(rpcvers_t rtype, rpcproc_t proc) -{ - switch (rtype + 2) { -#ifdef PORTMAP - case PMAPVERS: /* version 2 */ - if (proc > rpcb_highproc_2) - return; - break; -#endif - case RPCBVERS: /* version 3 */ - if (proc > rpcb_highproc_3) - return; - break; - case RPCBVERS4: /* version 4 */ - if (proc > rpcb_highproc_4) - return; - break; - default: return; - } - inf[rtype].info[proc]++; - return; -} - -void -rpcbs_set(rpcvers_t rtype, bool_t success) -{ - if ((rtype >= RPCBVERS_STAT) || (success == FALSE)) - return; - inf[rtype].setinfo++; - return; -} - -void -rpcbs_unset(rpcvers_t rtype, bool_t success) -{ - if ((rtype >= RPCBVERS_STAT) || (success == FALSE)) - return; - inf[rtype].unsetinfo++; - return; -} - -void -rpcbs_getaddr(rpcvers_t rtype, rpcprog_t prog, rpcvers_t vers, - const char *netid, const char *uaddr) -{ - rpcbs_addrlist *al; - struct netconfig *nconf; - - if (rtype >= RPCBVERS_STAT) - return; - for (al = inf[rtype].addrinfo; al; al = al->next) { - - if(al->netid == NULL) - return; - if ((al->prog == prog) && (al->vers == vers) && - (strcmp(al->netid, netid) == 0)) { - if ((uaddr == NULL) || (uaddr[0] == 0)) - al->failure++; - else - al->success++; - return; - } - } - nconf = rpcbind_get_conf(netid); - if (nconf == NULL) { - return; - } - al = (rpcbs_addrlist *) malloc(sizeof (rpcbs_addrlist)); - if (al == NULL) { - return; - } - al->prog = prog; - al->vers = vers; - al->netid = nconf->nc_netid; - if ((uaddr == NULL) || (uaddr[0] == 0)) { - al->failure = 1; - al->success = 0; - } else { - al->failure = 0; - al->success = 1; - } - al->next = inf[rtype].addrinfo; - inf[rtype].addrinfo = al; -} - -void -rpcbs_rmtcall(rpcvers_t rtype, rpcproc_t rpcbproc, rpcprog_t prog, - rpcvers_t vers, rpcproc_t proc, char *netid, rpcblist_ptr rbl) -{ - rpcbs_rmtcalllist *rl; - struct netconfig *nconf; - - if (rtype >= RPCBVERS_STAT) - return; - for (rl = inf[rtype].rmtinfo; rl; rl = rl->next) { - - if(rl->netid == NULL) - return; - - if ((rl->prog == prog) && (rl->vers == vers) && - (rl->proc == proc) && - (strcmp(rl->netid, netid) == 0)) { - if ((rbl == NULL) || - (rbl->rpcb_map.r_vers != vers)) - rl->failure++; - else - rl->success++; - if (rpcbproc == RPCBPROC_INDIRECT) - rl->indirect++; - return; - } - } - nconf = rpcbind_get_conf(netid); - if (nconf == NULL) { - return; - } - rl = (rpcbs_rmtcalllist *) malloc(sizeof (rpcbs_rmtcalllist)); - if (rl == NULL) { - return; - } - rl->prog = prog; - rl->vers = vers; - rl->proc = proc; - rl->netid = nconf->nc_netid; - if ((rbl == NULL) || - (rbl->rpcb_map.r_vers != vers)) { - rl->failure = 1; - rl->success = 0; - } else { - rl->failure = 0; - rl->success = 1; - } - rl->indirect = 1; - rl->next = inf[rtype].rmtinfo; - inf[rtype].rmtinfo = rl; - return; -} - -/* - */ -void * -rpcbproc_getstat(void *arg, struct svc_req *req, SVCXPRT *xprt, - rpcvers_t versnum) -{ - return (void *)&inf; -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c deleted file mode 100644 index 16c86f67a375..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c +++ /dev/null @@ -1,232 +0,0 @@ -/* $NetBSD: rpcb_svc.c,v 1.2 2011/09/16 16:13:18 plunky Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcb_svc.c 1.16 93/07/05 SMI" */ - -/* - * rpcb_svc.c - * The server procedure for the version 3 rpcbind (TLI). - * - * It maintains a separate list of all the registered services with the - * version 3 of rpcbind. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rpcbind.h" - -static void *rpcbproc_getaddr_3_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void *rpcbproc_dump_3_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); - -/* - * Called by svc_getreqset. There is a separate server handle for - * every transport that it waits on. - */ -void -rpcb_service_3(struct svc_req *rqstp, SVCXPRT *transp) -{ - union { - RPCB rpcbproc_set_3_arg; - RPCB rpcbproc_unset_3_arg; - RPCB rpcbproc_getaddr_3_local_arg; - struct rpcb_rmtcallargs rpcbproc_callit_3_arg; - char *rpcbproc_uaddr2taddr_3_arg; - struct netbuf rpcbproc_taddr2uaddr_3_arg; - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; - void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t); - - rpcbs_procinfo(RPCBVERS_3_STAT, rqstp->rq_proc); - - switch (rqstp->rq_proc) { - case NULLPROC: - /* - * Null proc call - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_NULL\n"); -#endif - /* This call just logs, no actual checks */ - check_access(transp, rqstp->rq_proc, NULL, RPCBVERS); - (void) svc_sendreply(transp, (xdrproc_t)xdr_void, NULL); - return; - - case RPCBPROC_SET: - xdr_argument = (xdrproc_t )xdr_rpcb; - xdr_result = (xdrproc_t )xdr_bool; - local = rpcbproc_set_com; - break; - - case RPCBPROC_UNSET: - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_bool; - local = rpcbproc_unset_com; - break; - - case RPCBPROC_GETADDR: - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_getaddr_3_local; - break; - - case RPCBPROC_DUMP: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_DUMP\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_rpcblist_ptr; - local = rpcbproc_dump_3_local; - break; - - case RPCBPROC_CALLIT: - rpcbproc_callit_com(rqstp, transp, rqstp->rq_proc, RPCBVERS); - return; - - case RPCBPROC_GETTIME: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETTIME\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_u_long; - local = rpcbproc_gettime_com; - break; - - case RPCBPROC_UADDR2TADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_UADDR2TADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_wrapstring; - xdr_result = (xdrproc_t)xdr_netbuf; - local = rpcbproc_uaddr2taddr_com; - break; - - case RPCBPROC_TADDR2UADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_TADDR2UADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_netbuf; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_taddr2uaddr_com; - break; - - default: - svcerr_noproc(transp); - return; - } - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, (xdrproc_t) xdr_argument, - (char *) &argument)) { - svcerr_decode(transp); - if (debugging) - (void) fprintf(stderr, "rpcbind: could not decode\n"); - return; - } - if (!check_access(transp, rqstp->rq_proc, &argument, RPCBVERS)) { - svcerr_weakauth(transp); - goto done; - } - result = (*local)(&argument, rqstp, transp, RPCBVERS); - if (result != NULL && !svc_sendreply(transp, (xdrproc_t)xdr_result, - result)) { - svcerr_systemerr(transp); - if (debugging) { - (void) fprintf(stderr, "rpcbind: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } - } -done: - if (!svc_freeargs(transp, (xdrproc_t)xdr_argument, (char *) - &argument)) { - if (debugging) { - (void) fprintf(stderr, "unable to free arguments\n"); - if (doabort) { - rpcbind_abort(); - } - } - } -} - -/* - * Lookup the mapping for a program, version and return its - * address. Assuming that the caller wants the address of the - * server running on the transport on which the request came. - * - * We also try to resolve the universal address in terms of - * address of the caller. - */ -/* ARGSUSED */ -static void * -rpcbproc_getaddr_3_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - RPCB *regp = (RPCB *)arg; -#ifdef RPCBIND_DEBUG - if (debugging) { - char *uaddr; - - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), - svc_getrpccaller(transp)); - fprintf(stderr, "RPCB_GETADDR req for (%lu, %lu, %s) from %s: ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, uaddr); - free(uaddr); - } -#endif - return (rpcbproc_getaddr_com(regp, rqstp, transp, RPCBVERS, - RPCB_ALLVERS)); -} - -/* ARGSUSED */ -static void * -rpcbproc_dump_3_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - return ((void *)&list_rbl); -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c deleted file mode 100644 index c4e8edb0994f..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c +++ /dev/null @@ -1,455 +0,0 @@ -/* $NetBSD: rpcb_svc_4.c,v 1.2 2011/09/16 16:13:18 plunky Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcb_svc_4.c 1.8 93/07/05 SMI" */ - -/* - * rpcb_svc_4.c - * The server procedure for the version 4 rpcbind. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rpcbind.h" - -static void *rpcbproc_getaddr_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void *rpcbproc_getversaddr_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void *rpcbproc_getaddrlist_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -static void free_rpcb_entry_list(rpcb_entry_list_ptr *); -static void *rpcbproc_dump_4_local(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); - -/* - * Called by svc_getreqset. There is a separate server handle for - * every transport that it waits on. - */ -void -rpcb_service_4(struct svc_req *rqstp, SVCXPRT *transp) -{ - union { - rpcb rpcbproc_set_4_arg; - rpcb rpcbproc_unset_4_arg; - rpcb rpcbproc_getaddr_4_local_arg; - char *rpcbproc_uaddr2taddr_4_arg; - struct netbuf rpcbproc_taddr2uaddr_4_arg; - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; - void *(*local)(void *, struct svc_req *, SVCXPRT *, rpcvers_t); - - rpcbs_procinfo(RPCBVERS_4_STAT, rqstp->rq_proc); - - switch (rqstp->rq_proc) { - case NULLPROC: - /* - * Null proc call - */ -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_NULL\n"); -#endif - check_access(transp, rqstp->rq_proc, NULL, RPCBVERS4); - (void) svc_sendreply(transp, (xdrproc_t) xdr_void, NULL); - return; - - case RPCBPROC_SET: - /* - * Check to see whether the message came from - * loopback transports (for security reasons) - */ - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_bool; - local = rpcbproc_set_com; - break; - - case RPCBPROC_UNSET: - /* - * Check to see whether the message came from - * loopback transports (for security reasons) - */ - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_bool; - local = rpcbproc_unset_com; - break; - - case RPCBPROC_GETADDR: - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_getaddr_4_local; - break; - - case RPCBPROC_GETVERSADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETVERSADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_getversaddr_4_local; - break; - - case RPCBPROC_DUMP: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_DUMP\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_rpcblist_ptr; - local = rpcbproc_dump_4_local; - break; - - case RPCBPROC_INDIRECT: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_INDIRECT\n"); -#endif - rpcbproc_callit_com(rqstp, transp, rqstp->rq_proc, RPCBVERS4); - return; - -/* case RPCBPROC_CALLIT: */ - case RPCBPROC_BCAST: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_BCAST\n"); -#endif - rpcbproc_callit_com(rqstp, transp, rqstp->rq_proc, RPCBVERS4); - return; - - case RPCBPROC_GETTIME: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETTIME\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_u_long; - local = rpcbproc_gettime_com; - break; - - case RPCBPROC_UADDR2TADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_UADDR2TADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_wrapstring; - xdr_result = (xdrproc_t)xdr_netbuf; - local = rpcbproc_uaddr2taddr_com; - break; - - case RPCBPROC_TADDR2UADDR: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_TADDR2UADDR\n"); -#endif - xdr_argument = (xdrproc_t)xdr_netbuf; - xdr_result = (xdrproc_t)xdr_wrapstring; - local = rpcbproc_taddr2uaddr_com; - break; - - case RPCBPROC_GETADDRLIST: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETADDRLIST\n"); -#endif - xdr_argument = (xdrproc_t)xdr_rpcb; - xdr_result = (xdrproc_t)xdr_rpcb_entry_list_ptr; - local = rpcbproc_getaddrlist_4_local; - break; - - case RPCBPROC_GETSTAT: -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCBPROC_GETSTAT\n"); -#endif - xdr_argument = (xdrproc_t)xdr_void; - xdr_result = (xdrproc_t)xdr_rpcb_stat_byvers; - local = rpcbproc_getstat; - break; - - default: - svcerr_noproc(transp); - return; - } - memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, (xdrproc_t) xdr_argument, - (char *)&argument)) { - svcerr_decode(transp); - if (debugging) - (void) fprintf(stderr, "rpcbind: could not decode\n"); - return; - } - if (!check_access(transp, rqstp->rq_proc, &argument, RPCBVERS4)) { - svcerr_weakauth(transp); - goto done; - } - result = (*local)(&argument, rqstp, transp, RPCBVERS4); - if (result != NULL && !svc_sendreply(transp, (xdrproc_t) xdr_result, - result)) { - svcerr_systemerr(transp); - if (debugging) { - (void) fprintf(stderr, "rpcbind: svc_sendreply\n"); - if (doabort) { - rpcbind_abort(); - } - } - } -done: - if (!svc_freeargs(transp, (xdrproc_t) xdr_argument, - (char *)&argument)) { - if (debugging) { - (void) fprintf(stderr, "unable to free arguments\n"); - if (doabort) { - rpcbind_abort(); - } - } - } - return; -} - -/* - * Lookup the mapping for a program, version and return its - * address. Assuming that the caller wants the address of the - * server running on the transport on which the request came. - * Even if a service with a different version number is available, - * it will return that address. The client should check with an - * clnt_call to verify whether the service is the one that is desired. - * We also try to resolve the universal address in terms of - * address of the caller. - */ -/* ARGSUSED */ -static void * -rpcbproc_getaddr_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - RPCB *regp = (RPCB *)arg; -#ifdef RPCBIND_DEBUG - if (debugging) { - char *uaddr; - - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), - svc_getrpccaller(transp)); - fprintf(stderr, "RPCB_GETADDR req for (%lu, %lu, %s) from %s: ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, uaddr); - free(uaddr); - } -#endif - return (rpcbproc_getaddr_com(regp, rqstp, transp, RPCBVERS4, - RPCB_ALLVERS)); -} - -/* - * Lookup the mapping for a program, version and return its - * address. Assuming that the caller wants the address of the - * server running on the transport on which the request came. - * - * We also try to resolve the universal address in terms of - * address of the caller. - */ -/* ARGSUSED */ -static void * -rpcbproc_getversaddr_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - RPCB *regp = (RPCB *)arg; -#ifdef RPCBIND_DEBUG - if (debugging) { - char *uaddr; - - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), - svc_getrpccaller(transp)); - fprintf(stderr, "RPCB_GETVERSADDR rqst for (%lu, %lu, %s)" - " from %s : ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, uaddr); - free(uaddr); - } -#endif - return (rpcbproc_getaddr_com(regp, rqstp, transp, RPCBVERS4, - RPCB_ONEVERS)); -} - -/* - * Lookup the mapping for a program, version and return the - * addresses for all transports in the current transport family. - * We return a merged address. - */ -/* ARGSUSED */ -static void * -rpcbproc_getaddrlist_4_local(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t versnum) -{ - RPCB *regp = (RPCB *)arg; - static rpcb_entry_list_ptr rlist; - register rpcblist_ptr rbl; - rpcb_entry_list_ptr rp, tail = NULL; - rpcprog_t prog; - rpcvers_t vers; - rpcb_entry *a; - struct netconfig *nconf; - struct netconfig *reg_nconf; - char *saddr, *maddr = NULL; - - free_rpcb_entry_list(&rlist); - prog = regp->r_prog; - vers = regp->r_vers; - reg_nconf = rpcbind_get_conf(transp->xp_netid); - if (reg_nconf == NULL) - return (NULL); - if (*(regp->r_addr) != '\0') { - saddr = regp->r_addr; - } else { - saddr = NULL; - } -#ifdef RPCBIND_DEBUG - if (debugging) { - fprintf(stderr, "r_addr: %s r_netid: %s nc_protofmly: %s\n", - regp->r_addr, regp->r_netid, reg_nconf->nc_protofmly); - } -#endif - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog == prog) && - (rbl->rpcb_map.r_vers == vers)) { - nconf = rpcbind_get_conf(rbl->rpcb_map.r_netid); - if (nconf == NULL) - goto fail; - if (strcmp(nconf->nc_protofmly, reg_nconf->nc_protofmly) - != 0) { - continue; /* not same proto family */ - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "\tmerge with: %s\n", rbl->rpcb_map.r_addr); -#endif - if ((maddr = mergeaddr(transp, rbl->rpcb_map.r_netid, - rbl->rpcb_map.r_addr, saddr)) == NULL) { -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, " FAILED\n"); -#endif - continue; - } else if (!maddr[0]) { -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, " SUCCEEDED, but port died - maddr: nullstring\n"); -#endif - /* The server died. Unset this combination */ - delete_prog(regp->r_prog); - free(maddr); - continue; - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, " SUCCEEDED maddr: %s\n", maddr); -#endif - /* - * Add it to rlist. - */ - rp = (rpcb_entry_list_ptr) - malloc((u_int)sizeof (rpcb_entry_list)); - if (rp == NULL) { - free(maddr); - goto fail; - } - a = &rp->rpcb_entry_map; - a->r_maddr = maddr; - a->r_nc_netid = nconf->nc_netid; - a->r_nc_semantics = nconf->nc_semantics; - a->r_nc_protofmly = nconf->nc_protofmly; - a->r_nc_proto = nconf->nc_proto; - rp->rpcb_entry_next = NULL; - if (rlist == NULL) { - rlist = rp; - tail = rp; - } else if (tail) { - tail->rpcb_entry_next = rp; - tail = rp; - } - rp = NULL; - } - } -#ifdef RPCBIND_DEBUG - if (debugging) { - for (rp = rlist; rp; rp = rp->rpcb_entry_next) { - fprintf(stderr, "\t%s %s\n", rp->rpcb_entry_map.r_maddr, - rp->rpcb_entry_map.r_nc_proto); - } - } -#endif - /* - * XXX: getaddrlist info is also being stuffed into getaddr. - * Perhaps wrong, but better than it not getting counted at all. - */ - rpcbs_getaddr(RPCBVERS4 - 2, prog, vers, transp->xp_netid, maddr); - return (void *)&rlist; - -fail: free_rpcb_entry_list(&rlist); - return (NULL); -} - -/* - * Free only the allocated structure, rest is all a pointer to some - * other data somewhere else. - */ -static void -free_rpcb_entry_list(rpcb_entry_list_ptr *rlistp) -{ - register rpcb_entry_list_ptr rbl, tmp; - - for (rbl = *rlistp; rbl != NULL; ) { - tmp = rbl; - rbl = rbl->rpcb_entry_next; - free((char *)tmp->rpcb_entry_map.r_maddr); - free((char *)tmp); - } - *rlistp = NULL; -} - -/* ARGSUSED */ -static void * -rpcbproc_dump_4_local(void *arg, struct svc_req *req, SVCXPRT *xprt, - rpcvers_t versnum) -{ - return ((void *)&list_rbl); -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c deleted file mode 100644 index d7ac0db55d3a..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c +++ /dev/null @@ -1,1460 +0,0 @@ -/* $NetBSD: rpcb_svc_com.c,v 1.2 2011/09/16 16:13:18 plunky Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcb_svc_com.c 1.18 94/05/02 SMI" */ - -/* - * rpcb_svc_com.c - * The commom server procedure for the rpcbind. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef PORTMAP -#include -#include -#endif /* PORTMAP */ -#include -#include - -#include -#include - -#include "rpcbind.h" -#include "svc_dg.h" -#include "svc_fdset.h" - -#define RPC_BUF_MAX 65536 /* can be raised if required */ - -static char emptystring[] = ""; -static int rpcb_rmtcalls; - -struct rmtcallfd_list { - int fd; - SVCXPRT *xprt; - char *netid; - struct rmtcallfd_list *next; -}; - -#define NFORWARD 64 -#define MAXTIME_OFF 300 /* 5 minutes */ - -struct finfo { - int flag; -#define FINFO_ACTIVE 0x1 - u_int32_t caller_xid; - struct netbuf *caller_addr; - u_int32_t forward_xid; - int forward_fd; - char *uaddr; - rpcproc_t reply_type; - rpcvers_t versnum; - time_t time; -}; -static struct finfo FINFO[NFORWARD]; - - -static bool_t xdr_encap_parms(XDR *, struct encap_parms *); -static bool_t xdr_rmtcall_args(XDR *, struct r_rmtcall_args *); -static bool_t xdr_rmtcall_result(XDR *, struct r_rmtcall_args *); -static bool_t xdr_opaque_parms(XDR *, struct r_rmtcall_args *); -static int find_rmtcallfd_by_netid(char *); -static SVCXPRT *find_rmtcallxprt_by_fd(int); -static u_int32_t forward_register(u_int32_t, struct netbuf *, int, char *, - rpcproc_t, rpcvers_t); -static struct finfo *forward_find(u_int32_t); -static int free_slot_by_xid(u_int32_t); -static int free_slot_by_index(int); -static int netbufcmp(struct netbuf *, struct netbuf *); -static struct netbuf *netbufdup(struct netbuf *); -static void netbuffree(struct netbuf *); -static int check_rmtcalls(struct pollfd *, int); -static void xprt_set_caller(SVCXPRT *, struct finfo *); -static void send_svcsyserr(SVCXPRT *, struct finfo *); -static void handle_reply(int, SVCXPRT *); -static void find_versions(rpcprog_t, char *, rpcvers_t *, rpcvers_t *); -static rpcblist_ptr find_service(rpcprog_t, rpcvers_t, char *); -static char *getowner(SVCXPRT *, char *, size_t); -static int add_pmaplist(RPCB *); -static int del_pmaplist(RPCB *); - -/* - * Set a mapping of program, version, netid - */ -/* ARGSUSED */ -void * -rpcbproc_set_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - RPCB *regp = (RPCB *)arg; - static bool_t ans; - char owner[64]; - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCB_SET request for (%lu, %lu, %s, %s) : ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid, regp->r_addr); -#endif - ans = map_set(regp, getowner(transp, owner, sizeof owner)); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed"); -#endif - /* XXX: should have used some defined constant here */ - rpcbs_set(rpcbversnum - 2, ans); - return (void *)&ans; -} - -bool_t -map_set(RPCB *regp, char *owner) -{ - RPCB reg, *a; - rpcblist_ptr rbl, fnd; - - reg = *regp; - /* - * check to see if already used - * find_service returns a hit even if - * the versions don't match, so check for it - */ - fnd = find_service(reg.r_prog, reg.r_vers, reg.r_netid); - if (fnd && (fnd->rpcb_map.r_vers == reg.r_vers)) { - if (!strcmp(fnd->rpcb_map.r_addr, reg.r_addr)) - /* - * if these match then it is already - * registered so just say "OK". - */ - return (TRUE); - else - return (FALSE); - } - /* - * add to the end of the list - */ - rbl = (rpcblist_ptr) malloc((u_int)sizeof (RPCBLIST)); - if (rbl == NULL) { - return (FALSE); - } - a = &(rbl->rpcb_map); - a->r_prog = reg.r_prog; - a->r_vers = reg.r_vers; - a->r_netid = strdup(reg.r_netid); - a->r_addr = strdup(reg.r_addr); - a->r_owner = strdup(owner); - if (!a->r_addr || !a->r_netid || !a->r_owner) { - if (a->r_netid) - free((void *) a->r_netid); - if (a->r_addr) - free((void *) a->r_addr); - if (a->r_owner) - free((void *) a->r_owner); - free((void *)rbl); - return (FALSE); - } - rbl->rpcb_next = NULL; - if (list_rbl == NULL) { - list_rbl = rbl; - } else { - for (fnd = list_rbl; fnd->rpcb_next; - fnd = fnd->rpcb_next) - ; - fnd->rpcb_next = rbl; - } -#ifdef PORTMAP - (void) add_pmaplist(regp); -#endif - return (TRUE); -} - -/* - * Unset a mapping of program, version, netid - */ -/* ARGSUSED */ -void * -rpcbproc_unset_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - RPCB *regp = (RPCB *)arg; - static bool_t ans; - char owner[64]; - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "RPCB_UNSET request for (%lu, %lu, %s) : ", - (unsigned long)regp->r_prog, (unsigned long)regp->r_vers, - regp->r_netid); -#endif - ans = map_unset(regp, getowner(transp, owner, sizeof owner)); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "%s\n", ans == TRUE ? "succeeded" : "failed"); -#endif - /* XXX: should have used some defined constant here */ - rpcbs_unset(rpcbversnum - 2, ans); - return (void *)&ans; -} - -bool_t -map_unset(RPCB *regp, const char *owner) -{ - int ans = 0; - rpcblist_ptr rbl, prev, tmp; - - if (owner == NULL) - return (0); - - for (prev = NULL, rbl = list_rbl; rbl; /* cstyle */) { - if ((rbl->rpcb_map.r_prog != regp->r_prog) || - (rbl->rpcb_map.r_vers != regp->r_vers) || - (regp->r_netid[0] && strcasecmp(regp->r_netid, - rbl->rpcb_map.r_netid))) { - /* both rbl & prev move forwards */ - prev = rbl; - rbl = rbl->rpcb_next; - continue; - } - /* - * Check whether appropriate uid. Unset only - * if superuser or the owner itself. - */ - if (strcmp(owner, rpcbind_superuser) && - strcmp(rbl->rpcb_map.r_owner, owner)) - return (0); - /* found it; rbl moves forward, prev stays */ - ans = 1; - tmp = rbl; - rbl = rbl->rpcb_next; - if (prev == NULL) - list_rbl = rbl; - else - prev->rpcb_next = rbl; - free((void *) tmp->rpcb_map.r_addr); - free((void *) tmp->rpcb_map.r_netid); - free((void *) tmp->rpcb_map.r_owner); - free((void *) tmp); - } -#ifdef PORTMAP - if (ans) - (void) del_pmaplist(regp); -#endif - /* - * We return 1 either when the entry was not there or it - * was able to unset it. It can come to this point only if - * atleast one of the conditions is true. - */ - return (1); -} - -void -delete_prog(int prog) -{ - RPCB reg; - register rpcblist_ptr rbl; - - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog != prog)) - continue; - if (is_bound(rbl->rpcb_map.r_netid, rbl->rpcb_map.r_addr)) - continue; - reg.r_prog = rbl->rpcb_map.r_prog; - reg.r_vers = rbl->rpcb_map.r_vers; - reg.r_netid = strdup(rbl->rpcb_map.r_netid); - (void)map_unset(®, rpcbind_superuser); - free(reg.r_netid); - } -} - -void * -rpcbproc_getaddr_com(RPCB *regp, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum, rpcvers_t verstype) -{ - static char *uaddr; - char *saddr = NULL; - rpcblist_ptr fnd; - - if (uaddr && uaddr[0]) - free((void *) uaddr); - fnd = find_service(regp->r_prog, regp->r_vers, transp->xp_netid); - if (fnd && ((verstype == RPCB_ALLVERS) || - (regp->r_vers == fnd->rpcb_map.r_vers))) { - if (*(regp->r_addr) != '\0') { /* may contain a hint about */ - saddr = regp->r_addr; /* the interface that we */ - } /* should use */ - if (!(uaddr = mergeaddr(transp, transp->xp_netid, - fnd->rpcb_map.r_addr, saddr))) { - /* Try whatever we have */ - uaddr = strdup(fnd->rpcb_map.r_addr); - } else if (!uaddr[0]) { - /* - * The server died. Unset all versions of this prog. - */ - delete_prog(regp->r_prog); - uaddr = emptystring; - } - } else { - uaddr = emptystring; - } -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "getaddr: %s\n", uaddr); -#endif - /* XXX: should have used some defined constant here */ - rpcbs_getaddr(rpcbversnum - 2, regp->r_prog, regp->r_vers, - transp->xp_netid, uaddr); - return (void *)&uaddr; -} - -/* ARGSUSED */ -void * -rpcbproc_gettime_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - static time_t curtime; - - (void) time(&curtime); - return (void *)&curtime; -} - -/* - * Convert uaddr to taddr. Should be used only by - * local servers/clients. (kernel level stuff only) - */ -/* ARGSUSED */ -void * -rpcbproc_uaddr2taddr_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - char **uaddrp = (char **)arg; - struct netconfig *nconf; - static struct netbuf nbuf; - static struct netbuf *taddr; - - if (taddr) { - free((void *) taddr->buf); - free((void *) taddr); - } - if (((nconf = rpcbind_get_conf(transp->xp_netid)) == NULL) || - ((taddr = uaddr2taddr(nconf, *uaddrp)) == NULL)) { - (void) memset((char *)&nbuf, 0, sizeof (struct netbuf)); - return (void *)&nbuf; - } - return (void *)taddr; -} - -/* - * Convert taddr to uaddr. Should be used only by - * local servers/clients. (kernel level stuff only) - */ -/* ARGSUSED */ -void * -rpcbproc_taddr2uaddr_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, - rpcvers_t rpcbversnum) -{ - struct netbuf *taddr = (struct netbuf *)arg; - static char *uaddr; - struct netconfig *nconf; - - if (uaddr && !uaddr[0]) - free((void *) uaddr); - if (((nconf = rpcbind_get_conf(transp->xp_netid)) == NULL) || - ((uaddr = taddr2uaddr(nconf, taddr)) == NULL)) { - uaddr = emptystring; - } - return (void *)&uaddr; -} - - -static bool_t -xdr_encap_parms(XDR *xdrs, struct encap_parms *epp) -{ - return (xdr_bytes(xdrs, &(epp->args), (u_int *) &(epp->arglen), ~0)); -} - -/* - * XDR remote call arguments. It ignores the address part. - * written for XDR_DECODE direction only - */ -static bool_t -xdr_rmtcall_args(XDR *xdrs, struct r_rmtcall_args *cap) -{ - /* does not get the address or the arguments */ - if (xdr_u_int32_t(xdrs, &(cap->rmt_prog)) && - xdr_u_int32_t(xdrs, &(cap->rmt_vers)) && - xdr_u_int32_t(xdrs, &(cap->rmt_proc))) { - return (xdr_encap_parms(xdrs, &(cap->rmt_args))); - } - return (FALSE); -} - -/* - * XDR remote call results along with the address. Ignore - * program number, version number and proc number. - * Written for XDR_ENCODE direction only. - */ -static bool_t -xdr_rmtcall_result(XDR *xdrs, struct r_rmtcall_args *cap) -{ - bool_t result; - -#ifdef PORTMAP - if (cap->rmt_localvers == PMAPVERS) { - int h1, h2, h3, h4, p1, p2; - u_long port; - - /* interpret the universal address for TCP/IP */ - if (sscanf(cap->rmt_uaddr, "%d.%d.%d.%d.%d.%d", - &h1, &h2, &h3, &h4, &p1, &p2) != 6) - return (FALSE); - port = ((p1 & 0xff) << 8) + (p2 & 0xff); - result = xdr_u_long(xdrs, &port); - } else -#endif - if ((cap->rmt_localvers == RPCBVERS) || - (cap->rmt_localvers == RPCBVERS4)) { - result = xdr_wrapstring(xdrs, &(cap->rmt_uaddr)); - } else { - return (FALSE); - } - if (result == TRUE) - return (xdr_encap_parms(xdrs, &(cap->rmt_args))); - return (FALSE); -} - -/* - * only worries about the struct encap_parms part of struct r_rmtcall_args. - * The arglen must already be set!! - */ -static bool_t -xdr_opaque_parms(XDR *xdrs, struct r_rmtcall_args *cap) -{ - return (xdr_opaque(xdrs, cap->rmt_args.args, cap->rmt_args.arglen)); -} - -static struct rmtcallfd_list *rmthead; -static struct rmtcallfd_list *rmttail; - -int -create_rmtcall_fd(struct netconfig *nconf) -{ - int fd; - struct rmtcallfd_list *rmt; - SVCXPRT *xprt; - - if ((fd = __rpc_nconf2fd(nconf)) == -1) { - if (debugging) - fprintf(stderr, - "create_rmtcall_fd: couldn't open \"%s\" (errno %d)\n", - nconf->nc_device, errno); - return (-1); - } - xprt = svc_tli_create(fd, 0, (struct t_bind *) 0, 0, 0); - if (xprt == NULL) { - if (debugging) - fprintf(stderr, - "create_rmtcall_fd: svc_tli_create failed\n"); - return (-1); - } - rmt = (struct rmtcallfd_list *)malloc((u_int) - sizeof (struct rmtcallfd_list)); - if (rmt == NULL) { - syslog(LOG_ERR, "create_rmtcall_fd: no memory!"); - return (-1); - } - rmt->xprt = xprt; - rmt->netid = strdup(nconf->nc_netid); - xprt->xp_netid = rmt->netid; - rmt->fd = fd; - rmt->next = NULL; - if (rmthead == NULL) { - rmthead = rmt; - rmttail = rmt; - } else { - rmttail->next = rmt; - rmttail = rmt; - } - /* XXX not threadsafe */ - if (fd > *get_fdsetmax()) - *get_fdsetmax() = fd; - FD_SET(fd, get_fdset()); - return (fd); -} - -static int -find_rmtcallfd_by_netid(char *netid) -{ - struct rmtcallfd_list *rmt; - - for (rmt = rmthead; rmt != NULL; rmt = rmt->next) { - if (strcmp(netid, rmt->netid) == 0) { - return (rmt->fd); - } - } - return (-1); -} - -static SVCXPRT * -find_rmtcallxprt_by_fd(int fd) -{ - struct rmtcallfd_list *rmt; - - for (rmt = rmthead; rmt != NULL; rmt = rmt->next) { - if (fd == rmt->fd) { - return (rmt->xprt); - } - } - return (NULL); -} - - -/* - * Call a remote procedure service. This procedure is very quiet when things - * go wrong. The proc is written to support broadcast rpc. In the broadcast - * case, a machine should shut-up instead of complain, lest the requestor be - * overrun with complaints at the expense of not hearing a valid reply. - * When receiving a request and verifying that the service exists, we - * - * receive the request - * - * open a new TLI endpoint on the same transport on which we received - * the original request - * - * remember the original request's XID (which requires knowing the format - * of the svc_dg_data structure) - * - * forward the request, with a new XID, to the requested service, - * remembering the XID used to send this request (for later use in - * reassociating the answer with the original request), the requestor's - * address, the file descriptor on which the forwarded request is - * made and the service's address. - * - * mark the file descriptor on which we anticipate receiving a reply from - * the service and one to select for in our private svc_run procedure - * - * At some time in the future, a reply will be received from the service to - * which we forwarded the request. At that time, we detect that the socket - * used was for forwarding (by looking through the finfo structures to see - * whether the fd corresponds to one of those) and call handle_reply() to - * - * receive the reply - * - * bundle the reply, along with the service's universal address - * - * create a SVCXPRT structure and use a version of svc_sendreply - * that allows us to specify the reply XID and destination, send the reply - * to the original requestor. - */ - -void -rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp, - rpcproc_t reply_type, rpcvers_t versnum) -{ - register rpcblist_ptr rbl; - struct netconfig *nconf; - struct netbuf *caller; - struct r_rmtcall_args a; - char *buf_alloc = NULL, *outbufp; - char *outbuf_alloc = NULL; - char buf[RPC_BUF_MAX], outbuf[RPC_BUF_MAX]; - struct netbuf *na = NULL; - struct rpc_msg call_msg; - int outlen; - u_int sendsz; - XDR outxdr; - AUTH *auth; - int fd = -1; - char *uaddr, *m_uaddr, *local_uaddr = NULL; - u_int32_t *xidp; - struct __rpc_sockinfo si; - struct sockaddr *localsa; - struct netbuf tbuf; - - if (!__rpc_fd2sockinfo(transp->xp_fd, &si)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - return; - } - if (si.si_socktype != SOCK_DGRAM) - return; /* Only datagram type accepted */ - sendsz = __rpc_get_t_size(si.si_af, si.si_proto, UDPMSGSIZE); - if (sendsz == 0) { /* data transfer not supported */ - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - return; - } - /* - * Should be multiple of 4 for XDR. - */ - sendsz = ((sendsz + 3) / 4) * 4; - if (sendsz > RPC_BUF_MAX) { -#ifdef notyet - buf_alloc = alloca(sendsz); /* not in IDR2? */ -#else - buf_alloc = malloc(sendsz); -#endif /* notyet */ - if (buf_alloc == NULL) { - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: No Memory!\n"); - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - return; - } - a.rmt_args.args = buf_alloc; - } else { - a.rmt_args.args = buf; - } - - call_msg.rm_xid = 0; /* For error checking purposes */ - if (!svc_getargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_decode(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: svc_getargs failed\n"); - goto error; - } - - if (!check_callit(transp, &a, versnum)) { - svcerr_weakauth(transp); - goto error; - } - - caller = svc_getrpccaller(transp); -#ifdef RPCBIND_DEBUG - if (debugging) { - uaddr = taddr2uaddr(rpcbind_get_conf(transp->xp_netid), caller); - fprintf(stderr, "%s %s req for (%lu, %lu, %lu, %s) from %s : ", - versnum == PMAPVERS ? "pmap_rmtcall" : - versnum == RPCBVERS ? "rpcb_rmtcall" : - versnum == RPCBVERS4 ? "rpcb_indirect" : - rpcbind_unknown, - reply_type == RPCBPROC_INDIRECT ? "indirect" : "callit", - (unsigned long)a.rmt_prog, (unsigned long)a.rmt_vers, - (unsigned long)a.rmt_proc, transp->xp_netid, - uaddr ? uaddr : rpcbind_unknown); - if (uaddr) - free((void *) uaddr); - } -#endif - - rbl = find_service(a.rmt_prog, a.rmt_vers, transp->xp_netid); - - rpcbs_rmtcall(versnum - 2, reply_type, a.rmt_prog, a.rmt_vers, - a.rmt_proc, transp->xp_netid, rbl); - - if (rbl == NULL) { -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "not found\n"); -#endif - if (reply_type == RPCBPROC_INDIRECT) - svcerr_noprog(transp); - goto error; - } - if (rbl->rpcb_map.r_vers != a.rmt_vers) { - if (reply_type == RPCBPROC_INDIRECT) { - rpcvers_t vers_low, vers_high; - - find_versions(a.rmt_prog, transp->xp_netid, - &vers_low, &vers_high); - svcerr_progvers(transp, vers_low, vers_high); - } - goto error; - } - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "found at uaddr %s\n", rbl->rpcb_map.r_addr); -#endif - /* - * Check whether this entry is valid and a server is present - * Mergeaddr() returns NULL if no such entry is present, and - * returns "" if the entry was present but the server is not - * present (i.e., it crashed). - */ - if (reply_type == RPCBPROC_INDIRECT) { - uaddr = mergeaddr(transp, transp->xp_netid, - rbl->rpcb_map.r_addr, NULL); - if (uaddr == NULL || uaddr[0] == '\0') { - svcerr_noprog(transp); - if (uaddr != NULL) { - free((void *) uaddr); - } - goto error; - } - if (uaddr != NULL) { - free((void *) uaddr); - } - } - nconf = rpcbind_get_conf(transp->xp_netid); - if (nconf == NULL) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: rpcbind_get_conf failed\n"); - goto error; - } - localsa = local_sa(((struct sockaddr *)caller->buf)->sa_family); - if (localsa == NULL) { - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: no local address\n"); - goto error; - } - tbuf.len = tbuf.maxlen = localsa->sa_len; - tbuf.buf = localsa; - local_uaddr = - addrmerge(&tbuf, rbl->rpcb_map.r_addr, NULL, nconf->nc_netid); - m_uaddr = addrmerge(caller, rbl->rpcb_map.r_addr, NULL, - nconf->nc_netid); -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "merged uaddr %s\n", m_uaddr); -#endif - if ((fd = find_rmtcallfd_by_netid(nconf->nc_netid)) == -1) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - free((void *) m_uaddr); - goto error; - } - xidp = __rpcb_get_dg_xidp(transp); - call_msg.rm_xid = forward_register(*xidp, - caller, fd, m_uaddr, reply_type, versnum); - if (call_msg.rm_xid == 0) { - /* - * A duplicate request for the slow server. Let's not - * beat on it any more. - */ - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: duplicate request\n"); - free((void *) m_uaddr); - goto error; - } else if (call_msg.rm_xid == -1) { - /* forward_register failed. Perhaps no memory. */ - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: forward_register failed\n"); - free((void *) m_uaddr); - goto error; - } - -#ifdef DEBUG_RMTCALL - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: original XID %x, new XID %x\n", - *xidp, call_msg.rm_xid); -#endif - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = a.rmt_prog; - call_msg.rm_call.cb_vers = a.rmt_vers; - if (sendsz > RPC_BUF_MAX) { -#ifdef notyet - outbuf_alloc = alloca(sendsz); /* not in IDR2? */ -#else - outbuf_alloc = malloc(sendsz); -#endif /* notyet */ - if (outbuf_alloc == NULL) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: No memory!\n"); - goto error; - } - xdrmem_create(&outxdr, outbuf_alloc, sendsz, XDR_ENCODE); - } else { - xdrmem_create(&outxdr, outbuf, sendsz, XDR_ENCODE); - } - if (!xdr_callhdr(&outxdr, &call_msg)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: xdr_callhdr failed\n"); - goto error; - } - if (!xdr_u_int32_t(&outxdr, &(a.rmt_proc))) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: xdr_u_long failed\n"); - goto error; - } - - if (rqstp->rq_cred.oa_flavor == AUTH_NULL) { - auth = authnone_create(); - } else if (rqstp->rq_cred.oa_flavor == AUTH_SYS) { - struct authunix_parms *au; - - au = (struct authunix_parms *)rqstp->rq_clntcred; - auth = authunix_create(au->aup_machname, - au->aup_uid, au->aup_gid, - au->aup_len, au->aup_gids); - if (auth == NULL) /* fall back */ - auth = authnone_create(); - } else { - /* we do not support any other authentication scheme */ - if (debugging) - fprintf(stderr, -"rpcbproc_callit_com: oa_flavor != AUTH_NONE and oa_flavor != AUTH_SYS\n"); - if (reply_type == RPCBPROC_INDIRECT) - svcerr_weakauth(transp); /* XXX too strong.. */ - goto error; - } - if (auth == NULL) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: authwhatever_create returned NULL\n"); - goto error; - } - if (!AUTH_MARSHALL(auth, &outxdr)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - AUTH_DESTROY(auth); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: AUTH_MARSHALL failed\n"); - goto error; - } - AUTH_DESTROY(auth); - if (!xdr_opaque_parms(&outxdr, &a)) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: xdr_opaque_parms failed\n"); - goto error; - } - outlen = (int) XDR_GETPOS(&outxdr); - if (outbuf_alloc) - outbufp = outbuf_alloc; - else - outbufp = outbuf; - - na = uaddr2taddr(nconf, local_uaddr); - if (!na) { - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - goto error; - } - - if (sendto(fd, outbufp, outlen, 0, (struct sockaddr *)na->buf, na->len) - != outlen) { - if (debugging) - fprintf(stderr, - "rpcbproc_callit_com: sendto failed: errno %d\n", errno); - if (reply_type == RPCBPROC_INDIRECT) - svcerr_systemerr(transp); - goto error; - } - goto out; - -error: - if (call_msg.rm_xid != 0) - (void) free_slot_by_xid(call_msg.rm_xid); -out: - if (local_uaddr) - free(local_uaddr); - if (buf_alloc) - free((void *) buf_alloc); - if (outbuf_alloc) - free((void *) outbuf_alloc); - if (na) { - free(na->buf); - free(na); - } -} - -/* - * Makes an entry into the FIFO for the given request. - * If duplicate request, returns a 0, else returns the xid of its call. - */ -static u_int32_t -forward_register(u_int32_t caller_xid, struct netbuf *caller_addr, - int forward_fd, char *uaddr, rpcproc_t reply_type, - rpcvers_t versnum) -{ - int i; - int j = 0; - time_t min_time, time_now; - static u_int32_t lastxid; - int entry = -1; - - min_time = FINFO[0].time; - time_now = time((time_t *)0); - /* initialization */ - if (lastxid == 0) - lastxid = time_now * NFORWARD; - - /* - * Check if it is an duplicate entry. Then, - * try to find an empty slot. If not available, then - * use the slot with the earliest time. - */ - for (i = 0; i < NFORWARD; i++) { - if (FINFO[i].flag & FINFO_ACTIVE) { - if ((FINFO[i].caller_xid == caller_xid) && - (FINFO[i].reply_type == reply_type) && - (FINFO[i].versnum == versnum) && - (!netbufcmp(FINFO[i].caller_addr, - caller_addr))) { - FINFO[i].time = time((time_t *)0); - return (0); /* Duplicate entry */ - } else { - /* Should we wait any longer */ - if ((time_now - FINFO[i].time) > MAXTIME_OFF) - (void) free_slot_by_index(i); - } - } - if (entry == -1) { - if ((FINFO[i].flag & FINFO_ACTIVE) == 0) { - entry = i; - } else if (FINFO[i].time < min_time) { - j = i; - min_time = FINFO[i].time; - } - } - } - if (entry != -1) { - /* use this empty slot */ - j = entry; - } else { - (void) free_slot_by_index(j); - } - if ((FINFO[j].caller_addr = netbufdup(caller_addr)) == NULL) { - return (-1); - } - rpcb_rmtcalls++; /* no of pending calls */ - FINFO[j].flag = FINFO_ACTIVE; - FINFO[j].reply_type = reply_type; - FINFO[j].versnum = versnum; - FINFO[j].time = time_now; - FINFO[j].caller_xid = caller_xid; - FINFO[j].forward_fd = forward_fd; - /* - * Though uaddr is not allocated here, it will still be freed - * from free_slot_*(). - */ - FINFO[j].uaddr = uaddr; - lastxid = lastxid + NFORWARD; - FINFO[j].forward_xid = lastxid + j; /* encode slot */ - return (FINFO[j].forward_xid); /* forward on this xid */ -} - -static struct finfo * -forward_find(u_int32_t reply_xid) -{ - int i; - - i = reply_xid % NFORWARD; - if (i < 0) - i += NFORWARD; - if ((FINFO[i].flag & FINFO_ACTIVE) && - (FINFO[i].forward_xid == reply_xid)) { - return (&FINFO[i]); - } - return (NULL); -} - -static int -free_slot_by_xid(u_int32_t xid) -{ - int entry; - - entry = xid % NFORWARD; - if (entry < 0) - entry += NFORWARD; - return (free_slot_by_index(entry)); -} - -static int -free_slot_by_index(int idx) -{ - struct finfo *fi; - - fi = &FINFO[idx]; - if (fi->flag & FINFO_ACTIVE) { - netbuffree(fi->caller_addr); - /* XXX may be too big, but can't access xprt array here */ - if (fi->forward_fd >= *get_fdsetmax()) - (*get_fdsetmax())--; - free((void *) fi->uaddr); - fi->flag &= ~FINFO_ACTIVE; - rpcb_rmtcalls--; - return (1); - } - return (0); -} - -static int -netbufcmp(struct netbuf *n1, struct netbuf *n2) -{ - return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); -} - -static struct netbuf * -netbufdup(struct netbuf *ap) -{ - struct netbuf *np; - - np = (struct netbuf *) malloc(sizeof (struct netbuf) + ap->len); - if (np) { - np->maxlen = np->len = ap->len; - np->buf = ((char *) np) + sizeof (struct netbuf); - (void) memcpy(np->buf, ap->buf, ap->len); - } - return (np); -} - -static void -netbuffree(struct netbuf *ap) -{ - free((void *) ap); -} - - -#define MASKVAL (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND) -extern bool_t __svc_clean_idle(fd_set *, int, bool_t); - -void -my_svc_run() -{ - size_t nfds; - struct pollfd pollfds[FD_SETSIZE]; - int poll_ret, check_ret; - int n; -#ifdef SVC_RUN_DEBUG - int i; -#endif - register struct pollfd *p; - fd_set cleanfds; - - for (;;) { - p = pollfds; - for (n = 0; n <= *get_fdsetmax(); n++) { - if (FD_ISSET(n, get_fdset())) { - p->fd = n; - p->events = MASKVAL; - p++; - } - } - nfds = p - pollfds; - poll_ret = 0; -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "polling for read on fd < "); - for (i = 0, p = pollfds; i < nfds; i++, p++) - if (p->events) - fprintf(stderr, "%d ", p->fd); - fprintf(stderr, ">\n"); - } -#endif - poll_ret = rump_sys_poll(pollfds, nfds, 30 * 1000); - //printf("rpcbind poll got %d\n", poll_ret); - switch (poll_ret) { - case -1: - /* - * We ignore all errors, continuing with the assumption - * that it was set by the signal handlers (or any - * other outside event) and not caused by poll(). - */ - case 0: - cleanfds = *get_fdset(); - __svc_clean_idle(&cleanfds, 30, FALSE); - continue; - default: -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "poll returned read fds < "); - for (i = 0, p = pollfds; i < nfds; i++, p++) - if (p->revents) - fprintf(stderr, "%d (0x%x) ", p->fd, p->revents); - fprintf(stderr, ">\n"); - } -#endif - /* - * If we found as many replies on callback fds - * as the number of descriptors selectable which - * poll() returned, there can be no more so we - * don't call svc_getreq_poll. Otherwise, there - * must be another so we must call svc_getreq_poll. - */ - if ((check_ret = check_rmtcalls(pollfds, nfds)) == - poll_ret) - continue; - svc_getreq_poll(pollfds, poll_ret-check_ret); - } -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "svc_maxfd now %u\n", *get_fdsetmax()); - } -#endif - } -} - -static int -check_rmtcalls(struct pollfd *pfds, int nfds) -{ - int j, ncallbacks_found = 0, rmtcalls_pending; - SVCXPRT *xprt; - - if (rpcb_rmtcalls == 0) - return (0); - - rmtcalls_pending = rpcb_rmtcalls; - for (j = 0; j < nfds; j++) { - if ((xprt = find_rmtcallxprt_by_fd(pfds[j].fd)) != NULL) { - if (pfds[j].revents) { - ncallbacks_found++; -#ifdef DEBUG_RMTCALL - if (debugging) - fprintf(stderr, -"my_svc_run: polled on forwarding fd %d, netid %s - calling handle_reply\n", - pfds[j].fd, xprt->xp_netid); -#endif - handle_reply(pfds[j].fd, xprt); - pfds[j].revents = 0; - if (ncallbacks_found >= rmtcalls_pending) { - break; - } - } - } - } - return (ncallbacks_found); -} - -static void -xprt_set_caller(SVCXPRT *xprt, struct finfo *fi) -{ - u_int32_t *xidp; - - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); - xidp = __rpcb_get_dg_xidp(xprt); - *xidp = fi->caller_xid; -} - -/* - * Call svcerr_systemerr() only if RPCBVERS4 - */ -static void -send_svcsyserr(SVCXPRT *xprt, struct finfo *fi) -{ - if (fi->reply_type == RPCBPROC_INDIRECT) { - xprt_set_caller(xprt, fi); - svcerr_systemerr(xprt); - } - return; -} - -static void -handle_reply(int fd, SVCXPRT *xprt) -{ - XDR reply_xdrs; - struct rpc_msg reply_msg; - struct rpc_err reply_error; - char *buffer; - struct finfo *fi; - int inlen, pos, len; - struct r_rmtcall_args a; - struct sockaddr_storage ss; - socklen_t fromlen; -#ifdef SVC_RUN_DEBUG - char *uaddr; -#endif - - buffer = malloc(RPC_BUF_MAX); - if (buffer == NULL) - goto done; - - do { - fromlen = sizeof ss; - inlen = recvfrom(fd, buffer, RPC_BUF_MAX, 0, - (struct sockaddr *)&ss, &fromlen); - } while (inlen < 0 && errno == EINTR); - if (inlen < 0) { - if (debugging) - fprintf(stderr, - "handle_reply: recvfrom returned %d, errno %d\n", inlen, errno); - goto done; - } - - reply_msg.acpted_rply.ar_verf = _null_auth; - reply_msg.acpted_rply.ar_results.where = 0; - reply_msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void; - - xdrmem_create(&reply_xdrs, buffer, (u_int)inlen, XDR_DECODE); - if (!xdr_replymsg(&reply_xdrs, &reply_msg)) { - if (debugging) - (void) fprintf(stderr, - "handle_reply: xdr_replymsg failed\n"); - goto done; - } - fi = forward_find(reply_msg.rm_xid); -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "handle_reply: reply xid: %d fi addr: %p\n", - reply_msg.rm_xid, fi); - } -#endif - if (fi == NULL) { - goto done; - } - _seterr_reply(&reply_msg, &reply_error); - if (reply_error.re_status != RPC_SUCCESS) { - if (debugging) - (void) fprintf(stderr, "handle_reply: %s\n", - clnt_sperrno(reply_error.re_status)); - send_svcsyserr(xprt, fi); - goto done; - } - pos = XDR_GETPOS(&reply_xdrs); - len = inlen - pos; - a.rmt_args.args = &buffer[pos]; - a.rmt_args.arglen = len; - a.rmt_uaddr = fi->uaddr; - a.rmt_localvers = fi->versnum; - - xprt_set_caller(xprt, fi); -#ifdef SVC_RUN_DEBUG - uaddr = taddr2uaddr(rpcbind_get_conf("udp"), - svc_getrpccaller(xprt)); - if (debugging) { - fprintf(stderr, "handle_reply: forwarding address %s to %s\n", - a.rmt_uaddr, uaddr ? uaddr : rpcbind_unknown); - } - if (uaddr) - free((void *) uaddr); -#endif - svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a); -done: - if (buffer) - free(buffer); - - if (reply_msg.rm_xid == 0) { -#ifdef SVC_RUN_DEBUG - if (debugging) { - fprintf(stderr, "handle_reply: NULL xid on exit!\n"); - } -#endif - } else - (void) free_slot_by_xid(reply_msg.rm_xid); - return; -} - -static void -find_versions(rpcprog_t prog, char *netid, rpcvers_t *lowvp, rpcvers_t *highvp) -{ - register rpcblist_ptr rbl; - int lowv = 0; - int highv = 0; - - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog != prog) || - ((rbl->rpcb_map.r_netid != NULL) && - (strcasecmp(rbl->rpcb_map.r_netid, netid) != 0))) - continue; - if (lowv == 0) { - highv = rbl->rpcb_map.r_vers; - lowv = highv; - } else if (rbl->rpcb_map.r_vers < lowv) { - lowv = rbl->rpcb_map.r_vers; - } else if (rbl->rpcb_map.r_vers > highv) { - highv = rbl->rpcb_map.r_vers; - } - } - *lowvp = lowv; - *highvp = highv; - return; -} - -/* - * returns the item with the given program, version number and netid. - * If that version number is not found, it returns the item with that - * program number, so that address is now returned to the caller. The - * caller when makes a call to this program, version number, the call - * will fail and it will return with PROGVERS_MISMATCH. The user can - * then determine the highest and the lowest version number for this - * program using clnt_geterr() and use those program version numbers. - * - * Returns the RPCBLIST for the given prog, vers and netid - */ -static rpcblist_ptr -find_service(rpcprog_t prog, rpcvers_t vers, char *netid) -{ - register rpcblist_ptr hit = NULL; - register rpcblist_ptr rbl; - - for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { - if ((rbl->rpcb_map.r_prog != prog) || - ((rbl->rpcb_map.r_netid != NULL) && - (strcasecmp(rbl->rpcb_map.r_netid, netid) != 0))) - continue; - hit = rbl; - if (rbl->rpcb_map.r_vers == vers) - break; - } - return (hit); -} - -/* - * Copies the name associated with the uid of the caller and returns - * a pointer to it. Similar to getwd(). - */ -static char * -getowner(SVCXPRT *transp, char *owner, size_t ownersize) -{ - struct sockcred *sc; - - sc = __svc_getcallercreds(transp); - if (sc == NULL) - strlcpy(owner, rpcbind_unknown, ownersize); - else if (sc->sc_uid == 0) - strlcpy(owner, rpcbind_superuser, ownersize); - else - snprintf(owner, ownersize, "%d", sc->sc_uid); - - return owner; -} - -#ifdef PORTMAP -/* - * Add this to the pmap list only if it is UDP or TCP. - */ -static int -add_pmaplist(RPCB *arg) -{ - struct pmap pmap; - struct pmaplist *pml; - int h1, h2, h3, h4, p1, p2; - - if (strcmp(arg->r_netid, udptrans) == 0) { - /* It is UDP! */ - pmap.pm_prot = IPPROTO_UDP; - } else if (strcmp(arg->r_netid, tcptrans) == 0) { - /* It is TCP */ - pmap.pm_prot = IPPROTO_TCP; - } else - /* Not a IP protocol */ - return (0); - - /* interpret the universal address for TCP/IP */ - if (sscanf(arg->r_addr, "%d.%d.%d.%d.%d.%d", - &h1, &h2, &h3, &h4, &p1, &p2) != 6) - return (0); - pmap.pm_port = ((p1 & 0xff) << 8) + (p2 & 0xff); - pmap.pm_prog = arg->r_prog; - pmap.pm_vers = arg->r_vers; - /* - * add to END of list - */ - pml = (struct pmaplist *) malloc((u_int)sizeof (struct pmaplist)); - if (pml == NULL) { - (void) syslog(LOG_ERR, "rpcbind: no memory!\n"); - return (1); - } - pml->pml_map = pmap; - pml->pml_next = NULL; - if (list_pml == NULL) { - list_pml = pml; - } else { - struct pmaplist *fnd; - - /* Attach to the end of the list */ - for (fnd = list_pml; fnd->pml_next; fnd = fnd->pml_next) - ; - fnd->pml_next = pml; - } - return (0); -} - -/* - * Delete this from the pmap list only if it is UDP or TCP. - */ -static int -del_pmaplist(RPCB *arg) -{ - struct pmaplist *pml; - struct pmaplist *prevpml, *fnd; - long prot; - - if (strcmp(arg->r_netid, udptrans) == 0) { - /* It is UDP! */ - prot = IPPROTO_UDP; - } else if (strcmp(arg->r_netid, tcptrans) == 0) { - /* It is TCP */ - prot = IPPROTO_TCP; - } else if (arg->r_netid[0] == 0) { - prot = 0; /* Remove all occurrences */ - } else { - /* Not a IP protocol */ - return (0); - } - for (prevpml = NULL, pml = list_pml; pml; /* cstyle */) { - if ((pml->pml_map.pm_prog != arg->r_prog) || - (pml->pml_map.pm_vers != arg->r_vers) || - (prot && (pml->pml_map.pm_prot != prot))) { - /* both pml & prevpml move forwards */ - prevpml = pml; - pml = pml->pml_next; - continue; - } - /* found it; pml moves forward, prevpml stays */ - fnd = pml; - pml = pml->pml_next; - if (prevpml == NULL) - list_pml = pml; - else - prevpml->pml_next = pml; - free((void *) fnd); - } - return (0); -} -#endif /* PORTMAP */ diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 deleted file mode 100644 index c77f1d5e8631..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 +++ /dev/null @@ -1,127 +0,0 @@ -.\" $NetBSD: rpcbind.8,v 1.1 2010/07/26 15:53:00 pooka Exp $ -.\" @(#)rpcbind.1m 1.19 92/09/14 SMI; from SVr4 -.\" Copyright 1989 AT&T -.\" Copyright 1991 Sun Microsystems, Inc. -.Dd October 19, 2008 -.Dt RPCBIND 8 -.Sh NAME -.Nm rpcbind -.Nd universal addresses to RPC program number mapper -.Sh SYNOPSIS -.Nm -.Op Fl dilLs -.Sh DESCRIPTION -.Nm -is a server that converts -.Tn RPC -program numbers into -universal addresses. -It must be running on the host to be able to make -.Tn RPC -calls -on a server on that machine. -.Pp -When an -.Tn RPC -service is started, -it tells -.Nm -the address at which it is listening, -and the -.Tn RPC -program numbers it is prepared to serve. -When a client wishes to make an -.Tn RPC -call to a given program number, -it first contacts -.Nm -on the server machine to determine -the address where -.Tn RPC -requests should be sent. -.Pp -.Nm -should be started before any other RPC service. -Normally, standard -.Tn RPC -servers are started by port monitors, so -.Nm -must be started before port monitors are invoked. -.Pp -When -.Nm -is started, it checks that certain name-to-address -translation-calls function correctly. -If they fail, the network configuration databases may be corrupt. -Since -.Tn RPC -services cannot function correctly in this situation, -.Nm -reports the condition and terminates. -.Pp -.Nm -can only be started by the super-user. -.Pp -Access control is provided by -.Pa /etc/hosts.allow -and -.Pa /etc/hosts.deny , -as described in -.Xr hosts_access 5 -with daemon name -.Nm . -.Sh OPTIONS -.Bl -tag -width Ds -.It Fl d -Run in debug mode. -In this mode, -.Nm -will not fork when it starts, will print additional information -during operation, and will abort on certain errors. -With this option, the name-to-address translation consistency -checks are shown in detail. -.It Fl i -.Dq insecure -mode. -Allows calls to SET and UNSET from any host. -Normally -.Nm -accepts these requests only from the loopback interface for security reasons. -This change is necessary for programs that were compiled with earlier -versions of the rpc library and do not make those requests using the -loopback interface. -.It Fl l -Turns on libwrap connection logging. -.It Fl s -Causes -.Nm -to change to the user daemon as soon as possible. -This causes -.Nm -to use non-privileged ports for outgoing connections, preventing non-privileged -clients from using -.Nm -to connect to services from a privileged port. -.It Fl L -Allow old-style local connections over the loopback interface. -Without this flag, local connections are only allowed over a local socket, -.Pa /var/run/rpcbind.sock -.El -.Sh NOTES -All RPC servers must be restarted if -.Nm -is restarted. -.Sh FILES -.Bl -tag -width "/var/run/rpcbind.sock" -compact -.It Pa /var/run/rpcbind.sock -.It Pa /etc/hosts.allow -explicit remote host access list. -.It Pa /etc/hosts.deny -explicit remote host denial of service list. -.El -.Sh SEE ALSO -.Xr rpcbind 3 , -.Xr hosts_access 5 , -.Xr hosts_options 5 , -.Xr netconfig 5 , -.Xr rpcinfo 8 diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c deleted file mode 100644 index 492b0b676a85..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.c +++ /dev/null @@ -1,613 +0,0 @@ -/* $NetBSD: rpcbind.c,v 1.4 2013/10/19 17:45:00 christos Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcbind.c 1.19 94/04/25 SMI" */ - -#if 0 -#ifndef lint -static char sccsid[] = "@(#)rpcbind.c 1.35 89/04/21 Copyr 1984 Sun Micro"; -#endif -#endif - -/* - * rpcbind.c - * Implements the program, version to address mapping for rpc. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef PORTMAP -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rpcbind.h" - -#include -#include - -/* Global variables */ -int debugging = 1; /* Tell me what's going on */ -int doabort = 0; /* When debugging, do an abort on errors */ -rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */ - -#include "svc_fdset.h" - -/* who to suid to if -s is given */ -#define RUN_AS "daemon" - -int runasdaemon = 0; -int insecure = 0; -int oldstyle_local = 0; -int verboselog = 0; - -#ifdef WARMSTART -/* Local Variable */ -static int warmstart = 0; /* Grab a old copy of registrations */ -#endif - -#ifdef PORTMAP -struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ -const char *udptrans; /* Name of UDP transport */ -const char *tcptrans; /* Name of TCP transport */ -const char *udp_uaddr; /* Universal UDP address */ -const char *tcp_uaddr; /* Universal TCP address */ -#endif -static const char servname[] = "sunrpc"; - -const char rpcbind_superuser[] = "superuser"; -const char rpcbind_unknown[] = "unknown"; - -static int init_transport(struct netconfig *); -static void rbllist_add(rpcprog_t, rpcvers_t, struct netconfig *, - struct netbuf *); -static void terminate(int); -#if 0 -static void parseargs(int, char *[]); -#endif - -int rpcbind_main(void *); -int -rpcbind_main(void *arg) -{ - struct netconfig *nconf; - void *nc_handle; /* Net config handle */ - struct rlimit rl; - int maxrec = RPC_MAXDATASIZE; - extern sem_t gensem; - -#if 0 - parseargs(argc, argv); -#endif - - alloc_fdset(); - - getrlimit(RLIMIT_NOFILE, &rl); - if (rl.rlim_cur < 128) { - if (rl.rlim_max <= 128) - rl.rlim_cur = rl.rlim_max; - else - rl.rlim_cur = 128; - setrlimit(RLIMIT_NOFILE, &rl); - } -#if 0 - if (geteuid()) /* This command allowed only to root */ - errx(1, "Sorry. You are not superuser"); -#endif - nc_handle = setnetconfig(); /* open netconfig file */ - if (nc_handle == NULL) - errx(1, "could not read /etc/netconfig"); -#ifdef PORTMAP - udptrans = ""; - tcptrans = ""; -#endif - - nconf = getnetconfigent("local"); - if (nconf == NULL) - errx(1, "can't find local transport"); - - rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); - - init_transport(nconf); - - while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) - init_transport(nconf); - } - endnetconfig(nc_handle); - - /* catch the usual termination signals for graceful exit */ - (void) signal(SIGCHLD, reap); - (void) signal(SIGINT, terminate); - (void) signal(SIGTERM, terminate); - (void) signal(SIGQUIT, terminate); - /* ignore others that could get sent */ - (void) signal(SIGPIPE, SIG_IGN); - //(void) signal(SIGHUP, SIG_IGN); used by mountd - (void) signal(SIGUSR1, SIG_IGN); - (void) signal(SIGUSR2, SIG_IGN); -#ifdef WARMSTART - if (warmstart) { - read_warmstart(); - } -#endif - if (debugging) { - printf("rpcbind debugging enabled."); - if (doabort) { - printf(" Will abort on errors!\n"); - } else { - printf("\n"); - } - } else { - if (daemon(0, 0)) - err(1, "fork failed"); - } - - openlog("rpcbind", 0, LOG_DAEMON); - pidfile(NULL); - - if (runasdaemon) { - struct passwd *p; - - if((p = getpwnam(RUN_AS)) == NULL) { - syslog(LOG_ERR, "cannot get uid of daemon: %m"); - exit(1); - } - if (setuid(p->pw_uid) == -1) { - syslog(LOG_ERR, "setuid to daemon failed: %m"); - exit(1); - } - } - - network_init(); - - sem_post(&gensem); - my_svc_run(); - syslog(LOG_ERR, "svc_run returned unexpectedly"); - rpcbind_abort(); - /* NOTREACHED */ - - return 0; -} - -/* - * Adds the entry into the rpcbind database. - * If PORTMAP, then for UDP and TCP, it adds the entries for version 2 also - * Returns 0 if succeeds, else fails - */ -static int -init_transport(struct netconfig *nconf) -{ - int fd; - struct t_bind taddr; - struct addrinfo hints, *res = NULL; - struct __rpc_sockinfo si; - SVCXPRT *my_xprt; - int aicode, status, addrlen; - struct sockaddr *sa; - struct sockaddr_un sun; - const int one = 1; - - if ((nconf->nc_semantics != NC_TPI_CLTS) && - (nconf->nc_semantics != NC_TPI_COTS) && - (nconf->nc_semantics != NC_TPI_COTS_ORD)) - return 1; /* not my type */ -#ifdef RPCBIND_DEBUG - if (debugging) { - int i; - char **s; - - (void)fprintf(stderr, "%s: %ld lookup routines :\n", - nconf->nc_netid, nconf->nc_nlookups); - for (i = 0, s = nconf->nc_lookups; i < nconf->nc_nlookups; - i++, s++) - (void)fprintf(stderr, "[%d] - %s\n", i, *s); - } -#endif - - /* - * XXX - using RPC library internal functions. - */ - if ((fd = __rpc_nconf2fd(nconf)) < 0) { - if (errno == EAFNOSUPPORT) - return 1; - warn("Cannot create socket for `%s'", nconf->nc_netid); - return 1; - } - - if (!__rpc_nconf2sockinfo(nconf, &si)) { - warnx("Cannot get information for `%s'", nconf->nc_netid); - return 1; - } - - if (si.si_af == AF_INET6) { - /* - * We're doing host-based access checks here, so don't allow - * v4-in-v6 to confuse things. - */ - if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, - sizeof one) < 0) { - warn("Can't make socket ipv6 only"); - return 1; - } - } - - - if (!strcmp(nconf->nc_netid, "local")) { - (void)memset(&sun, 0, sizeof sun); - sun.sun_family = AF_LOCAL; - (void)rump_sys_unlink(_PATH_RPCBINDSOCK); - (void)strlcpy(sun.sun_path, _PATH_RPCBINDSOCK, - sizeof(sun.sun_path)); - sun.sun_len = SUN_LEN(&sun); - addrlen = sizeof(struct sockaddr_un); - sa = (struct sockaddr *)&sun; - } else { - /* Get rpcbind's address on this transport */ - - (void)memset(&hints, 0, sizeof hints); - hints.ai_flags = AI_PASSIVE; - hints.ai_family = si.si_af; - hints.ai_socktype = si.si_socktype; - hints.ai_protocol = si.si_proto; - if ((aicode = getaddrinfo(NULL, servname, &hints, &res)) != 0) { - warnx("Cannot get local address for `%s' (%s)", - nconf->nc_netid, gai_strerror(aicode)); - return 1; - } - addrlen = res->ai_addrlen; - sa = (struct sockaddr *)res->ai_addr; - } - - if (bind(fd, sa, addrlen) < 0) { - warn("Cannot bind `%s'", nconf->nc_netid); - if (res != NULL) - freeaddrinfo(res); - return 1; - } -#if 0 - if (sa->sa_family == AF_LOCAL) - if (rump_sys_chmod(sun.sun_path, S_IRWXU|S_IRWXG|S_IRWXO) == -1) - warn("Cannot chmod `%s'", sun.sun_path); -#endif - - /* Copy the address */ - taddr.addr.len = taddr.addr.maxlen = addrlen; - taddr.addr.buf = malloc(addrlen); - if (taddr.addr.buf == NULL) { - warn("Cannot allocate memory for `%s' address", - nconf->nc_netid); - if (res != NULL) - freeaddrinfo(res); - return 1; - } - (void)memcpy(taddr.addr.buf, sa, addrlen); -#ifdef RPCBIND_DEBUG - if (debugging) { - /* for debugging print out our universal address */ - char *uaddr; - struct netbuf nb; - - nb.buf = sa; - nb.len = nb.maxlen = sa->sa_len; - uaddr = taddr2uaddr(nconf, &nb); - (void)fprintf(stderr, "rpcbind: my address is %s\n", uaddr); - (void)free(uaddr); - } -#endif - - if (res != NULL) - freeaddrinfo(res); - - if (nconf->nc_semantics != NC_TPI_CLTS) - listen(fd, SOMAXCONN); - - my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, - RPC_MAXDATASIZE); - if (my_xprt == NULL) { - warnx("Could not create service for `%s'", nconf->nc_netid); - goto error; - } - -#ifdef PORTMAP - /* - * Register both the versions for tcp/ip, udp/ip and local. - */ - if ((strcmp(nconf->nc_protofmly, NC_INET) == 0 && - (strcmp(nconf->nc_proto, NC_TCP) == 0 || - strcmp(nconf->nc_proto, NC_UDP) == 0)) || - strcmp(nconf->nc_netid, "local") == 0) { - struct pmaplist *pml; - - if (!svc_register(my_xprt, PMAPPROG, PMAPVERS, - pmap_service, 0)) { - warn("Could not register on `%s'", nconf->nc_netid); - goto error; - } - pml = malloc(sizeof (struct pmaplist)); - if (pml == NULL) { - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map.pm_prog = PMAPPROG; - pml->pml_map.pm_vers = PMAPVERS; - pml->pml_map.pm_port = PMAPPORT; - if (strcmp(nconf->nc_proto, NC_TCP) == 0) { - if (tcptrans[0]) { - warnx( - "Cannot have more than one TCP transport"); - free(pml); - goto error; - } - tcptrans = strdup(nconf->nc_netid); - if (tcptrans == NULL) { - free(pml); - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map.pm_prot = IPPROTO_TCP; - - /* Let's snarf the universal address */ - /* "h1.h2.h3.h4.p1.p2" */ - tcp_uaddr = taddr2uaddr(nconf, &taddr.addr); - } else if (strcmp(nconf->nc_proto, NC_UDP) == 0) { - if (udptrans[0]) { - free(pml); - warnx( - "Cannot have more than one UDP transport"); - goto error; - } - udptrans = strdup(nconf->nc_netid); - if (udptrans == NULL) { - free(pml); - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map.pm_prot = IPPROTO_UDP; - - /* Let's snarf the universal address */ - /* "h1.h2.h3.h4.p1.p2" */ - udp_uaddr = taddr2uaddr(nconf, &taddr.addr); - } - pml->pml_next = list_pml; - list_pml = pml; - - /* Add version 3 information */ - pml = malloc(sizeof (struct pmaplist)); - if (pml == NULL) { - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map = list_pml->pml_map; - pml->pml_map.pm_vers = RPCBVERS; - pml->pml_next = list_pml; - list_pml = pml; - - /* Add version 4 information */ - pml = malloc(sizeof (struct pmaplist)); - if (pml == NULL) { - warn("Cannot allocate memory"); - goto error; - } - pml->pml_map = list_pml->pml_map; - pml->pml_map.pm_vers = RPCBVERS4; - pml->pml_next = list_pml; - list_pml = pml; - - /* Also add version 2 stuff to rpcbind list */ - rbllist_add(PMAPPROG, PMAPVERS, nconf, &taddr.addr); - } -#endif - - /* version 3 registration */ - if (!svc_reg(my_xprt, RPCBPROG, RPCBVERS, rpcb_service_3, NULL)) { - warn("Could not register %s version 3", nconf->nc_netid); - goto error; - } - rbllist_add(RPCBPROG, RPCBVERS, nconf, &taddr.addr); - - /* version 4 registration */ - if (!svc_reg(my_xprt, RPCBPROG, RPCBVERS4, rpcb_service_4, NULL)) { - warn("Could not register %s version 4", nconf->nc_netid); - goto error; - } - rbllist_add(RPCBPROG, RPCBVERS4, nconf, &taddr.addr); - - /* decide if bound checking works for this transport */ - status = add_bndlist(nconf, &taddr.addr); -#ifdef RPCBIND_DEBUG - if (debugging) { - if (status < 0) { - fprintf(stderr, "Error in finding bind status for %s\n", - nconf->nc_netid); - } else if (status == 0) { - fprintf(stderr, "check binding for %s\n", - nconf->nc_netid); - } else if (status > 0) { - fprintf(stderr, "No check binding for %s\n", - nconf->nc_netid); - } - } -#else - __USE(status); -#endif - /* - * rmtcall only supported on CLTS transports for now. - */ - if (nconf->nc_semantics == NC_TPI_CLTS) { - status = create_rmtcall_fd(nconf); - -#ifdef RPCBIND_DEBUG - if (debugging) { - if (status < 0) { - fprintf(stderr, - "Could not create rmtcall fd for %s\n", - nconf->nc_netid); - } else { - fprintf(stderr, "rmtcall fd for %s is %d\n", - nconf->nc_netid, status); - } - } -#endif - } - return (0); -error: - (void)rump_sys_close(fd); - return (1); -} - -static void -rbllist_add(rpcprog_t prog, rpcvers_t vers, struct netconfig *nconf, - struct netbuf *addr) -{ - rpcblist_ptr rbl; - - rbl = malloc(sizeof(rpcblist)); - if (rbl == NULL) { - warn("Out of memory"); - return; - } - - rbl->rpcb_map.r_prog = prog; - rbl->rpcb_map.r_vers = vers; - rbl->rpcb_map.r_netid = strdup(nconf->nc_netid); - rbl->rpcb_map.r_addr = taddr2uaddr(nconf, addr); - rbl->rpcb_map.r_owner = strdup(rpcbind_superuser); - rbl->rpcb_next = list_rbl; /* Attach to global list */ - list_rbl = rbl; -} - -/* - * Catch the signal and die - */ -static void -terminate(int dummy) -{ -#ifdef WARMSTART - syslog(LOG_ERR, - "rpcbind terminating on signal. Restart with \"rpcbind -w\""); - write_warmstart(); /* Dump yourself */ -#endif - exit(2); -} - -void -rpcbind_abort() -{ -#ifdef WARMSTART - write_warmstart(); /* Dump yourself */ -#endif - abort(); -} - -#if 0 -/* get command line options */ -static void -parseargs(int argc, char *argv[]) -{ - int c; - - while ((c = getopt(argc, argv, "dwailLs")) != -1) { - switch (c) { - case 'a': - doabort = 1; /* when debugging, do an abort on */ - break; /* errors; for rpcbind developers */ - /* only! */ - case 'd': - debugging = 1; - break; - case 'i': - insecure = 1; - break; - case 'L': - oldstyle_local = 1; - break; - case 'l': - verboselog = 1; - break; - case 's': - runasdaemon = 1; - break; -#ifdef WARMSTART - case 'w': - warmstart = 1; - break; -#endif - default: /* error */ - fprintf(stderr, "usage: rpcbind [-Idwils]\n"); - exit (1); - } - } - if (doabort && !debugging) { - fprintf(stderr, - "-a (abort) specified without -d (debugging) -- ignored.\n"); - doabort = 0; - } -} -#endif - -void -reap(int dummy) -{ - int save_errno = errno; - - while (wait3(NULL, WNOHANG, NULL) > 0) - ; - errno = save_errno; -} - -void -toggle_verboselog(int dummy) -{ - verboselog = !verboselog; -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h deleted file mode 100644 index 1717e31643b1..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/rpcbind.h +++ /dev/null @@ -1,146 +0,0 @@ -/* $NetBSD: rpcbind.h,v 1.1 2010/07/26 15:53:00 pooka Exp $ */ - -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ -/* - * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc. - */ - -/* #ident "@(#)rpcbind.h 1.4 90/04/12 SMI" */ - -/* - * rpcbind.h - * The common header declarations - */ - -#ifndef rpcbind_h -#define rpcbind_h - -#ifdef PORTMAP -#include -#endif -#include - -/* - * Stuff for the rmtcall service - */ -struct encap_parms { - u_int32_t arglen; - char *args; -}; - -struct r_rmtcall_args { - u_int32_t rmt_prog; - u_int32_t rmt_vers; - u_int32_t rmt_proc; - int rmt_localvers; /* whether to send port # or uaddr */ - char *rmt_uaddr; - struct encap_parms rmt_args; -}; - -extern int debugging; -extern int doabort; -extern int verboselog; -extern int insecure; -extern int oldstyle_local; -extern rpcblist_ptr list_rbl; /* A list of version 3 & 4 rpcbind services */ - -#ifdef PORTMAP -extern struct pmaplist *list_pml; /* A list of version 2 rpcbind services */ -extern const char *udptrans; /* Name of UDP transport */ -extern const char *tcptrans; /* Name of TCP transport */ -extern const char *udp_uaddr; /* Universal UDP address */ -extern const char *tcp_uaddr; /* Universal TCP address */ -#endif - -extern const char rpcbind_superuser[]; -extern const char rpcbind_unknown[]; - -int add_bndlist(struct netconfig *, struct netbuf *); -bool_t is_bound(const char *, const char *); -char *mergeaddr(SVCXPRT *, char *, char *, char *); -struct netconfig *rpcbind_get_conf(const char *); - -void rpcbs_init(void); -void rpcbs_procinfo(rpcvers_t, rpcproc_t); -void rpcbs_set(rpcvers_t, bool_t); -void rpcbs_unset(rpcvers_t, bool_t); -void rpcbs_getaddr(rpcvers_t, rpcprog_t, rpcvers_t, const char *, const char *); -void rpcbs_rmtcall(rpcvers_t, rpcproc_t, rpcprog_t, rpcvers_t, rpcproc_t, - char *, rpcblist_ptr); -void *rpcbproc_getstat(void *, struct svc_req *, SVCXPRT *, rpcvers_t); - -void rpcb_service_3(struct svc_req *, SVCXPRT *); -void rpcb_service_4(struct svc_req *, SVCXPRT *); - -/* Common functions shared between versions */ -void *rpcbproc_set_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); -void *rpcbproc_unset_com(void *, struct svc_req *, SVCXPRT *, rpcvers_t); -bool_t map_set(RPCB *, char *); -bool_t map_unset(RPCB *, const char *); -void delete_prog(int); -void *rpcbproc_getaddr_com(RPCB *, struct svc_req *, SVCXPRT *, rpcvers_t, - rpcvers_t); -void *rpcbproc_gettime_com(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -void *rpcbproc_uaddr2taddr_com(void *, struct svc_req *, - SVCXPRT *, rpcvers_t); -void *rpcbproc_taddr2uaddr_com(void *, struct svc_req *, SVCXPRT *, - rpcvers_t); -int create_rmtcall_fd(struct netconfig *); -void rpcbproc_callit_com(struct svc_req *, SVCXPRT *, rpcvers_t, - rpcvers_t); -void my_svc_run(void); - -void rpcbind_abort(void); -void reap(int); -void toggle_verboselog(int); - -int check_access(SVCXPRT *, rpcproc_t, void *, int); -int check_callit(SVCXPRT *, struct r_rmtcall_args *, int); -void logit(int, struct sockaddr *, rpcproc_t, rpcprog_t, const char *); -int is_loopback(struct netbuf *); - -#ifdef PORTMAP -extern void pmap_service(struct svc_req *, SVCXPRT *); -#endif - -void write_warmstart(void); -void read_warmstart(void); - -char *addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, - char *netid); -void network_init(void); -struct sockaddr *local_sa(int); - -/* For different getaddr semantics */ -#define RPCB_ALLVERS 0 -#define RPCB_ONEVERS 1 - -#endif /* rpcbind_h */ diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c deleted file mode 100644 index 755c0d3ffe30..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/security.c +++ /dev/null @@ -1,282 +0,0 @@ -/* $NetBSD: security.c,v 1.1 2010/07/26 15:53:01 pooka Exp $ */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * XXX for special case checks in check_callit. - */ -#include -#include -#include -#include -#include -#include - -#include "rpcbind.h" - -#ifdef LIBWRAP -# include -#ifndef LIBWRAP_ALLOW_FACILITY -# define LIBWRAP_ALLOW_FACILITY LOG_AUTH -#endif -#ifndef LIBWRAP_ALLOW_SEVERITY -# define LIBWRAP_ALLOW_SEVERITY LOG_INFO -#endif -#ifndef LIBWRAP_DENY_FACILITY -# define LIBWRAP_DENY_FACILITY LOG_AUTH -#endif -#ifndef LIBWRAP_DENY_SEVERITY -# define LIBWRAP_DENY_SEVERITY LOG_WARNING -#endif -int allow_severity = LIBWRAP_ALLOW_FACILITY|LIBWRAP_ALLOW_SEVERITY; -int deny_severity = LIBWRAP_DENY_FACILITY|LIBWRAP_DENY_SEVERITY; -#endif - -#ifndef PORTMAP_LOG_FACILITY -# define PORTMAP_LOG_FACILITY LOG_AUTH -#endif -#ifndef PORTMAP_LOG_SEVERITY -# define PORTMAP_LOG_SEVERITY LOG_INFO -#endif -int log_severity = PORTMAP_LOG_FACILITY|PORTMAP_LOG_SEVERITY; - -extern int verboselog; - -int -check_access(SVCXPRT *xprt, rpcproc_t proc, void *args, int rpcbvers) -{ - struct netbuf *caller = svc_getrpccaller(xprt); - struct sockaddr *addr = (struct sockaddr *)caller->buf; -#ifdef LIBWRAP - struct request_info req; -#endif - rpcprog_t prog = 0; - rpcb *rpcbp; - struct pmap *pmap; - - /* - * The older PMAP_* equivalents have the same numbers, so - * they are accounted for here as well. - */ - switch (proc) { - case RPCBPROC_GETADDR: - case RPCBPROC_SET: - case RPCBPROC_UNSET: - if (rpcbvers > PMAPVERS) { - rpcbp = (rpcb *)args; - prog = rpcbp->r_prog; - } else { - pmap = (struct pmap *)args; - prog = pmap->pm_prog; - } - if (proc == RPCBPROC_GETADDR) - break; - if (!insecure && !is_loopback(caller)) { - if (verboselog) - logit(log_severity, addr, proc, prog, - " declined (non-loopback sender)"); - return 0; - } - break; - case RPCBPROC_CALLIT: - case RPCBPROC_INDIRECT: - case RPCBPROC_DUMP: - case RPCBPROC_GETTIME: - case RPCBPROC_UADDR2TADDR: - case RPCBPROC_TADDR2UADDR: - case RPCBPROC_GETVERSADDR: - case RPCBPROC_GETADDRLIST: - case RPCBPROC_GETSTAT: - default: - break; - } - -#ifdef LIBWRAP - if (addr->sa_family == AF_LOCAL) - return 1; - request_init(&req, RQ_DAEMON, "rpcbind", RQ_CLIENT_SIN, addr, 0); - sock_methods(&req); - if(!hosts_access(&req)) { - logit(deny_severity, addr, proc, prog, ": request from unauthorized host"); - return 0; - } -#endif - if (verboselog) - logit(log_severity, addr, proc, prog, ""); - return 1; -} - -int -is_loopback(struct netbuf *nbuf) -{ - struct sockaddr *addr = (struct sockaddr *)nbuf->buf; - struct sockaddr_in *sin; -#ifdef INET6 - struct sockaddr_in6 *sin6; -#endif - - switch (addr->sa_family) { - case AF_INET: - if (!oldstyle_local) - return 0; - sin = (struct sockaddr_in *)addr; - return ((sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && - (ntohs(sin->sin_port) < IPPORT_RESERVED)); -#ifdef INET6 - case AF_INET6: - if (!oldstyle_local) - return 0; - sin6 = (struct sockaddr_in6 *)addr; - return (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && - (ntohs(sin6->sin6_port) < IPV6PORT_RESERVED)); -#endif - case AF_LOCAL: - return 1; - default: - break; - } - - return 0; -} - - -/* logit - report events of interest via the syslog daemon */ -void -logit(int severity, struct sockaddr *addr, rpcproc_t procnum, rpcprog_t prognum, - const char *text) -{ - const char *procname; - char procbuf[32]; - char *progname; - char progbuf[32]; - char fromname[NI_MAXHOST]; - struct rpcent *rpc; - static const char *procmap[] = { - /* RPCBPROC_NULL */ "null", - /* RPCBPROC_SET */ "set", - /* RPCBPROC_UNSET */ "unset", - /* RPCBPROC_GETADDR */ "getport/addr", - /* RPCBPROC_DUMP */ "dump", - /* RPCBPROC_CALLIT */ "callit", - /* RPCBPROC_GETTIME */ "gettime", - /* RPCBPROC_UADDR2TADDR */ "uaddr2taddr", - /* RPCBPROC_TADDR2UADDR */ "taddr2uaddr", - /* RPCBPROC_GETVERSADDR */ "getversaddr", - /* RPCBPROC_INDIRECT */ "indirect", - /* RPCBPROC_GETADDRLIST */ "getaddrlist", - /* RPCBPROC_GETSTAT */ "getstat" - }; - - /* - * Fork off a process or the portmap daemon might hang while - * getrpcbynumber() or syslog() does its thing. - */ - - if (fork() == 0) { - setproctitle("logit"); - - /* Try to map program number to name. */ - - if (prognum == 0) { - progname = __UNCONST(""); - } else if ((rpc = getrpcbynumber((int) prognum))) { - progname = rpc->r_name; - } else { - snprintf(progname = progbuf, sizeof(progbuf), "%u", - (unsigned)prognum); - } - - /* Try to map procedure number to name. */ - - if (procnum >= (sizeof procmap / sizeof (char *))) { - snprintf(procbuf, sizeof procbuf, "%u", - (unsigned)procnum); - procname = procbuf; - } else - procname = procmap[procnum]; - - /* Write syslog record. */ - - if (addr->sa_family == AF_LOCAL) - strlcpy(fromname, "local", sizeof(fromname)); - else - getnameinfo(addr, addr->sa_len, fromname, - sizeof fromname, NULL, 0, NI_NUMERICHOST); - - syslog(severity, "connect from %s to %s(%s)%s", - fromname, procname, progname, text); - _exit(0); - } -} - -int -check_callit(SVCXPRT *xprt, struct r_rmtcall_args *args, int versnum) -{ - struct sockaddr *sa = (struct sockaddr *)svc_getrpccaller(xprt)->buf; - - /* - * Always allow calling NULLPROC - */ - if (args->rmt_proc == 0) - return 1; - - /* - * XXX - this special casing sucks. - */ - switch (args->rmt_prog) { - case RPCBPROG: - /* - * Allow indirect calls to ourselves in insecure mode. - * The is_loopback checks aren't useful then anyway. - */ - if (!insecure) - goto deny; - break; - case MOUNTPROG: - if (args->rmt_proc != MOUNTPROC_MNT && - args->rmt_proc != MOUNTPROC_UMNT) - break; - goto deny; - case YPBINDPROG: - if (args->rmt_proc != YPBINDPROC_SETDOM) - break; - /* FALLTHROUGH */ - case YPPASSWDPROG: - case NFS_PROGRAM: - case RQUOTAPROG: - goto deny; - case YPPROG: - switch (args->rmt_proc) { - case YPPROC_ALL: - case YPPROC_MATCH: - case YPPROC_FIRST: - case YPPROC_NEXT: - goto deny; - default: - break; - } - default: - break; - } - - return 1; -deny: - logit(deny_severity, sa, args->rmt_proc, args->rmt_prog, - ": indirect call not allowed"); - - return 0; -} diff --git a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c b/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c deleted file mode 100644 index f67e98d4d250..000000000000 --- a/contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind/util.c +++ /dev/null @@ -1,401 +0,0 @@ -/* $NetBSD: util.c,v 1.2 2011/06/11 18:03:17 christos Exp $ */ - -/*- - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Frank van der Linden. - * - * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "rpcbind.h" - -static struct sockaddr_in *local_in4; -#ifdef INET6 -static struct sockaddr_in6 *local_in6; -#endif - -static int bitmaskcmp(void *, void *, void *, int); -#ifdef INET6 -static void in6_fillscopeid(struct sockaddr_in6 *); -#endif - -/* - * For all bits set in "mask", compare the corresponding bits in - * "dst" and "src", and see if they match. - */ -static int -bitmaskcmp(void *dst, void *src, void *mask, int bytelen) -{ - int i, j; - u_int8_t *p1 = dst, *p2 = src, *netmask = mask; - u_int8_t bitmask; - - for (i = 0; i < bytelen; i++) { - for (j = 0; j < 8; j++) { - bitmask = 1 << j; - if (!(netmask[i] & bitmask)) - continue; - if ((p1[i] & bitmask) != (p2[i] & bitmask)) - return 1; - } - } - - return 0; -} - -/* - * Taken from ifconfig.c - */ -#ifdef INET6 -static void -in6_fillscopeid(struct sockaddr_in6 *sin6) -{ - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - sin6->sin6_scope_id = - ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); - sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; - } -} -#endif - -char * -addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr, - char *netid) -{ - struct ifaddrs *ifap, *ifp, *bestif; -#ifdef INET6 - struct sockaddr_in6 *servsin6, *sin6mask, *clntsin6, *ifsin6, *realsin6; - struct sockaddr_in6 *newsin6; -#endif - struct sockaddr_in *servsin, *sinmask, *clntsin, *newsin, *ifsin; - struct netbuf *serv_nbp, *clnt_nbp = NULL, tbuf; - struct sockaddr *serv_sa; - struct sockaddr *clnt_sa; - struct sockaddr_storage ss; - struct netconfig *nconf; - struct sockaddr *clnt = caller->buf; - char *ret = NULL; - -#ifdef INET6 - servsin6 = ifsin6 = newsin6 = NULL; /* XXXGCC -Wuninitialized */ -#endif - servsin = newsin = NULL; /* XXXGCC -Wuninitialized */ - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "addrmerge(caller, %s, %s, %s\n", serv_uaddr, - clnt_uaddr, netid); -#endif - nconf = getnetconfigent(netid); - if (nconf == NULL) - return NULL; - - /* - * Local merge, just return a duplicate. - */ - if (clnt_uaddr != NULL && strncmp(clnt_uaddr, "0.0.0.0.", 8) == 0) - return strdup(clnt_uaddr); - - serv_nbp = uaddr2taddr(nconf, serv_uaddr); - if (serv_nbp == NULL) - return NULL; - - serv_sa = (struct sockaddr *)serv_nbp->buf; - if (clnt_uaddr != NULL) { - clnt_nbp = uaddr2taddr(nconf, clnt_uaddr); - if (clnt_nbp == NULL) { - free(serv_nbp); - return NULL; - } - clnt_sa = (struct sockaddr *)clnt_nbp->buf; - if (clnt_sa->sa_family == AF_LOCAL) { - free(serv_nbp); - free(clnt_nbp); - free(clnt_sa); - return strdup(serv_uaddr); - } - } else { - clnt_sa = (struct sockaddr *) - malloc(sizeof (struct sockaddr_storage)); - memcpy(clnt_sa, clnt, clnt->sa_len); - } - - if (getifaddrs(&ifp) < 0) { - free(serv_nbp); - free(clnt_sa); - if (clnt_nbp != NULL) - free(clnt_nbp); - return 0; - } - - /* - * Loop through all interfaces. For each interface, see if the - * network portion of its address is equal to that of the client. - * If so, we have found the interface that we want to use. - */ - for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { - if (ifap->ifa_addr->sa_family != clnt->sa_family || - !(ifap->ifa_flags & IFF_UP)) - continue; - - switch (clnt->sa_family) { - case AF_INET: - /* - * realsin: address that recvfrom gave us. - * ifsin: address of interface being examined. - * clntsin: address that client want us to contact - * it on - * servsin: local address of RPC service. - * sinmask: netmask of this interface - * newsin: initially a copy of clntsin, eventually - * the merged address - */ - servsin = (struct sockaddr_in *)serv_sa; - clntsin = (struct sockaddr_in *)clnt_sa; - sinmask = (struct sockaddr_in *)ifap->ifa_netmask; - newsin = (struct sockaddr_in *)&ss; - ifsin = (struct sockaddr_in *)ifap->ifa_addr; - if (!bitmaskcmp(&ifsin->sin_addr, &clntsin->sin_addr, - &sinmask->sin_addr, sizeof (struct in_addr))) { - goto found; - } - break; -#ifdef INET6 - case AF_INET6: - /* - * realsin6: address that recvfrom gave us. - * ifsin6: address of interface being examined. - * clntsin6: address that client want us to contact - * it on - * servsin6: local address of RPC service. - * sin6mask: netmask of this interface - * newsin6: initially a copy of clntsin, eventually - * the merged address - * - * For v6 link local addresses, if the client contacted - * us via a link-local address, and wants us to reply - * to one, use the scope id to see which one. - */ - realsin6 = (struct sockaddr_in6 *)clnt; - ifsin6 = (struct sockaddr_in6 *)ifap->ifa_addr; - in6_fillscopeid(ifsin6); - clntsin6 = (struct sockaddr_in6 *)clnt_sa; - servsin6 = (struct sockaddr_in6 *)serv_sa; - sin6mask = (struct sockaddr_in6 *)ifap->ifa_netmask; - newsin6 = (struct sockaddr_in6 *)&ss; - if (IN6_IS_ADDR_LINKLOCAL(&ifsin6->sin6_addr) && - IN6_IS_ADDR_LINKLOCAL(&realsin6->sin6_addr) && - IN6_IS_ADDR_LINKLOCAL(&clntsin6->sin6_addr)) { - if (ifsin6->sin6_scope_id != - realsin6->sin6_scope_id) - continue; - goto found; - } - if (!bitmaskcmp(&ifsin6->sin6_addr, - &clntsin6->sin6_addr, &sin6mask->sin6_addr, - sizeof (struct in6_addr))) - goto found; - break; -#endif - default: - goto freeit; - } - } - /* - * Didn't find anything. Get the first possibly useful interface, - * preferring "normal" interfaces to point-to-point and loopback - * ones. - */ - bestif = NULL; - for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { - if (ifap->ifa_addr->sa_family != clnt->sa_family || - !(ifap->ifa_flags & IFF_UP)) - continue; - if (!(ifap->ifa_flags & IFF_LOOPBACK) && - !(ifap->ifa_flags & IFF_POINTOPOINT)) { - bestif = ifap; - break; - } - if (bestif == NULL) - bestif = ifap; - else if ((bestif->ifa_flags & IFF_LOOPBACK) && - !(ifap->ifa_flags & IFF_LOOPBACK)) - bestif = ifap; - } - ifap = bestif; -found: - switch (clnt->sa_family) { - case AF_INET: - memcpy(newsin, ifap->ifa_addr, clnt_sa->sa_len); - newsin->sin_port = servsin->sin_port; - tbuf.len = clnt_sa->sa_len; - tbuf.maxlen = sizeof (struct sockaddr_storage); - tbuf.buf = newsin; - break; -#ifdef INET6 - case AF_INET6: - assert(newsin6); - memcpy(newsin6, ifsin6, clnt_sa->sa_len); - newsin6->sin6_port = servsin6->sin6_port; - tbuf.maxlen = sizeof (struct sockaddr_storage); - tbuf.len = clnt_sa->sa_len; - tbuf.buf = newsin6; - break; -#endif - default: - goto freeit; - } - if (ifap != NULL) - ret = taddr2uaddr(nconf, &tbuf); -freeit: - freenetconfigent(nconf); - free(serv_sa); - free(serv_nbp); - if (clnt_sa != NULL) - free(clnt_sa); - if (clnt_nbp != NULL) - free(clnt_nbp); - freeifaddrs(ifp); - -#ifdef RPCBIND_DEBUG - if (debugging) - fprintf(stderr, "addrmerge: returning %s\n", ret); -#endif - return ret; -} - -void -network_init() -{ -#ifdef INET6 - struct ifaddrs *ifap, *ifp; - struct ipv6_mreq mreq6; - int ifindex, s; -#endif - int ecode; - struct addrinfo hints, *res; - - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_INET; - if ((ecode = getaddrinfo(NULL, "sunrpc", &hints, &res))) { - if (debugging) - fprintf(stderr, "can't get local ip4 address: %s\n", - gai_strerror(ecode)); - } else { - local_in4 = (struct sockaddr_in *)malloc(sizeof *local_in4); - if (local_in4 == NULL) { - if (debugging) - fprintf(stderr, "can't alloc local ip4 addr\n"); - } - memcpy(local_in4, res->ai_addr, sizeof *local_in4); - } - -#ifdef INET6 - hints.ai_family = AF_INET6; - if ((ecode = getaddrinfo(NULL, "sunrpc", &hints, &res))) { - if (debugging) - fprintf(stderr, "can't get local ip6 address: %s\n", - gai_strerror(ecode)); - } else { - local_in6 = (struct sockaddr_in6 *)malloc(sizeof *local_in6); - if (local_in6 == NULL) { - if (debugging) - fprintf(stderr, "can't alloc local ip6 addr\n"); - } - memcpy(local_in6, res->ai_addr, sizeof *local_in6); - } - - /* - * Now join the RPC ipv6 multicast group on all interfaces. - */ - if (getifaddrs(&ifp) < 0) - return; - - mreq6.ipv6mr_interface = 0; - inet_pton(AF_INET6, RPCB_MULTICAST_ADDR, &mreq6.ipv6mr_multiaddr); - - s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); - - /* - * Loop through all interfaces. For each interface, see if the - * network portion of its address is equal to that of the client. - * If so, we have found the interface that we want to use. - */ - for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) { - if (ifap->ifa_addr->sa_family != AF_INET6 || - !(ifap->ifa_flags & IFF_MULTICAST)) - continue; - ifindex = if_nametoindex(ifap->ifa_name); - if (ifindex == mreq6.ipv6mr_interface) - /* - * Already did this one. - */ - continue; - mreq6.ipv6mr_interface = ifindex; - if (setsockopt(s, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6, - sizeof mreq6) < 0) - if (debugging) - warn("setsockopt v6 multicast"); - } -#endif - - /* close(s); */ -} - -struct sockaddr * -local_sa(int af) -{ - switch (af) { - case AF_INET: - return (struct sockaddr *)local_in4; -#ifdef INET6 - case AF_INET6: - return (struct sockaddr *)local_in6; -#endif - default: - return NULL; - } -} From a567518138e0e2fa7177c60e241e8b8e4bb468d5 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 06:18:54 +0000 Subject: [PATCH 087/126] Add additional tests missed in previous merges Reminder: use cvs up -APd to pull new directories --- dev/clock_subr/clock_subr_test_data_gen.sh | 25 + dev/clock_subr/t_clock_subr.c | 309 +++ kernel/arch/amd64/t_ptrace_wait.c | 1388 ++++++++++++ kernel/arch/amd64/t_ptrace_wait3.c | 30 + kernel/arch/amd64/t_ptrace_wait4.c | 30 + kernel/arch/amd64/t_ptrace_wait6.c | 30 + kernel/arch/amd64/t_ptrace_waitid.c | 30 + kernel/arch/amd64/t_ptrace_waitpid.c | 30 + kernel/arch/i386/t_ptrace_wait.c | 141 ++ kernel/arch/i386/t_ptrace_wait3.c | 30 + kernel/arch/i386/t_ptrace_wait4.c | 30 + kernel/arch/i386/t_ptrace_wait6.c | 30 + kernel/arch/i386/t_ptrace_waitid.c | 30 + kernel/arch/i386/t_ptrace_waitpid.c | 30 + kernel/t_ptrace_wait.c | 118 +- lib/libc/gen/exect/t_exect.c | 90 + lib/libpthread_dbg/h_common.h | 128 ++ lib/libpthread_dbg/t_dummy.c | 131 ++ lib/libpthread_dbg/t_threads.c | 719 ++++++ lib/librefuse/t_refuse_opt.c | 418 ++++ net/if_tun/t_tun.sh | 138 ++ net/if_vlan/t_vlan.sh | 115 + sys/uvm/t_uvm_physseg.c | 2377 ++++++++++++++++++++ sys/uvm/t_uvm_physseg_load.c | 740 ++++++ usr.bin/mixerctl/t_mixerctl.sh | 51 + usr.bin/uniq/d_basic.in | 4 + usr.bin/uniq/d_basic.out | 3 + usr.bin/uniq/d_counts.out | 6 + usr.bin/uniq/d_input.in | 7 + usr.bin/uniq/d_show_duplicates.out | 1 + usr.bin/uniq/d_show_uniques.out | 5 + usr.bin/uniq/t_uniq.sh | 97 + 32 files changed, 7309 insertions(+), 2 deletions(-) create mode 100755 dev/clock_subr/clock_subr_test_data_gen.sh create mode 100644 dev/clock_subr/t_clock_subr.c create mode 100644 kernel/arch/amd64/t_ptrace_wait.c create mode 100644 kernel/arch/amd64/t_ptrace_wait3.c create mode 100644 kernel/arch/amd64/t_ptrace_wait4.c create mode 100644 kernel/arch/amd64/t_ptrace_wait6.c create mode 100644 kernel/arch/amd64/t_ptrace_waitid.c create mode 100644 kernel/arch/amd64/t_ptrace_waitpid.c create mode 100644 kernel/arch/i386/t_ptrace_wait.c create mode 100644 kernel/arch/i386/t_ptrace_wait3.c create mode 100644 kernel/arch/i386/t_ptrace_wait4.c create mode 100644 kernel/arch/i386/t_ptrace_wait6.c create mode 100644 kernel/arch/i386/t_ptrace_waitid.c create mode 100644 kernel/arch/i386/t_ptrace_waitpid.c create mode 100644 lib/libc/gen/exect/t_exect.c create mode 100644 lib/libpthread_dbg/h_common.h create mode 100644 lib/libpthread_dbg/t_dummy.c create mode 100644 lib/libpthread_dbg/t_threads.c create mode 100644 lib/librefuse/t_refuse_opt.c create mode 100755 net/if_tun/t_tun.sh create mode 100755 net/if_vlan/t_vlan.sh create mode 100644 sys/uvm/t_uvm_physseg.c create mode 100644 sys/uvm/t_uvm_physseg_load.c create mode 100755 usr.bin/mixerctl/t_mixerctl.sh create mode 100644 usr.bin/uniq/d_basic.in create mode 100644 usr.bin/uniq/d_basic.out create mode 100644 usr.bin/uniq/d_counts.out create mode 100644 usr.bin/uniq/d_input.in create mode 100644 usr.bin/uniq/d_show_duplicates.out create mode 100644 usr.bin/uniq/d_show_uniques.out create mode 100755 usr.bin/uniq/t_uniq.sh diff --git a/dev/clock_subr/clock_subr_test_data_gen.sh b/dev/clock_subr/clock_subr_test_data_gen.sh new file mode 100755 index 000000000000..2da21a8da1bd --- /dev/null +++ b/dev/clock_subr/clock_subr_test_data_gen.sh @@ -0,0 +1,25 @@ +#!/bin/ksh + +export TZ=Etc/Universal + +datesub() { + gdate "$@" '+ FILL(%_11s,%_4Y,%_m,%_d,%w,%_H,%_M,%_S), // %a %b %e %H:%M:%S %Z %Y' +} + +( + datesub -d '1970/01/01 00:00:00' + datesub -d '1981/04/12 12:00:03' + datesub -d '2011/07/21 09:57:00' + datesub -d @2147483647 + datesub -d @2147483648 + datesub -d '2063/04/05 00:00:00' + for year in `seq 1970 1 2030`; do + datesub -d "${year}/01/01 00:00:00" + datesub -d "${year}/07/01 00:00:00" + done + for year in `seq 2000 25 2600`; do + datesub -d "$((${year} - 1))/12/31 23:59:59" + datesub -d "$((${year} + 0))/01/01 00:00:00" + datesub -d "$((${year} + 1))/01/01 00:00:00" + done +)|sort -u diff --git a/dev/clock_subr/t_clock_subr.c b/dev/clock_subr/t_clock_subr.c new file mode 100644 index 000000000000..bb03c688bf79 --- /dev/null +++ b/dev/clock_subr/t_clock_subr.c @@ -0,0 +1,309 @@ +/* $NetBSD: t_clock_subr.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */ + +/* + * Copyright (c) 2016 Jonathan A. Kollasch + * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 +__COPYRIGHT("@(#) Copyright (c) 2016\ + Jonathan A. Kollasch. All rights reserved."); +__RCSID("$NetBSD: t_clock_subr.c,v 1.3 2017/01/13 21:30:39 christos Exp $"); + +#include +#include + +#include +#include +#include + +#include + +#include "h_macros.h" + +#define FILL(ti,ye,mo,da,wd,ho,mi,se) \ +{ .time = (ti), .clock = { .dt_year = (ye), .dt_mon = (mo), .dt_day = (da), \ + .dt_wday = (wd), .dt_hour = (ho), .dt_min = (mi), .dt_sec = (se), } } + +static struct clock_test { + time_t time; + struct clock_ymdhms clock; +} const clock_tests[] = { + FILL( 0,1970, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1970 + FILL( 15638400,1970, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1970 + FILL( 31536000,1971, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1971 + FILL( 47174400,1971, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1971 + FILL( 63072000,1972, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1972 + FILL( 78796800,1972, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1972 + FILL( 94694400,1973, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1973 + FILL( 110332800,1973, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1973 + FILL( 126230400,1974, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1974 + FILL( 141868800,1974, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1974 + FILL( 157766400,1975, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1975 + FILL( 173404800,1975, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1975 + FILL( 189302400,1976, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1976 + FILL( 205027200,1976, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1976 + FILL( 220924800,1977, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1977 + FILL( 236563200,1977, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1977 + FILL( 252460800,1978, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1978 + FILL( 268099200,1978, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1978 + FILL( 283996800,1979, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1979 + FILL( 299635200,1979, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1979 + FILL( 315532800,1980, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1980 + FILL( 331257600,1980, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1980 + FILL( 347155200,1981, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1981 + FILL( 355924803,1981, 4,12,0,12, 0, 3), // Sun Apr 12 12:00:03 UTC 1981 + FILL( 362793600,1981, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1981 + FILL( 378691200,1982, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1982 + FILL( 394329600,1982, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1982 + FILL( 410227200,1983, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1983 + FILL( 425865600,1983, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1983 + FILL( 441763200,1984, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1984 + FILL( 457488000,1984, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1984 + FILL( 473385600,1985, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1985 + FILL( 489024000,1985, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1985 + FILL( 504921600,1986, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1986 + FILL( 520560000,1986, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1986 + FILL( 536457600,1987, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1987 + FILL( 552096000,1987, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1987 + FILL( 567993600,1988, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1988 + FILL( 583718400,1988, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1988 + FILL( 599616000,1989, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1989 + FILL( 615254400,1989, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1989 + FILL( 631152000,1990, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1990 + FILL( 646790400,1990, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 1990 + FILL( 662688000,1991, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 1991 + FILL( 678326400,1991, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1991 + FILL( 694224000,1992, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1992 + FILL( 709948800,1992, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1992 + FILL( 725846400,1993, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1993 + FILL( 741484800,1993, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1993 + FILL( 757382400,1994, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 1994 + FILL( 773020800,1994, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 1994 + FILL( 788918400,1995, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 1995 + FILL( 804556800,1995, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 1995 + FILL( 820454400,1996, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 1996 + FILL( 836179200,1996, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 1996 + FILL( 852076800,1997, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 1997 + FILL( 867715200,1997, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 1997 + FILL( 883612800,1998, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 1998 + FILL( 899251200,1998, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 1998 + FILL( 915148800,1999, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 1999 + FILL( 930787200,1999, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 1999 + FILL( 946684799,1999,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 1999 + FILL( 946684800,2000, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2000 + FILL( 962409600,2000, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2000 + FILL( 978307200,2001, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2001 + FILL( 993945600,2001, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2001 + FILL( 1009843200,2002, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2002 + FILL( 1025481600,2002, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2002 + FILL( 1041379200,2003, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2003 + FILL( 1057017600,2003, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2003 + FILL( 1072915200,2004, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2004 + FILL( 1088640000,2004, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2004 + FILL( 1104537600,2005, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2005 + FILL( 1120176000,2005, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2005 + FILL( 1136073600,2006, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2006 + FILL( 1151712000,2006, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2006 + FILL( 1167609600,2007, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2007 + FILL( 1183248000,2007, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2007 + FILL( 1199145600,2008, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2008 + FILL( 1214870400,2008, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2008 + FILL( 1230768000,2009, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2009 + FILL( 1246406400,2009, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2009 + FILL( 1262304000,2010, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2010 + FILL( 1277942400,2010, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2010 + FILL( 1293840000,2011, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2011 + FILL( 1309478400,2011, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2011 + FILL( 1311242220,2011, 7,21,4, 9,57, 0), // Thu Jul 21 09:57:00 UTC 2011 + FILL( 1325376000,2012, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2012 + FILL( 1341100800,2012, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2012 + FILL( 1356998400,2013, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2013 + FILL( 1372636800,2013, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2013 + FILL( 1388534400,2014, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2014 + FILL( 1404172800,2014, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2014 + FILL( 1420070400,2015, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2015 + FILL( 1435708800,2015, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2015 + FILL( 1451606400,2016, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2016 + FILL( 1467331200,2016, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2016 + FILL( 1483228800,2017, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2017 + FILL( 1498867200,2017, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2017 + FILL( 1514764800,2018, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2018 + FILL( 1530403200,2018, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2018 + FILL( 1546300800,2019, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2019 + FILL( 1561939200,2019, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2019 + FILL( 1577836800,2020, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2020 + FILL( 1593561600,2020, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2020 + FILL( 1609459200,2021, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2021 + FILL( 1625097600,2021, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2021 + FILL( 1640995200,2022, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2022 + FILL( 1656633600,2022, 7, 1,5, 0, 0, 0), // Fri Jul 1 00:00:00 UTC 2022 + FILL( 1672531200,2023, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2023 + FILL( 1688169600,2023, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2023 + FILL( 1704067200,2024, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2024 + FILL( 1719792000,2024, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2024 + FILL( 1735689599,2024,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2024 + FILL( 1735689600,2025, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2025 + FILL( 1751328000,2025, 7, 1,2, 0, 0, 0), // Tue Jul 1 00:00:00 UTC 2025 + FILL( 1767225600,2026, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2026 + FILL( 1782864000,2026, 7, 1,3, 0, 0, 0), // Wed Jul 1 00:00:00 UTC 2026 + FILL( 1798761600,2027, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2027 + FILL( 1814400000,2027, 7, 1,4, 0, 0, 0), // Thu Jul 1 00:00:00 UTC 2027 + FILL( 1830297600,2028, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2028 + FILL( 1846022400,2028, 7, 1,6, 0, 0, 0), // Sat Jul 1 00:00:00 UTC 2028 + FILL( 1861920000,2029, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2029 + FILL( 1877558400,2029, 7, 1,0, 0, 0, 0), // Sun Jul 1 00:00:00 UTC 2029 + FILL( 1893456000,2030, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2030 + FILL( 1909094400,2030, 7, 1,1, 0, 0, 0), // Mon Jul 1 00:00:00 UTC 2030 + FILL( 2147483647,2038, 1,19,2, 3,14, 7), // Tue Jan 19 03:14:07 UTC 2038 + FILL( 2147483648,2038, 1,19,2, 3,14, 8), // Tue Jan 19 03:14:08 UTC 2038 + FILL( 2524607999,2049,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2049 + FILL( 2524608000,2050, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2050 + FILL( 2556144000,2051, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2051 + FILL( 2942956800,2063, 4, 5,4, 0, 0, 0), // Thu Apr 5 00:00:00 UTC 2063 + FILL( 3313526399,2074,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2074 + FILL( 3313526400,2075, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2075 + FILL( 3345062400,2076, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2076 + FILL( 4102444799,2099,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2099 + FILL( 4102444800,2100, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2100 + FILL( 4133980800,2101, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2101 + FILL( 4891363199,2124,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2124 + FILL( 4891363200,2125, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2125 + FILL( 4922899200,2126, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2126 + FILL( 5680281599,2149,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2149 + FILL( 5680281600,2150, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2150 + FILL( 5711817600,2151, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2151 + FILL( 6469199999,2174,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2174 + FILL( 6469200000,2175, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2175 + FILL( 6500736000,2176, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2176 + FILL( 7258118399,2199,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2199 + FILL( 7258118400,2200, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2200 + FILL( 7289654400,2201, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2201 + FILL( 8047036799,2224,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2224 + FILL( 8047036800,2225, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2225 + FILL( 8078572800,2226, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2226 + FILL( 8835955199,2249,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2249 + FILL( 8835955200,2250, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2250 + FILL( 8867491200,2251, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2251 + FILL( 9624873599,2274,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2274 + FILL( 9624873600,2275, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2275 + FILL( 9656409600,2276, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2276 + FILL(10413791999,2299,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2299 + FILL(10413792000,2300, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2300 + FILL(10445328000,2301, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2301 + FILL(11202710399,2324,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2324 + FILL(11202710400,2325, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2325 + FILL(11234246400,2326, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2326 + FILL(11991628799,2349,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2349 + FILL(11991628800,2350, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2350 + FILL(12023164800,2351, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2351 + FILL(12780547199,2374,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2374 + FILL(12780547200,2375, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2375 + FILL(12812083200,2376, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2376 + FILL(13569465599,2399,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2399 + FILL(13569465600,2400, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2400 + FILL(13601088000,2401, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2401 + FILL(14358470399,2424,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2424 + FILL(14358470400,2425, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2425 + FILL(14390006400,2426, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2426 + FILL(15147388799,2449,12,31,5,23,59,59), // Fri Dec 31 23:59:59 UTC 2449 + FILL(15147388800,2450, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2450 + FILL(15178924800,2451, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2451 + FILL(15936307199,2474,12,31,1,23,59,59), // Mon Dec 31 23:59:59 UTC 2474 + FILL(15936307200,2475, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2475 + FILL(15967843200,2476, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2476 + FILL(16725225599,2499,12,31,4,23,59,59), // Thu Dec 31 23:59:59 UTC 2499 + FILL(16725225600,2500, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2500 + FILL(16756761600,2501, 1, 1,6, 0, 0, 0), // Sat Jan 1 00:00:00 UTC 2501 + FILL(17514143999,2524,12,31,0,23,59,59), // Sun Dec 31 23:59:59 UTC 2524 + FILL(17514144000,2525, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2525 + FILL(17545680000,2526, 1, 1,2, 0, 0, 0), // Tue Jan 1 00:00:00 UTC 2526 + FILL(18303062399,2549,12,31,3,23,59,59), // Wed Dec 31 23:59:59 UTC 2549 + FILL(18303062400,2550, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2550 + FILL(18334598400,2551, 1, 1,5, 0, 0, 0), // Fri Jan 1 00:00:00 UTC 2551 + FILL(19091980799,2574,12,31,6,23,59,59), // Sat Dec 31 23:59:59 UTC 2574 + FILL(19091980800,2575, 1, 1,0, 0, 0, 0), // Sun Jan 1 00:00:00 UTC 2575 + FILL(19123516800,2576, 1, 1,1, 0, 0, 0), // Mon Jan 1 00:00:00 UTC 2576 + FILL(19880899199,2599,12,31,2,23,59,59), // Tue Dec 31 23:59:59 UTC 2599 + FILL(19880899200,2600, 1, 1,3, 0, 0, 0), // Wed Jan 1 00:00:00 UTC 2600 + FILL(19912435200,2601, 1, 1,4, 0, 0, 0), // Thu Jan 1 00:00:00 UTC 2601 +}; +#undef FILL + +ATF_TC(ymdhms_to_secs); +ATF_TC_HEAD(ymdhms_to_secs, tc) +{ + + atf_tc_set_md_var(tc, "descr", "check clock_ymdhms_to_secs"); +} +ATF_TC_BODY(ymdhms_to_secs, tc) +{ + time_t secs; + size_t i; + + for (i = 0; i < __arraycount(clock_tests); i++) { + secs = clock_ymdhms_to_secs(__UNCONST(&clock_tests[i].clock)); + ATF_CHECK_EQ_MSG(clock_tests[i].time, secs, "%jd != %jd", + (intmax_t)clock_tests[i].time, (intmax_t)secs); + } +} + +ATF_TC(secs_to_ymdhms); +ATF_TC_HEAD(secs_to_ymdhms, tc) +{ + + atf_tc_set_md_var(tc, "descr", "check clock_secs_to_ymdhms"); +} +ATF_TC_BODY(secs_to_ymdhms, tc) +{ + struct clock_ymdhms ymdhms; + size_t i; + +#define CHECK_FIELD(f) \ + ATF_CHECK_EQ_MSG(ymdhms.dt_##f, clock_tests[i].clock.dt_##f, \ + "%jd != %jd for %jd", (intmax_t)ymdhms.dt_##f, \ + (intmax_t)clock_tests[i].clock.dt_##f, \ + (intmax_t)clock_tests[i].time) + + for (i = 0; i < __arraycount(clock_tests); i++) { + clock_secs_to_ymdhms(clock_tests[i].time, &ymdhms); + CHECK_FIELD(year); + CHECK_FIELD(mon); + CHECK_FIELD(day); + CHECK_FIELD(wday); + CHECK_FIELD(hour); + CHECK_FIELD(min); + CHECK_FIELD(sec); + } +#undef CHECK_FIELD +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, ymdhms_to_secs); + ATF_TP_ADD_TC(tp, secs_to_ymdhms); + + return atf_no_error(); +} diff --git a/kernel/arch/amd64/t_ptrace_wait.c b/kernel/arch/amd64/t_ptrace_wait.c new file mode 100644 index 000000000000..5adbb0e94554 --- /dev/null +++ b/kernel/arch/amd64/t_ptrace_wait.c @@ -0,0 +1,1388 @@ +/* $NetBSD: t_ptrace_wait.c,v 1.9 2017/01/13 21:30:41 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.9 2017/01/13 21:30:41 christos Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "h_macros.h" + +#include "../../t_ptrace_wait.h" + + +#if defined(HAVE_GPREGS) +ATF_TC(regs1); +ATF_TC_HEAD(regs1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_GETREGS and iterate over General Purpose registers"); +} + +ATF_TC_BODY(regs1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("RAX=%#" PRIxREGISTER "\n", r.regs[_REG_RAX]); + printf("RBX=%#" PRIxREGISTER "\n", r.regs[_REG_RBX]); + printf("RCX=%#" PRIxREGISTER "\n", r.regs[_REG_RCX]); + printf("RDX=%#" PRIxREGISTER "\n", r.regs[_REG_RDX]); + + printf("RDI=%#" PRIxREGISTER "\n", r.regs[_REG_RDI]); + printf("RSI=%#" PRIxREGISTER "\n", r.regs[_REG_RSI]); + + printf("GS=%#" PRIxREGISTER "\n", r.regs[_REG_GS]); + printf("FS=%#" PRIxREGISTER "\n", r.regs[_REG_FS]); + printf("ES=%#" PRIxREGISTER "\n", r.regs[_REG_ES]); + printf("DS=%#" PRIxREGISTER "\n", r.regs[_REG_DS]); + printf("CS=%#" PRIxREGISTER "\n", r.regs[_REG_CS]); + printf("SS=%#" PRIxREGISTER "\n", r.regs[_REG_SS]); + + printf("RSP=%#" PRIxREGISTER "\n", r.regs[_REG_RSP]); + printf("RIP=%#" PRIxREGISTER "\n", r.regs[_REG_RIP]); + + printf("RFLAGS=%#" PRIxREGISTER "\n", r.regs[_REG_RFLAGS]); + + printf("R8=%#" PRIxREGISTER "\n", r.regs[_REG_R8]); + printf("R9=%#" PRIxREGISTER "\n", r.regs[_REG_R9]); + printf("R10=%#" PRIxREGISTER "\n", r.regs[_REG_R10]); + printf("R11=%#" PRIxREGISTER "\n", r.regs[_REG_R11]); + printf("R12=%#" PRIxREGISTER "\n", r.regs[_REG_R12]); + printf("R13=%#" PRIxREGISTER "\n", r.regs[_REG_R13]); + printf("R14=%#" PRIxREGISTER "\n", r.regs[_REG_R14]); + printf("R15=%#" PRIxREGISTER "\n", r.regs[_REG_R15]); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_count); +ATF_TC_HEAD(watchpoint_count, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and assert four available watchpoints"); +} + +ATF_TC_BODY(watchpoint_count, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int N; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1); + printf("Reported %d watchpoints\n", N); + + ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_read); +ATF_TC_HEAD(watchpoint_read, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and assert four available watchpoints"); +} + +ATF_TC_BODY(watchpoint_read, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int i, N; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1); + + ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N); + + for (i = 0; i < N; i++) { + printf("Before reading watchpoint %d\n", i); + pw.pw_index = i; + ATF_REQUIRE(ptrace(PT_READ_WATCHPOINT, child, &pw, len) != -1); + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_write_unmodified); +ATF_TC_HEAD(watchpoint_write_unmodified, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and assert functional write of " + "unmodified data"); +} + +ATF_TC_BODY(watchpoint_write_unmodified, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + int i, N; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1); + + ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N); + + for (i = 0; i < N; i++) { + printf("Before reading watchpoint %d\n", i); + pw.pw_index = i; + ATF_REQUIRE(ptrace(PT_READ_WATCHPOINT, child, &pw, len) != -1); + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d (unmodified)\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) + != -1); + } + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_code0); +ATF_TC_HEAD(watchpoint_trap_code0, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 0"); +} + +ATF_TC_BODY(watchpoint_trap_code0, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 0; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("check_happy(%d)=%d\n", watchme, check_happy(watchme)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_lwpid = 0; + pw.pw_md.md_address = (void *)check_happy; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + pw.pw_md.md_address = NULL; + printf("Before writing watchpoint %d (disable it)\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_code1); +ATF_TC_HEAD(watchpoint_trap_code1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 1"); +} + +ATF_TC_BODY(watchpoint_trap_code1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 1; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("check_happy(%d)=%d\n", watchme, check_happy(watchme)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_lwpid = 0; + pw.pw_md.md_address = (void *)check_happy; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + pw.pw_md.md_address = NULL; + printf("Before writing watchpoint %d (disable it)\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_code2); +ATF_TC_HEAD(watchpoint_trap_code2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 2"); +} + +ATF_TC_BODY(watchpoint_trap_code2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 2; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("check_happy(%d)=%d\n", watchme, check_happy(watchme)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_lwpid = 0; + pw.pw_md.md_address = (void *)check_happy; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + pw.pw_md.md_address = NULL; + printf("Before writing watchpoint %d (disable it)\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_code3); +ATF_TC_HEAD(watchpoint_trap_code3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test code trap with watchpoint 3"); +} + +ATF_TC_BODY(watchpoint_trap_code3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 3; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("check_happy(%d)=%d\n", watchme, check_happy(watchme)); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_lwpid = 0; + pw.pw_md.md_address = (void *)check_happy; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_EXECUTION; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + pw.pw_md.md_address = NULL; + printf("Before writing watchpoint %d (disable it)\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_write0); +ATF_TC_HEAD(watchpoint_trap_data_write0, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 0"); +} + +ATF_TC_BODY(watchpoint_trap_data_write0, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 0; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + ++watchme; + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = 0; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_write1); +ATF_TC_HEAD(watchpoint_trap_data_write1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 1"); +} + +ATF_TC_BODY(watchpoint_trap_data_write1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 1; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + ++watchme; + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_write2); +ATF_TC_HEAD(watchpoint_trap_data_write2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 2"); +} + +ATF_TC_BODY(watchpoint_trap_data_write2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 2; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + ++watchme; + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_write3); +ATF_TC_HEAD(watchpoint_trap_data_write3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 3"); +} + +ATF_TC_BODY(watchpoint_trap_data_write3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 3; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + ++watchme; + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_WRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_rw0); +ATF_TC_HEAD(watchpoint_trap_data_rw0, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 0"); +} + +ATF_TC_BODY(watchpoint_trap_data_rw0, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 0; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("watchme=%d\n", watchme); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_rw1); +ATF_TC_HEAD(watchpoint_trap_data_rw1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 1"); +} + +ATF_TC_BODY(watchpoint_trap_data_rw1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 1; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("watchme=%d\n", watchme); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_rw2); +ATF_TC_HEAD(watchpoint_trap_data_rw2, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 2"); +} + +ATF_TC_BODY(watchpoint_trap_data_rw2, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 2; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("watchme=%d\n", watchme); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +#if defined(__HAVE_PTRACE_WATCHPOINTS) +ATF_TC(watchpoint_trap_data_rw3); +ATF_TC_HEAD(watchpoint_trap_data_rw3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_COUNT_WATCHPOINTS and test write trap with watchpoint 3"); +} + +ATF_TC_BODY(watchpoint_trap_data_rw3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + const int i = 3; + struct ptrace_watchpoint pw; + int len = sizeof(pw); + int watchme = 1234; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("watchme=%d\n", watchme); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Preparing code watchpoint trap %d\n", i); + + pw.pw_index = i; + pw.pw_md.md_address = &watchme; + pw.pw_md.md_condition = X86_HW_WATCHPOINT_DR7_CONDITION_DATA_READWRITE; + pw.pw_md.md_length = X86_HW_WATCHPOINT_DR7_LENGTH_BYTE; + + printf("struct ptrace {\n"); + printf("\t.pw_index=%d\n", pw.pw_index); + printf("\t.pw_lwpid=%d\n", pw.pw_lwpid); + printf("\t.pw_md.md_address=%p\n", pw.pw_md.md_address); + printf("\t.pw_md.md_condition=%#x\n", pw.pw_md.md_condition); + printf("\t.pw_md.md_length=%#x\n", pw.pw_md.md_length); + printf("}\n"); + + printf("Before writing watchpoint %d\n", i); + ATF_REQUIRE(ptrace(PT_WRITE_WATCHPOINT, child, &pw, len) != -1); + + printf("Before resuming the child process where it left off " + "and without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, SIGTRAP); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TP_ADD_TCS(tp) +{ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1); + + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_count); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_read); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_write_unmodified); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code0); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code1); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code2); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_code3); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write0); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write1); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write2); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_write3); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw0); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw1); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw2); + ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(tp, watchpoint_trap_data_rw3); + + return atf_no_error(); +} diff --git a/kernel/arch/amd64/t_ptrace_wait3.c b/kernel/arch/amd64/t_ptrace_wait3.c new file mode 100644 index 000000000000..c5dfe7358738 --- /dev/null +++ b/kernel/arch/amd64/t_ptrace_wait3.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT3 +#include "t_ptrace_wait.c" diff --git a/kernel/arch/amd64/t_ptrace_wait4.c b/kernel/arch/amd64/t_ptrace_wait4.c new file mode 100644 index 000000000000..7e1fed95ee62 --- /dev/null +++ b/kernel/arch/amd64/t_ptrace_wait4.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT4 +#include "t_ptrace_wait.c" diff --git a/kernel/arch/amd64/t_ptrace_wait6.c b/kernel/arch/amd64/t_ptrace_wait6.c new file mode 100644 index 000000000000..601efe3f3d62 --- /dev/null +++ b/kernel/arch/amd64/t_ptrace_wait6.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT6 +#include "t_ptrace_wait.c" diff --git a/kernel/arch/amd64/t_ptrace_waitid.c b/kernel/arch/amd64/t_ptrace_waitid.c new file mode 100644 index 000000000000..5ec17a9b8d24 --- /dev/null +++ b/kernel/arch/amd64/t_ptrace_waitid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAITID +#include "t_ptrace_wait.c" diff --git a/kernel/arch/amd64/t_ptrace_waitpid.c b/kernel/arch/amd64/t_ptrace_waitpid.c new file mode 100644 index 000000000000..78b341c111f3 --- /dev/null +++ b/kernel/arch/amd64/t_ptrace_waitpid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/02 05:54:15 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAITPID +#include "t_ptrace_wait.c" diff --git a/kernel/arch/i386/t_ptrace_wait.c b/kernel/arch/i386/t_ptrace_wait.c new file mode 100644 index 000000000000..698573bb0985 --- /dev/null +++ b/kernel/arch/i386/t_ptrace_wait.c @@ -0,0 +1,141 @@ +/* $NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.2 2017/01/13 21:30:41 christos Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "h_macros.h" + +#include "../../t_ptrace_wait.h" + + +#if defined(HAVE_GPREGS) +ATF_TC(regs1); +ATF_TC_HEAD(regs1, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Call PT_GETREGS and iterate over General Purpose registers"); +} + +ATF_TC_BODY(regs1, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + struct reg r; + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + printf("Call GETREGS for the child process\n"); + ATF_REQUIRE(ptrace(PT_GETREGS, child, &r, 0) != -1); + + printf("EAX=%#" PRIxREGISTER "\n", r.r_eax); + printf("EBX=%#" PRIxREGISTER "\n", r.r_ebx); + printf("ECX=%#" PRIxREGISTER "\n", r.r_ecx); + printf("EDX=%#" PRIxREGISTER "\n", r.r_edx); + + printf("ESP=%#" PRIxREGISTER "\n", r.r_esp); + printf("EBP=%#" PRIxREGISTER "\n", r.r_ebp); + + printf("ESI=%#" PRIxREGISTER "\n", r.r_esi); + printf("EDI=%#" PRIxREGISTER "\n", r.r_edi); + + printf("EIP=%#" PRIxREGISTER "\n", r.r_eip); + + printf("EFLAGS=%#" PRIxREGISTER "\n", r.r_eflags); + + printf("CS=%#" PRIxREGISTER "\n", r.r_cs); + printf("SS=%#" PRIxREGISTER "\n", r.r_ss); + printf("DS=%#" PRIxREGISTER "\n", r.r_ds); + printf("ES=%#" PRIxREGISTER "\n", r.r_es); + printf("FS=%#" PRIxREGISTER "\n", r.r_fs); + printf("GS=%#" PRIxREGISTER "\n", r.r_gs); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} +#endif + +ATF_TP_ADD_TCS(tp) +{ + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + + ATF_TP_ADD_TC_HAVE_GPREGS(tp, regs1); + + return atf_no_error(); +} diff --git a/kernel/arch/i386/t_ptrace_wait3.c b/kernel/arch/i386/t_ptrace_wait3.c new file mode 100644 index 000000000000..56dda8e6978d --- /dev/null +++ b/kernel/arch/i386/t_ptrace_wait3.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait3.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT3 +#include "t_ptrace_wait.c" diff --git a/kernel/arch/i386/t_ptrace_wait4.c b/kernel/arch/i386/t_ptrace_wait4.c new file mode 100644 index 000000000000..5fbdb53503b9 --- /dev/null +++ b/kernel/arch/i386/t_ptrace_wait4.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait4.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT4 +#include "t_ptrace_wait.c" diff --git a/kernel/arch/i386/t_ptrace_wait6.c b/kernel/arch/i386/t_ptrace_wait6.c new file mode 100644 index 000000000000..117c844123c9 --- /dev/null +++ b/kernel/arch/i386/t_ptrace_wait6.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_wait6.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAIT6 +#include "t_ptrace_wait.c" diff --git a/kernel/arch/i386/t_ptrace_waitid.c b/kernel/arch/i386/t_ptrace_waitid.c new file mode 100644 index 000000000000..274e8bd9f19c --- /dev/null +++ b/kernel/arch/i386/t_ptrace_waitid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAITID +#include "t_ptrace_wait.c" diff --git a/kernel/arch/i386/t_ptrace_waitpid.c b/kernel/arch/i386/t_ptrace_waitpid.c new file mode 100644 index 000000000000..2fe5c570f9f7 --- /dev/null +++ b/kernel/arch/i386/t_ptrace_waitpid.c @@ -0,0 +1,30 @@ +/* $NetBSD: t_ptrace_waitpid.c,v 1.1 2016/12/13 18:00:10 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#define TWAIT_WAITPID +#include "t_ptrace_wait.c" diff --git a/kernel/t_ptrace_wait.c b/kernel/t_ptrace_wait.c index d8935904c516..b1b4d1bef2c2 100644 --- a/kernel/t_ptrace_wait.c +++ b/kernel/t_ptrace_wait.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.57 2017/01/13 23:22:12 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.58 2017/01/14 04:37:55 kamil Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.57 2017/01/13 23:22:12 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.58 2017/01/14 04:37:55 kamil Exp $"); #include #include @@ -1072,6 +1072,118 @@ ATF_TC_BODY(eventmask2, tc) TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); } +ATF_TC(eventmask3); +ATF_TC_HEAD(eventmask3, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PTRACE_VFORK in EVENT_MASK is preserved"); +} + +ATF_TC_BODY(eventmask3, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t set_event, get_event; + const int len = sizeof(ptrace_event_t); + + atf_tc_expect_fail("PR kern/51630"); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + set_event.pe_set_event = PTRACE_VFORK; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); + ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + +ATF_TC(eventmask4); +ATF_TC_HEAD(eventmask4, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify that PTRACE_VFORK_DONE in EVENT_MASK is preserved"); +} + +ATF_TC_BODY(eventmask4, tc) +{ + const int exitval = 5; + const int sigval = SIGSTOP; + pid_t child, wpid; +#if defined(TWAIT_HAVE_STATUS) + int status; +#endif + ptrace_event_t set_event, get_event; + const int len = sizeof(ptrace_event_t); + + printf("Before forking process PID=%d\n", getpid()); + ATF_REQUIRE((child = fork()) != -1); + if (child == 0) { + printf("Before calling PT_TRACE_ME from child %d\n", getpid()); + FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + printf("Before raising %s from child\n", strsignal(sigval)); + FORKEE_ASSERT(raise(sigval) == 0); + + printf("Before exiting of the child process\n"); + _exit(exitval); + } + printf("Parent process PID=%d, child's PID=%d\n", getpid(), child); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_stopped(status, sigval); + + set_event.pe_set_event = PTRACE_VFORK_DONE; + ATF_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); + ATF_REQUIRE(ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); + ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); + + printf("Before resuming the child process where it left off and " + "without signal to be sent\n"); + ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); + + validate_status_exited(status, exitval); + + printf("Before calling %s() for the child\n", TWAIT_FNAME); + TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); +} + #if defined(TWAIT_HAVE_PID) ATF_TC(fork1); ATF_TC_HEAD(fork1, tc) @@ -5193,6 +5305,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, eventmask1); ATF_TP_ADD_TC(tp, eventmask2); + ATF_TP_ADD_TC(tp, eventmask3); + ATF_TP_ADD_TC(tp, eventmask4); ATF_TP_ADD_TC_HAVE_PID(tp, fork1); ATF_TP_ADD_TC(tp, fork2); diff --git a/lib/libc/gen/exect/t_exect.c b/lib/libc/gen/exect/t_exect.c new file mode 100644 index 000000000000..4c85e4b2db4b --- /dev/null +++ b/lib/libc/gen/exect/t_exect.c @@ -0,0 +1,90 @@ +/* $NetBSD: t_exect.c,v 1.6 2016/12/12 10:34:55 joerg Exp $ */ + +/*- + * Copyright (c) 2014 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 + +#include +#include +#include +#include +#include + +ATF_TC(t_exect_null); + +ATF_TC_HEAD(t_exect_null, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Tests an empty exect(2) executing"); +} + +static volatile sig_atomic_t caught = 0; + +static void +sigtrap_handler(int sig, siginfo_t *info, void *ctx) +{ + ATF_REQUIRE_EQ(sig, SIGTRAP); + ATF_REQUIRE_EQ(info->si_code, TRAP_TRACE); + + ++caught; +} + +ATF_TC_BODY(t_exect_null, tc) +{ + struct sigaction act; + + /* + * Currently exect(3) is misdesigned -- see PR port-amd64/51700 and it + * needs to be redone from scratch. + * + * This test affects amd64 releng machines causing tests to hang or + * fail. As there is little point to test interface that is still not, + * designed and implemented and is breaking tests - skip it + * unconditionally for all ports. + */ + /* Prevent static analysis from requiring t_exec_null to be __dead. */ + if (!caught) + atf_tc_skip("exect(3) misdesigned and hangs - PR port-amd64/51700"); + + ATF_REQUIRE(sigemptyset(&act.sa_mask) == 0); + act.sa_sigaction = sigtrap_handler; + act.sa_flags = SA_SIGINFO; + + ATF_REQUIRE(sigaction(SIGTRAP, &act, 0) == 0); + + ATF_REQUIRE_ERRNO(EFAULT, exect(NULL, NULL, NULL) == -1); + + ATF_REQUIRE_EQ_MSG(caught, 1, "expected caught (1) != received (%d)", + (int)caught); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, t_exect_null); + + return atf_no_error(); +} diff --git a/lib/libpthread_dbg/h_common.h b/lib/libpthread_dbg/h_common.h new file mode 100644 index 000000000000..0a02b963d436 --- /dev/null +++ b/lib/libpthread_dbg/h_common.h @@ -0,0 +1,128 @@ +/* $NetBSD: h_common.h,v 1.2 2016/11/19 02:30:54 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + + +#ifndef H_COMMON_H +#define H_COMMON_H + +#include +#include +#include +#include + +#include + +#define PTHREAD_REQUIRE(x) \ + do { \ + int ret = (x); \ + ATF_REQUIRE_MSG(ret == 0, "%s: %s", #x, strerror(ret)); \ + } while (0) + +#define PTHREAD_REQUIRE_STATUS(x, v) \ + do { \ + int ret = (x); \ + ATF_REQUIRE_MSG(ret == (v), "%s: %s", #x, strerror(ret)); \ + } while (0) + +static int __used +dummy_proc_read(void *arg, caddr_t addr, void *buf, size_t size) +{ + return TD_ERR_ERR; +} + +static int __used +dummy_proc_write(void *arg, caddr_t addr, void *buf, size_t size) +{ + return TD_ERR_ERR; +} + +static int __used +dummy_proc_lookup(void *arg, const char *sym, caddr_t *addr) +{ + return TD_ERR_ERR; +} + +static int __used +dummy_proc_regsize(void *arg, int regset, size_t *size) +{ + return TD_ERR_ERR; +} + +static int __used +dummy_proc_getregs(void *arg, int regset, int lwp, void *buf) +{ + return TD_ERR_ERR; +} + +static int __used +dummy_proc_setregs(void *arg, int regset, int lwp, void *buf) +{ + return TD_ERR_ERR; +} + +/* Minimalistic basic implementation */ + +static int __used +basic_proc_read(void *arg, caddr_t addr, void *buf, size_t size) +{ + memcpy(buf, addr, size); + + return TD_ERR_OK; +} + +static int __used +basic_proc_write(void *arg, caddr_t addr, void *buf, size_t size) +{ + memcpy(addr, buf, size); + + return TD_ERR_OK; +} + +static int __used +basic_proc_lookup(void *arg, const char *sym, caddr_t *addr) +{ + void *handle; + void *symbol; + + ATF_REQUIRE_MSG((handle = dlopen(NULL, RTLD_LOCAL | RTLD_LAZY)) + != NULL, "dlopen(3) failed: %s", dlerror()); + + symbol = dlsym(handle, sym); + + ATF_REQUIRE_MSG(dlclose(handle) == 0, "dlclose(3) failed: %s", + dlerror()); + + if (!symbol) + return TD_ERR_NOSYM; + + *addr = (caddr_t)(uintptr_t)symbol; + + return TD_ERR_OK; +} + +#endif // H_COMMON_H diff --git a/lib/libpthread_dbg/t_dummy.c b/lib/libpthread_dbg/t_dummy.c new file mode 100644 index 000000000000..367443cd0351 --- /dev/null +++ b/lib/libpthread_dbg/t_dummy.c @@ -0,0 +1,131 @@ +/* $NetBSD: t_dummy.c,v 1.6 2016/11/19 15:13:46 kamil Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_dummy.c,v 1.6 2016/11/19 15:13:46 kamil Exp $"); + +#include "h_common.h" +#include +#include + +#include + + +ATF_TC(dummy1); +ATF_TC_HEAD(dummy1, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that dummy lookup functions stop td_open() with failure"); +} + +ATF_TC_BODY(dummy1, tc) +{ + + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + + dummy_callbacks.proc_read = dummy_proc_read; + dummy_callbacks.proc_write = dummy_proc_write; + dummy_callbacks.proc_lookup = dummy_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_ERR); +} + +ATF_TC(dummy2); +ATF_TC_HEAD(dummy2, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that td_open() for basic proc_{read,write,lookup} works"); +} + +ATF_TC_BODY(dummy2, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); +} + +ATF_TC(dummy3); +ATF_TC_HEAD(dummy3, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that calling twice td_open() for the same process fails"); +} + +ATF_TC_BODY(dummy3, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta1; + td_proc_t *main_ta2; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + printf("Calling td_open(3) for the first time - expecting success\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta1) == TD_ERR_OK); + + printf("Calling td_open(3) for the first time - expecting in-use\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta2) == + TD_ERR_INUSE); + + printf("Calling td_close(3) for the first successful call\n"); + ATF_REQUIRE(td_close(main_ta1) == TD_ERR_OK); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, dummy1); + ATF_TP_ADD_TC(tp, dummy2); + ATF_TP_ADD_TC(tp, dummy3); + + return atf_no_error(); +} diff --git a/lib/libpthread_dbg/t_threads.c b/lib/libpthread_dbg/t_threads.c new file mode 100644 index 000000000000..f22bbc9c0563 --- /dev/null +++ b/lib/libpthread_dbg/t_threads.c @@ -0,0 +1,719 @@ +/* $NetBSD: t_threads.c,v 1.9 2017/01/13 05:18:22 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_threads.c,v 1.9 2017/01/13 05:18:22 christos Exp $"); + +#include +#include +#include +#include +#include +#include + +#include + +#include "h_common.h" + +#define MAX_THREADS (size_t)10 + +ATF_TC(threads1); +ATF_TC_HEAD(threads1, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that td_thr_iter() call without extra logic works"); +} + +static volatile int exiting1; + +static void * +busyFunction1(void *arg) +{ + + while (exiting1 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads1(td_thread_t *thread, void *arg) +{ + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads1, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction1, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads1, NULL) == TD_ERR_OK); + + exiting1 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); +} + +ATF_TC(threads2); +ATF_TC_HEAD(threads2, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that td_thr_iter() call is executed for each thread once"); +} + +static volatile int exiting2; + +static void * +busyFunction2(void *arg) +{ + + while (exiting2 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads2(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads2, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction2, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads2, &count) == TD_ERR_OK); + + exiting2 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads3); +ATF_TC_HEAD(threads3, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that for each td_thr_iter() call td_thr_info() is valid"); +} + +static volatile int exiting3; + +static void * +busyFunction3(void *arg) +{ + + while (exiting3 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads3(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + td_thread_info_t info; + + ATF_REQUIRE(td_thr_info(thread, &info) == TD_ERR_OK); + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads3, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction3, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads3, &count) == TD_ERR_OK); + + exiting3 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads4); +ATF_TC_HEAD(threads4, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that for each td_thr_iter() call td_thr_getname() is " + "valid"); +} + +static volatile int exiting4; + +static void * +busyFunction4(void *arg) +{ + + while (exiting4 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads4(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + char name[PTHREAD_MAX_NAMELEN_NP]; + + ATF_REQUIRE(td_thr_getname(thread, name, sizeof(name)) == TD_ERR_OK); + + printf("Thread name: %s\n", name); + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads4, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction4, NULL)); + } + + for (i = 0; i < MAX_THREADS; i++) { + PTHREAD_REQUIRE + (pthread_setname_np(threads[i], "test_%d", (void*)i)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads4, &count) == TD_ERR_OK); + + exiting4 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads5); +ATF_TC_HEAD(threads5, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that td_thr_getname() handles shorter buffer parameter " + "and the result is properly truncated"); +} + +static volatile int exiting5; + +static void * +busyFunction5(void *arg) +{ + + while (exiting5 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads5(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + /* Arbitrarily short string buffer */ + char name[3]; + + ATF_REQUIRE(td_thr_getname(thread, name, sizeof(name)) == TD_ERR_OK); + + printf("Thread name: %s\n", name); + + /* strlen(3) does not count including a '\0' character */ + ATF_REQUIRE(strlen(name) < sizeof(name)); + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads5, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction5, NULL)); + } + + for (i = 0; i < MAX_THREADS; i++) { + PTHREAD_REQUIRE + (pthread_setname_np(threads[i], "test_%d", (void*)i)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads5, &count) == TD_ERR_OK); + + exiting5 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads6); +ATF_TC_HEAD(threads6, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that pthread_t can be translated with td_map_pth2thr() " + "to td_thread_t -- and assert earlier that td_thr_iter() call is " + "valid"); +} + +static volatile int exiting6; + +static void * +busyFunction6(void *arg) +{ + + while (exiting6 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads6(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads6, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction6, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads6, &count) == TD_ERR_OK); + + for (i = 0; i < MAX_THREADS; i++) { + td_thread_t *td_thread; + ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread) + == TD_ERR_OK); + } + + exiting6 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads7); +ATF_TC_HEAD(threads7, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that pthread_t can be translated with td_map_pth2thr() " + "to td_thread_t -- and assert later that td_thr_iter() call is " + "valid"); +} + +static volatile int exiting7; + +static void * +busyFunction7(void *arg) +{ + + while (exiting7 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads7(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads7, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction7, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + for (i = 0; i < MAX_THREADS; i++) { + td_thread_t *td_thread; + ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread) + == TD_ERR_OK); + } + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads7, &count) == TD_ERR_OK); + + exiting7 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads8); +ATF_TC_HEAD(threads8, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that pthread_t can be translated with td_map_pth2thr() " + "to td_thread_t -- compare thread's name of pthread_t and " + "td_thread_t"); +} + +static volatile int exiting8; + +static void * +busyFunction8(void *arg) +{ + + while (exiting8 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads8(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads8, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction8, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads8, &count) == TD_ERR_OK); + + for (i = 0; i < MAX_THREADS; i++) { + td_thread_t *td_thread; + char td_threadname[PTHREAD_MAX_NAMELEN_NP]; + char pth_threadname[PTHREAD_MAX_NAMELEN_NP]; + ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread) + == TD_ERR_OK); + ATF_REQUIRE(td_thr_getname(td_thread, td_threadname, + sizeof(td_threadname)) == TD_ERR_OK); + PTHREAD_REQUIRE(pthread_getname_np(threads[i], pth_threadname, + sizeof(pth_threadname))); + ATF_REQUIRE(strcmp(td_threadname, pth_threadname) == 0); + } + + exiting8 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TC(threads9); +ATF_TC_HEAD(threads9, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "Asserts that pthread_t can be translated with td_map_pth2thr() " + "to td_thread_t -- assert that thread is in the TD_STATE_RUNNING " + "state"); +} + +static volatile int exiting9; + +static void * +busyFunction9(void *arg) +{ + + while (exiting9 == 0) + usleep(50000); + + return NULL; +} + +static int +iterateThreads9(td_thread_t *thread, void *arg) +{ + int *counter = (int *)arg; + + ++(*counter); + + return TD_ERR_OK; +} + +ATF_TC_BODY(threads9, tc) +{ + struct td_proc_callbacks_t dummy_callbacks; + td_proc_t *main_ta; + size_t i; + pthread_t threads[MAX_THREADS]; + int count = 0; + + dummy_callbacks.proc_read = basic_proc_read; + dummy_callbacks.proc_write = basic_proc_write; + dummy_callbacks.proc_lookup = basic_proc_lookup; + dummy_callbacks.proc_regsize = dummy_proc_regsize; + dummy_callbacks.proc_getregs = dummy_proc_getregs; + dummy_callbacks.proc_setregs = dummy_proc_setregs; + + for (i = 0; i < MAX_THREADS; i++) { + printf("Creating thread %zu\n", i); + PTHREAD_REQUIRE + (pthread_create(&threads[i], NULL, busyFunction9, NULL)); + } + + printf("Calling td_open(3)\n"); + ATF_REQUIRE(td_open(&dummy_callbacks, NULL, &main_ta) == TD_ERR_OK); + + for (i = 0; i < MAX_THREADS; i++) { + td_thread_t *td_thread; + td_thread_info_t info; + ATF_REQUIRE(td_map_pth2thr(main_ta, threads[i], &td_thread) + == TD_ERR_OK); + ATF_REQUIRE(td_thr_info(td_thread, &info) == TD_ERR_OK); + ATF_REQUIRE_EQ(info.thread_state, TD_STATE_RUNNING); + } + + ATF_REQUIRE(td_thr_iter(main_ta, iterateThreads9, &count) == TD_ERR_OK); + + exiting9 = 1; + + printf("Calling td_close(3)\n"); + ATF_REQUIRE(td_close(main_ta) == TD_ERR_OK); + + ATF_REQUIRE_EQ_MSG(count, MAX_THREADS + 1, + "counted threads (%d) != expected threads (%zu)", + count, MAX_THREADS + 1); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, threads1); + ATF_TP_ADD_TC(tp, threads2); + ATF_TP_ADD_TC(tp, threads3); + ATF_TP_ADD_TC(tp, threads4); + ATF_TP_ADD_TC(tp, threads5); + ATF_TP_ADD_TC(tp, threads6); + ATF_TP_ADD_TC(tp, threads7); + ATF_TP_ADD_TC(tp, threads8); + ATF_TP_ADD_TC(tp, threads9); + + return atf_no_error(); +} diff --git a/lib/librefuse/t_refuse_opt.c b/lib/librefuse/t_refuse_opt.c new file mode 100644 index 000000000000..23c2803f8552 --- /dev/null +++ b/lib/librefuse/t_refuse_opt.c @@ -0,0 +1,418 @@ +/* $NetBSD: t_refuse_opt.c,v 1.8 2017/01/13 21:30:41 christos Exp $ */ + +/*- + * Copyright (c) 2016 The NetBSD Foundation, 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_refuse_opt.c,v 1.8 2017/01/13 21:30:41 christos Exp $"); + +#define _KERNTYPES +#include + +#include + +#include + +#include "h_macros.h" + +ATF_TC(t_fuse_opt_add_arg); +ATF_TC_HEAD(t_fuse_opt_add_arg, tc) +{ + atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_add_arg(3) works"); +} + +ATF_TC_BODY(t_fuse_opt_add_arg, tc) +{ + struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + + RZ(fuse_opt_add_arg(&args, "foo")); + RZ(fuse_opt_add_arg(&args, "bar")); + + ATF_REQUIRE_EQ(args.argc, 2); + ATF_CHECK_STREQ(args.argv[0], "foo"); + ATF_CHECK_STREQ(args.argv[1], "bar"); + ATF_CHECK(args.allocated != 0); +} + +ATF_TC(t_fuse_opt_insert_arg); +ATF_TC_HEAD(t_fuse_opt_insert_arg, tc) +{ + atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_insert_arg(3) works"); +} + +ATF_TC_BODY(t_fuse_opt_insert_arg, tc) +{ + struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + + RZ(fuse_opt_insert_arg(&args, 0, "foo")); + RZ(fuse_opt_insert_arg(&args, 0, "bar")); + + ATF_REQUIRE_EQ(args.argc, 2); + ATF_CHECK_STREQ(args.argv[0], "bar"); + ATF_CHECK_STREQ(args.argv[1], "foo"); + ATF_CHECK(args.allocated != 0); +} + +ATF_TC(t_fuse_opt_add_opt); +ATF_TC_HEAD(t_fuse_opt_add_opt, tc) +{ + atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_add_opt(3) works"); +} + +ATF_TC_BODY(t_fuse_opt_add_opt, tc) +{ + char* opt = NULL; + + RZ(fuse_opt_add_opt(&opt, "fo\\o")); + ATF_CHECK_STREQ(opt, "fo\\o"); + + RZ(fuse_opt_add_opt(&opt, "ba,r")); + ATF_CHECK_STREQ(opt, "fo\\o,ba,r"); +} + +ATF_TC(t_fuse_opt_add_opt_escaped); +ATF_TC_HEAD(t_fuse_opt_add_opt_escaped, tc) +{ + atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_add_opt_escaped(3) works"); +} + +ATF_TC_BODY(t_fuse_opt_add_opt_escaped, tc) +{ + char* opt = NULL; + + RZ(fuse_opt_add_opt_escaped(&opt, "fo\\o")); + ATF_CHECK_STREQ(opt, "fo\\\\o"); + + RZ(fuse_opt_add_opt_escaped(&opt, "ba,r")); + ATF_CHECK_STREQ(opt, "fo\\\\o,ba\\,r"); +} + +ATF_TC(t_fuse_opt_match); +ATF_TC_HEAD(t_fuse_opt_match, tc) +{ + atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_match(3) works" + " for every form of templates"); +} + +ATF_TC_BODY(t_fuse_opt_match, tc) +{ + struct fuse_opt o1[] = { FUSE_OPT_KEY("-x" , 0), FUSE_OPT_END }; + struct fuse_opt o2[] = { FUSE_OPT_KEY("foo" , 0), FUSE_OPT_END }; + struct fuse_opt o3[] = { FUSE_OPT_KEY("foo=" , 0), FUSE_OPT_END }; + struct fuse_opt o4[] = { FUSE_OPT_KEY("foo=%s", 0), FUSE_OPT_END }; + struct fuse_opt o5[] = { FUSE_OPT_KEY("-x " , 0), FUSE_OPT_END }; + struct fuse_opt o6[] = { FUSE_OPT_KEY("-x %s" , 0), FUSE_OPT_END }; + + ATF_CHECK(fuse_opt_match(o1, "-x") == 1); + ATF_CHECK(fuse_opt_match(o1, "x") == 0); + + ATF_CHECK(fuse_opt_match(o2, "foo") == 1); + ATF_CHECK(fuse_opt_match(o2, "-foo") == 0); + + ATF_CHECK(fuse_opt_match(o3, "foo=bar") == 1); + ATF_CHECK(fuse_opt_match(o3, "foo" ) == 0); + + ATF_CHECK(fuse_opt_match(o4, "foo=bar") == 1); + ATF_CHECK(fuse_opt_match(o4, "foo" ) == 0); + + ATF_CHECK(fuse_opt_match(o5, "-xbar" ) == 1); + ATF_CHECK(fuse_opt_match(o5, "-x" ) == 1); + ATF_CHECK(fuse_opt_match(o5, "-x=bar") == 1); + ATF_CHECK(fuse_opt_match(o5, "bar" ) == 0); + + ATF_CHECK(fuse_opt_match(o6, "-xbar" ) == 1); + ATF_CHECK(fuse_opt_match(o6, "-x" ) == 1); + ATF_CHECK(fuse_opt_match(o6, "-x=bar") == 1); + ATF_CHECK(fuse_opt_match(o6, "bar" ) == 0); +} + +struct foofs_config { + int number; + char *string; + char* nonopt; +}; + +#define FOOFS_OPT(t, p, v) { t, offsetof(struct foofs_config, p), v } + +static struct fuse_opt foofs_opts[] = { + FOOFS_OPT("number=%i" , number, 0), + FOOFS_OPT("-n %i" , number, 0), + FOOFS_OPT("string=%s" , string, 0), + FOOFS_OPT("number1" , number, 1), + FOOFS_OPT("number2" , number, 2), + FOOFS_OPT("--number=three", number, 3), + FOOFS_OPT("--number=four" , number, 4), + FUSE_OPT_END +}; + +static int foo_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { + struct foofs_config *config = data; + + if (key == FUSE_OPT_KEY_NONOPT && config->nonopt == NULL) { + config->nonopt = strdup(arg); + return 0; + } + else { + return 1; + } +} + +ATF_TC(t_fuse_opt_parse_null_args); +ATF_TC_HEAD(t_fuse_opt_parse_null_args, tc) +{ + atf_tc_set_md_var(tc, "descr", "NULL args means an empty arguments vector"); +} + +ATF_TC_BODY(t_fuse_opt_parse_null_args, tc) +{ + struct foofs_config config; + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(NULL, &config, NULL, NULL) == 0); + ATF_CHECK_EQ(config.number, 0); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_EQ(config.nonopt, NULL); +} + +ATF_TC(t_fuse_opt_parse_null_opts); +ATF_TC_HEAD(t_fuse_opt_parse_null_opts, tc) +{ + atf_tc_set_md_var(tc, "descr", "NULL opts means an opts array which only has FUSE_OPT_END"); +} + +ATF_TC_BODY(t_fuse_opt_parse_null_opts, tc) +{ + struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + struct foofs_config config; + + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "number=1,string=foo")); + RZ(fuse_opt_add_arg(&args, "bar")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, NULL, NULL) == 0); + ATF_CHECK_EQ(config.number, 0); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_EQ(config.nonopt, NULL); + ATF_CHECK_EQ(args.argc, 4); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + ATF_CHECK_STREQ(args.argv[1], "-o"); + ATF_CHECK_STREQ(args.argv[2], "number=1,string=foo"); + ATF_CHECK_STREQ(args.argv[3], "bar"); +} + +ATF_TC(t_fuse_opt_parse_null_proc); +ATF_TC_HEAD(t_fuse_opt_parse_null_proc, tc) +{ + atf_tc_set_md_var(tc, "descr", "NULL proc means a processor function always returning 1," + " i.e. keep the argument"); +} + +ATF_TC_BODY(t_fuse_opt_parse_null_proc, tc) +{ + struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + struct foofs_config config; + + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "number=1,string=foo")); + RZ(fuse_opt_add_arg(&args, "bar")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, NULL) == 0); + ATF_CHECK_EQ(config.number, 1); + ATF_CHECK_STREQ(config.string, "foo"); + ATF_CHECK_EQ(config.nonopt, NULL); + ATF_CHECK_EQ(args.argc, 2); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + ATF_CHECK_STREQ(args.argv[1], "bar"); +} + +ATF_TC(t_fuse_opt_parse); +ATF_TC_HEAD(t_fuse_opt_parse, tc) +{ + atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_parse(3) fully works"); +} + +ATF_TC_BODY(t_fuse_opt_parse, tc) +{ + struct fuse_args args = FUSE_ARGS_INIT(0, NULL); + struct foofs_config config; + + /* Standard form */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "number=1,string=foo")); + RZ(fuse_opt_add_arg(&args, "bar")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 1); + ATF_CHECK_STREQ(config.string, "foo"); + ATF_CHECK_STREQ(config.nonopt, "bar"); + ATF_CHECK_EQ(args.argc, 1); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + + /* Concatenated -o */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-onumber=1,unknown,string=foo")); + RZ(fuse_opt_add_arg(&args, "bar")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 1); + ATF_CHECK_STREQ(config.string, "foo"); + ATF_CHECK_STREQ(config.nonopt, "bar"); + ATF_CHECK_EQ(args.argc, 3); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + ATF_CHECK_STREQ(args.argv[1], "-o"); + ATF_CHECK_STREQ(args.argv[2], "unknown"); + + /* Sparse -o */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "bar")); + RZ(fuse_opt_add_arg(&args, "baz")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "number=1")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "unknown")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "string=foo")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 1); + ATF_CHECK_STREQ(config.string, "foo"); + ATF_CHECK_STREQ(config.nonopt, "bar"); + ATF_CHECK_EQ(args.argc, 4); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + ATF_CHECK_STREQ(args.argv[1], "-o"); + ATF_CHECK_STREQ(args.argv[2], "unknown"); + ATF_CHECK_STREQ(args.argv[3], "baz"); + + /* Separate -n %i */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-n")); + RZ(fuse_opt_add_arg(&args, "3")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 3); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_EQ(config.nonopt, NULL); + ATF_CHECK_EQ(args.argc, 1); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + + /* Concatenated -n %i */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-n3")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 3); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_EQ(config.nonopt, NULL); + ATF_CHECK_EQ(args.argc, 1); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + + /* -o constant */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "-o")); + RZ(fuse_opt_add_arg(&args, "number2")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 2); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_EQ(config.nonopt, NULL); + ATF_CHECK_EQ(args.argc, 1); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + + /* -x constant */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "--number=four")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 4); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_EQ(config.nonopt, NULL); + ATF_CHECK_EQ(args.argc, 1); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + + /* end-of-options "--" marker */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "--")); + RZ(fuse_opt_add_arg(&args, "-onumber=1")); + RZ(fuse_opt_add_arg(&args, "-ostring=foo")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 0); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_STREQ(config.nonopt, "-onumber=1"); + ATF_CHECK_EQ(args.argc, 3); + ATF_CHECK_STREQ(args.argv[0], "foofs"); + ATF_CHECK_STREQ(args.argv[1], "--"); + ATF_CHECK_STREQ(args.argv[2], "-ostring=foo"); + + /* The "--" marker at the last of outargs should be removed */ + fuse_opt_free_args(&args); + RZ(fuse_opt_add_arg(&args, "foofs")); + RZ(fuse_opt_add_arg(&args, "--")); + RZ(fuse_opt_add_arg(&args, "-onumber=1")); + + memset(&config, 0, sizeof(config)); + ATF_CHECK(fuse_opt_parse(&args, &config, foofs_opts, foo_opt_proc) == 0); + ATF_CHECK_EQ(config.number, 0); + ATF_CHECK_EQ(config.string, NULL); + ATF_CHECK_STREQ(config.nonopt, "-onumber=1"); + ATF_CHECK_EQ(args.argc, 1); + ATF_CHECK_STREQ(args.argv[0], "foofs"); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, t_fuse_opt_add_arg); + ATF_TP_ADD_TC(tp, t_fuse_opt_insert_arg); + ATF_TP_ADD_TC(tp, t_fuse_opt_add_opt); + ATF_TP_ADD_TC(tp, t_fuse_opt_add_opt_escaped); + ATF_TP_ADD_TC(tp, t_fuse_opt_match); + ATF_TP_ADD_TC(tp, t_fuse_opt_parse_null_args); + ATF_TP_ADD_TC(tp, t_fuse_opt_parse_null_opts); + ATF_TP_ADD_TC(tp, t_fuse_opt_parse_null_proc); + ATF_TP_ADD_TC(tp, t_fuse_opt_parse); + + return atf_no_error(); +} diff --git a/net/if_tun/t_tun.sh b/net/if_tun/t_tun.sh new file mode 100755 index 000000000000..87df39ab5886 --- /dev/null +++ b/net/if_tun/t_tun.sh @@ -0,0 +1,138 @@ +# $NetBSD: t_tun.sh,v 1.4 2016/11/07 05:25:37 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +RUMP_FLAGS="-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6" +RUMP_FLAGS="$RUMP_FLAGS -lrumpnet_shmif -lrumpnet_tun -lrumpdev" + +BUS=bus +SOCK_LOCAL=unix://commsock1 +SOCK_REMOTE=unix://commsock2 +IP_LOCAL=10.0.0.1 +IP_REMOTE=10.0.0.2 + +DEBUG=${DEBUG:-true} + +atf_test_case tun_create_destroy cleanup +tun_create_destroy_head() +{ + + atf_set "descr" "tests of creation and deletion of tun interface" + atf_set "require.progs" "rump_server" +} + +tun_create_destroy_body() +{ + + atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} + + export RUMP_SERVER=${SOCK_LOCAL} + + atf_check -s exit:0 rump.ifconfig tun0 create + atf_check -s exit:0 rump.ifconfig tun0 up + atf_check -s exit:0 rump.ifconfig tun0 down + atf_check -s exit:0 rump.ifconfig tun0 destroy +} + +tun_create_destroy_cleanup() +{ + + RUMP_SERVER=${SOCK_LOCAL} rump.halt +} + +atf_test_case tun_setup cleanup +tun_setup_head() +{ + + atf_set "descr" "tests of setting up a tunnel" + atf_set "require.progs" "rump_server" +} + +check_route_entry() +{ + local ip=$(echo $1 |sed 's/\./\\./g') + local gw=$2 + local flags=$3 + local iface=$4 + + atf_check -s exit:0 -o match:" $flags " -e ignore -x \ + "rump.netstat -rn -f inet | grep ^'$ip'" + atf_check -s exit:0 -o match:" $gw " -e ignore -x \ + "rump.netstat -rn -f inet | grep ^'$ip'" + atf_check -s exit:0 -o match:" $iface" -e ignore -x \ + "rump.netstat -rn -f inet | grep ^'$ip'" +} + +tun_setup_body() +{ + + atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_LOCAL} + atf_check -s exit:0 rump_server ${RUMP_FLAGS} ${SOCK_REMOTE} + + export RUMP_SERVER=${SOCK_LOCAL} + + atf_check -s exit:0 rump.ifconfig shmif0 create + atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + atf_check -s exit:0 rump.ifconfig shmif0 ${IP_LOCAL}/24 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=${SOCK_REMOTE} + + atf_check -s exit:0 rump.ifconfig shmif0 create + atf_check -s exit:0 rump.ifconfig shmif0 linkstr $BUS + atf_check -s exit:0 rump.ifconfig shmif0 ${IP_REMOTE}/24 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=${SOCK_LOCAL} + atf_check -s exit:0 rump.ifconfig tun0 create + atf_check -s exit:0 rump.ifconfig tun0 ${IP_LOCAL} ${IP_REMOTE} up + atf_check -s exit:0 \ + -o match:"inet ${IP_LOCAL}/32 -> ${IP_REMOTE}" rump.ifconfig tun0 + $DEBUG && rump.netstat -nr -f inet + check_route_entry ${IP_REMOTE} ${IP_LOCAL} UH tun0 + + export RUMP_SERVER=${SOCK_REMOTE} + atf_check -s exit:0 rump.ifconfig tun0 create + atf_check -s exit:0 rump.ifconfig tun0 ${IP_REMOTE} ${IP_LOCAL} up + atf_check -s exit:0 \ + -o match:"inet ${IP_REMOTE}/32 -> ${IP_LOCAL}" rump.ifconfig tun0 + $DEBUG && rump.netstat -nr -f inet + check_route_entry ${IP_LOCAL} ${IP_REMOTE} UH tun0 +} + +tun_setup_cleanup() +{ + + RUMP_SERVER=${SOCK_LOCAL} rump.halt + RUMP_SERVER=${SOCK_REMOTE} rump.halt +} + +atf_init_test_cases() +{ + + atf_add_test_case tun_create_destroy + atf_add_test_case tun_setup +} diff --git a/net/if_vlan/t_vlan.sh b/net/if_vlan/t_vlan.sh new file mode 100755 index 000000000000..a6902fb1e247 --- /dev/null +++ b/net/if_vlan/t_vlan.sh @@ -0,0 +1,115 @@ +# $NetBSD: t_vlan.sh,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $ +# +# Copyright (c) 2016 Internet Initiative Japan 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +BUS=bus +SOCK_LOCAL=unix://commsock1 +SOCK_REMOTE=unix://commsock2 +IP_LOCAL=10.0.0.1 +IP_REMOTE=10.0.0.2 + +DEBUG=${DEBUG:-false} + +atf_test_case vlan_create_destroy cleanup +vlan_create_destroy_head() +{ + + atf_set "descr" "tests of creation and deletion of vlan interface" + atf_set "require.progs" "rump_server" +} + +vlan_create_destroy_body() +{ + + rump_server_start $SOCK_LOCAL vlan + + export RUMP_SERVER=${SOCK_LOCAL} + + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 up + atf_check -s exit:0 rump.ifconfig vlan0 down + atf_check -s exit:0 rump.ifconfig vlan0 destroy +} + +vlan_create_destroy_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_test_case vlan_basic cleanup +vlan_basic_head() +{ + + atf_set "descr" "tests of communications over vlan interfaces" + atf_set "require.progs" "rump_server" +} + +vlan_basic_body() +{ + + rump_server_start $SOCK_LOCAL vlan + rump_server_add_iface $SOCK_LOCAL shmif0 $BUS + rump_server_start $SOCK_REMOTE vlan + rump_server_add_iface $SOCK_REMOTE shmif0 $BUS + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 rump.ifconfig shmif0 up + export RUMP_SERVER=$SOCK_REMOTE + atf_check -s exit:0 rump.ifconfig shmif0 up + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 + atf_check -s exit:0 rump.ifconfig vlan0 $IP_LOCAL/24 + atf_check -s exit:0 rump.ifconfig vlan0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=$SOCK_REMOTE + atf_check -s exit:0 rump.ifconfig vlan0 create + atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0 + atf_check -s exit:0 rump.ifconfig vlan0 $IP_REMOTE/24 + atf_check -s exit:0 rump.ifconfig vlan0 up + atf_check -s exit:0 rump.ifconfig -w 10 + + export RUMP_SERVER=$SOCK_LOCAL + atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE +} + +vlan_basic_cleanup() +{ + + $DEBUG && dump + cleanup +} + +atf_init_test_cases() +{ + + atf_add_test_case vlan_create_destroy + atf_add_test_case vlan_basic +} diff --git a/sys/uvm/t_uvm_physseg.c b/sys/uvm/t_uvm_physseg.c new file mode 100644 index 000000000000..a5f2fa9e9067 --- /dev/null +++ b/sys/uvm/t_uvm_physseg.c @@ -0,0 +1,2377 @@ +/* $NetBSD: t_uvm_physseg.c,v 1.2 2016/12/22 08:15:20 cherry Exp $ */ + +/*- + * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Santhosh N. Raju and + * by Cherry G. Mathew + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_uvm_physseg.c,v 1.2 2016/12/22 08:15:20 cherry Exp $"); + +/* + * If this line is commented out tests related to uvm_physseg_get_pmseg() + * wont run. + * + * Have a look at machine/uvm_physseg.h for more details. + */ +#define __HAVE_PMAP_PHYSSEG + +/* + * This is a dummy struct used for testing purposes + * + * In reality this struct would exist in the MD part of the code residing in + * machines/vmparam.h + */ + +#ifdef __HAVE_PMAP_PHYSSEG +struct pmap_physseg { + int dummy_variable; /* Dummy variable use for testing */ +}; +#endif + +/* Testing API - assumes userland */ +/* Provide Kernel API equivalents */ +#include +#include +#include +#include /* memset(3) et. al */ +#include /* printf(3) */ +#include /* malloc(3) */ +#include +#include + +#define PRIxPADDR "lx" +#define PRIxPSIZE "lx" +#define PRIuPSIZE "lu" +#define PRIxVADDR "lx" +#define PRIxVSIZE "lx" +#define PRIuVSIZE "lu" + +#define UVM_HOTPLUG /* Enable hotplug with rbtree. */ +#define PMAP_STEAL_MEMORY +#define DEBUG /* Enable debug functionality. */ + +typedef unsigned long vaddr_t; +typedef unsigned long paddr_t; +typedef unsigned long psize_t; +typedef unsigned long vsize_t; + +#include +#include + +#ifndef DIAGNOSTIC +#define KASSERTMSG(e, msg, ...) /* NOTHING */ +#define KASSERT(e) /* NOTHING */ +#else +#define KASSERT(a) assert(a) +#define KASSERTMSG(exp, ...) printf(__VA_ARGS__); assert((exp)) +#endif + +#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH + +#define VM_NFREELIST 4 +#define VM_FREELIST_DEFAULT 0 +#define VM_FREELIST_FIRST16 3 +#define VM_FREELIST_FIRST1G 2 +#define VM_FREELIST_FIRST4G 1 + +/* + * Used in tests when Array implementation is tested + */ +#if !defined(VM_PHYSSEG_MAX) +#define VM_PHYSSEG_MAX 1 +#endif + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1 << PAGE_SHIFT) +#define PAGE_MASK (PAGE_SIZE - 1) +#define atop(x) (((paddr_t)(x)) >> PAGE_SHIFT) +#define ptoa(x) (((paddr_t)(x)) << PAGE_SHIFT) + +#define mutex_enter(l) +#define mutex_exit(l) + +psize_t physmem; + +struct uvmexp uvmexp; /* decl */ + +/* + * uvm structure borrowed from uvm.h + * + * Remember this is a dummy structure used within the ATF Tests and + * uses only necessary fields from the original uvm struct. + * See uvm/uvm.h for the full struct. + */ + +struct uvm { + /* vm_page related parameters */ + + bool page_init_done; /* TRUE if uvm_page_init() finished */ +} uvm; + +#include + +void * +kmem_alloc(size_t size, km_flag_t flags) +{ + return malloc(size); +} + +void * +kmem_zalloc(size_t size, km_flag_t flags) +{ + void *ptr; + ptr = malloc(size); + + memset(ptr, 0, size); + + return ptr; +} + +void +kmem_free(void *mem, size_t size) +{ + free(mem); +} + +static void +panic(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vprintf(fmt, ap); + printf("\n"); + va_end(ap); + KASSERT(false); + + /*NOTREACHED*/ +} + +static void +uvm_pagefree(struct vm_page *pg) +{ + return; +} + +#if defined(UVM_HOTPLUG) +static void +uvmpdpol_reinit(void) +{ + return; +} +#endif /* UVM_HOTPLUG */ + +/* end - Provide Kernel API equivalents */ + + +#include "uvm/uvm_physseg.c" + +#include + +#define SIXTYFOUR_KILO (64 * 1024) +#define ONETWENTYEIGHT_KILO (128 * 1024) +#define TWOFIFTYSIX_KILO (256 * 1024) +#define FIVEONETWO_KILO (512 * 1024) +#define ONE_MEGABYTE (1024 * 1024) +#define TWO_MEGABYTE (2 * 1024 * 1024) + +/* Sample Page Frame Numbers */ +#define VALID_START_PFN_1 atop(0) +#define VALID_END_PFN_1 atop(ONE_MEGABYTE) +#define VALID_AVAIL_START_PFN_1 atop(0) +#define VALID_AVAIL_END_PFN_1 atop(ONE_MEGABYTE) + +#define VALID_START_PFN_2 atop(ONE_MEGABYTE + 1) +#define VALID_END_PFN_2 atop(ONE_MEGABYTE * 2) +#define VALID_AVAIL_START_PFN_2 atop(ONE_MEGABYTE + 1) +#define VALID_AVAIL_END_PFN_2 atop(ONE_MEGABYTE * 2) + +#define VALID_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1) +#define VALID_END_PFN_3 atop(ONE_MEGABYTE * 3) +#define VALID_AVAIL_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1) +#define VALID_AVAIL_END_PFN_3 atop(ONE_MEGABYTE * 3) + +#define VALID_START_PFN_4 atop((ONE_MEGABYTE * 3) + 1) +#define VALID_END_PFN_4 atop(ONE_MEGABYTE * 4) +#define VALID_AVAIL_START_PFN_4 atop((ONE_MEGABYTE * 3) + 1) +#define VALID_AVAIL_END_PFN_4 atop(ONE_MEGABYTE * 4) + +/* + * Total number of pages (of 4K size each) should be 256 for 1MB of memory. + */ +#define PAGE_COUNT_1M 256 + +/* + * A debug fucntion to print the content of upm. + */ + static inline void + uvm_physseg_dump_seg(uvm_physseg_t upm) + { +#if defined(DEBUG) + printf("%s: seg->start == %ld\n", __func__, + uvm_physseg_get_start(upm)); + printf("%s: seg->end == %ld\n", __func__, + uvm_physseg_get_end(upm)); + printf("%s: seg->avail_start == %ld\n", __func__, + uvm_physseg_get_avail_start(upm)); + printf("%s: seg->avail_end == %ld\n", __func__, + uvm_physseg_get_avail_end(upm)); + + printf("====\n\n"); +#else + return; +#endif /* DEBUG */ + } + +/* + * Private accessor that gets the value of uvm_physseg_graph.nentries + */ +static int +uvm_physseg_get_entries(void) +{ +#if defined(UVM_HOTPLUG) + return uvm_physseg_graph.nentries; +#else + return vm_nphysmem; +#endif /* UVM_HOTPLUG */ +} + +#if !defined(UVM_HOTPLUG) +static void * +uvm_physseg_alloc(size_t sz) +{ + return &vm_physmem[vm_nphysseg++]; +} +#endif + +/* + * Test Fixture SetUp(). + */ +static void +setup(void) +{ + /* Prerequisites for running certain calls in uvm_physseg */ + uvmexp.pagesize = PAGE_SIZE; + uvmexp.npages = 0; + uvm.page_init_done = false; + uvm_physseg_init(); +} + + +/* <---- Tests for Internal functions ----> */ +#if defined(UVM_HOTPLUG) +ATF_TC(uvm_physseg_alloc_atboot_mismatch); +ATF_TC_HEAD(uvm_physseg_alloc_atboot_mismatch, tc) +{ + atf_tc_set_md_var(tc, "descr", "boot time uvm_physseg_alloc() sanity" + "size mismatch alloc() test."); +} + +ATF_TC_BODY(uvm_physseg_alloc_atboot_mismatch, tc) +{ + uvm.page_init_done = false; + + atf_tc_expect_signal(SIGABRT, "size mismatch alloc()"); + + uvm_physseg_alloc(sizeof(struct uvm_physseg) - 1); +} + +ATF_TC(uvm_physseg_alloc_atboot_overrun); +ATF_TC_HEAD(uvm_physseg_alloc_atboot_overrun, tc) +{ + atf_tc_set_md_var(tc, "descr", "boot time uvm_physseg_alloc() sanity" + "array overrun alloc() test."); +} + +ATF_TC_BODY(uvm_physseg_alloc_atboot_overrun, tc) +{ + uvm.page_init_done = false; + + atf_tc_expect_signal(SIGABRT, "array overrun alloc()"); + + uvm_physseg_alloc((VM_PHYSSEG_MAX + 1) * sizeof(struct uvm_physseg)); + +} + +ATF_TC(uvm_physseg_alloc_sanity); +ATF_TC_HEAD(uvm_physseg_alloc_sanity, tc) +{ + atf_tc_set_md_var(tc, "descr", "further uvm_physseg_alloc() sanity checks"); +} + +ATF_TC_BODY(uvm_physseg_alloc_sanity, tc) +{ + + /* At boot time */ + uvm.page_init_done = false; + + /* Correct alloc */ + ATF_REQUIRE(uvm_physseg_alloc(VM_PHYSSEG_MAX * sizeof(struct uvm_physseg))); + + /* Retry static alloc()s as dynamic - we expect them to pass */ + uvm.page_init_done = true; + ATF_REQUIRE(uvm_physseg_alloc(sizeof(struct uvm_physseg) - 1)); + ATF_REQUIRE(uvm_physseg_alloc(2 * VM_PHYSSEG_MAX * sizeof(struct uvm_physseg))); +} + +ATF_TC(uvm_physseg_free_atboot_mismatch); +ATF_TC_HEAD(uvm_physseg_free_atboot_mismatch, tc) +{ + atf_tc_set_md_var(tc, "descr", "boot time uvm_physseg_free() sanity" + "size mismatch free() test."); +} + +ATF_TC_BODY(uvm_physseg_free_atboot_mismatch, tc) +{ + uvm.page_init_done = false; + + atf_tc_expect_signal(SIGABRT, "size mismatch free()"); + + uvm_physseg_free(&uvm_physseg[0], sizeof(struct uvm_physseg) - 1); +} + +ATF_TC(uvm_physseg_free_sanity); +ATF_TC_HEAD(uvm_physseg_free_sanity, tc) +{ + atf_tc_set_md_var(tc, "descr", "further uvm_physseg_free() sanity checks"); +} + +ATF_TC_BODY(uvm_physseg_free_sanity, tc) +{ + + /* At boot time */ + uvm.page_init_done = false; + + struct uvm_physseg *seg; + +#if VM_PHYSSEG_MAX > 1 + /* + * Note: free()ing the entire array is considered to be an + * error. Thus VM_PHYSSEG_MAX - 1. + */ + + seg = uvm_physseg_alloc((VM_PHYSSEG_MAX - 1) * sizeof(*seg)); + uvm_physseg_free(seg, (VM_PHYSSEG_MAX - 1) * sizeof(struct uvm_physseg)); +#endif + + /* Retry static alloc()s as dynamic - we expect them to pass */ + uvm.page_init_done = true; + + seg = uvm_physseg_alloc(sizeof(struct uvm_physseg) - 1); + uvm_physseg_free(seg, sizeof(struct uvm_physseg) - 1); + + seg = uvm_physseg_alloc(2 * VM_PHYSSEG_MAX * sizeof(struct uvm_physseg)); + + uvm_physseg_free(seg, 2 * VM_PHYSSEG_MAX * sizeof(struct uvm_physseg)); +} + +#if VM_PHYSSEG_MAX > 1 +ATF_TC(uvm_physseg_atboot_free_leak); +ATF_TC_HEAD(uvm_physseg_atboot_free_leak, tc) +{ + atf_tc_set_md_var(tc, "descr", + "does free() leak at boot ?\n" + "This test needs VM_PHYSSEG_MAX > 1)"); +} + +ATF_TC_BODY(uvm_physseg_atboot_free_leak, tc) +{ + + /* At boot time */ + uvm.page_init_done = false; + + /* alloc to array size */ + struct uvm_physseg *seg; + seg = uvm_physseg_alloc(VM_PHYSSEG_MAX * sizeof(*seg)); + + uvm_physseg_free(seg, sizeof(*seg)); + + atf_tc_expect_signal(SIGABRT, "array overrun on alloc() after leak"); + + ATF_REQUIRE(uvm_physseg_alloc(sizeof(struct uvm_physseg))); +} +#endif /* VM_PHYSSEG_MAX */ +#endif /* UVM_HOTPLUG */ + +/* + * Note: This function replicates verbatim what happens in + * uvm_page.c:uvm_page_init(). + * + * Please track any changes that happen there. + */ +static void +uvm_page_init_fake(struct vm_page *pagearray, psize_t pagecount) +{ + uvm_physseg_t bank; + size_t n; + + for (bank = uvm_physseg_get_first(), + uvm_physseg_seg_chomp_slab(bank, pagearray, pagecount); + uvm_physseg_valid_p(bank); + bank = uvm_physseg_get_next(bank)) { + + n = uvm_physseg_get_end(bank) - uvm_physseg_get_start(bank); + uvm_physseg_seg_alloc_from_slab(bank, n); + uvm_physseg_init_seg(bank, pagearray); + + /* set up page array pointers */ + pagearray += n; + pagecount -= n; + } + + uvm.page_init_done = true; +} + +ATF_TC(uvm_physseg_plug); +ATF_TC_HEAD(uvm_physseg_plug, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test plug functionality."); +} +/* Note: We only do the second boot time plug if VM_PHYSSEG_MAX > 1 */ +ATF_TC_BODY(uvm_physseg_plug, tc) +{ + int nentries = 0; /* Count of entries via plug done so far */ + uvm_physseg_t upm1; +#if VM_PHYSSEG_MAX > 2 + uvm_physseg_t upm2; +#endif + +#if VM_PHYSSEG_MAX > 1 + uvm_physseg_t upm3; +#endif + uvm_physseg_t upm4; + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2); + psize_t npages3 = (VALID_END_PFN_3 - VALID_START_PFN_3); + psize_t npages4 = (VALID_END_PFN_4 - VALID_START_PFN_4); + struct vm_page *pgs, *slab = malloc(sizeof(struct vm_page) * (npages1 +#if VM_PHYSSEG_MAX > 2 + + npages2 +#endif + + npages3)); + + /* Fake early boot */ + + setup(); + + /* Vanilla plug x 2 */ + ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_1, npages1, &upm1), true); + ATF_REQUIRE_EQ(++nentries, uvm_physseg_get_entries()); + ATF_REQUIRE_EQ(0, uvmexp.npages); + +#if VM_PHYSSEG_MAX > 2 + ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_2, npages2, &upm2), true); + ATF_REQUIRE_EQ(++nentries, uvm_physseg_get_entries()); + ATF_REQUIRE_EQ(0, uvmexp.npages); +#endif + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2 + npages3); + + ATF_CHECK_EQ(npages1 +#if VM_PHYSSEG_MAX > 2 + + npages2 +#endif + , uvmexp.npages); +#if VM_PHYSSEG_MAX > 1 + /* Scavenge plug - goes into the same slab */ + ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_3, npages3, &upm3), true); + ATF_REQUIRE_EQ(++nentries, uvm_physseg_get_entries()); + ATF_REQUIRE_EQ(npages1 +#if VM_PHYSSEG_MAX > 2 + + npages2 +#endif + + npages3, uvmexp.npages); + + /* Scavenge plug should fit right in the slab */ + pgs = uvm_physseg_get_pg(upm3, 0); + ATF_REQUIRE(pgs > slab && pgs < (slab + npages1 + npages2 + npages3)); +#endif + /* Hot plug - goes into a brand new slab */ + ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_4, npages4, &upm4), true); + /* The hot plug slab should have nothing to do with the original slab */ + pgs = uvm_physseg_get_pg(upm4, 0); + ATF_REQUIRE(pgs < slab || pgs > (slab + npages1 +#if VM_PHYSSEG_MAX > 2 + + npages2 +#endif + + npages3)); + +} +ATF_TC(uvm_physseg_unplug); +ATF_TC_HEAD(uvm_physseg_unplug, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test unplug functionality."); +} +ATF_TC_BODY(uvm_physseg_unplug, tc) +{ + paddr_t pa = 0; + + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2); + psize_t npages3 = (VALID_END_PFN_3 - VALID_START_PFN_3); + + struct vm_page *slab = malloc(sizeof(struct vm_page) * (npages1 + npages2 + npages3)); + + uvm_physseg_t upm; + + /* Boot time */ + setup(); + + /* We start with zero segments */ + ATF_REQUIRE_EQ(true, uvm_physseg_plug(atop(0), atop(ONE_MEGABYTE), NULL)); + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + /* Do we have an arbitrary offset in there ? */ + uvm_physseg_find(atop(TWOFIFTYSIX_KILO), &pa); + ATF_REQUIRE_EQ(pa, atop(TWOFIFTYSIX_KILO)); + ATF_REQUIRE_EQ(0, uvmexp.npages); /* Boot time sanity */ + +#if VM_PHYSSEG_MAX == 1 + /* + * This is the curious case at boot time, of having one + * extent(9) static entry per segment, which means that a + * fragmenting unplug will fail. + */ + atf_tc_expect_signal(SIGABRT, "fragmenting unplug for single segment"); + + /* + * In order to test the fragmenting cases, please set + * VM_PHYSSEG_MAX > 1 + */ +#endif + /* Now let's unplug from the middle */ + ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(TWOFIFTYSIX_KILO), atop(FIVEONETWO_KILO))); + /* verify that a gap exists at TWOFIFTYSIX_KILO */ + pa = 0; /* reset */ + uvm_physseg_find(atop(TWOFIFTYSIX_KILO), &pa); + ATF_REQUIRE_EQ(pa, 0); + + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2 + npages3); + /* Account for the unplug */ + ATF_CHECK_EQ(atop(FIVEONETWO_KILO), uvmexp.npages); + + /* Original entry should fragment into two */ + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + upm = uvm_physseg_find(atop(TWOFIFTYSIX_KILO + FIVEONETWO_KILO), NULL); + + ATF_REQUIRE(uvm_physseg_valid_p(upm)); + + /* Now unplug the tail fragment - should swallow the complete entry */ + ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(TWOFIFTYSIX_KILO + FIVEONETWO_KILO), atop(TWOFIFTYSIX_KILO))); + + /* The "swallow" above should have invalidated the handle */ + ATF_REQUIRE_EQ(false, uvm_physseg_valid_p(upm)); + + /* Only the first one is left now */ + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Unplug from the back */ + ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(ONETWENTYEIGHT_KILO), atop(ONETWENTYEIGHT_KILO))); + /* Shouldn't change the number of segments */ + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Unplug from the front */ + ATF_REQUIRE_EQ(true, uvm_physseg_unplug(0, atop(SIXTYFOUR_KILO))); + /* Shouldn't change the number of segments */ + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Unplugging the final fragment should fail */ + atf_tc_expect_signal(SIGABRT, "Unplugging the last segment"); + ATF_REQUIRE_EQ(true, uvm_physseg_unplug(atop(SIXTYFOUR_KILO), atop(SIXTYFOUR_KILO))); +} + + +/* <---- end Tests for Internal functions ----> */ + +/* Tests for functions exported via uvm_physseg.h */ +ATF_TC(uvm_physseg_init); +ATF_TC_HEAD(uvm_physseg_init, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_init() call\ + initializes the vm_physmem struct which holds the rb_tree."); +} +ATF_TC_BODY(uvm_physseg_init, tc) +{ + uvm_physseg_init(); + + ATF_REQUIRE_EQ(0, uvm_physseg_get_entries()); +} + +ATF_TC(uvm_page_physload_preload); +ATF_TC_HEAD(uvm_page_physload_preload, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physload() \ + call works without a panic() in a preload scenario."); +} +ATF_TC_BODY(uvm_page_physload_preload, tc) +{ + uvm_physseg_t upm; + + setup(); + + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Should return a valid handle */ + ATF_REQUIRE(uvm_physseg_valid_p(upm)); + + /* No pages should be allocated yet */ + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* After the first call one segment should exist */ + ATF_CHECK_EQ(1, uvm_physseg_get_entries()); + + /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + /* Should return a valid handle */ + ATF_REQUIRE(uvm_physseg_valid_p(upm)); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* After the second call two segments should exist */ + ATF_CHECK_EQ(2, uvm_physseg_get_entries()); +#endif +} + +ATF_TC(uvm_page_physload_postboot); +ATF_TC_HEAD(uvm_page_physload_postboot, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physload() \ + panic()s in a post boot scenario."); +} +ATF_TC_BODY(uvm_page_physload_postboot, tc) +{ + uvm_physseg_t upm; + + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2); + + struct vm_page *slab = malloc(sizeof(struct vm_page) * (npages1 + npages2)); + + setup(); + + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Should return a valid handle */ + ATF_REQUIRE(uvm_physseg_valid_p(upm)); + + /* No pages should be allocated yet */ + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* After the first call one segment should exist */ + ATF_CHECK_EQ(1, uvm_physseg_get_entries()); + + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2); + + atf_tc_expect_signal(SIGABRT, + "uvm_page_physload() called post boot"); + + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + /* Should return a valid handle */ + ATF_REQUIRE(uvm_physseg_valid_p(upm)); + + ATF_REQUIRE_EQ(npages1 + npages2, uvmexp.npages); + + /* After the second call two segments should exist */ + ATF_CHECK_EQ(2, uvm_physseg_get_entries()); +} + +ATF_TC(uvm_physseg_handle_immutable); +ATF_TC_HEAD(uvm_physseg_handle_immutable, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the uvm_physseg_t handle is \ + immutable."); +} +ATF_TC_BODY(uvm_physseg_handle_immutable, tc) +{ + uvm_physseg_t upm; + + /* We insert the segments in out of order */ + + setup(); + + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_EMPTY, uvm_physseg_get_prev(upm)); + + /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */ +#if VM_PHYSSEG_MAX > 1 + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + /* Fetch Previous, we inserted a lower value */ + upm = uvm_physseg_get_prev(upm); + +#if !defined(UVM_HOTPLUG) + /* + * This test is going to fail for the Array Implementation but is + * expected to pass in the RB Tree implementation. + */ + /* Failure can be expected iff there are more than one handles */ + atf_tc_expect_fail("Mutable handle in static array impl."); +#endif + ATF_CHECK(UVM_PHYSSEG_TYPE_INVALID_EMPTY != upm); + ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm)); +#endif +} + +ATF_TC(uvm_physseg_seg_chomp_slab); +ATF_TC_HEAD(uvm_physseg_seg_chomp_slab, tc) +{ + atf_tc_set_md_var(tc, "descr", "The slab import code.()"); + +} +ATF_TC_BODY(uvm_physseg_seg_chomp_slab, tc) +{ + int err; + size_t i; + struct uvm_physseg *seg; + struct vm_page *slab, *pgs; + const size_t npages = UVM_PHYSSEG_BOOT_UNPLUG_MAX; /* Number of pages */ + + setup(); + + /* This is boot time */ + slab = malloc(sizeof(struct vm_page) * npages * 2); + + seg = uvm_physseg_alloc(sizeof(struct uvm_physseg)); + + uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2); + + /* Should be able to allocate two 128 * sizeof(*slab) */ + ATF_REQUIRE_EQ(0, extent_alloc(seg->ext, sizeof(*slab), 1, 0, EX_BOUNDZERO, (void *)&pgs)); + err = extent_free(seg->ext, (u_long) pgs, sizeof(*slab), EX_BOUNDZERO); + +#if VM_PHYSSEG_MAX == 1 + /* + * free() needs an extra region descriptor, but we only have + * one! The classic alloc() at free() problem + */ + + ATF_REQUIRE_EQ(ENOMEM, err); +#else + /* Try alloc/free at static time */ + for (i = 0; i < npages; i++) { + ATF_REQUIRE_EQ(0, extent_alloc(seg->ext, sizeof(*slab), 1, 0, EX_BOUNDZERO, (void *)&pgs)); + err = extent_free(seg->ext, (u_long) pgs, sizeof(*slab), EX_BOUNDZERO); + ATF_REQUIRE_EQ(0, err); + } +#endif + + /* Now setup post boot */ + uvm.page_init_done = true; + + uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2); + + /* Try alloc/free after uvm_page.c:uvm_page_init() as well */ + for (i = 0; i < npages; i++) { + ATF_REQUIRE_EQ(0, extent_alloc(seg->ext, sizeof(*slab), 1, 0, EX_BOUNDZERO, (void *)&pgs)); + err = extent_free(seg->ext, (u_long) pgs, sizeof(*slab), EX_BOUNDZERO); + ATF_REQUIRE_EQ(0, err); + } + +} + +ATF_TC(uvm_physseg_alloc_from_slab); +ATF_TC_HEAD(uvm_physseg_alloc_from_slab, tc) +{ + atf_tc_set_md_var(tc, "descr", "The slab alloc code.()"); + +} +ATF_TC_BODY(uvm_physseg_alloc_from_slab, tc) +{ + struct uvm_physseg *seg; + struct vm_page *slab, *pgs; + const size_t npages = UVM_PHYSSEG_BOOT_UNPLUG_MAX; /* Number of pages */ + + setup(); + + /* This is boot time */ + slab = malloc(sizeof(struct vm_page) * npages * 2); + + seg = uvm_physseg_alloc(sizeof(struct uvm_physseg)); + + uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2); + + pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages); + + ATF_REQUIRE(pgs != NULL); + + /* Now setup post boot */ + uvm.page_init_done = true; + +#if VM_PHYSSEG_MAX > 1 + pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages); + ATF_REQUIRE(pgs != NULL); +#endif + atf_tc_expect_fail("alloc beyond extent"); + + pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages); + ATF_REQUIRE(pgs != NULL); +} + +ATF_TC(uvm_physseg_init_seg); +ATF_TC_HEAD(uvm_physseg_init_seg, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if uvm_physseg_init_seg adds pages to" + "uvmexp.npages"); +} +ATF_TC_BODY(uvm_physseg_init_seg, tc) +{ + struct uvm_physseg *seg; + struct vm_page *slab, *pgs; + const size_t npages = UVM_PHYSSEG_BOOT_UNPLUG_MAX; /* Number of pages */ + + setup(); + + /* This is boot time */ + slab = malloc(sizeof(struct vm_page) * npages * 2); + + seg = uvm_physseg_alloc(sizeof(struct uvm_physseg)); + + uvm_physseg_seg_chomp_slab(PHYSSEG_NODE_TO_HANDLE(seg), slab, npages * 2); + + pgs = uvm_physseg_seg_alloc_from_slab(PHYSSEG_NODE_TO_HANDLE(seg), npages); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + seg->start = 0; + seg->end = npages; + + seg->avail_start = 0; + seg->avail_end = npages; + + uvm_physseg_init_seg(PHYSSEG_NODE_TO_HANDLE(seg), pgs); + + ATF_REQUIRE_EQ(npages, uvmexp.npages); +} + +#if 0 +ATF_TC(uvm_physseg_init_seg); +ATF_TC_HEAD(uvm_physseg_init_seg, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physload() \ + call works without a panic() after Segment is inited."); +} +ATF_TC_BODY(uvm_physseg_init_seg, tc) +{ + uvm_physseg_t upm; + psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1); + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(0, uvmexp.npages); + + /* + * Boot time physplug needs explicit external init, + * Duplicate what uvm_page.c:uvm_page_init() does. + * Note: not everything uvm_page_init() does gets done here. + * Read the source. + */ + /* suck in backing slab, initialise extent. */ + uvm_physseg_seg_chomp_slab(upm, pgs, npages); + + /* + * Actual pgs[] allocation, from extent. + */ + uvm_physseg_alloc_from_slab(upm, npages); + + /* Now we initialize the segment */ + uvm_physseg_init_seg(upm, pgs); + + /* Done with boot simulation */ + extent_init(); + uvm.page_init_done = true; + + /* We have total memory of 1MB */ + ATF_CHECK_EQ(PAGE_COUNT_1M, uvmexp.npages); + + upm =uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + /* We added another 1MB so PAGE_COUNT_1M + PAGE_COUNT_1M */ + ATF_CHECK_EQ(PAGE_COUNT_1M + PAGE_COUNT_1M, uvmexp.npages); + +} +#endif + +ATF_TC(uvm_physseg_get_start); +ATF_TC_HEAD(uvm_physseg_get_start, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the start PFN is returned \ + correctly from a segment created via uvm_page_physload()."); +} +ATF_TC_BODY(uvm_physseg_get_start, tc) +{ + uvm_physseg_t upm; + + /* Fake early boot */ + setup(); + + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_start_invalid); +ATF_TC_HEAD(uvm_physseg_get_start_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \ + correctly when uvm_physseg_get_start() is called with invalid \ + parameter values."); +} +ATF_TC_BODY(uvm_physseg_get_start_invalid, tc) +{ + /* Check for pgs == NULL */ + setup(); + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Force other check conditions */ + uvm.page_init_done = true; + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(true, uvm.page_init_done); + + /* Invalid uvm_physseg_t */ + ATF_CHECK_EQ((paddr_t) -1, + uvm_physseg_get_start(UVM_PHYSSEG_TYPE_INVALID)); +} + +ATF_TC(uvm_physseg_get_end); +ATF_TC_HEAD(uvm_physseg_get_end, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the end PFN is returned \ + correctly from a segment created via uvm_page_physload()."); +} +ATF_TC_BODY(uvm_physseg_get_end, tc) +{ + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_end_invalid); +ATF_TC_HEAD(uvm_physseg_get_end_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \ + correctly when uvm_physseg_get_end() is called with invalid \ + parameter values."); +} +ATF_TC_BODY(uvm_physseg_get_end_invalid, tc) +{ + /* Check for pgs == NULL */ + setup(); + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Force other check conditions */ + uvm.page_init_done = true; + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(true, uvm.page_init_done); + + /* Invalid uvm_physseg_t */ + ATF_CHECK_EQ((paddr_t) -1, + uvm_physseg_get_end(UVM_PHYSSEG_TYPE_INVALID)); +} + +ATF_TC(uvm_physseg_get_avail_start); +ATF_TC_HEAD(uvm_physseg_get_avail_start, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the avail_start PFN is \ + returned correctly from a segment created via uvm_page_physload()."); +} +ATF_TC_BODY(uvm_physseg_get_avail_start, tc) +{ + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_avail_start_invalid); +ATF_TC_HEAD(uvm_physseg_get_avail_start_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \ + correctly when uvm_physseg_get_avail_start() is called with invalid\ + parameter values."); +} +ATF_TC_BODY(uvm_physseg_get_avail_start_invalid, tc) +{ + /* Check for pgs == NULL */ + setup(); + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Force other check conditions */ + uvm.page_init_done = true; + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(true, uvm.page_init_done); + + /* Invalid uvm_physseg_t */ + ATF_CHECK_EQ((paddr_t) -1, + uvm_physseg_get_avail_start(UVM_PHYSSEG_TYPE_INVALID)); +} + +ATF_TC(uvm_physseg_get_avail_end); +ATF_TC_HEAD(uvm_physseg_get_avail_end, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the avail_end PFN is \ + returned correctly from a segment created via uvm_page_physload()."); +} +ATF_TC_BODY(uvm_physseg_get_avail_end, tc) +{ + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_avail_end_invalid); +ATF_TC_HEAD(uvm_physseg_get_avail_end_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \ + correctly when uvm_physseg_get_avail_end() is called with invalid\ + parameter values."); +} +ATF_TC_BODY(uvm_physseg_get_avail_end_invalid, tc) +{ + /* Check for pgs == NULL */ + setup(); + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Force other check conditions */ + uvm.page_init_done = true; + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(true, uvm.page_init_done); + + /* Invalid uvm_physseg_t */ + ATF_CHECK_EQ((paddr_t) -1, + uvm_physseg_get_avail_end(UVM_PHYSSEG_TYPE_INVALID)); +} + +ATF_TC(uvm_physseg_get_next); +ATF_TC_HEAD(uvm_physseg_get_next, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the pointer values for next \ + segment using the uvm_physseg_get_next() call."); +} +ATF_TC_BODY(uvm_physseg_get_next, tc) +{ + uvm_physseg_t upm; +#if VM_PHYSSEG_MAX > 1 + uvm_physseg_t upm_next; +#endif + + /* We insert the segments in ascending order */ + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_OVERFLOW, + uvm_physseg_get_next(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm_next = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + upm = uvm_physseg_get_next(upm); /* Fetch Next */ + + ATF_CHECK_EQ(upm_next, upm); + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); +#endif + + /* This test will be triggered only if there are 3 or more segments. */ +#if VM_PHYSSEG_MAX > 2 + upm_next = uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3, + VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(3, uvm_physseg_get_entries()); + + upm = uvm_physseg_get_next(upm); /* Fetch Next */ + + ATF_CHECK_EQ(upm_next, upm); + ATF_CHECK_EQ(VALID_START_PFN_3, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_3, uvm_physseg_get_end(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_next_invalid); +ATF_TC_HEAD(uvm_physseg_get_next_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \ + correctly when uvm_physseg_get_next() is called with invalid \ + parameter values."); +} +ATF_TC_BODY(uvm_physseg_get_next_invalid, tc) +{ + uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID; + + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID, uvm_physseg_get_next(upm)); +} + +ATF_TC(uvm_physseg_get_prev); +ATF_TC_HEAD(uvm_physseg_get_prev, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the pointer values for previous \ + segment using the uvm_physseg_get_prev() call."); +} +ATF_TC_BODY(uvm_physseg_get_prev, tc) +{ +#if VM_PHYSSEG_MAX > 1 + uvm_physseg_t upm; +#endif + uvm_physseg_t upm_prev; + + + setup(); + upm_prev = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_EMPTY, + uvm_physseg_get_prev(upm_prev)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + /* Fetch Previous, we inserted a lower value */ + upm = uvm_physseg_get_prev(upm); + + ATF_CHECK_EQ(upm_prev, upm); + ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm)); +#endif + + /* This test will be triggered only if there are 3 or more segments. */ +#if VM_PHYSSEG_MAX > 2 + uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3, + VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(3, uvm_physseg_get_entries()); + + /* + * This will return a UVM_PHYSSEG_TYPE_INVALID_EMPTY we are at the + * lowest + */ + upm = uvm_physseg_get_prev(upm); + + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID_EMPTY, upm); +#endif +} + +ATF_TC(uvm_physseg_get_prev_invalid); +ATF_TC_HEAD(uvm_physseg_get_prev_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the invalid / error conditions \ + correctly when uvm_physseg_get_prev() is called with invalid \ + parameter values."); +} +ATF_TC_BODY(uvm_physseg_get_prev_invalid, tc) +{ + uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID; + + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID, uvm_physseg_get_prev(upm)); +} + +ATF_TC(uvm_physseg_get_first); +ATF_TC_HEAD(uvm_physseg_get_first, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the pointer values for first \ + segment (lowest node) using the uvm_physseg_get_first() call."); +} +ATF_TC_BODY(uvm_physseg_get_first, tc) +{ + uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID_EMPTY; + uvm_physseg_t upm_first; + + /* Fake early boot */ + setup(); + + /* No nodes exist */ + ATF_CHECK_EQ(upm, uvm_physseg_get_first()); + + upm_first = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Pointer to first should be the least valued node */ + upm = uvm_physseg_get_first(); + ATF_CHECK_EQ(upm_first, upm); + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + /* Insert a node of lesser value */ + upm_first = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_CHECK_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + /* Pointer to first should be the least valued node */ + upm = uvm_physseg_get_first(); + ATF_CHECK_EQ(upm_first, upm); + ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm)); +#endif + + /* This test will be triggered only if there are 3 or more segments. */ +#if VM_PHYSSEG_MAX > 2 + /* Insert a node of higher value */ + upm_first =uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3, + VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT); + + ATF_CHECK_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(3, uvm_physseg_get_entries()); + + /* Pointer to first should be the least valued node */ + upm = uvm_physseg_get_first(); + ATF_CHECK(upm_first != upm); + ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_last); +ATF_TC_HEAD(uvm_physseg_get_last, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the pointer values for last \ + segment using the uvm_physseg_get_last() call."); +} +ATF_TC_BODY(uvm_physseg_get_last, tc) +{ + uvm_physseg_t upm = UVM_PHYSSEG_TYPE_INVALID_EMPTY; + uvm_physseg_t upm_last; + + setup(); + + /* No nodes exist */ + ATF_CHECK_EQ(upm, uvm_physseg_get_last()); + + upm_last = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Pointer to last should be the most valued node */ + upm = uvm_physseg_get_last(); + ATF_CHECK_EQ(upm_last, upm); + ATF_CHECK_EQ(VALID_START_PFN_1, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_1, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_1, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1, uvm_physseg_get_avail_end(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + /* Insert node of greater value */ + upm_last = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + /* Pointer to last should be the most valued node */ + upm = uvm_physseg_get_last(); + ATF_CHECK_EQ(upm_last, upm); + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm)); +#endif + + /* This test will be triggered only if there are 3 or more segments. */ +#if VM_PHYSSEG_MAX > 2 + /* Insert node of greater value */ + upm_last = uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3, + VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(3, uvm_physseg_get_entries()); + + /* Pointer to last should be the most valued node */ + upm = uvm_physseg_get_last(); + ATF_CHECK_EQ(upm_last, upm); + ATF_CHECK_EQ(VALID_START_PFN_3, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_3, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_3, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_3, uvm_physseg_get_avail_end(upm)); +#endif +} + +ATF_TC(uvm_physseg_valid); +ATF_TC_HEAD(uvm_physseg_valid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the pointer value for current \ + segment is valid using the uvm_physseg_valid_p() call."); +} +ATF_TC_BODY(uvm_physseg_valid, tc) +{ + psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + uvm_physseg_init_seg(upm, pgs); + + ATF_REQUIRE_EQ(PAGE_COUNT_1M, uvmexp.npages); + + ATF_CHECK_EQ(true, uvm_physseg_valid_p(upm)); +} + +ATF_TC(uvm_physseg_valid_invalid); +ATF_TC_HEAD(uvm_physseg_valid_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests the pointer value for current \ + segment is invalid using the uvm_physseg_valid_p() call."); +} +ATF_TC_BODY(uvm_physseg_valid_invalid, tc) +{ + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Force other check conditions */ + uvm.page_init_done = true; + + ATF_REQUIRE_EQ(true, uvm.page_init_done); + + /* Invalid uvm_physseg_t */ + ATF_CHECK_EQ(false, uvm_physseg_valid_p(UVM_PHYSSEG_TYPE_INVALID)); + + /* + * Without any pages initialized for segment, it is considered + * invalid + */ + ATF_CHECK_EQ(false, uvm_physseg_valid_p(upm)); +} + +ATF_TC(uvm_physseg_get_highest); +ATF_TC_HEAD(uvm_physseg_get_highest, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned PFN matches \ + the highest PFN in use by the system."); +} +ATF_TC_BODY(uvm_physseg_get_highest, tc) +{ + setup(); + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Only one segment so highest is the current */ + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_1 - 1, uvm_physseg_get_highest_frame()); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3, + VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_DEFAULT); + + /* PFN_3 > PFN_1 */ + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_3 - 1, uvm_physseg_get_highest_frame()); +#endif + + /* This test will be triggered only if there are 3 or more segments. */ +#if VM_PHYSSEG_MAX > 2 + uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + /* PFN_3 > PFN_2 */ + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_3 - 1, uvm_physseg_get_highest_frame()); +#endif +} + +ATF_TC(uvm_physseg_get_free_list); +ATF_TC_HEAD(uvm_physseg_get_free_list, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned Free List type \ + of a segment matches the one returned from \ + uvm_physseg_get_free_list() call."); +} +ATF_TC_BODY(uvm_physseg_get_free_list, tc) +{ + uvm_physseg_t upm; + + /* Fake early boot */ + setup(); + + /* Insertions are made in ascending order */ + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_CHECK_EQ(VM_FREELIST_DEFAULT, uvm_physseg_get_free_list(upm)); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_FIRST16); + + ATF_CHECK_EQ(VM_FREELIST_FIRST16, uvm_physseg_get_free_list(upm)); +#endif + + /* This test will be triggered only if there are 3 or more segments. */ +#if VM_PHYSSEG_MAX > 2 + upm = uvm_page_physload(VALID_START_PFN_3, VALID_END_PFN_3, + VALID_AVAIL_START_PFN_3, VALID_AVAIL_END_PFN_3, VM_FREELIST_FIRST1G); + + ATF_CHECK_EQ(VM_FREELIST_FIRST1G, uvm_physseg_get_free_list(upm)); +#endif +} + +ATF_TC(uvm_physseg_get_start_hint); +ATF_TC_HEAD(uvm_physseg_get_start_hint, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned start_hint value \ + of a segment matches the one returned from \ + uvm_physseg_get_start_hint() call."); +} +ATF_TC_BODY(uvm_physseg_get_start_hint, tc) +{ + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Will be Zero since no specific value is set during init */ + ATF_CHECK_EQ(0, uvm_physseg_get_start_hint(upm)); +} + +ATF_TC(uvm_physseg_set_start_hint); +ATF_TC_HEAD(uvm_physseg_set_start_hint, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned start_hint value \ + of a segment matches the one set by the \ + uvm_physseg_set_start_hint() call."); +} +ATF_TC_BODY(uvm_physseg_set_start_hint, tc) +{ + psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + uvm_physseg_init_seg(upm, pgs); + + ATF_CHECK_EQ(true, uvm_physseg_set_start_hint(upm, atop(128))); + + /* Will be atop(128) since no specific value is set above */ + ATF_CHECK_EQ(atop(128), uvm_physseg_get_start_hint(upm)); +} + +ATF_TC(uvm_physseg_set_start_hint_invalid); +ATF_TC_HEAD(uvm_physseg_set_start_hint_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned value is false \ + when an invalid segment matches the one trying to set by the \ + uvm_physseg_set_start_hint() call."); +} +ATF_TC_BODY(uvm_physseg_set_start_hint_invalid, tc) +{ + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + /* Force other check conditions */ + uvm.page_init_done = true; + + ATF_REQUIRE_EQ(true, uvm.page_init_done); + + ATF_CHECK_EQ(false, uvm_physseg_set_start_hint(upm, atop(128))); + + /* + * Will be Zero since no specific value is set after the init + * due to failure + */ + atf_tc_expect_signal(SIGABRT, "invalid uvm_physseg_t handle"); + + ATF_CHECK_EQ(0, uvm_physseg_get_start_hint(upm)); +} + +ATF_TC(uvm_physseg_get_pg); +ATF_TC_HEAD(uvm_physseg_get_pg, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned vm_page struct \ + is correct when fetched by uvm_physseg_get_pg() call."); +} +ATF_TC_BODY(uvm_physseg_get_pg, tc) +{ + psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + struct vm_page *extracted_pg = NULL; + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* Now we initialize the segment */ + uvm_physseg_init_seg(upm, pgs); + + ATF_REQUIRE_EQ(PAGE_COUNT_1M, uvmexp.npages); + + ATF_REQUIRE_EQ(NULL, extracted_pg); + + /* Try fetching the 5th Page in the Segment */ + extracted_pg = uvm_physseg_get_pg(upm, 5); + + /* Values of phys_addr is n * PAGE_SIZE where n is the page number */ + ATF_CHECK_EQ(5 * PAGE_SIZE, extracted_pg->phys_addr); + + /* Try fetching the 113th Page in the Segment */ + extracted_pg = uvm_physseg_get_pg(upm, 113); + + ATF_CHECK_EQ(113 * PAGE_SIZE, extracted_pg->phys_addr); +} + +#ifdef __HAVE_PMAP_PHYSSEG +ATF_TC(uvm_physseg_get_pmseg); +ATF_TC_HEAD(uvm_physseg_get_pmseg, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned pmap_physseg \ + struct is correct when fetched by uvm_physseg_get_pmseg() call."); +} +ATF_TC_BODY(uvm_physseg_get_pmseg, tc) +{ + psize_t npages = (VALID_END_PFN_1 - VALID_START_PFN_1); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + struct pmap_physseg pmseg = { true }; + + struct pmap_physseg *extracted_pmseg = NULL; + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* Now we initialize the segment */ + uvm_physseg_init_seg(upm, pgs); + + ATF_REQUIRE_EQ(PAGE_COUNT_1M, uvmexp.npages); + + ATF_REQUIRE_EQ(NULL, extracted_pmseg); + + ATF_REQUIRE_EQ(true, pmseg.dummy_variable); + + /* Extract the current pmseg */ + extracted_pmseg = uvm_physseg_get_pmseg(upm); + + /* + * We can only check if it is not NULL + * We do not know the value it contains + */ + ATF_CHECK(NULL != extracted_pmseg); + + extracted_pmseg->dummy_variable = pmseg.dummy_variable; + + /* Invert value to ensure test integrity */ + pmseg.dummy_variable = false; + + ATF_REQUIRE_EQ(false, pmseg.dummy_variable); + + extracted_pmseg = uvm_physseg_get_pmseg(upm); + + ATF_CHECK(NULL != extracted_pmseg); + + ATF_CHECK_EQ(true, extracted_pmseg->dummy_variable); +} +#endif + +ATF_TC(vm_physseg_find); +ATF_TC_HEAD(vm_physseg_find, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned segment number \ + is correct when an PFN is passed into uvm_physseg_find() call. \ + In addition to this the offset of the PFN from the start of \ + segment is also set if the parameter is passed in as not NULL."); +} +ATF_TC_BODY(vm_physseg_find, tc) +{ + psize_t offset = (psize_t) -1; + + uvm_physseg_t upm_first, result; +#if VM_PHYSSEG_MAX > 1 + uvm_physseg_t upm_second; +#endif + + setup(); + + upm_first = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + upm_second = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); +#endif + + /* Under ONE_MEGABYTE is segment upm_first */ + result = uvm_physseg_find(atop(ONE_MEGABYTE - 1024), NULL); + ATF_CHECK_EQ(upm_first, result); + ATF_CHECK_EQ(uvm_physseg_get_start(upm_first), + uvm_physseg_get_start(result)); + ATF_CHECK_EQ(uvm_physseg_get_end(upm_first), + uvm_physseg_get_end(result)); + ATF_CHECK_EQ(uvm_physseg_get_avail_start(upm_first), + uvm_physseg_get_avail_start(result)); + ATF_CHECK_EQ(uvm_physseg_get_avail_end(upm_first), + uvm_physseg_get_avail_end(result)); + + ATF_REQUIRE_EQ((psize_t) -1, offset); + + /* This test will be triggered only if there are 2 or more segments. */ +#if VM_PHYSSEG_MAX > 1 + /* Over ONE_MEGABYTE is segment upm_second */ + result = uvm_physseg_find(atop(ONE_MEGABYTE + 8192), &offset); + ATF_CHECK_EQ(upm_second, result); + ATF_CHECK_EQ(uvm_physseg_get_start(upm_second), + uvm_physseg_get_start(result)); + ATF_CHECK_EQ(uvm_physseg_get_end(upm_second), + uvm_physseg_get_end(result)); + ATF_CHECK_EQ(uvm_physseg_get_avail_start(upm_second), + uvm_physseg_get_avail_start(result)); + ATF_CHECK_EQ(uvm_physseg_get_avail_end(upm_second), + uvm_physseg_get_avail_end(result)); + + /* Offset is calculated based on PAGE_SIZE */ + /* atop(ONE_MEGABYTE + (2 * PAGE_SIZE)) - VALID_START_PFN1 = 2 */ + ATF_CHECK_EQ(2, offset); +#else + /* Under ONE_MEGABYTE is segment upm_first */ + result = uvm_physseg_find(atop(ONE_MEGABYTE - 12288), &offset); + ATF_CHECK_EQ(upm_first, result); + ATF_CHECK_EQ(uvm_physseg_get_start(upm_first), + uvm_physseg_get_start(result)); + ATF_CHECK_EQ(uvm_physseg_get_end(upm_first), + uvm_physseg_get_end(result)); + ATF_CHECK_EQ(uvm_physseg_get_avail_start(upm_first), + uvm_physseg_get_avail_start(result)); + ATF_CHECK_EQ(uvm_physseg_get_avail_end(upm_first), + uvm_physseg_get_avail_end(result)); + + /* Offset is calculated based on PAGE_SIZE */ + /* atop(ONE_MEGABYTE - (3 * PAGE_SIZE)) - VALID_START_PFN1 = 253 */ + ATF_CHECK_EQ(253, offset); +#endif +} + +ATF_TC(vm_physseg_find_invalid); +ATF_TC_HEAD(vm_physseg_find_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the returned segment number \ + is (paddr_t) -1 when a non existant PFN is passed into \ + uvm_physseg_find() call."); +} +ATF_TC_BODY(vm_physseg_find_invalid, tc) +{ + psize_t offset = (psize_t) -1; + + setup(); + uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* No segments over 3 MB exists at the moment */ + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID, + uvm_physseg_find(atop(ONE_MEGABYTE * 3), NULL)); + + ATF_REQUIRE_EQ((psize_t) -1, offset); + + /* No segments over 3 MB exists at the moment */ + ATF_CHECK_EQ(UVM_PHYSSEG_TYPE_INVALID, + uvm_physseg_find(atop(ONE_MEGABYTE * 3), &offset)); + + ATF_CHECK_EQ((psize_t) -1, offset); +} + +ATF_TC(uvm_page_physunload_start); +ATF_TC_HEAD(uvm_page_physunload_start, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physunload()\ + call works without a panic(). Unloads from Start of the segment."); +} +ATF_TC_BODY(uvm_page_physunload_start, tc) +{ + /* + * Would uvmexp.npages reduce everytime an uvm_page_physunload is called? + */ + psize_t npages = (VALID_END_PFN_2 - VALID_START_PFN_2); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + uvm_physseg_init_seg(upm, pgs); + + ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p)); + + /* + * When called for first time, uvm_page_physload() removes the first PFN + * + * New avail start will be VALID_AVAIL_START_PFN_2 + 1 + */ + ATF_CHECK_EQ(VALID_START_PFN_2, atop(p)); + + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2 + 1, + uvm_physseg_get_avail_start(upm)); + + ATF_CHECK_EQ(VALID_START_PFN_2 + 1, uvm_physseg_get_start(upm)); + + /* Rest of the stuff should remain the same */ + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm)); +} + +ATF_TC(uvm_page_physunload_end); +ATF_TC_HEAD(uvm_page_physunload_end, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physunload()\ + call works without a panic(). Unloads from End of the segment."); +} +ATF_TC_BODY(uvm_page_physunload_end, tc) +{ + /* + * Would uvmexp.npages reduce everytime an uvm_page_physunload is called? + */ + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + /* Note: start != avail_start to remove from end. */ + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2 + 1, VALID_AVAIL_END_PFN_2, + VM_FREELIST_DEFAULT); + + p = 0; + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE( + uvm_physseg_get_avail_start(upm) != uvm_physseg_get_start(upm)); + + ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p)); + + /* + * Remember if X is the upper limit the actual valid pointer is X - 1 + * + * For example if 256 is the upper limit for 1MB memory, last valid + * pointer is 256 - 1 = 255 + */ + + ATF_CHECK_EQ(VALID_END_PFN_2 - 1, atop(p)); + + /* + * When called for second time, uvm_page_physload() removes the last PFN + * + * New avail end will be VALID_AVAIL_END_PFN_2 - 1 + * New end will be VALID_AVAIL_PFN_2 - 1 + */ + + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2 - 1, uvm_physseg_get_avail_end(upm)); + + ATF_CHECK_EQ(VALID_END_PFN_2 - 1, uvm_physseg_get_end(upm)); + + /* Rest of the stuff should remain the same */ + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2 + 1, + uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); +} + +ATF_TC(uvm_page_physunload_none); +ATF_TC_HEAD(uvm_page_physunload_none, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic uvm_page_physunload()\ + call works without a panic(). Does not unload from start or end \ + because of non-aligned start / avail_start and end / avail_end \ + respectively."); +} +ATF_TC_BODY(uvm_page_physunload_none, tc) +{ + psize_t npages = (VALID_END_PFN_2 - VALID_START_PFN_2); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + /* + * Note: start != avail_start and end != avail_end. + * + * This prevents any unload from occuring. + */ + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2 + 1, VALID_AVAIL_END_PFN_2 - 1, + VM_FREELIST_DEFAULT); + + p = 0; + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_REQUIRE( + uvm_physseg_get_avail_start(upm) != uvm_physseg_get_start(upm)); + + uvm_physseg_init_seg(upm, pgs); + + ATF_CHECK_EQ(false, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p)); + + /* uvm_page_physload() will no longer unload memory */ + ATF_CHECK_EQ(0, p); + + /* Rest of the stuff should remain the same */ + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2 + 1, + uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2 - 1, + uvm_physseg_get_avail_end(upm)); + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); +} + +ATF_TC(uvm_page_physunload_delete_start); +ATF_TC_HEAD(uvm_page_physunload_delete_start, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the uvm_page_physunload() \ + works when the segment gets small enough to be deleted scenario. \ + NOTE: This one works deletes from start."); +} +ATF_TC_BODY(uvm_page_physunload_delete_start, tc) +{ + /* + * Would uvmexp.npages reduce everytime an uvm_page_physunload is called? + */ + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + + /* + * Setup the Nuke from Starting point + */ + + upm = uvm_page_physload(VALID_END_PFN_1 - 1, VALID_END_PFN_1, + VALID_AVAIL_END_PFN_1 - 1, VALID_AVAIL_END_PFN_1, + VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */ +#if VM_PHYSSEG_MAX > 1 + uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); +#endif + +#if VM_PHYSSEG_MAX == 1 + atf_tc_expect_signal(SIGABRT, + "cannot uvm_page_physunload() the last segment"); +#endif + + ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p)); + + ATF_CHECK_EQ(VALID_END_PFN_1 - 1, atop(p)); + + ATF_CHECK_EQ(1, uvm_physseg_get_entries()); + + /* The only node now is the one we inserted second. */ + upm = uvm_physseg_get_first(); + + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm)); +} + +ATF_TC(uvm_page_physunload_delete_end); +ATF_TC_HEAD(uvm_page_physunload_delete_end, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the uvm_page_physunload() \ + works when the segment gets small enough to be deleted scenario. \ + NOTE: This one works deletes from end."); +} +ATF_TC_BODY(uvm_page_physunload_delete_end, tc) +{ + /* + * Would uvmexp.npages reduce everytime an uvm_page_physunload is called? + */ + + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + + /* + * Setup the Nuke from Ending point + */ + + upm = uvm_page_physload(VALID_START_PFN_1, VALID_START_PFN_1 + 2, + VALID_AVAIL_START_PFN_1 + 1, VALID_AVAIL_START_PFN_1 + 2, + VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */ +#if VM_PHYSSEG_MAX > 1 + uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); +#endif + +#if VM_PHYSSEG_MAX == 1 + atf_tc_expect_signal(SIGABRT, + "cannot uvm_page_physunload() the last segment"); +#endif + + ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p)); + + p = 0; + + ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, &p)); + + ATF_CHECK_EQ(VALID_START_PFN_1 + 2, atop(p)); + + ATF_CHECK_EQ(1, uvm_physseg_get_entries()); + + /* The only node now is the one we inserted second. */ + upm = uvm_physseg_get_first(); + + ATF_CHECK_EQ(VALID_START_PFN_2, uvm_physseg_get_start(upm)); + ATF_CHECK_EQ(VALID_END_PFN_2, uvm_physseg_get_end(upm)); + ATF_CHECK_EQ(VALID_AVAIL_START_PFN_2, uvm_physseg_get_avail_start(upm)); + ATF_CHECK_EQ(VALID_AVAIL_END_PFN_2, uvm_physseg_get_avail_end(upm)); +} + +ATF_TC(uvm_page_physunload_invalid); +ATF_TC_HEAD(uvm_page_physunload_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the uvm_page_physunload() \ + fails when then Free list does not match."); +} +ATF_TC_BODY(uvm_page_physunload_invalid, tc) +{ + psize_t npages = (VALID_END_PFN_2 - VALID_START_PFN_2); + + struct vm_page *pgs = malloc(sizeof(struct vm_page) * npages); + + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + uvm_physseg_init_seg(upm, pgs); + + ATF_CHECK_EQ(false, uvm_page_physunload(upm, VM_FREELIST_FIRST4G, &p)); +} + +ATF_TC(uvm_page_physunload_force); +ATF_TC_HEAD(uvm_page_physunload_force, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the basic \ + uvm_page_physunload_force() including delete works without."); +} +ATF_TC_BODY(uvm_page_physunload_force, tc) +{ + /* + * Would uvmexp.npages reduce everytime an uvm_page_physunload is called? + */ + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_1, VALID_END_PFN_1, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_END_PFN_1, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + /* Insert more than one segment iff VM_PHYSSEG_MAX > 1 */ +#if VM_PHYSSEG_MAX > 1 + /* + * We have couple of physloads done this is bacause of the fact that if + * we physunload all the PFs from a given range and we have only one + * segment in total a panic() is called + */ + uvm_page_physload(VALID_START_PFN_2, VALID_END_PFN_2, + VALID_AVAIL_START_PFN_2, VALID_AVAIL_END_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); +#endif + +#if VM_PHYSSEG_MAX == 1 + atf_tc_expect_signal(SIGABRT, + "cannot uvm_page_physunload() the last segment"); +#endif + + ATF_REQUIRE_EQ(VALID_AVAIL_START_PFN_1, + uvm_physseg_get_avail_start(upm)); + + for(paddr_t i = VALID_AVAIL_START_PFN_1; + i < VALID_AVAIL_END_PFN_1; i++) { + ATF_CHECK_EQ(true, + uvm_page_physunload_force(upm, VM_FREELIST_DEFAULT, &p)); + ATF_CHECK_EQ(i, atop(p)); + + if(i + 1 < VALID_AVAIL_END_PFN_1) + ATF_CHECK_EQ(i + 1, uvm_physseg_get_avail_start(upm)); + } + + /* + * Now we try to retrieve the segment, which has been removed + * from the system through force unloading all the pages inside it. + */ + upm = uvm_physseg_find(VALID_AVAIL_END_PFN_1 - 1, NULL); + + /* It should no longer exist */ + ATF_CHECK_EQ(NULL, upm); + + ATF_CHECK_EQ(1, uvm_physseg_get_entries()); +} + +ATF_TC(uvm_page_physunload_force_invalid); +ATF_TC_HEAD(uvm_page_physunload_force_invalid, tc) +{ + atf_tc_set_md_var(tc, "descr", "Tests if the invalid conditions for \ + uvm_page_physunload_force_invalid()."); +} +ATF_TC_BODY(uvm_page_physunload_force_invalid, tc) +{ + paddr_t p = 0; + + uvm_physseg_t upm; + + setup(); + upm = uvm_page_physload(VALID_START_PFN_2, VALID_START_PFN_2+ 1, + VALID_START_PFN_2, VALID_START_PFN_2, VM_FREELIST_DEFAULT); + + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + ATF_REQUIRE_EQ(0, uvmexp.npages); + + ATF_CHECK_EQ(false, + uvm_page_physunload_force(upm, VM_FREELIST_DEFAULT, &p)); + + ATF_CHECK_EQ(0, p); +} + +ATF_TP_ADD_TCS(tp) +{ +#if defined(UVM_HOTPLUG) + /* Internal */ + ATF_TP_ADD_TC(tp, uvm_physseg_alloc_atboot_mismatch); + ATF_TP_ADD_TC(tp, uvm_physseg_alloc_atboot_overrun); + ATF_TP_ADD_TC(tp, uvm_physseg_alloc_sanity); + ATF_TP_ADD_TC(tp, uvm_physseg_free_atboot_mismatch); + ATF_TP_ADD_TC(tp, uvm_physseg_free_sanity); +#if VM_PHYSSEG_MAX > 1 + ATF_TP_ADD_TC(tp, uvm_physseg_atboot_free_leak); +#endif +#endif /* UVM_HOTPLUG */ + + ATF_TP_ADD_TC(tp, uvm_physseg_plug); + ATF_TP_ADD_TC(tp, uvm_physseg_unplug); + + /* Exported */ + ATF_TP_ADD_TC(tp, uvm_physseg_init); + ATF_TP_ADD_TC(tp, uvm_page_physload_preload); + ATF_TP_ADD_TC(tp, uvm_page_physload_postboot); + ATF_TP_ADD_TC(tp, uvm_physseg_handle_immutable); + ATF_TP_ADD_TC(tp, uvm_physseg_seg_chomp_slab); + ATF_TP_ADD_TC(tp, uvm_physseg_alloc_from_slab); + ATF_TP_ADD_TC(tp, uvm_physseg_init_seg); + ATF_TP_ADD_TC(tp, uvm_physseg_get_start); + ATF_TP_ADD_TC(tp, uvm_physseg_get_start_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_end); + ATF_TP_ADD_TC(tp, uvm_physseg_get_end_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_start); + ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_start_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_end); + ATF_TP_ADD_TC(tp, uvm_physseg_get_avail_end_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_next); + ATF_TP_ADD_TC(tp, uvm_physseg_get_next_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_prev); + ATF_TP_ADD_TC(tp, uvm_physseg_get_prev_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_first); + ATF_TP_ADD_TC(tp, uvm_physseg_get_last); + ATF_TP_ADD_TC(tp, uvm_physseg_valid); + ATF_TP_ADD_TC(tp, uvm_physseg_valid_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_highest); + ATF_TP_ADD_TC(tp, uvm_physseg_get_free_list); + ATF_TP_ADD_TC(tp, uvm_physseg_get_start_hint); + ATF_TP_ADD_TC(tp, uvm_physseg_set_start_hint); + ATF_TP_ADD_TC(tp, uvm_physseg_set_start_hint_invalid); + ATF_TP_ADD_TC(tp, uvm_physseg_get_pg); + +#ifdef __HAVE_PMAP_PHYSSEG + ATF_TP_ADD_TC(tp, uvm_physseg_get_pmseg); +#endif + ATF_TP_ADD_TC(tp, vm_physseg_find); + ATF_TP_ADD_TC(tp, vm_physseg_find_invalid); + + ATF_TP_ADD_TC(tp, uvm_page_physunload_start); + ATF_TP_ADD_TC(tp, uvm_page_physunload_end); + ATF_TP_ADD_TC(tp, uvm_page_physunload_none); + ATF_TP_ADD_TC(tp, uvm_page_physunload_delete_start); + ATF_TP_ADD_TC(tp, uvm_page_physunload_delete_end); + ATF_TP_ADD_TC(tp, uvm_page_physunload_invalid); + ATF_TP_ADD_TC(tp, uvm_page_physunload_force); + ATF_TP_ADD_TC(tp, uvm_page_physunload_force_invalid); + + return atf_no_error(); +} diff --git a/sys/uvm/t_uvm_physseg_load.c b/sys/uvm/t_uvm_physseg_load.c new file mode 100644 index 000000000000..a150f6976c7b --- /dev/null +++ b/sys/uvm/t_uvm_physseg_load.c @@ -0,0 +1,740 @@ +/* $NetBSD: t_uvm_physseg_load.c,v 1.2 2016/12/22 08:15:20 cherry Exp $ */ + +/*- + * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Santhosh N. Raju and + * by Cherry G. Mathew + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__RCSID("$NetBSD: t_uvm_physseg_load.c,v 1.2 2016/12/22 08:15:20 cherry Exp $"); + +/* + * If this line is commented out tests related touvm_physseg_get_pmseg() + * wont run. + * + * Have a look at machine/uvm_physseg.h for more details. + */ +#define __HAVE_PMAP_PHYSSEG + +/* + * This is a dummy struct used for testing purposes + * + * In reality this struct would exist in the MD part of the code residing in + * machines/vmparam.h + */ + +#ifdef __HAVE_PMAP_PHYSSEG +struct pmap_physseg { + int dummy_variable; /* Dummy variable use for testing */ +}; +#endif + +/* Testing API - assumes userland */ +/* Provide Kernel API equivalents */ +#include +#include +#include /* memset(3) et. al */ +#include /* printf(3) */ +#include /* malloc(3) */ +#include +#include +#include + +#define PRIxPADDR "lx" +#define PRIxPSIZE "lx" +#define PRIuPSIZE "lu" +#define PRIxVADDR "lx" +#define PRIxVSIZE "lx" +#define PRIuVSIZE "lu" + +#define UVM_HOTPLUG /* Enable hotplug with rbtree. */ +#define PMAP_STEAL_MEMORY +#define DEBUG /* Enable debug functionality. */ + +typedef unsigned long vaddr_t; +typedef unsigned long paddr_t; +typedef unsigned long psize_t; +typedef unsigned long vsize_t; + +#include +#include + +#ifndef DIAGNOSTIC +#define KASSERTMSG(e, msg, ...) /* NOTHING */ +#define KASSERT(e) /* NOTHING */ +#else +#define KASSERT(a) assert(a) +#define KASSERTMSG(exp, ...) printf(__VA_ARGS__); assert((exp)) +#endif + +#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH + +#define VM_NFREELIST 4 +#define VM_FREELIST_DEFAULT 0 +#define VM_FREELIST_FIRST16 3 +#define VM_FREELIST_FIRST1G 2 +#define VM_FREELIST_FIRST4G 1 + +/* + * Used in tests when Array implementation is tested + */ +#if !defined(VM_PHYSSEG_MAX) +#define VM_PHYSSEG_MAX 32 +#endif + +#define PAGE_SIZE 4096 +#define PAGE_SHIFT 12 +#define atop(x) (((paddr_t)(x)) >> PAGE_SHIFT) + +#define mutex_enter(l) +#define mutex_exit(l) + +#define _SYS_KMEM_H_ /* Disallow the real kmem API (see below) */ +/* free(p) XXX: pgs management need more thought */ +#define kmem_alloc(size, flags) malloc(size) +#define kmem_zalloc(size, flags) malloc(size) +#define kmem_free(p, size) free(p) + +psize_t physmem; + +struct uvmexp uvmexp; /* decl */ + +/* + * uvm structure borrowed from uvm.h + * + * Remember this is a dummy structure used within the ATF Tests and + * uses only necessary fields from the original uvm struct. + * See uvm/uvm.h for the full struct. + */ + +struct uvm { + /* vm_page related parameters */ + + bool page_init_done; /* TRUE if uvm_page_init() finished */ +} uvm; + +static void +panic(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vprintf(fmt, ap); + printf("\n"); + va_end(ap); + KASSERT(false); + + /*NOTREACHED*/ +} + +static void +uvm_pagefree(struct vm_page *pg) +{ + return; +} + +#if defined(UVM_HOTPLUG) +static void +uvmpdpol_reinit(void) +{ + return; +} +#endif /* UVM_HOTPLUG */ + +/* end - Provide Kernel API equivalents */ + +#include "uvm/uvm_physseg.c" + +#include + +#define ONE_MEGABYTE 1024 * 1024 + +/* Sample Page Frame Numbers */ +#define VALID_START_PFN_1 atop(0) +#define VALID_END_PFN_1 atop(ONE_MEGABYTE) +#define VALID_AVAIL_START_PFN_1 atop(0) +#define VALID_AVAIL_END_PFN_1 atop(ONE_MEGABYTE) + +#define VALID_START_PFN_2 atop(ONE_MEGABYTE + 1) +#define VALID_END_PFN_2 atop(ONE_MEGABYTE * 2) +#define VALID_AVAIL_START_PFN_2 atop(ONE_MEGABYTE + 1) +#define VALID_AVAIL_END_PFN_2 atop(ONE_MEGABYTE * 2) + +#define VALID_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1) +#define VALID_END_PFN_3 atop(ONE_MEGABYTE * 3) +#define VALID_AVAIL_START_PFN_3 atop((ONE_MEGABYTE * 2) + 1) +#define VALID_AVAIL_END_PFN_3 atop(ONE_MEGABYTE * 3) + +#define VALID_START_PFN_4 atop(ONE_MEGABYTE + 1) +#define VALID_END_PFN_4 atop(ONE_MEGABYTE * 128) +#define VALID_AVAIL_START_PFN_4 atop(ONE_MEGABYTE + 1) +#define VALID_AVAIL_END_PFN_4 atop(ONE_MEGABYTE * 128) + +#define VALID_START_PFN_5 atop(ONE_MEGABYTE + 1) +#define VALID_END_PFN_5 atop(ONE_MEGABYTE * 256) +#define VALID_AVAIL_START_PFN_5 atop(ONE_MEGABYTE + 1) +#define VALID_AVAIL_END_PFN_5 atop(ONE_MEGABYTE * 256) + +/* + * Total number of pages (of 4K size each) should be 256 for 1MB of memory. + */ +#define PAGE_COUNT_1M 256 + +/* + * The number of Page Frames to allot per segment + */ +#define PF_STEP 8 + +/* + * A debug fucntion to print the content of upm. + */ + static inline void + uvm_physseg_dump_seg(uvm_physseg_t upm) + { +#if defined(DEBUG) + printf("%s: seg->start == %ld\n", __func__, + uvm_physseg_get_start(upm)); + printf("%s: seg->end == %ld\n", __func__, + uvm_physseg_get_end(upm)); + printf("%s: seg->avail_start == %ld\n", __func__, + uvm_physseg_get_avail_start(upm)); + printf("%s: seg->avail_end == %ld\n", __func__, + uvm_physseg_get_avail_end(upm)); + + printf("====\n\n"); +#else + return; +#endif /* DEBUG */ + } + +/* + * Private accessor that gets the value of vm_physmem.nentries + */ +static int +uvm_physseg_get_entries(void) +{ +#if defined(UVM_HOTPLUG) + return uvm_physseg_graph.nentries; +#else + return vm_nphysmem; +#endif /* UVM_HOTPLUG */ +} + +/* + * Note: This function replicates verbatim what happens in + * uvm_page.c:uvm_page_init(). + * + * Please track any changes that happen there. + */ +static void +uvm_page_init_fake(struct vm_page *pagearray, psize_t pagecount) +{ + uvm_physseg_t bank; + size_t n; + + for (bank = uvm_physseg_get_first(), + uvm_physseg_seg_chomp_slab(bank, pagearray, pagecount); + uvm_physseg_valid_p(bank); + bank = uvm_physseg_get_next(bank)) { + + n = uvm_physseg_get_end(bank) - uvm_physseg_get_start(bank); + uvm_physseg_seg_alloc_from_slab(bank, n); + uvm_physseg_init_seg(bank, pagearray); + + /* set up page array pointers */ + pagearray += n; + pagecount -= n; + } + + uvm.page_init_done = true; +} + +/* + * PHYS_TO_VM_PAGE: find vm_page for a PA. used by MI code to get vm_pages + * back from an I/O mapping (ugh!). used in some MD code as well. + */ +static struct vm_page * +uvm_phys_to_vm_page(paddr_t pa) +{ + paddr_t pf = atop(pa); + paddr_t off; + uvm_physseg_t psi; + + psi = uvm_physseg_find(pf, &off); + if (psi != UVM_PHYSSEG_TYPE_INVALID) + return uvm_physseg_get_pg(psi, off); + return(NULL); +} + +//static paddr_t +//uvm_vm_page_to_phys(const struct vm_page *pg) +//{ +// +// return pg->phys_addr; +//} + +/* + * XXX: To do, write control test cases for uvm_vm_page_to_phys(). + */ + +/* #define VM_PAGE_TO_PHYS(entry) uvm_vm_page_to_phys(entry) */ + +#define PHYS_TO_VM_PAGE(pa) uvm_phys_to_vm_page(pa) + +/* + * Test Fixture SetUp(). + */ +static void +setup(void) +{ + /* Prerequisites for running certain calls in uvm_physseg */ + uvmexp.pagesize = PAGE_SIZE; + uvmexp.npages = 0; + uvm.page_init_done = false; + uvm_physseg_init(); +} + +ATF_TC(uvm_physseg_100); +ATF_TC_HEAD(uvm_physseg_100, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 100 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_100, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 100; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_1K); +ATF_TC_HEAD(uvm_physseg_1K, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 1000 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_1K, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 1000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_10K); +ATF_TC_HEAD(uvm_physseg_10K, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 10,000 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_10K, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 10000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_100K); +ATF_TC_HEAD(uvm_physseg_100K, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 100,000 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_100K, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 100000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_1M); +ATF_TC_HEAD(uvm_physseg_1M, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 1,000,000 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_1M, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 1000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_10M); +ATF_TC_HEAD(uvm_physseg_10M, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 10,000,000 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_10M, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 10000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_100M); +ATF_TC_HEAD(uvm_physseg_100M, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 100,000,000 calls, VM_PHYSSEG_MAX is 32."); +} +ATF_TC_BODY(uvm_physseg_100M, tc) +{ + paddr_t pa; + + setup(); + + for(paddr_t i = VALID_START_PFN_1; + i < VALID_END_PFN_1; i += PF_STEP) { + uvm_page_physload(i, i + PF_STEP, i, i + PF_STEP, + VM_FREELIST_DEFAULT); + } + + ATF_REQUIRE_EQ(VM_PHYSSEG_MAX, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(int i = 0; i < 100000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_1); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_1MB); +ATF_TC_HEAD(uvm_physseg_1MB, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 1 MB Segment."); +} +ATF_TC_BODY(uvm_physseg_1MB, t) +{ + paddr_t pa = 0; + + paddr_t pf = 0; + + psize_t pf_chunk_size = 0; + + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + + psize_t npages2 = (VALID_END_PFN_2 - VALID_START_PFN_2); + + struct vm_page *slab = malloc(sizeof(struct vm_page) * + (npages1 + npages2)); + + setup(); + + /* We start with zero segments */ + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL)); + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2); + + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_2, npages2, NULL)); + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(pf = VALID_START_PFN_2; pf < VALID_END_PFN_2; pf += PF_STEP) { + pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1; + uvm_physseg_unplug(pf, pf_chunk_size); + } + + for(int i = 0; i < 10000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_2); + if(pa < ctob(VALID_START_PFN_2)) + pa += ctob(VALID_START_PFN_2); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_64MB); +ATF_TC_HEAD(uvm_physseg_64MB, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 64 MB Segment."); +} +ATF_TC_BODY(uvm_physseg_64MB, t) +{ + paddr_t pa = 0; + + paddr_t pf = 0; + + psize_t pf_chunk_size = 0; + + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + + psize_t npages2 = (VALID_END_PFN_3 - VALID_START_PFN_3); + + struct vm_page *slab = malloc(sizeof(struct vm_page) * + (npages1 + npages2)); + + setup(); + + /* We start with zero segments */ + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL)); + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2); + + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_3, npages2, NULL)); + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(pf = VALID_START_PFN_3; pf < VALID_END_PFN_3; pf += PF_STEP) { + pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1; + uvm_physseg_unplug(pf, pf_chunk_size); + } + + for(int i = 0; i < 10000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_3); + if(pa < ctob(VALID_START_PFN_3)) + pa += ctob(VALID_START_PFN_3); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_128MB); +ATF_TC_HEAD(uvm_physseg_128MB, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 128 MB Segment."); +} +ATF_TC_BODY(uvm_physseg_128MB, t) +{ + paddr_t pa = 0; + + paddr_t pf = 0; + + psize_t pf_chunk_size = 0; + + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + + psize_t npages2 = (VALID_END_PFN_4 - VALID_START_PFN_4); + + struct vm_page *slab = malloc(sizeof(struct vm_page) + * (npages1 + npages2)); + + setup(); + + /* We start with zero segments */ + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL)); + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2); + + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_2, npages2, NULL)); + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(pf = VALID_START_PFN_4; pf < VALID_END_PFN_4; pf += PF_STEP) { + pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1; + uvm_physseg_unplug(pf, pf_chunk_size); + } + + for(int i = 0; i < 10000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_4); + if(pa < ctob(VALID_START_PFN_4)) + pa += ctob(VALID_START_PFN_4); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TC(uvm_physseg_256MB); +ATF_TC_HEAD(uvm_physseg_256MB, tc) +{ + atf_tc_set_md_var(tc, "descr", "Load test uvm_phys_to_vm_page() with \ + 10,000,000 calls, VM_PHYSSEG_MAX is 32 on 256 MB Segment."); +} +ATF_TC_BODY(uvm_physseg_256MB, t) +{ + paddr_t pa = 0; + + paddr_t pf = 0; + + psize_t pf_chunk_size = 0; + + psize_t npages1 = (VALID_END_PFN_1 - VALID_START_PFN_1); + + psize_t npages2 = (VALID_END_PFN_5 - VALID_START_PFN_5); + + struct vm_page *slab = malloc(sizeof(struct vm_page) * (npages1 + npages2)); + + setup(); + + /* We start with zero segments */ + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_1, npages1, NULL)); + ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); + + /* Post boot: Fake all segments and pages accounted for. */ + uvm_page_init_fake(slab, npages1 + npages2); + + ATF_REQUIRE_EQ(true, uvm_physseg_plug(VALID_START_PFN_2, npages2, NULL)); + ATF_REQUIRE_EQ(2, uvm_physseg_get_entries()); + + srandom((unsigned)time(NULL)); + for(pf = VALID_START_PFN_5; pf < VALID_END_PFN_5; pf += PF_STEP) { + pf_chunk_size = (psize_t) random() % (psize_t) (PF_STEP - 1) + 1; + uvm_physseg_unplug(pf, pf_chunk_size); + } + + for(int i = 0; i < 10000000; i++) { + pa = (paddr_t) random() % (paddr_t) ctob(VALID_END_PFN_5); + if(pa < ctob(VALID_END_PFN_5)) + pa += ctob(VALID_START_PFN_5); + PHYS_TO_VM_PAGE(pa); + } + + ATF_CHECK_EQ(true, true); +} + +ATF_TP_ADD_TCS(tp) +{ + /* Fixed memory size tests. */ + ATF_TP_ADD_TC(tp, uvm_physseg_100); + ATF_TP_ADD_TC(tp, uvm_physseg_1K); + ATF_TP_ADD_TC(tp, uvm_physseg_10K); + ATF_TP_ADD_TC(tp, uvm_physseg_100K); + ATF_TP_ADD_TC(tp, uvm_physseg_1M); + ATF_TP_ADD_TC(tp, uvm_physseg_10M); + ATF_TP_ADD_TC(tp, uvm_physseg_100M); + +#if defined(UVM_HOTPLUG) + /* Variable memory size tests. */ + ATF_TP_ADD_TC(tp, uvm_physseg_1MB); + ATF_TP_ADD_TC(tp, uvm_physseg_64MB); + ATF_TP_ADD_TC(tp, uvm_physseg_128MB); + ATF_TP_ADD_TC(tp, uvm_physseg_256MB); +#endif /* UVM_HOTPLUG */ + + return atf_no_error(); +} diff --git a/usr.bin/mixerctl/t_mixerctl.sh b/usr.bin/mixerctl/t_mixerctl.sh new file mode 100755 index 000000000000..94c0bdf8cdf4 --- /dev/null +++ b/usr.bin/mixerctl/t_mixerctl.sh @@ -0,0 +1,51 @@ +# $NetBSD: t_mixerctl.sh,v 1.1 2017/01/02 15:40:09 christos Exp $ + +atf_test_case noargs_usage +noargs_usage_head() { + atf_set "descr" "Ensure mixerctl(1) with no args prints a usage message" +} +noargs_usage_body() { + atf_check -s exit:0 -o not-empty -e ignore \ + mixerctl +} + +atf_test_case showvalue +showvalue_head() { + atf_set "descr" "Ensure mixerctl(1) can print the value for all variables" +} +showvalue_body() { + for var in $(mixerctl -a | awk -F= '{print $1}'); do + atf_check -s exit:0 -e ignore -o match:"^${var}=" \ + mixerctl ${var} + done +} + +atf_test_case nflag +nflag_head() { + atf_set "descr" "Ensure 'mixerctl -n' actually suppresses some output" +} +nflag_body() { + varname="$(mixerctl -a | head -1 | awk -F= '{print $1}')" + + atf_check -s exit:0 -o match:"${varname}" -e ignore \ + mixerctl ${varname} + + atf_check -s exit:0 -o not-match:"${varname}" -e ignore \ + mixerctl -n ${varname} +} + +atf_test_case nonexistant_device +nonexistant_device_head() { + atf_set "descr" "Ensure mixerctl(1) complains if provided a nonexistant mixer device" +} +nonexistant_device_body() { + atf_check -s not-exit:0 -o ignore -e match:"No such file" \ + mixerctl -d /a/b/c/d/e +} + +atf_init_test_cases() { + atf_add_test_case noargs_usage + atf_add_test_case showvalue + atf_add_test_case nflag + atf_add_test_case nonexistant_device +} diff --git a/usr.bin/uniq/d_basic.in b/usr.bin/uniq/d_basic.in new file mode 100644 index 000000000000..52a24bcfbb8c --- /dev/null +++ b/usr.bin/uniq/d_basic.in @@ -0,0 +1,4 @@ +1 +12 +1 +1 diff --git a/usr.bin/uniq/d_basic.out b/usr.bin/uniq/d_basic.out new file mode 100644 index 000000000000..d44fcba56f35 --- /dev/null +++ b/usr.bin/uniq/d_basic.out @@ -0,0 +1,3 @@ +1 +12 +1 diff --git a/usr.bin/uniq/d_counts.out b/usr.bin/uniq/d_counts.out new file mode 100644 index 000000000000..bb1c86ba3d6d --- /dev/null +++ b/usr.bin/uniq/d_counts.out @@ -0,0 +1,6 @@ + 1 #01 foo0 bar0 foo1 bar1 + 1 #02 bar0 foo1 bar1 foo1 + 1 #03 foo0 bar0 foo1 bar1 + 1 #04 + 2 #05 foo0 bar0 foo1 bar1 + 1 #07 bar0 foo1 bar1 foo0 diff --git a/usr.bin/uniq/d_input.in b/usr.bin/uniq/d_input.in new file mode 100644 index 000000000000..c32c44d44c0a --- /dev/null +++ b/usr.bin/uniq/d_input.in @@ -0,0 +1,7 @@ +#01 foo0 bar0 foo1 bar1 +#02 bar0 foo1 bar1 foo1 +#03 foo0 bar0 foo1 bar1 +#04 +#05 foo0 bar0 foo1 bar1 +#06 foo0 bar0 foo1 bar1 +#07 bar0 foo1 bar1 foo0 diff --git a/usr.bin/uniq/d_show_duplicates.out b/usr.bin/uniq/d_show_duplicates.out new file mode 100644 index 000000000000..45f4be7029a1 --- /dev/null +++ b/usr.bin/uniq/d_show_duplicates.out @@ -0,0 +1 @@ +#05 foo0 bar0 foo1 bar1 diff --git a/usr.bin/uniq/d_show_uniques.out b/usr.bin/uniq/d_show_uniques.out new file mode 100644 index 000000000000..1cc2ecbf3058 --- /dev/null +++ b/usr.bin/uniq/d_show_uniques.out @@ -0,0 +1,5 @@ +#01 foo0 bar0 foo1 bar1 +#02 bar0 foo1 bar1 foo1 +#03 foo0 bar0 foo1 bar1 +#04 +#07 bar0 foo1 bar1 foo0 diff --git a/usr.bin/uniq/t_uniq.sh b/usr.bin/uniq/t_uniq.sh new file mode 100755 index 000000000000..d90a4d595a86 --- /dev/null +++ b/usr.bin/uniq/t_uniq.sh @@ -0,0 +1,97 @@ +# $NetBSD: t_uniq.sh,v 1.1 2016/10/22 14:13:39 abhinav Exp $ +# +# Copyright (c) 2016 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Abhinav Upadhyay +# +# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# + +atf_test_case basic +basic_head() +{ + atf_set "descr" "Checks the basic functionality" +} +basic_body() +{ + atf_check -o file:$(atf_get_srcdir)/d_basic.out uniq \ + $(atf_get_srcdir)/d_basic.in +} + +atf_test_case test_counts +test_counts_head() +{ + atf_set "descr" "Tests the -c option, comparing each line of the input" \ + "file data starting from the second field" +} +test_counts_body() +{ + atf_check -o file:$(atf_get_srcdir)/d_counts.out uniq -c -f 1 \ + $(atf_get_srcdir)/d_input.in +} + +atf_test_case show_duplicates +show_duplicates_head() +{ + atf_set "descr" "Checks the -d option, comparing each line of the input" \ + "file data starting from the second field" +} +show_duplicates_body() +{ + atf_check -o file:$(atf_get_srcdir)/d_show_duplicates.out uniq -d -f 1 \ + $(atf_get_srcdir)/d_input.in +} + +atf_test_case show_uniques +show_uniques_head() +{ + atf_set "descr" "Checks the -u option, comparing each line of the input" \ + "file data starting from the second field" +} +show_uniques_body() +{ + atf_check -o file:$(atf_get_srcdir)/d_show_uniques.out uniq -u -f 1 \ + $(atf_get_srcdir)/d_input.in +} + +atf_test_case show_duplicates_from_third_character +show_duplicates_from_third_character_head() +{ + atf_set "descr" "Checks the -d option, comparing each line of the input" \ + "file data starting from the third character (-s option)" +} +show_duplicates_from_third_character_body() +{ + atf_check -o empty uniq -d -s 2 $(atf_get_srcdir)/d_input.in + +} + +atf_init_test_cases() +{ + atf_add_test_case basic + atf_add_test_case test_counts + atf_add_test_case show_duplicates + atf_add_test_case show_uniques + atf_add_test_case show_duplicates_from_third_character +} From ed2159c92c0214d224e13d4452e576a92d29911e Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sat, 14 Jan 2017 06:20:36 +0000 Subject: [PATCH 088/126] tmpfs: manage tm_pages_used with atomics Reviewed by: kib (previous version) --- sys/fs/tmpfs/tmpfs.h | 6 +++--- sys/fs/tmpfs/tmpfs_subr.c | 10 +++------- sys/fs/tmpfs/tmpfs_vfsops.c | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index cf1e3fa3cac9..8cd1c4b6dcdf 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -312,12 +312,12 @@ struct tmpfs_mount { /* Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of - * free memory; in the extreme case, it will hold the SIZE_MAX + * free memory; in the extreme case, it will hold the ULONG_MAX * value. */ - size_t tm_pages_max; + u_long tm_pages_max; /* Number of pages in use by the file system. */ - size_t tm_pages_used; + u_long tm_pages_used; /* Pointer to the node representing the root directory of this * file system. */ diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 42a822c2038e..0af55eccf8bf 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -129,7 +129,7 @@ tmpfs_pages_check_avail(struct tmpfs_mount *tmp, size_t req_pages) if (tmpfs_mem_avail() < req_pages) return (0); - if (tmp->tm_pages_max != SIZE_MAX && + if (tmp->tm_pages_max != ULONG_MAX && tmp->tm_pages_max < req_pages + tmpfs_pages_used(tmp)) return (0); @@ -327,9 +327,7 @@ tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { - TMPFS_LOCK(tmp); - tmp->tm_pages_used -= uobj->size; - TMPFS_UNLOCK(tmp); + atomic_subtract_long(&tmp->tm_pages_used, uobj->size); KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); @@ -1417,9 +1415,7 @@ tmpfs_reg_resize(struct vnode *vp, off_t newsize, boolean_t ignerr) uobj->size = newpages; VM_OBJECT_WUNLOCK(uobj); - TMPFS_LOCK(tmp); - tmp->tm_pages_used += (newpages - oldpages); - TMPFS_UNLOCK(tmp); + atomic_add_long(&tmp->tm_pages_used, newpages - oldpages); node->tn_size = newsize; return (0); diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 67de4b6716f2..869b6f1feafb 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -397,7 +397,7 @@ tmpfs_statfs(struct mount *mp, struct statfs *sbp) sbp->f_bsize = PAGE_SIZE; used = tmpfs_pages_used(tmp); - if (tmp->tm_pages_max != SIZE_MAX) + if (tmp->tm_pages_max != ULONG_MAX) sbp->f_blocks = tmp->tm_pages_max; else sbp->f_blocks = used + tmpfs_mem_avail(); From 71164a14d098d70379f47fa051f005145e676336 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 06:51:31 +0000 Subject: [PATCH 089/126] Integrate .../contrib/netbsd-tests/usr.bin/uniq into the FreeBSD test suite as .../usr.bin/uniq/tests Sponsored by: Dell EMC Isilon --- etc/mtree/BSD.tests.dist | 2 ++ usr.bin/uniq/Makefile | 6 ++++++ usr.bin/uniq/tests/Makefile | 16 ++++++++++++++++ usr.bin/uniq/tests/Makefile.depend | 11 +++++++++++ 4 files changed, 35 insertions(+) create mode 100644 usr.bin/uniq/tests/Makefile create mode 100644 usr.bin/uniq/tests/Makefile.depend diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 60e2dbea9ae6..bd08c2f00776 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -660,6 +660,8 @@ .. uuencode .. + uniq + .. xargs .. xinstall diff --git a/usr.bin/uniq/Makefile b/usr.bin/uniq/Makefile index 2bcf18e53703..c6ca3691d1e0 100644 --- a/usr.bin/uniq/Makefile +++ b/usr.bin/uniq/Makefile @@ -1,6 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= uniq +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include diff --git a/usr.bin/uniq/tests/Makefile b/usr.bin/uniq/tests/Makefile new file mode 100644 index 000000000000..06a384eface5 --- /dev/null +++ b/usr.bin/uniq/tests/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +PACKAGE= tests + +NETBSD_ATF_TESTS_SH= uniq_test + +${PACKAGE}FILES+= d_basic.in +${PACKAGE}FILES+= d_basic.out +${PACKAGE}FILES+= d_counts.out +${PACKAGE}FILES+= d_input.in +${PACKAGE}FILES+= d_show_duplicates.out +${PACKAGE}FILES+= d_show_uniques.out + +.include + +.include diff --git a/usr.bin/uniq/tests/Makefile.depend b/usr.bin/uniq/tests/Makefile.depend new file mode 100644 index 000000000000..f80275d86ab1 --- /dev/null +++ b/usr.bin/uniq/tests/Makefile.depend @@ -0,0 +1,11 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif From 8eace6ac0f54ee5a381bd62774f85df64d75689e Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:15:14 +0000 Subject: [PATCH 090/126] Try again with a better commit message --- contrib/netbsd-tests/lib/libc/hash/t_hmac.c | 127 -------------------- 1 file changed, 127 deletions(-) delete mode 100644 contrib/netbsd-tests/lib/libc/hash/t_hmac.c diff --git a/contrib/netbsd-tests/lib/libc/hash/t_hmac.c b/contrib/netbsd-tests/lib/libc/hash/t_hmac.c deleted file mode 100644 index 3dcbea99c97c..000000000000 --- a/contrib/netbsd-tests/lib/libc/hash/t_hmac.c +++ /dev/null @@ -1,127 +0,0 @@ -/* $NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $ */ - -/*- - * Copyright (c) 2016 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 -__RCSID("$NetBSD: t_hmac.c,v 1.1 2016/07/02 14:52:09 christos Exp $"); - -#include -#include -#include -#include -#include - -static void -test(void) -{ - uint8_t tmp1[EVP_MAX_MD_SIZE]; - uint8_t tmp2[EVP_MAX_MD_SIZE]; - uint8_t key[256]; - uint8_t data[4096]; - unsigned int tmp1len; - size_t tmp2len; - int stop; - void *e1; - const void *evps[] = { - EVP_md2(), - EVP_md4(), - EVP_md5(), - EVP_ripemd160(), - EVP_sha1(), - EVP_sha224(), - EVP_sha256(), - EVP_sha384(), - EVP_sha512(), - }; - const char *names[] = { - "md2", - "md4", - "md5", - "rmd160", - "sha1", - "sha224", - "sha256", - "sha384", - "sha512", - }; - - for (size_t k = 0; k < sizeof(key); k++) - key[k] = k; - for (size_t d = 0; d < sizeof(data); d++) - data[d] = d % 256; - - for (size_t t = 0; t < __arraycount(names); t++) - for (size_t i = 1; i < sizeof(key); i += 9) - for (size_t j = 3; j < sizeof(data); j += 111) { - stop = 0; -#ifdef DEBUG - printf("%s: keysize = %zu datasize = %zu\n", names[t], - i, j); -#endif - memset(tmp1, 0, sizeof(tmp1)); - memset(tmp2, 0, sizeof(tmp2)); - e1 = HMAC(evps[t], key, i, data, j, tmp1, &tmp1len); - ATF_REQUIRE(e1 != NULL); - tmp2len = hmac(names[t], key, i, data, j, tmp2, - sizeof(tmp2)); - ATF_REQUIRE_MSG(tmp1len == tmp2len, "hash %s len %u " - "!= %zu", names[t], tmp1len, tmp2len); - for (size_t k = 0; k < tmp2len; k++) - if (tmp1[k] != tmp2[k]) { -#ifdef DEBUG - printf("%zu %.2x %.2x\n", - k, tmp1[k], tmp2[k]); -#endif - stop = 1; - break; - } - ATF_REQUIRE_MSG(!stop, "hash %s failed for " - "keylen=%zu, datalen=%zu", names[t], i, j); - } -} - -ATF_TC(t_hmac); - -ATF_TC_HEAD(t_hmac, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Test hmac functions for consistent results"); -} - -ATF_TC_BODY(t_hmac, tc) -{ - test(); -} - -ATF_TP_ADD_TCS(tp) -{ - ATF_TP_ADD_TC(tp, t_hmac); - return atf_no_error(); -} - From 3b852823339de23e65ffc488229bf75a2896fe2b Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:39:07 +0000 Subject: [PATCH 091/126] Diff reduce with upstream --- contrib/netbsd-tests/lib/libc/db/t_db.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/db/t_db.sh b/contrib/netbsd-tests/lib/libc/db/t_db.sh index 6858e3610a4c..1cf040c0de3b 100755 --- a/contrib/netbsd-tests/lib/libc/db/t_db.sh +++ b/contrib/netbsd-tests/lib/libc/db/t_db.sh @@ -42,7 +42,6 @@ dict() elif [ -f /usr/dict/words ]; then echo /usr/dict/words else - echo "" atf_fail "no dictionary found" fi } From acf26de3fa620c4433b5f1a479785700c113ecdc Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:46:03 +0000 Subject: [PATCH 092/126] Add stdio.h #include for fparseln fparseln on FreeBSD requires stdio.h, then libutil.h, whereas NetBSD only requires util.h --- lib/libnetbsd/util.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libnetbsd/util.h b/lib/libnetbsd/util.h index c7d32e132336..a2e59b0ed52e 100644 --- a/lib/libnetbsd/util.h +++ b/lib/libnetbsd/util.h @@ -30,9 +30,10 @@ * SUCH DAMAGE. */ -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef _LIBNETBSD_UTIL_H_ +#define _LIBNETBSD_UTIL_H_ +#include /* for fparseln(3) */ #include char *flags_to_string(u_long flags, const char *def); From 4e9c68081e1e4eaad6d3782f3c542b778e426d0c Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:48:22 +0000 Subject: [PATCH 093/126] Diff reduce with upstream by using util.h from libnetbsd instead of libutil.h --- contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c index 17eac877f5d4..09bdca2c27aa 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c @@ -34,11 +34,7 @@ #include #include #include -#ifdef __FreeBSD__ #include -#else -#include -#endif const struct hnopts { size_t ho_len; From 9a62e988b37bf1a25ea8880768b1f1df8113975f Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:50:29 +0000 Subject: [PATCH 094/126] r312133 should have used the non-FreeBSD block --- contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c index 09bdca2c27aa..54d798fc9b5f 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include const struct hnopts { size_t ho_len; From 59754238a2b87589ec52d3befb2989e448cef35d Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:57:34 +0000 Subject: [PATCH 095/126] libnetbsd: improve sha1.h compat with FreeBSD Map SHA1_CTX to SHA_CTX and SHA1Final to SHA1_Final --- lib/libnetbsd/sha1.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/libnetbsd/sha1.h b/lib/libnetbsd/sha1.h index 41280c58b076..9da870eacf6e 100644 --- a/lib/libnetbsd/sha1.h +++ b/lib/libnetbsd/sha1.h @@ -35,8 +35,11 @@ #include +#define SHA1_CTX SHA_CTX + #define SHA1End SHA1_End #define SHA1File SHA1_File +#define SHA1Final SHA1_Final #define SHA1Init SHA1_Init #define SHA1Update SHA1_Update From 1cb4521644cce766187093f9a4ec5cd045f8b702 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:58:40 +0000 Subject: [PATCH 096/126] Diff reduce with upstream using lib/libnetbsd's updated copy of sha1.h --- contrib/netbsd-tests/lib/libc/hash/h_hash.c | 21 --------------------- lib/libc/tests/hash/Makefile | 1 + 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/hash/h_hash.c b/contrib/netbsd-tests/lib/libc/hash/h_hash.c index 6e20a4889a25..58e4e6258baf 100644 --- a/contrib/netbsd-tests/lib/libc/hash/h_hash.c +++ b/contrib/netbsd-tests/lib/libc/hash/h_hash.c @@ -35,13 +35,7 @@ #include #include #include -#ifdef __NetBSD__ #include -#endif - -#ifdef __FreeBSD__ -#include -#endif int mflag, rflag, sflag, tflag; @@ -107,32 +101,17 @@ regress(void) MD5Final(out, &ctx); outlen = 16; } else { -#ifdef __FreeBSD__ - SHA_CTX ctx; - - SHA1_Init(&ctx); - SHA1_Update(&ctx, buf, len); -#else SHA1_CTX ctx; SHA1Init(&ctx); SHA1Update(&ctx, buf, len); -#endif while (!last && fgets((char *)buf, sizeof(buf), stdin) != NULL) { len = strlen((char *)buf); CHOMP(buf, len, last); -#ifdef __FreeBSD__ - SHA1_Update(&ctx, buf, len); -#else SHA1Update(&ctx, buf, len); -#endif } -#ifdef __FreeBSD__ - SHA1_Final(out, &ctx); -#else SHA1Final(out, &ctx); -#endif outlen = 20; } hexdump(out, outlen); diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile index 1e2cd29dbddf..2dc2073fc7ec 100644 --- a/lib/libc/tests/hash/Makefile +++ b/lib/libc/tests/hash/Makefile @@ -32,6 +32,7 @@ ${PACKAGE}DATA_FILES+= data/sha1test2-out LIBADD+= md LIBADD.sha2_test+= crypto +CFLAGS.h_hash+= -I${SRCTOP}/lib/libnetbsd CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh/openbsd-compat CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh From 0e3f47800f51aaf6320bab578e8cbcf4607364a8 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 07:59:33 +0000 Subject: [PATCH 097/126] Restore deleted line --- contrib/netbsd-tests/lib/libc/hash/h_hash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/netbsd-tests/lib/libc/hash/h_hash.c b/contrib/netbsd-tests/lib/libc/hash/h_hash.c index 58e4e6258baf..33b9f9a62497 100644 --- a/contrib/netbsd-tests/lib/libc/hash/h_hash.c +++ b/contrib/netbsd-tests/lib/libc/hash/h_hash.c @@ -37,6 +37,7 @@ #include #include + int mflag, rflag, sflag, tflag; static void From c3b0c094b362bf1f6fd1ea58c3d6ec6053803f06 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:10:37 +0000 Subject: [PATCH 098/126] libnetbsd: improve sha2.h compat with FreeBSD Add sha384 #include to libnetbsd's copy of sha2.h to expose all of the SHA384 support via the header. --- lib/libnetbsd/sha2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libnetbsd/sha2.h b/lib/libnetbsd/sha2.h index b67691d54fb0..6329284924fc 100644 --- a/lib/libnetbsd/sha2.h +++ b/lib/libnetbsd/sha2.h @@ -34,6 +34,7 @@ #define _SHA2_H_ #include +#include #include #endif /* _SHA2_H_ */ From 154be3585701619c4dd106ab61be1e33a60cba68 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:11:17 +0000 Subject: [PATCH 099/126] Use copy of sha2.h from libnetbsd --- contrib/netbsd-tests/lib/libc/hash/t_sha2.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/hash/t_sha2.c b/contrib/netbsd-tests/lib/libc/hash/t_sha2.c index ce2c80d31a80..a45e82ac57d3 100644 --- a/contrib/netbsd-tests/lib/libc/hash/t_sha2.c +++ b/contrib/netbsd-tests/lib/libc/hash/t_sha2.c @@ -36,23 +36,9 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09/26 22:23:30 joerg Exp $"); #include #include -#ifdef __NetBSD__ #include -#endif #include -#ifdef __FreeBSD__ -#include -typedef SHA512_CTX SHA384_CTX; -/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */ -#define SHA256_DIGEST_LENGTH 32 -#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) -#define SHA384_DIGEST_LENGTH 48 -#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) -#define SHA512_DIGEST_LENGTH 64 -#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) -#endif - ATF_TC(t_sha256); ATF_TC(t_sha384); ATF_TC(t_sha512); From 1081817ad50f72575fe87f740d337efc24fbb2df Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:12:57 +0000 Subject: [PATCH 100/126] Diff reduce with upstream --- contrib/netbsd-tests/lib/libc/locale/t_io.c | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/locale/t_io.c b/contrib/netbsd-tests/lib/libc/locale/t_io.c index 86029e934d58..ed6af954613b 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_io.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_io.c @@ -61,7 +61,6 @@ ATF_TC_BODY(bad_big5_wprintf, tc) /* XXX implementation detail knowledge (wchar_t encoding) */ wchar_t ibuf[] = { 0xcf10, 0 }; setlocale(LC_CTYPE, "zh_TW.Big5"); - ATF_REQUIRE_ERRNO(EILSEQ, wprintf(L"%ls\n", ibuf) < 0); ATF_REQUIRE(ferror(stdout)); } From 50e474a4f65b88464e7217184831af218717662f Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:35:29 +0000 Subject: [PATCH 101/126] :strtold_nan: remove unnecessary strcmp check It gets checked again later on in the testcase --- contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c index 06f2de09c50b..4835e5de137f 100644 --- a/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c +++ b/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c @@ -218,9 +218,7 @@ ATF_TC_BODY(strtold_nan, tc) volatile long double ld = strtold(nan_string, &end); ATF_REQUIRE(isnan(ld) != 0); -#ifdef __FreeBSD__ - ATF_REQUIRE(strcmp(end, "y") == 0); -#else +#ifndef __FreeBSD__ ATF_REQUIRE(__isnanl(ld) != 0); #endif ATF_REQUIRE(strcmp(end, "y") == 0); From 04f40d86dbd10eb02436e8b31c16b66f056b6d8e Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:36:43 +0000 Subject: [PATCH 102/126] Diff reduce with upstream --- contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c b/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c index 3a18286091b3..a319b09bce73 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c @@ -63,6 +63,7 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #include #include + #include #include #include From 6e515978dd2ab6c352a9f7b944a29a0584baa7e6 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:38:21 +0000 Subject: [PATCH 103/126] Remove comment no longer true since the test no longer bombs out earlier on --- contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c index 2e5778687391..e366344d7fbf 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_mbtowc.c @@ -137,7 +137,6 @@ ATF_TC_BODY(mbtowc, tc) h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B"); h_mbtowc("ja_JP.SJIS", "\202", "\202\240"); h_mbtowc("ja_JP.eucJP", "\244", "\244\242"); - /* Moved last as it fails */ h_mbtowc("zh_CN.GB18030", "\241", "\241\241"); h_mbtowc("zh_TW.Big5", "\241", "\241@"); h_mbtowc("zh_TW.eucTW", "\241", "\241\241"); From 0e6a2253dcf5619d1a0e56dfda50e73d7b7594f0 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:39:53 +0000 Subject: [PATCH 104/126] Diff reduce with upstream --- contrib/netbsd-tests/lib/libc/locale/t_io.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/locale/t_io.c b/contrib/netbsd-tests/lib/libc/locale/t_io.c index ed6af954613b..8c7f371f209a 100644 --- a/contrib/netbsd-tests/lib/libc/locale/t_io.c +++ b/contrib/netbsd-tests/lib/libc/locale/t_io.c @@ -57,7 +57,6 @@ ATF_TC_BODY(bad_big5_wprintf, tc) atf_tc_skip("does not fail as expected (may be implementation " "specific issue with the test)"); #endif - /* XXX implementation detail knowledge (wchar_t encoding) */ wchar_t ibuf[] = { 0xcf10, 0 }; setlocale(LC_CTYPE, "zh_TW.Big5"); @@ -77,12 +76,10 @@ ATF_TC_BODY(bad_big5_swprintf, tc) atf_tc_skip("does not fail as expected (may be implementation " "specific issue with the test)"); #endif - /* XXX implementation detail knowledge (wchar_t encoding) */ wchar_t ibuf[] = { 0xcf10, 0 }; wchar_t obuf[20]; setlocale(LC_CTYPE, "zh_TW.Big5"); - ATF_REQUIRE_ERRNO(EILSEQ, swprintf(obuf, sizeof(obuf), L"%ls\n", ibuf) < 0); } From 7bb9bc9cc2a4eb528c72b92d42f015ddcd3ce54b Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 08:47:00 +0000 Subject: [PATCH 105/126] Try to consolidate the #ifdef soup into FreeBSD vs non-FreeBSD blocks better --- contrib/netbsd-tests/lib/libc/sys/t_getcontext.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c b/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c index 9f21b3e344c0..beb6516e0938 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c @@ -51,12 +51,14 @@ run(int n, ...) ATF_REQUIRE_EQ(n, DEPTH - calls - 1); va_start(va, n); -#if defined(__FreeBSD__) && defined(__amd64__) +#ifdef __FreeBSD__ +#if defined(__amd64__) for (i = 0; i < 5; i++) { -#elif defined(__FreeBSD__) && defined(__aarch64__) +#elif defined(__aarch64__) for (i = 0; i < 7; i++) { -#elif defined(__FreeBSD__) && defined(__mips__) +#elif defined(__mips__) for (i = 0; i < 5; i++) { +#endif #else for (i = 0; i < 9; i++) { #endif @@ -116,18 +118,20 @@ ATF_TC_BODY(setcontext_link, tc) uc[i].uc_stack.ss_size = STACKSZ; uc[i].uc_link = (i > 0) ? &uc[i - 1] : &save; -#if defined(__FreeBSD__) && defined(__amd64__) +#ifdef __FreeBSD__ +#if defined(__amd64__) /* FreeBSD/amd64 only permits up to 6 arguments. */ makecontext(&uc[i], (void *)run, 6, i, 0, 1, 2, 3, 4); -#elif defined(__FreeBSD__) && defined(__aarch64__) +#elif defined(__aarch64__) /* FreeBSD/arm64 only permits up to 8 arguments. */ makecontext(&uc[i], (void *)run, 8, i, 0, 1, 2, 3, 4, 5, 6); -#elif defined(__FreeBSD__) && defined(__mips__) +#elif defined(__mips__) /* FreeBSD/mips only permits up to 6 arguments. */ makecontext(&uc[i], (void *)run, 6, i, 0, 1, 2, 3, 4); +#endif #else makecontext(&uc[i], (void *)run, 10, i, 0, 1, 2, 3, 4, 5, 6, 7, 8); From a41b7cf58ea07f2506649b6cafcdc91d10be3b52 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:20:54 +0000 Subject: [PATCH 106/126] Diff reduce with upstream Use CMSG_FIRSTHDR macro to properly link the kqueue to the socket to get it to now return -1/EBADF with sendmsg per the testcase expectations --- contrib/netbsd-tests/lib/libc/sys/t_kevent.c | 26 +++----------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c index 8a20d63dfa87..2f034eaad970 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c @@ -117,15 +117,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc) if (recvmsg(s[1], &m, 0) == -1) err(1, "child: could not recvmsg"); -#ifdef __FreeBSD__ - bcopy(CMSG_DATA(msg), &kq, sizeof(kq)); - printf("child (pid %d): received kq fd %d\n", getpid(), kq); - _exit(0); -#else kq = *(int *)CMSG_DATA(msg); printf("child (pid %d): received kq fd %d\n", getpid(), kq); exit(0); -#endif } close(s[1]); @@ -133,33 +127,21 @@ ATF_TC_BODY(kqueue_desc_passing, tc) iov.iov_base = &storage; iov.iov_len = sizeof(int); +#ifdef __FreeBSD__ + msg = CMSG_FIRSTHDR(&m); +#endif msg->cmsg_level = SOL_SOCKET; msg->cmsg_type = SCM_RIGHTS; msg->cmsg_len = CMSG_LEN(sizeof(int)); -#ifdef __FreeBSD__ - /* - * What is should have been - * bcopy(&s[0], CMSG_DATA(msg), sizeof(kq)); - */ - bcopy(&kq, CMSG_DATA(msg), sizeof(kq)); -#else - *(int *)CMSG_DATA(msg) = kq; -#endif - + EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1); printf("parent (pid %d): sending kq fd %d\n", getpid(), kq); if (sendmsg(s[0], &m, 0) == -1) { -#ifdef __NetBSD__ ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno); atf_tc_skip("PR kern/46523"); -#endif -#ifdef __FreeBSD__ - ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno); - close(s[0]); -#endif } close(kq); From 25785590d5efa8115e29792baa8f6329b4f32736 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:21:36 +0000 Subject: [PATCH 107/126] Remove extra EVSET I added in r312146 by accident --- contrib/netbsd-tests/lib/libc/sys/t_kevent.c | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c index 2f034eaad970..312fadabdfa6 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c @@ -134,7 +134,6 @@ ATF_TC_BODY(kqueue_desc_passing, tc) msg->cmsg_type = SCM_RIGHTS; msg->cmsg_len = CMSG_LEN(sizeof(int)); - EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1); From 9f30f6b7c32ba2a821a1bf562b3591f5d5717a16 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:25:09 +0000 Subject: [PATCH 108/126] Readd the CMSG_DATA for assigning the kqueue... this testcase isn't officially correct yet, but it's getting closer. --- contrib/netbsd-tests/lib/libc/sys/t_kevent.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c index 312fadabdfa6..8b649ca39dfc 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c @@ -134,6 +134,10 @@ ATF_TC_BODY(kqueue_desc_passing, tc) msg->cmsg_type = SCM_RIGHTS; msg->cmsg_len = CMSG_LEN(sizeof(int)); +#ifdef __NetBSD__ + *(int *)CMSG_DATA(msg) = kq; +#endif + EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1); From 2a1440c618f933b7f32a27f03fcfe184300c7110 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:38:40 +0000 Subject: [PATCH 109/126] Diff reduce with upstream by taking diff hunks that were contributed back --- contrib/netbsd-tests/lib/libc/sys/t_connect.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_dup.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_link.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_listen.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_msgctl.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c | 4 ---- contrib/netbsd-tests/lib/libc/sys/t_msync.c | 14 +++++++++++++- contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c | 7 ------- contrib/netbsd-tests/lib/libc/sys/t_stat.c | 7 ------- contrib/netbsd-tests/lib/libc/sys/t_truncate.c | 4 ---- 11 files changed, 13 insertions(+), 47 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_connect.c b/contrib/netbsd-tests/lib/libc/sys/t_connect.c index 5dc88d5661ca..a920d3def0ff 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_connect.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_connect.c @@ -37,10 +37,6 @@ #include -#ifdef __FreeBSD__ -#include -#endif - ATF_TC(connect_low_port); ATF_TC_HEAD(connect_low_port, tc) { diff --git a/contrib/netbsd-tests/lib/libc/sys/t_dup.c b/contrib/netbsd-tests/lib/libc/sys/t_dup.c index 044b6e37dc20..b1924e4f1d30 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_dup.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_dup.c @@ -46,10 +46,6 @@ __RCSID("$NetBSD: t_dup.c,v 1.9 2017/01/13 20:31:53 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#endif - static char path[] = "dup"; #ifdef __NetBSD__ static void check_mode(bool, bool, bool); diff --git a/contrib/netbsd-tests/lib/libc/sys/t_link.c b/contrib/netbsd-tests/lib/libc/sys/t_link.c index 5663d9ae946a..a6d894cc0894 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_link.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_link.c @@ -42,10 +42,6 @@ __RCSID("$NetBSD: t_link.c,v 1.3 2017/01/13 20:42:36 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#endif - static const char *getpath(void); static char path[] = "link"; static const char *pathl; diff --git a/contrib/netbsd-tests/lib/libc/sys/t_listen.c b/contrib/netbsd-tests/lib/libc/sys/t_listen.c index f9ac1dcd87c4..9f3f9b8413e2 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_listen.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_listen.c @@ -37,10 +37,6 @@ #include #include -#ifdef __FreeBSD__ -#include -#endif - static const char *path = "listen"; ATF_TC_WITH_CLEANUP(listen_err); diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c index a573d158fb10..9f99980ae4ca 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c @@ -47,10 +47,6 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#endif - #define MSG_KEY 12345689 #define MSG_MTYPE_1 0x41 diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c index bd8024754fa4..522ceb82cd38 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c @@ -48,10 +48,6 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#endif - #define MSG_KEY 1234 #define MSG_MTYPE_1 0x41 #define MSG_MTYPE_2 0x42 diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c index 36a428a84321..598882131a7d 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c @@ -48,10 +48,6 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#endif - #define MSG_KEY 1234 #define MSG_MTYPE_1 0x41 #define MSG_MTYPE_2 0x42 diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msync.c b/contrib/netbsd-tests/lib/libc/sys/t_msync.c index 70d0ccf69df1..e627614c067d 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_msync.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_msync.c @@ -65,22 +65,33 @@ msync_sync(const char *garbage, int flags) if (buf == NULL) return NULL; +#ifdef __FreeBSD__ + memset(buf, 'x', page); +#else for (i = 0; i < (size_t)page; i++) buf[i] = 'x'; +#endif fd = open(path, O_RDWR | O_CREAT, 0700); if (fd < 0) { +#ifdef __FreeBSD__ + free(buf); + return "failed to open"; +#else str = "failed to open"; goto out; +#endif } +#if __FreeBSD__ + (void)write(fd, buf, page); +#else tot = 0; while (tot < page) { rv = write(fd, buf, sizeof(buf)); - if (rv < 0) { str = "failed to write"; goto out; @@ -88,6 +99,7 @@ msync_sync(const char *garbage, int flags) tot += rv; } +#endif map = mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_FILE|MAP_PRIVATE, fd, 0); diff --git a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c index a309f53d5550..af560f84614c 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c @@ -41,11 +41,6 @@ __RCSID("$NetBSD: t_sigqueue.c,v 1.7 2017/01/13 20:44:10 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#include -#endif - static void handler(int, siginfo_t *, void *); #define VALUE (int)0xc001dad1 @@ -212,7 +207,6 @@ ATF_TC_BODY(sigqueue_rt, tc) if (sigaddset(&mask, signals[i]) == -1) warn("sigaddset"); - ATF_REQUIRE(sigprocmask(SIG_BLOCK, &mask, &orig) != -1); for (size_t i = 0; i < CNT; i++) @@ -222,7 +216,6 @@ ATF_TC_BODY(sigqueue_rt, tc) sleep(1); ATF_CHECK_MSG((size_t)count == ndelivered, "count %zu != ndelivered %zu", (size_t)count, ndelivered); - for (size_t i = 0; i < ndelivered; i++) ATF_REQUIRE_MSG(ordered[i] == delivered[i], "%zu: ordered %d != delivered %d", diff --git a/contrib/netbsd-tests/lib/libc/sys/t_stat.c b/contrib/netbsd-tests/lib/libc/sys/t_stat.c index 956075275c33..adb32bb11efc 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_stat.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_stat.c @@ -48,10 +48,6 @@ __RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $"); #include -#ifdef __FreeBSD__ -#include -#endif - static const char *path = "stat"; ATF_TC_WITH_CLEANUP(stat_chflags); @@ -400,9 +396,6 @@ ATF_TC_BODY(stat_symlink, tc) (void)close(fd); ATF_REQUIRE(unlink(path) == 0); ATF_REQUIRE(unlink(pathlink) == 0); -#ifdef __FreeBSD__ - (void)close(fd); -#endif } ATF_TC_CLEANUP(stat_symlink, tc) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c index 695ac37d4b37..5b96a20c9da9 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c @@ -41,10 +41,6 @@ __RCSID("$NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $"); #include #include -#ifdef __FreeBSD__ -#include -#endif - static const char path[] = "truncate"; static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 }; From c8300756f24e04cd241a5da1397304eba36cbbb0 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:42:06 +0000 Subject: [PATCH 110/126] Use cleanup routines to remove POSIX semaphores instead of just blindly unlinking them at the beginning of the testcase This is a lot more intelligent in cleaning up the semaphores if the testcase fails before sem_unlink is called. Contributed back as bin/51872 upstream. --- contrib/netbsd-tests/lib/librt/t_sem.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/contrib/netbsd-tests/lib/librt/t_sem.c b/contrib/netbsd-tests/lib/librt/t_sem.c index e76cd521559d..d0480213eb28 100644 --- a/contrib/netbsd-tests/lib/librt/t_sem.c +++ b/contrib/netbsd-tests/lib/librt/t_sem.c @@ -72,7 +72,7 @@ __RCSID("$NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $"); #define NCHILDREN 10 -ATF_TC(basic); +ATF_TC_WITH_CLEANUP(basic); ATF_TC_HEAD(basic, tc) { atf_tc_set_md_var(tc, "descr", "Checks basic functionality of POSIX " @@ -86,9 +86,6 @@ ATF_TC_BODY(basic, tc) if (sysconf(_SC_SEMAPHORES) == -1) atf_tc_skip("POSIX semaphores not supported"); -#ifdef __FreeBSD__ - sem_unlink("/sem_b"); -#endif sem_b = sem_open("/sem_b", O_CREAT | O_EXCL, 0644, 0); ATF_REQUIRE(sem_b != SEM_FAILED); @@ -111,8 +108,12 @@ ATF_TC_BODY(basic, tc) ATF_REQUIRE_EQ(sem_close(sem_b), 0); ATF_REQUIRE_EQ(sem_unlink("/sem_b"), 0); } +ATF_TC_CLEANUP(basic, tc) +{ + (void)sem_unlink("/sem_b"); +} -ATF_TC(child); +ATF_TC_WITH_CLEANUP(child); ATF_TC_HEAD(child, tc) { atf_tc_set_md_var(tc, "descr", "Checks using semaphores to synchronize " @@ -127,12 +128,9 @@ ATF_TC_BODY(child, tc) pid_t pid; - if (sysconf(_SC_SEMAPHORES) == -1) + if (sysconf(_SC_SEMAPHORES) == -1) atf_tc_skip("POSIX semaphores not supported"); -#ifdef __FreeBSD__ - sem_unlink("/sem_a"); -#endif sem_a = sem_open("/sem_a", O_CREAT | O_EXCL, 0644, 0); ATF_REQUIRE(sem_a != SEM_FAILED); @@ -170,6 +168,10 @@ ATF_TC_BODY(child, tc) ATF_REQUIRE_EQ(sem_close(sem_a), 0); ATF_REQUIRE_EQ(sem_unlink("/sem_a"), 0); } +ATF_TC_CLEANUP(child, tc) +{ + (void)sem_unlink("/sem_a"); +} ATF_TP_ADD_TCS(tp) { From ecab856bc9e9367728ca5759add7363b007693d0 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:45:46 +0000 Subject: [PATCH 111/126] Clarify why sys/types.h #include is needed on FreeBSD --- contrib/netbsd-tests/kernel/kqueue/t_proc2.c | 2 +- contrib/netbsd-tests/kernel/kqueue/t_proc3.c | 2 +- contrib/netbsd-tests/kernel/kqueue/t_sig.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc2.c b/contrib/netbsd-tests/kernel/kqueue/t_proc2.c index 49c621abe35c..5630df7bcd6c 100644 --- a/contrib/netbsd-tests/kernel/kqueue/t_proc2.c +++ b/contrib/netbsd-tests/kernel/kqueue/t_proc2.c @@ -35,7 +35,7 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ __RCSID("$NetBSD: t_proc2.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #ifdef __FreeBSD__ -#include +#include /* for kqueue(2) */ #endif #include #include diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc3.c b/contrib/netbsd-tests/kernel/kqueue/t_proc3.c index bb20aedc278e..4822957868e4 100644 --- a/contrib/netbsd-tests/kernel/kqueue/t_proc3.c +++ b/contrib/netbsd-tests/kernel/kqueue/t_proc3.c @@ -33,7 +33,7 @@ __RCSID("$NetBSD: t_proc3.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #ifdef __FreeBSD__ -#include +#include /* for kqueue(2) */ #endif #include #include diff --git a/contrib/netbsd-tests/kernel/kqueue/t_sig.c b/contrib/netbsd-tests/kernel/kqueue/t_sig.c index 3557ba57bdca..dd6bc3e4355e 100644 --- a/contrib/netbsd-tests/kernel/kqueue/t_sig.c +++ b/contrib/netbsd-tests/kernel/kqueue/t_sig.c @@ -35,7 +35,7 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ __RCSID("$NetBSD: t_sig.c,v 1.3 2017/01/13 21:30:41 christos Exp $"); #ifdef __FreeBSD__ -#include +#include /* for kqueue(2) */ #endif #include #include From 81e7d81dc3cf2eec7ebc59422f6cca6266a359f0 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 09:47:06 +0000 Subject: [PATCH 112/126] One more sys/types.h kevent clarification missed in r312151 --- contrib/netbsd-tests/kernel/kqueue/t_vnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/netbsd-tests/kernel/kqueue/t_vnode.c b/contrib/netbsd-tests/kernel/kqueue/t_vnode.c index 06ef683d8a3c..abb75743071d 100644 --- a/contrib/netbsd-tests/kernel/kqueue/t_vnode.c +++ b/contrib/netbsd-tests/kernel/kqueue/t_vnode.c @@ -1,5 +1,5 @@ #ifdef __FreeBSD__ -#include +#include /* for kqueue(2) */ #endif #include #include From 28699efd430e6904192f42882c42adb878087f8a Mon Sep 17 00:00:00 2001 From: "Jason A. Harmening" Date: Sat, 14 Jan 2017 09:56:01 +0000 Subject: [PATCH 113/126] For i386 temporary mappings, unpin the thread before releasing the cmap lock. Releasing the lock first may result in the thread being immediately rescheduled and bound to the same CPU, only to unpin itself upon resuming execution. Noted by: skra (in review for armv6 equivalent) MFC after: 1 week --- sys/i386/i386/pmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index b4eef419a698..b75af59112b7 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -4216,8 +4216,8 @@ pmap_zero_page(vm_page_t m) invlcaddr(pc->pc_cmap_addr2); pagezero(pc->pc_cmap_addr2); *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -4244,8 +4244,8 @@ pmap_zero_page_area(vm_page_t m, int off, int size) else bzero(pc->pc_cmap_addr2 + off, size); *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -4275,8 +4275,8 @@ pmap_copy_page(vm_page_t src, vm_page_t dst) bcopy(pc->pc_cmap_addr1, pc->pc_cmap_addr2, PAGE_SIZE); *cmap_pte1 = 0; *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } int unmapped_buf_allowed = 1; @@ -4323,8 +4323,8 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], } *cmap_pte1 = 0; *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } /* @@ -5310,8 +5310,8 @@ pmap_flush_page(vm_page_t m) if (useclflushopt || cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); *cmap_pte2 = 0; - mtx_unlock(&pc->pc_cmap_lock); sched_unpin(); + mtx_unlock(&pc->pc_cmap_lock); } else pmap_invalidate_cache(); } From e0940c61c2edeb584d9b8015233e6563ae2377a5 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 10:05:26 +0000 Subject: [PATCH 114/126] Diff reduce with upstream post-accepted contributions --- contrib/netbsd-tests/lib/libm/t_ilogb.c | 3 --- contrib/netbsd-tests/lib/libm/t_pow.c | 4 ---- 2 files changed, 7 deletions(-) diff --git a/contrib/netbsd-tests/lib/libm/t_ilogb.c b/contrib/netbsd-tests/lib/libm/t_ilogb.c index 4a36a610e538..1d35cb64127b 100644 --- a/contrib/netbsd-tests/lib/libm/t_ilogb.c +++ b/contrib/netbsd-tests/lib/libm/t_ilogb.c @@ -31,9 +31,6 @@ #include __RCSID("$NetBSD: t_ilogb.c,v 1.7 2017/01/13 19:23:40 christos Exp $"); -#ifdef __FreeBSD__ -#include -#endif #include #include #include diff --git a/contrib/netbsd-tests/lib/libm/t_pow.c b/contrib/netbsd-tests/lib/libm/t_pow.c index fbdb9845363e..ee513db27ddb 100644 --- a/contrib/netbsd-tests/lib/libm/t_pow.c +++ b/contrib/netbsd-tests/lib/libm/t_pow.c @@ -34,10 +34,6 @@ __RCSID("$NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $"); #include #include -#ifdef __FreeBSD__ -#define isinff isinf -#endif - /* * pow(3) */ From 1f6a3aa8e5f12b513d463803677a97a099f4cea9 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 10:08:22 +0000 Subject: [PATCH 115/126] Fix the build using hunks pending upstream contributions --- contrib/netbsd-tests/lib/libc/sys/t_msync.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_msync.c b/contrib/netbsd-tests/lib/libc/sys/t_msync.c index e627614c067d..864df02d7bbf 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_msync.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_msync.c @@ -52,8 +52,12 @@ msync_sync(const char *garbage, int flags) { char *buf, *map = MAP_FAILED; const char *str = NULL; +#ifdef __FreeBSD__ + size_t len; +#else size_t i, len; ssize_t tot; +#endif int fd, rv; /* From 83e891f222794ed5b3f7596396ddc8fbb2586037 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 10:10:49 +0000 Subject: [PATCH 116/126] Revert t_pow@r312154 This hunk hasn't been accepted yet --- contrib/netbsd-tests/lib/libm/t_pow.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/netbsd-tests/lib/libm/t_pow.c b/contrib/netbsd-tests/lib/libm/t_pow.c index ee513db27ddb..fbdb9845363e 100644 --- a/contrib/netbsd-tests/lib/libm/t_pow.c +++ b/contrib/netbsd-tests/lib/libm/t_pow.c @@ -34,6 +34,10 @@ __RCSID("$NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $"); #include #include +#ifdef __FreeBSD__ +#define isinff isinf +#endif + /* * pow(3) */ From 484b7007513543f58241aae6542ad1ea3d016871 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 10:20:38 +0000 Subject: [PATCH 117/126] Fix up r312105 - Only #include tcpd.h when LIBWRAP is true to avoid header include errors - Only define whichaf when LIBWRAP is true to avoid -Wunused warning and to avoid issues with structs being defined that should only be defined when tcpd.h is included. MFC after: 2 weeks X-MFC with: r312105 Pointyhat to: ngie Reported by: gcc tinderbox Sponsored by: Dell EMC Isilon --- usr.sbin/inetd/inetd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index e538b871172a..e073f8f9c0ac 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -138,7 +138,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef LIBWRAP #include +#endif #include #include "inetd.h" @@ -307,6 +309,7 @@ getvalue(const char *arg, int *value, const char *whine) return 0; /* success */ } +#ifdef LIBWRAP static sa_family_t whichaf(struct request_info *req) { @@ -322,6 +325,7 @@ whichaf(struct request_info *req) #endif return sa->sa_family; } +#endif int main(int argc, char **argv) From 00ea8a5fc96c046a54ba4c227eedf9ab41a062b0 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 10:38:39 +0000 Subject: [PATCH 118/126] Fix -Wformat issue Use %zu for printing out results from nitems, as it's size_t based MFC after: 1 week X-MFC with: r312120 Reported by: gcc (mips:mipsel tinderbox) Sponsored by: Dell EMC Isilon --- tests/sys/mac/bsdextended/ugidfw_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/mac/bsdextended/ugidfw_test.c b/tests/sys/mac/bsdextended/ugidfw_test.c index 31280e972fbd..57a283ba2251 100644 --- a/tests/sys/mac/bsdextended/ugidfw_test.c +++ b/tests/sys/mac/bsdextended/ugidfw_test.c @@ -222,7 +222,7 @@ main(void) return (0); } - printf("1..%lu\n", nitems(test_users) + nitems(test_groups) + + printf("1..%zu\n", nitems(test_users) + nitems(test_groups) + 3 * nitems(test_strings) + 2); test_libugidfw_strings(); From 0a57eb32ad108eb6193c615d36442e464a75111e Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 12:55:32 +0000 Subject: [PATCH 119/126] Remove CFLAGS for sha2_test The previous code used to grab definitions from these openssl/openssh, but this is no longer needed and is no longer correct. libnetbsd provides all of the needed definitions libnetbsd is added to CFLAGS automatically via netbsd-tests.test.mk -- hence all of CFLAGS can be cleared --- lib/libc/tests/hash/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile index 2dc2073fc7ec..7811d455cdc3 100644 --- a/lib/libc/tests/hash/Makefile +++ b/lib/libc/tests/hash/Makefile @@ -33,8 +33,6 @@ LIBADD+= md LIBADD.sha2_test+= crypto CFLAGS.h_hash+= -I${SRCTOP}/lib/libnetbsd -CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh/openbsd-compat -CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh .include "../Makefile.netbsd-tests" From 59c6e3a58f970ffb35e4bc33627c77b3156b86a0 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sat, 14 Jan 2017 18:04:12 +0000 Subject: [PATCH 120/126] Decouple iSCSI connection limits from defaults. If initiator does not negotiate some parameter, it expects one to get default value, not some unknown remote hardware limit. On the side side, if some parameter is negotiated, its default value from RFC should not be used for anything. --- usr.sbin/ctld/ctld.c | 1 + usr.sbin/ctld/ctld.h | 6 ++-- usr.sbin/ctld/login.c | 67 +++++++++++++++++++++++++++---------------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index d812bd271564..4f0521f718e9 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1582,6 +1582,7 @@ connection_new(struct portal *portal, int fd, const char *host, * Default values, from RFC 3720, section 12. */ conn->conn_max_recv_data_segment_length = 8192; + conn->conn_max_send_data_segment_length = 8192; conn->conn_max_burst_length = 262144; conn->conn_first_burst_length = 65536; conn->conn_immediate_data = true; diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index 85cbd324507e..8452a158e980 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -48,8 +48,6 @@ #define MAX_LUNS 1024 #define MAX_NAME_LEN 223 #define MAX_DATA_SEGMENT_LENGTH (128 * 1024) -#define MAX_BURST_LENGTH 16776192 -#define FIRST_BURST_LENGTH (128 * 1024) #define SOCKBUF_SIZE 1048576 struct auth { @@ -242,6 +240,10 @@ struct connection { struct sockaddr_storage conn_initiator_sa; uint32_t conn_cmdsn; uint32_t conn_statsn; + int conn_max_recv_data_segment_limit; + int conn_max_send_data_segment_limit; + int conn_max_burst_limit; + int conn_first_burst_limit; int conn_max_recv_data_segment_length; int conn_max_send_data_segment_length; int conn_max_burst_length; diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index 5c3586821b2f..3fb65024becb 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -557,13 +557,15 @@ login_negotiate_key(struct pdu *request, const char *name, * our MaxRecvDataSegmentLength is not influenced by the * initiator in any way. */ - if ((int)tmp > conn->conn_max_send_data_segment_length) { - log_debugx("capping max_send_data_segment_length " + if ((int)tmp > conn->conn_max_send_data_segment_limit) { + log_debugx("capping MaxRecvDataSegmentLength " "from %zd to %d", tmp, - conn->conn_max_send_data_segment_length); - tmp = conn->conn_max_send_data_segment_length; + conn->conn_max_send_data_segment_limit); + tmp = conn->conn_max_send_data_segment_limit; } conn->conn_max_send_data_segment_length = tmp; + conn->conn_max_recv_data_segment_length = + conn->conn_max_recv_data_segment_limit; keys_add_int(response_keys, name, conn->conn_max_recv_data_segment_length); } else if (strcmp(name, "MaxBurstLength") == 0) { @@ -572,10 +574,10 @@ login_negotiate_key(struct pdu *request, const char *name, login_send_error(request, 0x02, 0x00); log_errx(1, "received invalid MaxBurstLength"); } - if ((int)tmp > conn->conn_max_burst_length) { + if ((int)tmp > conn->conn_max_burst_limit) { log_debugx("capping MaxBurstLength from %zd to %d", - tmp, conn->conn_max_burst_length); - tmp = conn->conn_max_burst_length; + tmp, conn->conn_max_burst_limit); + tmp = conn->conn_max_burst_limit; } conn->conn_max_burst_length = tmp; keys_add_int(response_keys, name, tmp); @@ -585,10 +587,10 @@ login_negotiate_key(struct pdu *request, const char *name, login_send_error(request, 0x02, 0x00); log_errx(1, "received invalid FirstBurstLength"); } - if ((int)tmp > conn->conn_first_burst_length) { + if ((int)tmp > conn->conn_first_burst_limit) { log_debugx("capping FirstBurstLength from %zd to %d", - tmp, conn->conn_first_burst_length); - tmp = conn->conn_first_burst_length; + tmp, conn->conn_first_burst_limit); + tmp = conn->conn_first_burst_limit; } conn->conn_first_burst_length = tmp; keys_add_int(response_keys, name, tmp); @@ -694,25 +696,42 @@ login_negotiate(struct connection *conn, struct pdu *request) * offload, it depends on hardware capabilities. */ assert(conn->conn_target != NULL); + conn->conn_max_recv_data_segment_limit = (1 << 24) - 1; + conn->conn_max_send_data_segment_limit = (1 << 24) - 1; + conn->conn_max_burst_limit = (1 << 24) - 1; + conn->conn_first_burst_limit = (1 << 24) - 1; kernel_limits(conn->conn_portal->p_portal_group->pg_offload, - &conn->conn_max_recv_data_segment_length, - &conn->conn_max_send_data_segment_length, - &conn->conn_max_burst_length, - &conn->conn_first_burst_length); + &conn->conn_max_recv_data_segment_limit, + &conn->conn_max_send_data_segment_limit, + &conn->conn_max_burst_limit, + &conn->conn_first_burst_limit); /* We expect legal, usable values at this point. */ - assert(conn->conn_max_recv_data_segment_length >= 512); - assert(conn->conn_max_recv_data_segment_length < (1 << 24)); - assert(conn->conn_max_burst_length >= 512); - assert(conn->conn_max_burst_length < (1 << 24)); - assert(conn->conn_first_burst_length >= 512); - assert(conn->conn_first_burst_length < (1 << 24)); - assert(conn->conn_first_burst_length <= - conn->conn_max_burst_length); + assert(conn->conn_max_recv_data_segment_limit >= 512); + assert(conn->conn_max_recv_data_segment_limit < (1 << 24)); + assert(conn->conn_max_send_data_segment_limit >= 512); + assert(conn->conn_max_send_data_segment_limit < (1 << 24)); + assert(conn->conn_max_burst_limit >= 512); + assert(conn->conn_max_burst_limit < (1 << 24)); + assert(conn->conn_first_burst_limit >= 512); + assert(conn->conn_first_burst_limit < (1 << 24)); + assert(conn->conn_first_burst_limit <= + conn->conn_max_burst_limit); + + /* + * Limit default send length in case it won't be negotiated. + * We can't do it for other limits, since they may affect both + * sender and receiver operation, and we must obey defaults. + */ + if (conn->conn_max_send_data_segment_limit < + conn->conn_max_send_data_segment_length) { + conn->conn_max_send_data_segment_limit = + conn->conn_max_send_data_segment_length; + } } else { - conn->conn_max_recv_data_segment_length = + conn->conn_max_recv_data_segment_limit = MAX_DATA_SEGMENT_LENGTH; - conn->conn_max_send_data_segment_length = + conn->conn_max_send_data_segment_limit = MAX_DATA_SEGMENT_LENGTH; } From 86785b54a59d233fd639a3e629301676ebf368f0 Mon Sep 17 00:00:00 2001 From: "Jason A. Harmening" Date: Sat, 14 Jan 2017 19:35:36 +0000 Subject: [PATCH 121/126] Add comment explaining relative order of sched_unpin() and mtx_unlock(). Suggested by: alc MFC after: 1 week --- sys/i386/i386/pmap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index b75af59112b7..1dc61ad4002d 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -4216,6 +4216,12 @@ pmap_zero_page(vm_page_t m) invlcaddr(pc->pc_cmap_addr2); pagezero(pc->pc_cmap_addr2); *cmap_pte2 = 0; + + /* + * Unpin the thread before releasing the lock. Otherwise the thread + * could be rescheduled while still bound to the current CPU, only + * to unpin itself immediately upon resuming execution. + */ sched_unpin(); mtx_unlock(&pc->pc_cmap_lock); } From 7aceb7fcd409127b0e1e19fc529223f5e4c83045 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sat, 14 Jan 2017 19:58:51 +0000 Subject: [PATCH 122/126] Fix wrong way assignment in r312190. --- usr.sbin/ctld/login.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c index 3fb65024becb..221b6eb7edda 100644 --- a/usr.sbin/ctld/login.c +++ b/usr.sbin/ctld/login.c @@ -725,8 +725,8 @@ login_negotiate(struct connection *conn, struct pdu *request) */ if (conn->conn_max_send_data_segment_limit < conn->conn_max_send_data_segment_length) { - conn->conn_max_send_data_segment_limit = - conn->conn_max_send_data_segment_length; + conn->conn_max_send_data_segment_length = + conn->conn_max_send_data_segment_limit; } } else { conn->conn_max_recv_data_segment_limit = From 4944940b4ec04e4775cc8cc76323334fcafcef97 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 Jan 2017 20:21:21 +0000 Subject: [PATCH 123/126] Add include Makefiles for tests/sys/{fs,kern,kqueue,mac}/... The primary goal for doing this is to leverage the work done in r312114 for enabling WARNS to address trivial code quality issues with new tests MFC after: 6 days Tested with: make tinderbox Sponsored by: Dell EMC Isilon --- tests/sys/fs/Makefile.inc | 3 +++ tests/sys/kern/Makefile.inc | 3 +++ tests/sys/kqueue/Makefile.inc | 3 +++ tests/sys/mac/Makefile.inc | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 tests/sys/fs/Makefile.inc create mode 100644 tests/sys/kern/Makefile.inc create mode 100644 tests/sys/kqueue/Makefile.inc create mode 100644 tests/sys/mac/Makefile.inc diff --git a/tests/sys/fs/Makefile.inc b/tests/sys/fs/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/fs/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/kern/Makefile.inc b/tests/sys/kern/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/kern/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/kqueue/Makefile.inc b/tests/sys/kqueue/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/kqueue/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" diff --git a/tests/sys/mac/Makefile.inc b/tests/sys/mac/Makefile.inc new file mode 100644 index 000000000000..265f86d1ed55 --- /dev/null +++ b/tests/sys/mac/Makefile.inc @@ -0,0 +1,3 @@ +# $FreeBSD$ + +.include "../Makefile.inc" From a15fbc904a4d535e0c438bcecac056fca4fa3c5e Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sat, 14 Jan 2017 20:41:44 +0000 Subject: [PATCH 124/126] Alike to r312190 decouple iSCSI connection limits from defaults. Connection parameters should remain at defaults until negotiated. While there, remove sythetic limits, applied if kernel provided none. iscsid has no own limitations, no configuration and no any idea what values are good. Assume kernel knows what it requests. --- usr.sbin/iscsid/iscsid.c | 43 ++++++++++++++++++++-------------------- usr.sbin/iscsid/iscsid.h | 2 -- usr.sbin/iscsid/login.c | 3 +++ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 8e94c8a430c8..392c7a681f3d 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -172,8 +172,10 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) conn->conn_data_digest = CONN_DIGEST_NONE; conn->conn_initial_r2t = true; conn->conn_immediate_data = true; - conn->conn_max_burst_length = MAX_BURST_LENGTH; - conn->conn_first_burst_length = FIRST_BURST_LENGTH; + conn->conn_max_recv_data_segment_length = 8192; + conn->conn_max_send_data_segment_length = 8192; + conn->conn_max_burst_length = 262144; + conn->conn_first_burst_length = 65536; conn->conn_iscsi_fd = iscsi_fd; conn->conn_session_id = request->idr_session_id; @@ -190,31 +192,28 @@ connection_new(int iscsi_fd, const struct iscsi_daemon_request *request) */ isl = &conn->conn_limits; memcpy(isl, &request->idr_limits, sizeof(*isl)); - if (isl->isl_max_recv_data_segment_length == 0) { - conn->conn_max_recv_data_segment_length = 8192; - conn->conn_max_send_data_segment_length = 8192; - isl->isl_max_recv_data_segment_length = 8192; - } else { - conn->conn_max_recv_data_segment_length = - isl->isl_max_recv_data_segment_length; - conn->conn_max_send_data_segment_length = - isl->isl_max_recv_data_segment_length; - } - if (isl->isl_max_send_data_segment_length == 0) { + if (isl->isl_max_recv_data_segment_length == 0) + isl->isl_max_recv_data_segment_length = (1 << 24) - 1; + if (isl->isl_max_send_data_segment_length == 0) isl->isl_max_send_data_segment_length = isl->isl_max_recv_data_segment_length; - } else { + if (isl->isl_max_burst_length == 0) + isl->isl_max_burst_length = (1 << 24) - 1; + if (isl->isl_first_burst_length == 0) + isl->isl_first_burst_length = (1 << 24) - 1; + if (isl->isl_first_burst_length > isl->isl_max_burst_length) + isl->isl_first_burst_length = isl->isl_max_burst_length; + + /* + * Limit default send length in case it won't be negotiated. + * We can't do it for other limits, since they may affect both + * sender and receiver operation, and we must obey defaults. + */ + if (conn->conn_max_send_data_segment_length > + isl->isl_max_send_data_segment_length) { conn->conn_max_send_data_segment_length = isl->isl_max_send_data_segment_length; } - if (isl->isl_max_burst_length == 0) - isl->isl_max_burst_length = conn->conn_max_burst_length; - if (isl->isl_first_burst_length == 0) { - if (isl->isl_max_burst_length < (int)conn->conn_first_burst_length) - isl->isl_first_burst_length = isl->isl_max_burst_length; - else - isl->isl_first_burst_length = conn->conn_first_burst_length; - } from_addr = conn->conn_conf.isc_initiator_addr; to_addr = conn->conn_conf.isc_target_addr; diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h index 6a4e6cd2fbc9..52f773fdcf09 100644 --- a/usr.sbin/iscsid/iscsid.h +++ b/usr.sbin/iscsid/iscsid.h @@ -44,8 +44,6 @@ #define CONN_MUTUAL_CHALLENGE_LEN 1024 #define SOCKBUF_SIZE 1048576 -#define MAX_BURST_LENGTH (256 * 1024) -#define FIRST_BURST_LENGTH (128 * 1024) struct connection { int conn_iscsi_fd; diff --git a/usr.sbin/iscsid/login.c b/usr.sbin/iscsid/login.c index 0b2d994c1be8..60941f0f3a0b 100644 --- a/usr.sbin/iscsid/login.c +++ b/usr.sbin/iscsid/login.c @@ -397,6 +397,9 @@ login_negotiate_key(struct connection *conn, const char *name, tmp = isl->isl_max_send_data_segment_length; } conn->conn_max_send_data_segment_length = tmp; + /* We received target's limit, that means it accepted our's. */ + conn->conn_max_recv_data_segment_length = + isl->isl_max_recv_data_segment_length; } else if (strcmp(name, "MaxBurstLength") == 0) { tmp = strtoul(value, NULL, 10); if (tmp <= 0) From c2718b428e0a394b48fa10d252044621b3fd3ec2 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 14 Jan 2017 22:06:25 +0000 Subject: [PATCH 125/126] Revert r311952. It broke DDB type-ahead since it caused db_check_interrupt() to drop unrecognized characters. Reported by: bde --- sys/ddb/db_input.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index f40ee755ecac..a2a7b3829e8c 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -63,6 +63,7 @@ static int db_lhist_nlines; #define BLANK ' ' #define BACKUP '\b' +static int cnmaygetc(void); static void db_delete(int n, int bwd); static int db_inputchar(int c); static void db_putnchars(int c, int count); @@ -290,6 +291,12 @@ db_inputchar(c) return (0); } +static int +cnmaygetc() +{ + return (-1); +} + int db_readline(lstart, lsize) char * lstart; @@ -343,7 +350,7 @@ db_check_interrupt(void) { int c; - c = cncheckc(); + c = cnmaygetc(); switch (c) { case -1: /* no character */ return; @@ -354,7 +361,7 @@ db_check_interrupt(void) case CTRL('s'): do { - c = cncheckc(); + c = cnmaygetc(); if (c == CTRL('c')) db_error((char *)0); } while (c != CTRL('q')); From 42d33c1f4d851906b445cf18e4e40d7899781e5b Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 14 Jan 2017 22:16:03 +0000 Subject: [PATCH 126/126] Stop the scheduler upon panic even in non-SMP kernels. This is needed for kernel dumps to work, as the panicking thread will call into code that makes use of kernel locks. Reported and tested by: Eugene Grosbein MFC after: 1 week --- sys/kern/kern_shutdown.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index f981c8093623..370a5447be4d 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -733,13 +733,13 @@ vpanic(const char *fmt, va_list ap) CPU_CLR(PCPU_GET(cpuid), &other_cpus); stop_cpus_hard(other_cpus); } +#endif /* * Ensure that the scheduler is stopped while panicking, even if panic * has been entered from kdb. */ td->td_stopsched = 1; -#endif bootopt = RB_AUTOBOOT; newpanic = 0;