From owner-svn-src-stable-9@FreeBSD.ORG Sun Jan 25 14:50:50 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DB5DA11; Sun, 25 Jan 2015 14:50:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78031D8B; Sun, 25 Jan 2015 14:50:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0PEooKm008654; Sun, 25 Jan 2015 14:50:50 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0PEooEB008653; Sun, 25 Jan 2015 14:50:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201501251450.t0PEooEB008653@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 25 Jan 2015 14:50:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277703 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2015 14:50:50 -0000 Author: ae Date: Sun Jan 25 14:50:49 2015 New Revision: 277703 URL: https://svnweb.freebsd.org/changeset/base/277703 Log: MFC r277295: Fix condition and really sort ports. Also add comment describing the intent of this code. Modified: stable/9/sys/net/if_lagg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/if_lagg.c ============================================================================== --- stable/9/sys/net/if_lagg.c Sun Jan 25 14:32:48 2015 (r277702) +++ stable/9/sys/net/if_lagg.c Sun Jan 25 14:50:49 2015 (r277703) @@ -624,11 +624,16 @@ lagg_port_create(struct lagg_softc *sc, lagg_port_lladdr(lp, IF_LLADDR(sc->sc_ifp)); } - /* Insert into the list of ports. Keep ports sorted by if_index. */ + /* + * Insert into the list of ports. + * Keep ports sorted by if_index. It is handy, when configuration + * is predictable and `ifconfig laggN create ...` command + * will lead to the same result each time. + */ SLIST_FOREACH(tlp, &sc->sc_ports, lp_entries) { if (tlp->lp_ifp->if_index < ifp->if_index && ( SLIST_NEXT(tlp, lp_entries) == NULL || - SLIST_NEXT(tlp, lp_entries)->lp_ifp->if_index < + SLIST_NEXT(tlp, lp_entries)->lp_ifp->if_index > ifp->if_index)) break; } From owner-svn-src-stable-9@FreeBSD.ORG Mon Jan 26 19:33:36 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF932547; Mon, 26 Jan 2015 19:33:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2137F6; Mon, 26 Jan 2015 19:33:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0QJXa5i022904; Mon, 26 Jan 2015 19:33:36 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0QJXaFr022903; Mon, 26 Jan 2015 19:33:36 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201501261933.t0QJXaFr022903@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 26 Jan 2015 19:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277770 - stable/9/sys/dev/acpica X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jan 2015 19:33:37 -0000 Author: jkim Date: Mon Jan 26 19:33:35 2015 New Revision: 277770 URL: https://svnweb.freebsd.org/changeset/base/277770 Log: MFC: r277579 Revert r216942. This commit was premature and caused too many complaints. Modified: stable/9/sys/dev/acpica/acpi_ec.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_ec.c Mon Jan 26 19:31:14 2015 (r277769) +++ stable/9/sys/dev/acpica/acpi_ec.c Mon Jan 26 19:33:35 2015 (r277770) @@ -623,7 +623,7 @@ EcGpeQueryHandler(void *Context) struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; - int retry, sci_enqueued; + int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -644,7 +644,6 @@ EcGpeQueryHandler(void *Context) * that may arise from running the query from causing another query * to be queued, we clear the pending flag only after running it. */ - sci_enqueued = sc->ec_sci_pend; for (retry = 0; retry < 2; retry++) { Status = EcCommand(sc, EC_COMMAND_QUERY); if (ACPI_SUCCESS(Status)) @@ -684,14 +683,6 @@ EcGpeQueryHandler(void *Context) device_printf(sc->ec_dev, "evaluation of query method %s failed: %s\n", qxx, AcpiFormatException(Status)); } - - /* Reenable runtime GPE if its execution was deferred. */ - if (sci_enqueued) { - Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit); - if (ACPI_FAILURE(Status)) - device_printf(sc->ec_dev, "reenabling runtime GPE failed: %s\n", - AcpiFormatException(Status)); - } } /* @@ -725,10 +716,9 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) { + if (ACPI_SUCCESS(Status)) sc->ec_sci_pend = TRUE; - return (0); - } else + else printf("EcGpeHandler: queuing GPE query handler failed\n"); } return (ACPI_REENABLE_GPE); From owner-svn-src-stable-9@FreeBSD.ORG Tue Jan 27 19:36:10 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35C77E57; Tue, 27 Jan 2015 19:36:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F9F7B10; Tue, 27 Jan 2015 19:36:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0RJa9gD015384; Tue, 27 Jan 2015 19:36:09 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0RJa9Il015382; Tue, 27 Jan 2015 19:36:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201501271936.t0RJa9Il015382@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 27 Jan 2015 19:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277807 - in stable: 10/sys/netinet 8/sys/netinet 9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2015 19:36:10 -0000 Author: delphij Date: Tue Jan 27 19:36:08 2015 New Revision: 277807 URL: https://svnweb.freebsd.org/changeset/base/277807 Log: Fix SCTP SCTP_SS_VALUE kernel memory corruption and disclosure vulnerability and SCTP stream reset vulnerability. Security: FreeBSD-SA-15:02.kmem Security: CVE-2014-8612 Security: FreeBSD-SA-15:03.sctp Security: CVE-2014-8613 Modified: stable/9/sys/netinet/sctp_input.c stable/9/sys/netinet/sctp_usrreq.c Changes in other areas also in this revision: Modified: stable/10/sys/netinet/sctp_input.c stable/10/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_usrreq.c Modified: stable/9/sys/netinet/sctp_input.c ============================================================================== --- stable/9/sys/netinet/sctp_input.c Tue Jan 27 19:35:41 2015 (r277806) +++ stable/9/sys/netinet/sctp_input.c Tue Jan 27 19:36:08 2015 (r277807) @@ -3662,6 +3662,9 @@ sctp_handle_stream_reset_response(struct /* huh ? */ return (0); } + if (ntohs(respin->ph.param_length) < sizeof(struct sctp_stream_reset_response_tsn)) { + return (0); + } if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { resp = (struct sctp_stream_reset_response_tsn *)respin; asoc->stream_reset_outstanding--; @@ -4050,7 +4053,7 @@ __attribute__((noinline)) sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, struct sctp_chunkhdr *ch_req) { - int chk_length, param_len, ptype; + uint16_t remaining_length, param_len, ptype; struct sctp_paramhdr pstore; uint8_t cstore[SCTP_CHUNK_BUFFER_SIZE]; uint32_t seq = 0; @@ -4063,7 +4066,7 @@ __attribute__((noinline)) int num_param = 0; /* now it may be a reset or a reset-response */ - chk_length = ntohs(ch_req->chunk_length); + remaining_length = ntohs(ch_req->chunk_length) - sizeof(struct sctp_chunkhdr); /* setup for adding the response */ sctp_alloc_a_chunk(stcb, chk); @@ -4099,20 +4102,27 @@ strres_nochunk: ch->chunk_length = htons(chk->send_size); SCTP_BUF_LEN(chk->data) = SCTP_SIZE32(chk->send_size); offset += sizeof(struct sctp_chunkhdr); - while ((size_t)chk_length >= sizeof(struct sctp_stream_reset_tsn_request)) { + while (remaining_length >= sizeof(struct sctp_paramhdr)) { ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, sizeof(pstore), (uint8_t *) & pstore); - if (ph == NULL) + if (ph == NULL) { + /* TSNH */ break; + } param_len = ntohs(ph->param_length); - if (param_len < (int)sizeof(struct sctp_stream_reset_tsn_request)) { - /* bad param */ + if ((param_len > remaining_length) || + (param_len < (sizeof(struct sctp_paramhdr) + sizeof(uint32_t)))) { + /* bad parameter length */ break; } - ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, min(param_len, (int)sizeof(cstore)), + ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset, min(param_len, sizeof(cstore)), (uint8_t *) & cstore); + if (ph == NULL) { + /* TSNH */ + break; + } ptype = ntohs(ph->param_type); num_param++; - if (param_len > (int)sizeof(cstore)) { + if (param_len > sizeof(cstore)) { trunc = 1; } else { trunc = 0; @@ -4124,6 +4134,9 @@ strres_nochunk: if (ptype == SCTP_STR_RESET_OUT_REQUEST) { struct sctp_stream_reset_out_request *req_out; + if (param_len < sizeof(struct sctp_stream_reset_out_request)) { + break; + } req_out = (struct sctp_stream_reset_out_request *)ph; num_req++; if (stcb->asoc.stream_reset_outstanding) { @@ -4137,12 +4150,18 @@ strres_nochunk: } else if (ptype == SCTP_STR_RESET_ADD_OUT_STREAMS) { struct sctp_stream_reset_add_strm *str_add; + if (param_len < sizeof(struct sctp_stream_reset_add_strm)) { + break; + } str_add = (struct sctp_stream_reset_add_strm *)ph; num_req++; sctp_handle_str_reset_add_strm(stcb, chk, str_add); } else if (ptype == SCTP_STR_RESET_ADD_IN_STREAMS) { struct sctp_stream_reset_add_strm *str_add; + if (param_len < sizeof(struct sctp_stream_reset_add_strm)) { + break; + } str_add = (struct sctp_stream_reset_add_strm *)ph; num_req++; sctp_handle_str_reset_add_out_strm(stcb, chk, str_add); @@ -4167,6 +4186,9 @@ strres_nochunk: struct sctp_stream_reset_response *resp; uint32_t result; + if (param_len < sizeof(struct sctp_stream_reset_response)) { + break; + } resp = (struct sctp_stream_reset_response *)ph; seq = ntohl(resp->response_seq); result = ntohl(resp->result); @@ -4178,7 +4200,11 @@ strres_nochunk: break; } offset += SCTP_SIZE32(param_len); - chk_length -= SCTP_SIZE32(param_len); + if (remaining_length >= SCTP_SIZE32(param_len)) { + remaining_length -= SCTP_SIZE32(param_len); + } else { + remaining_length = 0; + } } if (num_req == 0) { /* we have no response free the stuff */ Modified: stable/9/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/9/sys/netinet/sctp_usrreq.c Tue Jan 27 19:35:41 2015 (r277806) +++ stable/9/sys/netinet/sctp_usrreq.c Tue Jan 27 19:36:08 2015 (r277807) @@ -1854,8 +1854,9 @@ flags_out: SCTP_CHECK_AND_CAST(av, optval, struct sctp_stream_value, *optsize); SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { - if (stcb->asoc.ss_functions.sctp_ss_get_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id], - &av->stream_value) < 0) { + if ((av->stream_id >= stcb->asoc.streamoutcnt) || + (stcb->asoc.ss_functions.sctp_ss_get_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id], + &av->stream_value) < 0)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } else { @@ -3660,8 +3661,9 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(av, optval, struct sctp_stream_value, optsize); SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { - if (stcb->asoc.ss_functions.sctp_ss_set_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id], - av->stream_value) < 0) { + if ((av->stream_id >= stcb->asoc.streamoutcnt) || + (stcb->asoc.ss_functions.sctp_ss_set_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id], + av->stream_value) < 0)) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } @@ -3671,10 +3673,12 @@ sctp_setopt(struct socket *so, int optna SCTP_INP_RLOCK(inp); LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); - stcb->asoc.ss_functions.sctp_ss_set_value(stcb, - &stcb->asoc, - &stcb->asoc.strmout[av->stream_id], - av->stream_value); + if (av->stream_id < stcb->asoc.streamoutcnt) { + stcb->asoc.ss_functions.sctp_ss_set_value(stcb, + &stcb->asoc, + &stcb->asoc.strmout[av->stream_id], + av->stream_value); + } SCTP_TCB_UNLOCK(stcb); } SCTP_INP_RUNLOCK(inp); From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 28 02:33:08 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97D8E1B2; Wed, 28 Jan 2015 02:33:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79BF62DA; Wed, 28 Jan 2015 02:33:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0S2X8JE022751; Wed, 28 Jan 2015 02:33:08 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0S2X7CK022747; Wed, 28 Jan 2015 02:33:07 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201501280233.t0S2X7CK022747@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 28 Jan 2015 02:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277817 - stable/9/contrib/gdb/gdb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 02:33:08 -0000 Author: pfg Date: Wed Jan 28 02:33:06 2015 New Revision: 277817 URL: https://svnweb.freebsd.org/changeset/base/277817 Log: MFC r277608, r277656, r277659: Small upstream fixes for GDB. GDB: Fix memset thinkos. 2005-03-25 Anthony Green * remote.c (remote_store_registers): Fix memset usage. * std-regs.c (value_of_builtin_frame_reg): Ditto. (value_of_builtin_frame_fp_reg): Ditto. (value_of_builtin_frame_reg): Ditto. Reported by: Dirk Engling gdb: Add missing break statements 2004-05-21 Jim Blandy * dwarf2expr.c (execute_stack_op): Add 'break' statements after cases for DW_OP_div and DW_OP_shr. (Thanks to Reva Cuthbertson.) GDB: Replace use of sprintf. 2005-03-17 Mark Kettenis * corelow.c (get_core_register_section): Replace usage of sprintf and strcpy with xstrprintf and xstrdup. CID: 604160, 604161, 604162, 604163 CID: 1006819 1008254 Modified: stable/9/contrib/gdb/gdb/corelow.c stable/9/contrib/gdb/gdb/dwarf2expr.c stable/9/contrib/gdb/gdb/remote.c stable/9/contrib/gdb/gdb/std-regs.c Directory Properties: stable/9/contrib/gdb/ (props changed) Modified: stable/9/contrib/gdb/gdb/corelow.c ============================================================================== --- stable/9/contrib/gdb/gdb/corelow.c Wed Jan 28 02:25:48 2015 (r277816) +++ stable/9/contrib/gdb/gdb/corelow.c Wed Jan 28 02:33:06 2015 (r277817) @@ -432,15 +432,16 @@ get_core_register_section (char *name, char *human_name, int required) { - char section_name[100]; + static char *section_name = NULL; struct bfd_section *section; bfd_size_type size; char *contents; + xfree (section_name); if (PIDGET (inferior_ptid)) - sprintf (section_name, "%s/%d", name, PIDGET (inferior_ptid)); + section_name = xstrprintf ("%s/%d", name, PIDGET (inferior_ptid)); else - strcpy (section_name, name); + section_name = xstrdup (name); section = bfd_get_section_by_name (core_bfd, section_name); if (! section) Modified: stable/9/contrib/gdb/gdb/dwarf2expr.c ============================================================================== --- stable/9/contrib/gdb/gdb/dwarf2expr.c Wed Jan 28 02:25:48 2015 (r277816) +++ stable/9/contrib/gdb/gdb/dwarf2expr.c Wed Jan 28 02:33:06 2015 (r277817) @@ -575,6 +575,7 @@ execute_stack_op (struct dwarf_expr_cont break; case DW_OP_div: binop = BINOP_DIV; + break; case DW_OP_minus: binop = BINOP_SUB; break; @@ -595,6 +596,7 @@ execute_stack_op (struct dwarf_expr_cont break; case DW_OP_shr: binop = BINOP_RSH; + break; case DW_OP_shra: binop = BINOP_RSH; val1 = value_from_longest (signed_address_type (), first); Modified: stable/9/contrib/gdb/gdb/remote.c ============================================================================== --- stable/9/contrib/gdb/gdb/remote.c Wed Jan 28 02:25:48 2015 (r277816) +++ stable/9/contrib/gdb/gdb/remote.c Wed Jan 28 02:33:06 2015 (r277817) @@ -3463,7 +3463,7 @@ remote_store_registers (int regnum) { int i; regs = alloca (rs->sizeof_g_packet); - memset (regs, rs->sizeof_g_packet, 0); + memset (regs, 0, rs->sizeof_g_packet); for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++) { struct packet_reg *r = &rs->regs[i]; Modified: stable/9/contrib/gdb/gdb/std-regs.c ============================================================================== --- stable/9/contrib/gdb/gdb/std-regs.c Wed Jan 28 02:25:48 2015 (r277816) +++ stable/9/contrib/gdb/gdb/std-regs.c Wed Jan 28 02:33:06 2015 (r277817) @@ -61,7 +61,7 @@ value_of_builtin_frame_reg (struct frame val = allocate_value (builtin_type_frame_reg); VALUE_LVAL (val) = not_lval; buf = VALUE_CONTENTS_RAW (val); - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + memset (buf, 0, TYPE_LENGTH (VALUE_TYPE (val))); /* frame.base. */ if (frame != NULL) ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, @@ -87,7 +87,7 @@ value_of_builtin_frame_fp_reg (struct fr struct value *val = allocate_value (builtin_type_void_data_ptr); char *buf = VALUE_CONTENTS_RAW (val); if (frame == NULL) - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + memset (buf, 0, TYPE_LENGTH (VALUE_TYPE (val))); else ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, get_frame_base_address (frame)); @@ -105,7 +105,7 @@ value_of_builtin_frame_pc_reg (struct fr struct value *val = allocate_value (builtin_type_void_data_ptr); char *buf = VALUE_CONTENTS_RAW (val); if (frame == NULL) - memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); + memset (buf, 0, TYPE_LENGTH (VALUE_TYPE (val))); else ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, get_frame_pc (frame)); From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 28 15:37:36 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBEB394A; Wed, 28 Jan 2015 15:37:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D76F305; Wed, 28 Jan 2015 15:37:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0SFbahF094450; Wed, 28 Jan 2015 15:37:36 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0SFbaVu094448; Wed, 28 Jan 2015 15:37:36 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201501281537.t0SFbaVu094448@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 28 Jan 2015 15:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277833 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 15:37:36 -0000 Author: pfg Date: Wed Jan 28 15:37:35 2015 New Revision: 277833 URL: https://svnweb.freebsd.org/changeset/base/277833 Log: MFC r277340, r277349: Remove dead code. After the ext2 variant of the "orlov allocator" was implemented, the case for a negative or zero dirsize disappeared. Drop the dead code and unsign dirsize given that it can't be negative anyways. ext2fs: fix for uninitialized pointer read. path.ep_bp was being used uninitialized in ext4_ext_find_extent(). CID: 1062344 CID: 1008669 Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_bmap.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jan 28 15:36:24 2015 (r277832) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jan 28 15:37:35 2015 (r277833) @@ -443,11 +443,11 @@ static u_long ext2_dirpref(struct inode *pip) { struct m_ext2fs *fs; - int cg, prefcg, dirsize, cgsize; + int cg, prefcg, cgsize; u_int avgifree, avgbfree, avgndir, curdirsize; u_int minifree, minbfree, maxndir; u_int mincg, minndir; - u_int maxcontigdirs; + u_int dirsize, maxcontigdirs; mtx_assert(EXT2_MTX(pip->i_ump), MA_OWNED); fs = pip->i_e2fs; @@ -498,10 +498,7 @@ ext2_dirpref(struct inode *pip) curdirsize = avgndir ? (cgsize - avgbfree * fs->e2fs_bsize) / avgndir : 0; if (dirsize < curdirsize) dirsize = curdirsize; - if (dirsize <= 0) - maxcontigdirs = 0; /* dirsize overflowed */ - else - maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255); + maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255); maxcontigdirs = min(maxcontigdirs, fs->e2fs_ipg / AFPDIR); if (maxcontigdirs == 0) maxcontigdirs = 1; Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jan 28 15:36:24 2015 (r277832) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jan 28 15:37:35 2015 (r277833) @@ -94,7 +94,7 @@ ext4_bmapext(struct vnode *vp, int32_t b struct inode *ip; struct m_ext2fs *fs; struct ext4_extent *ep; - struct ext4_extent_path path; + struct ext4_extent_path path = { .ep_bp = NULL }; daddr_t lbn; ip = VTOI(vp); From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 28 19:43:34 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A99393E4; Wed, 28 Jan 2015 19:43:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 957DE243; Wed, 28 Jan 2015 19:43:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0SJhYuk015952; Wed, 28 Jan 2015 19:43:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0SJhY64015951; Wed, 28 Jan 2015 19:43:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201501281943.t0SJhY64015951@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 28 Jan 2015 19:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277846 - stable/9/sys/dev/usb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 19:43:34 -0000 Author: hselasky Date: Wed Jan 28 19:43:33 2015 New Revision: 277846 URL: https://svnweb.freebsd.org/changeset/base/277846 Log: MFC r277417: Fix returned data for the USB_GET_DEV_PORT_PATH IOCTL in particular the value returned in the "udp_port_level" field. Modified: stable/9/sys/dev/usb/usb_generic.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb_generic.c ============================================================================== --- stable/9/sys/dev/usb/usb_generic.c Wed Jan 28 19:41:31 2015 (r277845) +++ stable/9/sys/dev/usb/usb_generic.c Wed Jan 28 19:43:33 2015 (r277846) @@ -1837,14 +1837,13 @@ ugen_get_port_path(struct usb_fifo *f, s if (nlevel > USB_DEVICE_PORT_PATH_MAX) goto error; + /* store total level of ports */ + dpp->udp_port_level = nlevel; + /* store port index array */ next = udev; while (next->parent_hub != NULL) { - nlevel--; - - dpp->udp_port_no[nlevel] = next->port_no; - dpp->udp_port_level = nlevel; - + dpp->udp_port_no[--nlevel] = next->port_no; next = next->parent_hub; } return (0); /* success */ From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 28 19:53:01 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CAD294D; Wed, 28 Jan 2015 19:53:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38C3536F; Wed, 28 Jan 2015 19:53:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0SJr1x9020783; Wed, 28 Jan 2015 19:53:01 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0SJr0cq020781; Wed, 28 Jan 2015 19:53:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201501281953.t0SJr0cq020781@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 28 Jan 2015 19:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277848 - stable/9/lib/libusb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 19:53:01 -0000 Author: hselasky Date: Wed Jan 28 19:53:00 2015 New Revision: 277848 URL: https://svnweb.freebsd.org/changeset/base/277848 Log: MFC r277245: Add more USB request definitions. The values are described in section 9.4.11 and 9.4.12 of the "Universal Serial Bus 3.0 Specification" Modified: stable/9/lib/libusb/libusb.h stable/9/lib/libusb/libusb20_desc.h Directory Properties: stable/9/lib/ (props changed) stable/9/lib/libusb/ (props changed) Modified: stable/9/lib/libusb/libusb.h ============================================================================== --- stable/9/lib/libusb/libusb.h Wed Jan 28 19:49:53 2015 (r277847) +++ stable/9/lib/libusb/libusb.h Wed Jan 28 19:53:00 2015 (r277848) @@ -125,6 +125,8 @@ enum libusb_standard_request { LIBUSB_REQUEST_GET_INTERFACE = 0x0A, LIBUSB_REQUEST_SET_INTERFACE = 0x0B, LIBUSB_REQUEST_SYNCH_FRAME = 0x0C, + LIBUSB_REQUEST_SET_SEL = 0x30, + LIBUSB_REQUEST_SET_ISOCH_DELAY = 0x31, }; enum libusb_request_type { Modified: stable/9/lib/libusb/libusb20_desc.h ============================================================================== --- stable/9/lib/libusb/libusb20_desc.h Wed Jan 28 19:49:53 2015 (r277847) +++ stable/9/lib/libusb/libusb20_desc.h Wed Jan 28 19:53:00 2015 (r277848) @@ -477,6 +477,12 @@ enum libusb20_standard_request { /** Set then report an endpoint's synchronization frame */ LIBUSB20_REQUEST_SYNCH_FRAME = 0x0C, + + /** Set U1 and U2 system exit latency */ + LIBUSB20_REQUEST_SET_SEL = 0x30, + + /** Set isochronous delay */ + LIBUSB20_REQUEST_SET_ISOCH_DELAY = 0x31, }; /** \ingroup misc From owner-svn-src-stable-9@FreeBSD.ORG Wed Jan 28 19:59:27 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF4B9F0A; Wed, 28 Jan 2015 19:59:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB2403E9; Wed, 28 Jan 2015 19:59:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0SJxRKA021802; Wed, 28 Jan 2015 19:59:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0SJxRJH021795; Wed, 28 Jan 2015 19:59:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201501281959.t0SJxRJH021795@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 28 Jan 2015 19:59:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277851 - in stable/9/sys/dev/usb: . serial X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 19:59:28 -0000 Author: hselasky Date: Wed Jan 28 19:59:26 2015 New Revision: 277851 URL: https://svnweb.freebsd.org/changeset/base/277851 Log: MFC r277246: Add more USB device IDs. PR: 196362 Modified: stable/9/sys/dev/usb/serial/u3g.c stable/9/sys/dev/usb/usbdevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/serial/u3g.c ============================================================================== --- stable/9/sys/dev/usb/serial/u3g.c Wed Jan 28 19:57:40 2015 (r277850) +++ stable/9/sys/dev/usb/serial/u3g.c Wed Jan 28 19:59:26 2015 (r277851) @@ -239,6 +239,8 @@ static const STRUCT_USB_HOST_ID u3g_devs U3G_DEV(DELL, U740, 0), U3G_DEV(DLINK, DWR510_CD, U3GINIT_SCSIEJECT), U3G_DEV(DLINK, DWR510, 0), + U3G_DEV(DLINK, DWM157_CD, U3GINIT_SCSIEJECT), + U3G_DEV(DLINK, DWM157, 0), U3G_DEV(DLINK3, DWM652, 0), U3G_DEV(HP, EV2200, 0), U3G_DEV(HP, HS2300, 0), Modified: stable/9/sys/dev/usb/usbdevs ============================================================================== --- stable/9/sys/dev/usb/usbdevs Wed Jan 28 19:57:40 2015 (r277850) +++ stable/9/sys/dev/usb/usbdevs Wed Jan 28 19:59:26 2015 (r277851) @@ -1626,6 +1626,8 @@ product DLINK DSB650 0xabc1 10/100 Ethe product DLINK DUBH7 0xf103 DUB-H7 USB 2.0 7-Port Hub product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode product DLINK DWR510 0x7e12 DWR-510 +product DLINK DWM157 0x7d02 DWM-157 +product DLINK DWM157_CD 0xa707 DWM-157 CD-ROM Mode product DLINK RTL8188CU 0x3308 RTL8188CU product DLINK RTL8192CU_1 0x3307 RTL8192CU product DLINK RTL8192CU_2 0x3309 RTL8192CU From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 29 09:06:22 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 264AA1E6; Thu, 29 Jan 2015 09:06:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 113ED964; Thu, 29 Jan 2015 09:06:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0T96LVn098840; Thu, 29 Jan 2015 09:06:21 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0T96Las098839; Thu, 29 Jan 2015 09:06:21 GMT (envelope-from des@FreeBSD.org) Message-Id: <201501290906.t0T96Las098839@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Thu, 29 Jan 2015 09:06:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277874 - stable/9/lib/libpam/modules/pam_radius X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 09:06:22 -0000 Author: des Date: Thu Jan 29 09:06:21 2015 New Revision: 277874 URL: https://svnweb.freebsd.org/changeset/base/277874 Log: MFH (r277237): pass PAM_RHOST to RADIUS server as Calling-Station-ID Modified: stable/9/lib/libpam/modules/pam_radius/pam_radius.c Directory Properties: stable/9/lib/libpam/ (props changed) Modified: stable/9/lib/libpam/modules/pam_radius/pam_radius.c ============================================================================== --- stable/9/lib/libpam/modules/pam_radius/pam_radius.c Thu Jan 29 09:03:57 2015 (r277873) +++ stable/9/lib/libpam/modules/pam_radius/pam_radius.c Thu Jan 29 09:06:21 2015 (r277874) @@ -62,11 +62,11 @@ __FBSDID("$FreeBSD$"); #define PASSWORD_PROMPT "RADIUS Password:" static int build_access_request(struct rad_handle *, const char *, - const char *, const char *, const char *, const void *, - size_t); + const char *, const char *, const char *, const char *, + const void *, size_t); static int do_accept(pam_handle_t *, struct rad_handle *); static int do_challenge(pam_handle_t *, struct rad_handle *, - const char *, const char *, const char *); + const char *, const char *, const char *, const char *); /* * Construct an access request, but don't send it. Returns 0 on success, @@ -75,7 +75,7 @@ static int do_challenge(pam_handle_t *, static int build_access_request(struct rad_handle *radh, const char *user, const char *pass, const char *nas_id, const char *nas_ipaddr, - const void *state, size_t state_len) + const char *rhost, const void *state, size_t state_len) { int error; char host[MAXHOSTNAMELEN]; @@ -121,8 +121,13 @@ build_access_request(struct rad_handle * } } } - if (state != NULL && rad_put_attr(radh, RAD_STATE, state, - state_len) == -1) { + if (rhost != NULL && + rad_put_string(radh, RAD_CALLING_STATION_ID, rhost) == -1) { + syslog(LOG_CRIT, "rad_put_string: %s", rad_strerror(radh)); + return (-1); + } + if (state != NULL && + rad_put_attr(radh, RAD_STATE, state, state_len) == -1) { syslog(LOG_CRIT, "rad_put_attr: %s", rad_strerror(radh)); return (-1); } @@ -162,7 +167,7 @@ do_accept(pam_handle_t *pamh, struct rad static int do_challenge(pam_handle_t *pamh, struct rad_handle *radh, const char *user, - const char *nas_id, const char *nas_ipaddr) + const char *nas_id, const char *nas_ipaddr, const char *rhost) { int retval; int attrtype; @@ -230,7 +235,7 @@ do_challenge(pam_handle_t *pamh, struct conv->appdata_ptr)) != PAM_SUCCESS) return (retval); if (build_access_request(radh, user, resp[num_msgs-1].resp, nas_id, - nas_ipaddr, state, statelen) == -1) + nas_ipaddr, rhost, state, statelen) == -1) return (PAM_SERVICE_ERR); memset(resp[num_msgs-1].resp, 0, strlen(resp[num_msgs-1].resp)); free(resp[num_msgs-1].resp); @@ -246,7 +251,7 @@ pam_sm_authenticate(pam_handle_t *pamh, { struct rad_handle *radh; const char *user, *pass; - const void *tmpuser; + const void *rhost, *tmpuser; const char *conf_file, *template_user, *nas_id, *nas_ipaddr; int retval; int e; @@ -255,6 +260,7 @@ pam_sm_authenticate(pam_handle_t *pamh, template_user = openpam_get_option(pamh, PAM_OPT_TEMPLATE_USER); nas_id = openpam_get_option(pamh, PAM_OPT_NAS_ID); nas_ipaddr = openpam_get_option(pamh, PAM_OPT_NAS_IPADDR); + pam_get_item(pamh, PAM_RHOST, &rhost); retval = pam_get_user(pamh, &user, NULL); if (retval != PAM_SUCCESS) @@ -284,8 +290,8 @@ pam_sm_authenticate(pam_handle_t *pamh, PAM_LOG("Radius config file read"); - if (build_access_request(radh, user, pass, nas_id, nas_ipaddr, NULL, - 0) == -1) { + if (build_access_request(radh, user, pass, nas_id, nas_ipaddr, rhost, + NULL, 0) == -1) { rad_close(radh); return (PAM_SERVICE_ERR); } @@ -330,7 +336,7 @@ pam_sm_authenticate(pam_handle_t *pamh, case RAD_ACCESS_CHALLENGE: retval = do_challenge(pamh, radh, user, nas_id, - nas_ipaddr); + nas_ipaddr, rhost); if (retval != PAM_SUCCESS) { rad_close(radh); return (retval); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 29 16:16:21 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 065BCF44; Thu, 29 Jan 2015 16:16:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD4EC117; Thu, 29 Jan 2015 16:16:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0TGGKd4001522; Thu, 29 Jan 2015 16:16:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0TGGK8m001521; Thu, 29 Jan 2015 16:16:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201501291616.t0TGGK8m001521@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 29 Jan 2015 16:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277880 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 16:16:21 -0000 Author: mav Date: Thu Jan 29 16:16:20 2015 New Revision: 277880 URL: https://svnweb.freebsd.org/changeset/base/277880 Log: MFC r276983: When aggregating TRIM segments, move the new one to the end. New segment at the list head may block all TRIM requests until txg of that segment can be processed. On my random I/O tests this change reduce peak TRIM list length from 650 to 450 segments. Hopefully it should reduce TRIM burstiness when list processing is unblocked. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Jan 29 15:35:55 2015 (r277879) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Jan 29 16:16:20 2015 (r277880) @@ -255,17 +255,23 @@ trim_map_segment_add(trim_map_t *tm, uin ts_after->ts_start = ts_before->ts_start; ts_after->ts_txg = txg; ts_after->ts_time = time; + list_remove(&tm->tm_head, ts_after); + list_insert_tail(&tm->tm_head, ts_after); kmem_free(ts_before, sizeof (*ts_before)); } else if (merge_before) { TRIM_MAP_SINC(tm, end - ts_before->ts_end); ts_before->ts_end = end; ts_before->ts_txg = txg; ts_before->ts_time = time; + list_remove(&tm->tm_head, ts_before); + list_insert_tail(&tm->tm_head, ts_before); } else if (merge_after) { TRIM_MAP_SINC(tm, ts_after->ts_start - start); ts_after->ts_start = start; ts_after->ts_txg = txg; ts_after->ts_time = time; + list_remove(&tm->tm_head, ts_after); + list_insert_tail(&tm->tm_head, ts_after); } else { TRIM_MAP_SINC(tm, end - start); TRIM_MAP_QINC(tm); From owner-svn-src-stable-9@FreeBSD.ORG Thu Jan 29 16:19:06 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 743F5143; Thu, 29 Jan 2015 16:19:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F566160; Thu, 29 Jan 2015 16:19:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0TGJ6bN001950; Thu, 29 Jan 2015 16:19:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0TGJ6gd001949; Thu, 29 Jan 2015 16:19:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201501291619.t0TGJ6gd001949@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 29 Jan 2015 16:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277881 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2015 16:19:06 -0000 Author: mav Date: Thu Jan 29 16:19:05 2015 New Revision: 277881 URL: https://svnweb.freebsd.org/changeset/base/277881 Log: MFC r277185: Fix overflow bug from r248577, turning 30s TRIM timeout into ~4s. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Jan 29 16:16:20 2015 (r277880) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Thu Jan 29 16:19:05 2015 (r277881) @@ -463,7 +463,7 @@ trim_map_vdev_commit(spa_t *spa, zio_t * if (tm == NULL) return; - timelimit = gethrtime() - trim_timeout * NANOSEC; + timelimit = gethrtime() - (hrtime_t)trim_timeout * NANOSEC; if (vd->vdev_isl2cache) { txgsafe = UINT64_MAX; txgtarget = UINT64_MAX; From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 30 14:38:00 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69C76263; Fri, 30 Jan 2015 14:38:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55E1E278; Fri, 30 Jan 2015 14:38:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0UEc06T067580; Fri, 30 Jan 2015 14:38:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0UEbxdQ067569; Fri, 30 Jan 2015 14:37:59 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201501301437.t0UEbxdQ067569@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 30 Jan 2015 14:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277934 - stable/9/usr.bin/sed X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2015 14:38:00 -0000 Author: pfg Date: Fri Jan 30 14:37:59 2015 New Revision: 277934 URL: https://svnweb.freebsd.org/changeset/base/277934 Log: MFC r277802, r277811: sed: Fix resource leak and dereference after NULL. process.c: Protect access against NULL. main.c: Prevent outfile overwrite resource leak. CID: 271181 CID: 1006930 Obtained from: NetBSD Modified: stable/9/usr.bin/sed/main.c stable/9/usr.bin/sed/process.c Directory Properties: stable/9/usr.bin/sed/ (props changed) Modified: stable/9/usr.bin/sed/main.c ============================================================================== --- stable/9/usr.bin/sed/main.c Fri Jan 30 14:36:02 2015 (r277933) +++ stable/9/usr.bin/sed/main.c Fri Jan 30 14:37:59 2015 (r277934) @@ -404,6 +404,8 @@ mf_fgets(SPACE *sp, enum e_spflag spflag if (len >= sizeof(tmpfname)) errx(1, "%s: name too long", fname); unlink(tmpfname); + if (outfile != NULL && outfile != stdout) + fclose(outfile); if ((outfile = fopen(tmpfname, "w")) == NULL) err(1, "%s", fname); fchown(fileno(outfile), sb.st_uid, sb.st_gid); Modified: stable/9/usr.bin/sed/process.c ============================================================================== --- stable/9/usr.bin/sed/process.c Fri Jan 30 14:36:02 2015 (r277933) +++ stable/9/usr.bin/sed/process.c Fri Jan 30 14:37:59 2015 (r277934) @@ -314,7 +314,7 @@ applies(struct s_command *cp) } else r = 1; } - } else if (MATCH(cp->a1)) { + } else if (cp->a1 && MATCH(cp->a1)) { /* * If the second address is a number less than or * equal to the line number first selected, only From owner-svn-src-stable-9@FreeBSD.ORG Fri Jan 30 18:55:18 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 117E1635; Fri, 30 Jan 2015 18:55:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4D0494B; Fri, 30 Jan 2015 18:55:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0UItHlT005545; Fri, 30 Jan 2015 18:55:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0UItHtQ005543; Fri, 30 Jan 2015 18:55:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201501301855.t0UItHtQ005543@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 30 Jan 2015 18:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r277947 - in stable/9/sys/boot: i386/loader pc98/loader X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2015 18:55:18 -0000 Author: jhb Date: Fri Jan 30 18:55:16 2015 New Revision: 277947 URL: https://svnweb.freebsd.org/changeset/base/277947 Log: MFC 274398,274537: Move NFS and TFTP filesystems before the synthetic filesystems (bzip, gzip, and split). Modified: stable/9/sys/boot/i386/loader/conf.c stable/9/sys/boot/pc98/loader/conf.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/i386/loader/conf.c ============================================================================== --- stable/9/sys/boot/i386/loader/conf.c Fri Jan 30 18:55:05 2015 (r277946) +++ stable/9/sys/boot/i386/loader/conf.c Fri Jan 30 18:55:16 2015 (r277947) @@ -77,8 +77,11 @@ struct fs_ops *file_system[] = { &ext2fs_fsops, &dosfs_fsops, &cd9660_fsops, -#ifdef LOADER_SPLIT_SUPPORT - &splitfs_fsops, +#ifdef LOADER_NFS_SUPPORT + &nfs_fsops, +#endif +#ifdef LOADER_TFTP_SUPPORT + &tftp_fsops, #endif #ifdef LOADER_GZIP_SUPPORT &gzipfs_fsops, @@ -86,11 +89,8 @@ struct fs_ops *file_system[] = { #ifdef LOADER_BZIP2_SUPPORT &bzipfs_fsops, #endif -#ifdef LOADER_NFS_SUPPORT - &nfs_fsops, -#endif -#ifdef LOADER_TFTP_SUPPORT - &tftp_fsops, +#ifdef LOADER_SPLIT_SUPPORT + &splitfs_fsops, #endif NULL }; Modified: stable/9/sys/boot/pc98/loader/conf.c ============================================================================== --- stable/9/sys/boot/pc98/loader/conf.c Fri Jan 30 18:55:05 2015 (r277946) +++ stable/9/sys/boot/pc98/loader/conf.c Fri Jan 30 18:55:16 2015 (r277947) @@ -61,19 +61,19 @@ struct fs_ops *file_system[] = { &ext2fs_fsops, &dosfs_fsops, &cd9660_fsops, - &splitfs_fsops, -#ifdef LOADER_GZIP_SUPPORT - &gzipfs_fsops, -#endif -#ifdef LOADER_BZIP2_SUPPORT - &bzipfs_fsops, -#endif #ifdef LOADER_NFS_SUPPORT &nfs_fsops, #endif #ifdef LOADER_TFTP_SUPPORT &tftp_fsops, #endif +#ifdef LOADER_GZIP_SUPPORT + &gzipfs_fsops, +#endif +#ifdef LOADER_BZIP2_SUPPORT + &bzipfs_fsops, +#endif + &splitfs_fsops, NULL }; From owner-svn-src-stable-9@FreeBSD.ORG Sat Jan 31 23:49:03 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68F4A939; Sat, 31 Jan 2015 23:49:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 523A8B0C; Sat, 31 Jan 2015 23:49:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0VNn3an078610; Sat, 31 Jan 2015 23:49:03 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0VNmxZX078437; Sat, 31 Jan 2015 23:48:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201501312348.t0VNmxZX078437@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 31 Jan 2015 23:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r278017 - in stable: 10/contrib/libcxxrt 10/lib/libcxxrt 9/contrib/libcxxrt 9/lib/libcxxrt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2015 23:49:03 -0000 Author: dim Date: Sat Jan 31 23:48:59 2015 New Revision: 278017 URL: https://svnweb.freebsd.org/changeset/base/278017 Log: MFC r273381 (by bapt): Add support for __cxa_throw_bad_array_new_length in libcxxrt It is required for use with newer g++49 Differential Revision: https://reviews.freebsd.org/D982 Reviewed by: theraven Approved by: theraven MFC r276417: Import libcxxrt master 00bc29eb6513624824a6d7db2ebc768a4216a604. Interesting fixes: 76584a0 Reorganize code to use only 32bit atomic ops for 32bit platforms 30d2ae5 Implement __cxa_throw_bad_array_new_length Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D1390 Modified: stable/9/contrib/libcxxrt/atomic.h stable/9/contrib/libcxxrt/auxhelper.cc stable/9/contrib/libcxxrt/cxxabi.h stable/9/contrib/libcxxrt/dwarf_eh.h stable/9/contrib/libcxxrt/dynamic_cast.cc stable/9/contrib/libcxxrt/exception.cc stable/9/contrib/libcxxrt/guard.cc stable/9/contrib/libcxxrt/stdexcept.cc stable/9/contrib/libcxxrt/stdexcept.h stable/9/contrib/libcxxrt/typeinfo.cc stable/9/contrib/libcxxrt/unwind-arm.h stable/9/contrib/libcxxrt/unwind.h stable/9/lib/libcxxrt/Version.map Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/libcxxrt/ (props changed) stable/9/lib/ (props changed) stable/9/lib/libcxxrt/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/libcxxrt/atomic.h stable/10/contrib/libcxxrt/auxhelper.cc stable/10/contrib/libcxxrt/cxxabi.h stable/10/contrib/libcxxrt/dwarf_eh.h stable/10/contrib/libcxxrt/dynamic_cast.cc stable/10/contrib/libcxxrt/exception.cc stable/10/contrib/libcxxrt/guard.cc stable/10/contrib/libcxxrt/stdexcept.cc stable/10/contrib/libcxxrt/stdexcept.h stable/10/contrib/libcxxrt/typeinfo.cc stable/10/contrib/libcxxrt/unwind-arm.h stable/10/contrib/libcxxrt/unwind.h stable/10/lib/libcxxrt/Version.map Directory Properties: stable/10/ (props changed) Modified: stable/9/contrib/libcxxrt/atomic.h ============================================================================== --- stable/9/contrib/libcxxrt/atomic.h Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/atomic.h Sat Jan 31 23:48:59 2015 (r278017) @@ -11,7 +11,7 @@ */ #if __has_builtin(__c11_atomic_exchange) #define ATOMIC_SWAP(addr, val)\ - __c11_atomic_exchange((_Atomic(__typeof__(val))*)addr, val, __ATOMIC_ACQ_REL) + __c11_atomic_exchange(reinterpret_cast<_Atomic(__typeof__(val))*>(addr), val, __ATOMIC_ACQ_REL) #elif __has_builtin(__sync_swap) #define ATOMIC_SWAP(addr, val)\ __sync_swap(addr, val) @@ -22,7 +22,7 @@ #if __has_builtin(__c11_atomic_load) #define ATOMIC_LOAD(addr)\ - __c11_atomic_load((_Atomic(__typeof__(*addr))*)addr, __ATOMIC_ACQUIRE) + __c11_atomic_load(reinterpret_cast<_Atomic(__typeof__(*addr))*>(addr), __ATOMIC_ACQUIRE) #else #define ATOMIC_LOAD(addr)\ (__sync_synchronize(), *addr) Modified: stable/9/contrib/libcxxrt/auxhelper.cc ============================================================================== --- stable/9/contrib/libcxxrt/auxhelper.cc Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/auxhelper.cc Sat Jan 31 23:48:59 2015 (r278017) @@ -75,3 +75,8 @@ extern "C" void __cxa_deleted_virtual() { abort(); } + +extern "C" void __cxa_throw_bad_array_new_length() +{ + throw std::bad_array_new_length(); +} Modified: stable/9/contrib/libcxxrt/cxxabi.h ============================================================================== --- stable/9/contrib/libcxxrt/cxxabi.h Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/cxxabi.h Sat Jan 31 23:48:59 2015 (r278017) @@ -110,7 +110,7 @@ struct __cxa_exception * handler count reaches 0 (which it doesn't with the top bit set). */ int handlerCount; -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) /** * The ARM EH ABI requires the unwind library to keep track of exceptions * during cleanups. These support nesting, so we need to keep a list of Modified: stable/9/contrib/libcxxrt/dwarf_eh.h ============================================================================== --- stable/9/contrib/libcxxrt/dwarf_eh.h Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/dwarf_eh.h Sat Jan 31 23:48:59 2015 (r278017) @@ -83,7 +83,7 @@ enum dwarf_data_encoding */ static inline enum dwarf_data_encoding get_encoding(unsigned char x) { - return (enum dwarf_data_encoding)(x & 0xf); + return static_cast(x & 0xf); } /** @@ -115,7 +115,7 @@ enum dwarf_data_relative */ static inline enum dwarf_data_relative get_base(unsigned char x) { - return (enum dwarf_data_relative)(x & 0x70); + return static_cast(x & 0x70); } /** * Returns whether an encoding represents an indirect address. @@ -206,9 +206,9 @@ static int64_t read_sleb128(dw_eh_ptr_t if ((uleb >> (bits-1)) == 1) { // Sign extend by setting all bits in front of it to 1 - uleb |= ((int64_t)-1) << bits; + uleb |= static_cast(-1) << bits; } - return (int64_t)uleb; + return static_cast(uleb); } /** * Reads a value using the specified encoding from the address pointed to by @@ -224,7 +224,7 @@ static uint64_t read_value(char encoding // Read fixed-length types #define READ(dwarf, type) \ case dwarf:\ - v = (uint64_t)(*(type*)(*data));\ + v = static_cast(*reinterpret_cast(*data));\ *data += sizeof(type);\ break; READ(DW_EH_PE_udata2, uint16_t) @@ -263,16 +263,16 @@ static uint64_t resolve_indirect_value(_ switch (get_base(encoding)) { case DW_EH_PE_pcrel: - v += (uint64_t)start; + v += reinterpret_cast(start); break; case DW_EH_PE_textrel: - v += (uint64_t)_Unwind_GetTextRelBase(c); + v += static_cast(static_cast(_Unwind_GetTextRelBase(c))); break; case DW_EH_PE_datarel: - v += (uint64_t)_Unwind_GetDataRelBase(c); + v += static_cast(static_cast(_Unwind_GetDataRelBase(c))); break; case DW_EH_PE_funcrel: - v += (uint64_t)_Unwind_GetRegionStart(c); + v += static_cast(static_cast(_Unwind_GetRegionStart(c))); default: break; } @@ -282,7 +282,7 @@ static uint64_t resolve_indirect_value(_ // be a GCC extensions, so not properly documented... if (is_indirect(encoding)) { - v = (uint64_t)(uintptr_t)*(void**)v; + v = static_cast(reinterpret_cast(*reinterpret_cast(v))); } return v; } @@ -342,14 +342,14 @@ static inline struct dwarf_eh_lsda parse { struct dwarf_eh_lsda lsda; - lsda.region_start = (dw_eh_ptr_t)(uintptr_t)_Unwind_GetRegionStart(context); + lsda.region_start = reinterpret_cast(_Unwind_GetRegionStart(context)); // If the landing pads are relative to anything other than the start of // this region, find out where. This is @LPStart in the spec, although the // encoding that GCC uses does not quite match the spec. - uint64_t v = (uint64_t)(uintptr_t)lsda.region_start; + uint64_t v = static_cast(reinterpret_cast(lsda.region_start)); read_value_with_encoding(context, &data, &v); - lsda.landing_pads = (dw_eh_ptr_t)(uintptr_t)v; + lsda.landing_pads = reinterpret_cast(static_cast(v)); // If there is a type table, find out where it is. This is @TTBase in the // spec. Note: we find whether there is a type table pointer by checking @@ -365,18 +365,18 @@ static inline struct dwarf_eh_lsda parse lsda.type_table = type_table; //lsda.type_table = (uintptr_t*)(data + v); } -#if __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) lsda.type_table_encoding = (DW_EH_PE_pcrel | DW_EH_PE_indirect); #endif - lsda.callsite_encoding = (enum dwarf_data_encoding)(*(data++)); + lsda.callsite_encoding = static_cast(*(data++)); // Action table is immediately after the call site table lsda.action_table = data; - uintptr_t callsite_size = (uintptr_t)read_uleb128(&data); + uintptr_t callsite_size = static_cast(read_uleb128(&data)); lsda.action_table = data + callsite_size; // Call site table is immediately after the header - lsda.call_site_table = (dw_eh_ptr_t)data; + lsda.call_site_table = static_cast(data); return lsda; @@ -413,7 +413,7 @@ static bool dwarf_eh_find_callsite(struc result->landing_pad = 0; // The current instruction pointer offset within the region uint64_t ip = _Unwind_GetIP(context) - _Unwind_GetRegionStart(context); - unsigned char *callsite_table = (unsigned char*)lsda->call_site_table; + unsigned char *callsite_table = static_cast(lsda->call_site_table); while (callsite_table <= lsda->action_table) { @@ -463,17 +463,17 @@ static bool dwarf_eh_find_callsite(struc /// Defines an exception class from 8 bytes (endian independent) #define EXCEPTION_CLASS(a,b,c,d,e,f,g,h) \ - (((uint64_t)a << 56) +\ - ((uint64_t)b << 48) +\ - ((uint64_t)c << 40) +\ - ((uint64_t)d << 32) +\ - ((uint64_t)e << 24) +\ - ((uint64_t)f << 16) +\ - ((uint64_t)g << 8) +\ - ((uint64_t)h)) + ((static_cast(a) << 56) +\ + (static_cast(b) << 48) +\ + (static_cast(c) << 40) +\ + (static_cast(d) << 32) +\ + (static_cast(e) << 24) +\ + (static_cast(f) << 16) +\ + (static_cast(g) << 8) +\ + (static_cast(h))) #define GENERIC_EXCEPTION_CLASS(e,f,g,h) \ - ((uint32_t)e << 24) +\ - ((uint32_t)f << 16) +\ - ((uint32_t)g << 8) +\ - ((uint32_t)h) + (static_cast(e) << 24) +\ + (static_cast(f) << 16) +\ + (static_cast(g) << 8) +\ + (static_cast(h)) Modified: stable/9/contrib/libcxxrt/dynamic_cast.cc ============================================================================== --- stable/9/contrib/libcxxrt/dynamic_cast.cc Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/dynamic_cast.cc Sat Jan 31 23:48:59 2015 (r278017) @@ -44,7 +44,7 @@ struct vtable_header * Simple macro that does pointer arithmetic in bytes but returns a value of * the same type as the original. */ -#define ADD_TO_PTR(x, off) (__typeof__(x))(((char*)x) + off) +#define ADD_TO_PTR(x, off) reinterpret_cast<__typeof__(x)>(reinterpret_cast(x) + off) bool std::type_info::__do_catch(std::type_info const *ex_type, void **exception_object, @@ -166,7 +166,7 @@ bool __vmi_class_type_info::__do_upcast( if (info->isVirtual()) { // Object's vtable - ptrdiff_t *off = *(ptrdiff_t**)obj; + ptrdiff_t *off = *static_cast(obj); // Offset location in vtable off = ADD_TO_PTR(off, offset); offset = *off; @@ -202,9 +202,9 @@ extern "C" void* __dynamic_cast(const vo const __class_type_info *dst, ptrdiff_t src2dst_offset) { - char *vtable_location = *(char**)sub; + const char *vtable_location = *static_cast(sub); const vtable_header *header = - (const vtable_header*)(vtable_location - sizeof(vtable_header)); - void *leaf = ADD_TO_PTR((void*)sub, header->leaf_offset); + reinterpret_cast(vtable_location - sizeof(vtable_header)); + void *leaf = ADD_TO_PTR(const_cast(sub), header->leaf_offset); return header->type->cast_to(leaf, dst); } Modified: stable/9/contrib/libcxxrt/exception.cc ============================================================================== --- stable/9/contrib/libcxxrt/exception.cc Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/exception.cc Sat Jan 31 23:48:59 2015 (r278017) @@ -71,11 +71,11 @@ static void saveLandingPad(struct _Unwin int selector, dw_eh_ptr_t landingPad) { -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) // On ARM, we store the saved exception in the generic part of the structure ucb->barrier_cache.sp = _Unwind_GetGR(context, 13); - ucb->barrier_cache.bitpattern[1] = (uint32_t)selector; - ucb->barrier_cache.bitpattern[3] = (uint32_t)landingPad; + ucb->barrier_cache.bitpattern[1] = static_cast(selector); + ucb->barrier_cache.bitpattern[3] = reinterpret_cast(landingPad); #endif // Cache the results for the phase 2 unwind, if we found a handler // and this is not a foreign exception. @@ -95,15 +95,15 @@ static int loadLandingPad(struct _Unwind unsigned long *selector, dw_eh_ptr_t *landingPad) { -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) *selector = ucb->barrier_cache.bitpattern[1]; - *landingPad = (dw_eh_ptr_t)ucb->barrier_cache.bitpattern[3]; + *landingPad = reinterpret_cast(ucb->barrier_cache.bitpattern[3]); return 1; #else if (ex) { *selector = ex->handlerSwitchValue; - *landingPad = (dw_eh_ptr_t)ex->catchTemp; + *landingPad = reinterpret_cast(ex->catchTemp); return 0; } return 0; @@ -113,7 +113,7 @@ static int loadLandingPad(struct _Unwind static inline _Unwind_Reason_Code continueUnwinding(struct _Unwind_Exception *ex, struct _Unwind_Context *context) { -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) if (__gnu_unwind_frame(ex, context) != _URC_OK) { return _URC_FAILURE; } #endif return _URC_CONTINUE_UNWIND; @@ -204,7 +204,7 @@ struct __cxa_dependent_exception terminate_handler terminateHandler; __cxa_exception *nextException; int handlerCount; -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) _Unwind_Exception *nextCleanup; int cleanupCount; #endif @@ -267,13 +267,13 @@ static bool isDependentException(uint64_ static __cxa_exception *exceptionFromPointer(void *ex) { - return (__cxa_exception*)((char*)ex - + return reinterpret_cast<__cxa_exception*>(static_cast(ex) - offsetof(struct __cxa_exception, unwindHeader)); } static __cxa_exception *realExceptionFromException(__cxa_exception *ex) { if (!isDependentException(ex->unwindHeader.exception_class)) { return ex; } - return ((__cxa_exception*)(((__cxa_dependent_exception*)ex)->primaryException))-1; + return reinterpret_cast<__cxa_exception*>((reinterpret_cast<__cxa_dependent_exception*>(ex))->primaryException)-1; } @@ -304,13 +304,13 @@ static pthread_key_t eh_key; static void exception_cleanup(_Unwind_Reason_Code reason, struct _Unwind_Exception *ex) { - __cxa_free_exception((void*)ex); + __cxa_free_exception(static_cast(ex)); } static void dependent_exception_cleanup(_Unwind_Reason_Code reason, struct _Unwind_Exception *ex) { - __cxa_free_dependent_exception((void*)ex); + __cxa_free_dependent_exception(static_cast(ex)); } /** @@ -333,13 +333,13 @@ static void free_exception_list(__cxa_ex */ static void thread_cleanup(void* thread_info) { - __cxa_thread_info *info = (__cxa_thread_info*)thread_info; + __cxa_thread_info *info = static_cast<__cxa_thread_info*>(thread_info); if (info->globals.caughtExceptions) { // If this is a foreign exception, ask it to clean itself up. if (info->foreign_exception_state != __cxa_thread_info::none) { - _Unwind_Exception *e = (_Unwind_Exception*)info->globals.caughtExceptions; + _Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(info->globals.caughtExceptions); e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e); } else @@ -379,8 +379,8 @@ static void init_key(void) return; } pthread_key_create(&eh_key, thread_cleanup); - pthread_setspecific(eh_key, (void*)0x42); - fakeTLS = (pthread_getspecific(eh_key) != (void*)0x42); + pthread_setspecific(eh_key, reinterpret_cast(0x42)); + fakeTLS = (pthread_getspecific(eh_key) != reinterpret_cast(0x42)); pthread_setspecific(eh_key, 0); } @@ -394,10 +394,10 @@ static __cxa_thread_info *thread_info() fakeTLS = true; } if (fakeTLS) { return &singleThreadInfo; } - __cxa_thread_info *info = (__cxa_thread_info*)pthread_getspecific(eh_key); + __cxa_thread_info *info = static_cast<__cxa_thread_info*>(pthread_getspecific(eh_key)); if (0 == info) { - info = (__cxa_thread_info*)calloc(1, sizeof(__cxa_thread_info)); + info = static_cast<__cxa_thread_info*>(calloc(1, sizeof(__cxa_thread_info))); pthread_setspecific(eh_key, info); } return info; @@ -409,7 +409,7 @@ static __cxa_thread_info *thread_info() static __cxa_thread_info *thread_info_fast() { if (fakeTLS) { return &singleThreadInfo; } - return (__cxa_thread_info*)pthread_getspecific(eh_key); + return static_cast<__cxa_thread_info*>(pthread_getspecific(eh_key)); } /** * ABI function returning the __cxa_eh_globals structure. @@ -472,7 +472,7 @@ static char *emergency_malloc(size_t siz if (0 != m) { pthread_mutex_unlock(&emergency_malloc_lock); - return (char*)m; + return static_cast(m); } for (int i=0 ; i<16 ; i++) { @@ -510,7 +510,7 @@ static void emergency_malloc_free(char * // Find the buffer corresponding to this pointer. for (int i=0 ; i<16 ; i++) { - if (ptr == (void*)(emergency_buffer + (1024 * i))) + if (ptr == static_cast(emergency_buffer + (1024 * i))) { buffer = i; break; @@ -521,7 +521,7 @@ static void emergency_malloc_free(char * // emergency_malloc() is expected to return 0-initialized data. We don't // zero the buffer when allocating it, because the static buffers will // begin life containing 0 values. - memset((void*)ptr, 0, 1024); + memset(ptr, 0, 1024); // Signal the condition variable to wake up any threads that are blocking // waiting for some space in the emergency buffer pthread_mutex_lock(&emergency_malloc_lock); @@ -535,7 +535,7 @@ static void emergency_malloc_free(char * static char *alloc_or_die(size_t size) { - char *buffer = (char*)calloc(1, size); + char *buffer = static_cast(calloc(1, size)); // If calloc() doesn't want to give us any memory, try using an emergency // buffer. @@ -597,7 +597,7 @@ extern "C" void *__cxa_allocate_dependen */ extern "C" void __cxa_free_exception(void *thrown_exception) { - __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + __cxa_exception *ex = reinterpret_cast<__cxa_exception*>(thrown_exception) - 1; // Free the object that was thrown, calling its destructor if (0 != ex->exceptionDestructor) { @@ -612,7 +612,7 @@ extern "C" void __cxa_free_exception(voi } } - free_exception((char*)ex); + free_exception(reinterpret_cast(ex)); } static void releaseException(__cxa_exception *exception) @@ -633,13 +633,13 @@ static void releaseException(__cxa_excep void __cxa_free_dependent_exception(void *thrown_exception) { - __cxa_dependent_exception *ex = ((__cxa_dependent_exception*)thrown_exception) - 1; + __cxa_dependent_exception *ex = reinterpret_cast<__cxa_dependent_exception*>(thrown_exception) - 1; assert(isDependentException(ex->unwindHeader.exception_class)); if (ex->primaryException) { - releaseException(realExceptionFromException((__cxa_exception*)ex)); + releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception((char*)ex); + free_exception(reinterpret_cast(ex)); } /** @@ -654,8 +654,8 @@ static _Unwind_Reason_Code trace(struct { Dl_info myinfo; int mylookup = - dladdr((void*)(uintptr_t)__cxa_current_exception_type, &myinfo); - void *ip = (void*)_Unwind_GetIP(context); + dladdr(reinterpret_cast(__cxa_current_exception_type), &myinfo); + void *ip = reinterpret_cast(_Unwind_GetIP(context)); Dl_info info; if (dladdr(ip, &info) != 0) { @@ -673,6 +673,11 @@ static _Unwind_Reason_Code trace(struct * If the failure happened by falling off the end of the stack without finding * a handler, prints a back trace before aborting. */ +#if __GNUC__ > 3 && __GNUC_MINOR__ > 2 +extern "C" void *__cxa_begin_catch(void *e) throw(); +#else +extern "C" void *__cxa_begin_catch(void *e); +#endif static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exception) { switch (err) @@ -681,14 +686,16 @@ static void report_failure(_Unwind_Reaso case _URC_FATAL_PHASE1_ERROR: fprintf(stderr, "Fatal error during phase 1 unwinding\n"); break; -#ifndef __arm__ +#if !defined(__arm__) || defined(__ARM_DWARF_EH__) case _URC_FATAL_PHASE2_ERROR: fprintf(stderr, "Fatal error during phase 2 unwinding\n"); break; #endif case _URC_END_OF_STACK: + __cxa_begin_catch (&(thrown_exception->unwindHeader)); + std::terminate(); fprintf(stderr, "Terminating due to uncaught exception %p", - (void*)thrown_exception); + static_cast(thrown_exception)); thrown_exception = realExceptionFromException(thrown_exception); static const __class_type_info *e_ti = static_cast(&typeid(std::exception)); @@ -697,8 +704,8 @@ static void report_failure(_Unwind_Reaso if (throw_ti) { std::exception *e = - (std::exception*)e_ti->cast_to((void*)(thrown_exception+1), - throw_ti); + static_cast(e_ti->cast_to(static_cast(thrown_exception+1), + throw_ti)); if (e) { fprintf(stderr, " '%s'", e->what()); @@ -706,18 +713,21 @@ static void report_failure(_Unwind_Reaso } size_t bufferSize = 128; - char *demangled = (char*)malloc(bufferSize); + char *demangled = static_cast(malloc(bufferSize)); const char *mangled = thrown_exception->exceptionType->name(); int status; demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status); fprintf(stderr, " of type %s\n", - status == 0 ? (const char*)demangled : mangled); + status == 0 ? demangled : mangled); if (status == 0) { free(demangled); } // Print a back trace if no handler is found. // TODO: Make this optional #ifndef __arm__ _Unwind_Backtrace(trace, 0); #endif + + // Just abort. No need to call std::terminate for the second time + abort(); break; } std::terminate(); @@ -755,7 +765,7 @@ extern "C" void __cxa_throw(void *thrown std::type_info *tinfo, void(*dest)(void*)) { - __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + __cxa_exception *ex = reinterpret_cast<__cxa_exception*>(thrown_exception) - 1; ex->referenceCount = 1; ex->exceptionType = tinfo; @@ -773,7 +783,7 @@ extern "C" void __cxa_rethrow_primary_ex if (NULL == thrown_exception) { return; } __cxa_exception *original = exceptionFromPointer(thrown_exception); - __cxa_dependent_exception *ex = ((__cxa_dependent_exception*)__cxa_allocate_dependent_exception())-1; + __cxa_dependent_exception *ex = reinterpret_cast<__cxa_dependent_exception*>(__cxa_allocate_dependent_exception())-1; ex->primaryException = thrown_exception; __cxa_increment_exception_refcount(thrown_exception); @@ -782,7 +792,7 @@ extern "C" void __cxa_rethrow_primary_ex ex->unwindHeader.exception_class = dependent_exception_class; ex->unwindHeader.exception_cleanup = dependent_exception_cleanup; - throw_exception((__cxa_exception*)ex); + throw_exception(reinterpret_cast<__cxa_exception*>(ex)); } extern "C" void *__cxa_current_primary_exception(void) @@ -799,14 +809,14 @@ extern "C" void *__cxa_current_primary_e extern "C" void __cxa_increment_exception_refcount(void* thrown_exception) { if (NULL == thrown_exception) { return; } - __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + __cxa_exception *ex = static_cast<__cxa_exception*>(thrown_exception) - 1; if (isDependentException(ex->unwindHeader.exception_class)) { return; } __sync_fetch_and_add(&ex->referenceCount, 1); } extern "C" void __cxa_decrement_exception_refcount(void* thrown_exception) { if (NULL == thrown_exception) { return; } - __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + __cxa_exception *ex = static_cast<__cxa_exception*>(thrown_exception) - 1; releaseException(ex); } @@ -838,7 +848,7 @@ extern "C" void __cxa_rethrow() if (ti->foreign_exception_state != __cxa_thread_info::none) { ti->foreign_exception_state = __cxa_thread_info::rethrown; - _Unwind_Exception *e = (_Unwind_Exception*)ex; + _Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(ex); _Unwind_Reason_Code err = _Unwind_Resume_or_Rethrow(e); report_failure(err, ex); return; @@ -881,8 +891,8 @@ static std::type_info *get_type_info_ent if (offset == 0) { return 0; } // ...so we need to resolve it - return (std::type_info*)resolve_indirect_value(context, - lsda->type_table_encoding, offset, start); + return reinterpret_cast(resolve_indirect_value(context, + lsda->type_table_encoding, offset, start)); } @@ -896,13 +906,13 @@ static bool check_type_signature(__cxa_e const std::type_info *type, void *&adjustedPtr) { - void *exception_ptr = (void*)(ex+1); + void *exception_ptr = static_cast(ex+1); const std::type_info *ex_type = ex ? ex->exceptionType : 0; bool is_ptr = ex ? ex_type->__is_pointer_p() : false; if (is_ptr) { - exception_ptr = *(void**)exception_ptr; + exception_ptr = *static_cast(exception_ptr); } // Always match a catchall, even with a foreign exception // @@ -974,7 +984,7 @@ static handler_type check_action_record( { bool matched = false; *selector = filter; -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) filter++; std::type_info *handler_type = get_type_info_entry(context, lsda, filter--); while (handler_type) @@ -987,7 +997,7 @@ static handler_type check_action_record( handler_type = get_type_info_entry(context, lsda, filter--); } #else - unsigned char *type_index = ((unsigned char*)lsda->type_table - filter - 1); + unsigned char *type_index = reinterpret_cast(lsda->type_table) - filter - 1; while (*type_index) { std::type_info *handler_type = get_type_info_entry(context, lsda, *(type_index++)); @@ -1019,7 +1029,7 @@ static handler_type check_action_record( static void pushCleanupException(_Unwind_Exception *exceptionObject, __cxa_exception *ex) { -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) __cxa_thread_info *info = thread_info_fast(); if (ex) { @@ -1064,8 +1074,13 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_persona realEx = realExceptionFromException(ex); } +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) + unsigned char *lsda_addr = + static_cast(_Unwind_GetLanguageSpecificData(context)); +#else unsigned char *lsda_addr = - (unsigned char*)_Unwind_GetLanguageSpecificData(context); + reinterpret_cast(static_cast(_Unwind_GetLanguageSpecificData(context))); +#endif // No LSDA implies no landing pads - try the next frame if (0 == lsda_addr) { return continueUnwinding(exceptionObject, context); } @@ -1114,8 +1129,8 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_persona if (ex) { saveLandingPad(context, exceptionObject, ex, selector, action.landing_pad); - ex->languageSpecificData = (const char*)lsda_addr; - ex->actionRecord = (const char*)action.action_record; + ex->languageSpecificData = reinterpret_cast(lsda_addr); + ex->actionRecord = reinterpret_cast(action.action_record); // ex->adjustedPtr is set when finding the action record. } return _URC_HANDLER_FOUND; @@ -1161,9 +1176,9 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_persona } - _Unwind_SetIP(context, (unsigned long)action.landing_pad); + _Unwind_SetIP(context, reinterpret_cast(action.landing_pad)); _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), - (unsigned long)exceptionObject); + reinterpret_cast(exceptionObject)); _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), selector); return _URC_INSTALL_CONTEXT; @@ -1187,7 +1202,7 @@ extern "C" void *__cxa_begin_catch(void __cxa_thread_info *ti = thread_info(); __cxa_eh_globals *globals = &ti->globals; globals->uncaughtExceptions--; - _Unwind_Exception *exceptionObject = (_Unwind_Exception*)e; + _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(e); if (isCXXException(exceptionObject->exception_class)) { @@ -1241,12 +1256,12 @@ extern "C" void *__cxa_begin_catch(void { std::terminate(); } - globals->caughtExceptions = (__cxa_exception*)exceptionObject; + globals->caughtExceptions = reinterpret_cast<__cxa_exception*>(exceptionObject); ti->foreign_exception_state = __cxa_thread_info::caught; } // exceptionObject is the pointer to the _Unwind_Exception within the // __cxa_exception. The throw object is after this - return ((char*)exceptionObject + sizeof(_Unwind_Exception)); + return (reinterpret_cast(exceptionObject) + sizeof(_Unwind_Exception)); } @@ -1270,7 +1285,7 @@ extern "C" void __cxa_end_catch() globals->caughtExceptions = 0; if (ti->foreign_exception_state != __cxa_thread_info::rethrown) { - _Unwind_Exception *e = (_Unwind_Exception*)ti->globals.caughtExceptions; + _Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(ti->globals.caughtExceptions); e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e); } ti->foreign_exception_state = __cxa_thread_info::none; @@ -1332,7 +1347,7 @@ extern "C" std::type_info *__cxa_current */ extern "C" void __cxa_call_unexpected(void*exception) { - _Unwind_Exception *exceptionObject = (_Unwind_Exception*)exception; + _Unwind_Exception *exceptionObject = static_cast<_Unwind_Exception*>(exception); if (exceptionObject->exception_class == exception_class) { __cxa_exception *ex = exceptionFromPointer(exceptionObject); @@ -1483,7 +1498,7 @@ namespace std return ATOMIC_LOAD(&terminateHandler); } } -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) extern "C" _Unwind_Exception *__cxa_get_cleanup(void) { __cxa_thread_info *info = thread_info_fast(); Modified: stable/9/contrib/libcxxrt/guard.cc ============================================================================== --- stable/9/contrib/libcxxrt/guard.cc Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/guard.cc Sat Jan 31 23:48:59 2015 (r278017) @@ -70,18 +70,45 @@ #ifdef __arm__ // ARM ABI - 32-bit guards. typedef uint32_t guard_t; -static const uint32_t LOCKED = ((guard_t)1) << 31; +typedef uint32_t guard_lock_t; +static const uint32_t LOCKED = static_cast(1) << 31; static const uint32_t INITIALISED = 1; -#else +#define LOCK_PART(guard) (guard) +#define INIT_PART(guard) (guard) +#elif defined(_LP64) typedef uint64_t guard_t; +typedef uint64_t guard_lock_t; # if defined(__LITTLE_ENDIAN__) -static const guard_t LOCKED = ((guard_t)1) << 63; +static const guard_t LOCKED = static_cast(1) << 63; static const guard_t INITIALISED = 1; # else static const guard_t LOCKED = 1; -static const guard_t INITIALISED = ((guard_t)1) << 56; +static const guard_t INITIALISED = static_cast(1) << 56; +# endif +#define LOCK_PART(guard) (guard) +#define INIT_PART(guard) (guard) +#else +typedef uint32_t guard_lock_t; +# if defined(__LITTLE_ENDIAN__) +typedef struct { + uint32_t init_half; + uint32_t lock_half; +} guard_t; +static const uint32_t LOCKED = static_cast(1) << 31; +static const uint32_t INITIALISED = 1; +# else +typedef struct { + uint32_t init_half; + uint32_t lock_half; +} guard_t; +_Static_assert(sizeof(guard_t) == sizeof(uint64_t), ""); +static const uint32_t LOCKED = 1; +static const uint32_t INITIALISED = static_cast(1) << 24; # endif +#define LOCK_PART(guard) (&(guard)->lock_half) +#define INIT_PART(guard) (&(guard)->init_half) #endif +static const guard_lock_t INITIAL = 0; /** * Acquires a lock on a guard, returning 0 if the object has already been @@ -90,42 +117,49 @@ static const guard_t INITIALISED = ((gua */ extern "C" int __cxa_guard_acquire(volatile guard_t *guard_object) { + guard_lock_t old; // Not an atomic read, doesn't establish a happens-before relationship, but // if one is already established and we end up seeing an initialised state // then it's a fast path, otherwise we'll do something more expensive than // this test anyway... - if ((INITIALISED == *guard_object)) { return 0; } + if (INITIALISED == *INIT_PART(guard_object)) + return 0; // Spin trying to do the initialisation - while (1) + for (;;) { // Loop trying to move the value of the guard from 0 (not // locked, not initialised) to the locked-uninitialised // position. - switch (__sync_val_compare_and_swap(guard_object, 0, LOCKED)) - { - // If the old value was 0, we succeeded, so continue - // initialising - case 0: + old = __sync_val_compare_and_swap(LOCK_PART(guard_object), + INITIAL, LOCKED); + if (old == INITIAL) { + // Lock obtained. If lock and init bit are + // in separate words, check for init race. + if (INIT_PART(guard_object) == LOCK_PART(guard_object)) return 1; - // If this was already initialised, return and let the caller skip - // initialising it again. - case INITIALISED: - return 0; - // If it is locked by another thread, relinquish the CPU and try - // again later. - case LOCKED: - case LOCKED | INITIALISED: - sched_yield(); - break; - // If it is some other value, then something has gone badly wrong. - // Give up. - default: - fprintf(stderr, "Invalid state detected attempting to lock static initialiser.\n"); - abort(); + if (INITIALISED != *INIT_PART(guard_object)) + return 1; + + // No need for a memory barrier here, + // see first comment. + *LOCK_PART(guard_object) = INITIAL; + return 0; } + // If lock and init bit are in the same word, check again + // if we are done. + if (INIT_PART(guard_object) == LOCK_PART(guard_object) && + old == INITIALISED) + return 0; + + assert(old == LOCKED); + // Another thread holds the lock. + // If lock and init bit are in different words, check + // if we are done before yielding and looping. + if (INIT_PART(guard_object) != LOCK_PART(guard_object) && + INITIALISED == *INIT_PART(guard_object)) + return 0; + sched_yield(); } - //__builtin_unreachable(); - return 0; } /** @@ -135,7 +169,8 @@ extern "C" int __cxa_guard_acquire(volat extern "C" void __cxa_guard_abort(volatile guard_t *guard_object) { __attribute__((unused)) - bool reset = __sync_bool_compare_and_swap(guard_object, LOCKED, 0); + bool reset = __sync_bool_compare_and_swap(LOCK_PART(guard_object), + LOCKED, INITIAL); assert(reset); } /** @@ -144,9 +179,15 @@ extern "C" void __cxa_guard_abort(volati */ extern "C" void __cxa_guard_release(volatile guard_t *guard_object) { + guard_lock_t old; + if (INIT_PART(guard_object) == LOCK_PART(guard_object)) + old = LOCKED; + else + old = INITIAL; __attribute__((unused)) - bool reset = __sync_bool_compare_and_swap(guard_object, LOCKED, INITIALISED); + bool reset = __sync_bool_compare_and_swap(INIT_PART(guard_object), + old, INITIALISED); assert(reset); + if (INIT_PART(guard_object) != LOCK_PART(guard_object)) + *LOCK_PART(guard_object) = INITIAL; } - - Modified: stable/9/contrib/libcxxrt/stdexcept.cc ============================================================================== --- stable/9/contrib/libcxxrt/stdexcept.cc Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/stdexcept.cc Sat Jan 31 23:48:59 2015 (r278017) @@ -82,5 +82,18 @@ const char* bad_typeid::what() const thr return "std::bad_typeid"; } +bad_array_new_length::bad_array_new_length() throw() {} +bad_array_new_length::~bad_array_new_length() {} +bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {} +bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw() +{ + return *this; +} + +const char* bad_array_new_length::what() const throw() +{ + return "std::bad_array_new_length"; +} + } // namespace std Modified: stable/9/contrib/libcxxrt/stdexcept.h ============================================================================== --- stable/9/contrib/libcxxrt/stdexcept.h Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/stdexcept.h Sat Jan 31 23:48:59 2015 (r278017) @@ -81,6 +81,15 @@ namespace std virtual const char* what() const throw(); }; + class bad_array_new_length: public bad_alloc + { + public: + bad_array_new_length() throw(); + bad_array_new_length(const bad_array_new_length&) throw(); + bad_array_new_length& operator=(const bad_array_new_length&) throw(); + virtual ~bad_array_new_length(); + virtual const char *what() const throw(); + }; } // namespace std Modified: stable/9/contrib/libcxxrt/typeinfo.cc ============================================================================== --- stable/9/contrib/libcxxrt/typeinfo.cc Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/typeinfo.cc Sat Jan 31 23:48:59 2015 (r278017) @@ -96,7 +96,7 @@ extern "C" char* __cxa_demangle(const ch } if (*n < len+1) { - buf = (char*)realloc(buf, len+1); + buf = static_cast(realloc(buf, len+1)); } if (0 != buf) { Modified: stable/9/contrib/libcxxrt/unwind-arm.h ============================================================================== --- stable/9/contrib/libcxxrt/unwind-arm.h Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/unwind-arm.h Sat Jan 31 23:48:59 2015 (r278017) @@ -218,6 +218,6 @@ _Unwind_Reason_Code name(_Unwind_State s break;\ }\ }\ - _Unwind_SetGR (context, 12, (unsigned long)exceptionObject);\ + _Unwind_SetGR (context, 12, reinterpret_cast(exceptionObject));\ #define CALL_PERSONALITY_FUNCTION(name) name(state,exceptionObject,context) Modified: stable/9/contrib/libcxxrt/unwind.h ============================================================================== --- stable/9/contrib/libcxxrt/unwind.h Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/contrib/libcxxrt/unwind.h Sat Jan 31 23:48:59 2015 (r278017) @@ -27,7 +27,7 @@ extern "C" { #endif -#ifdef __arm__ +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) #include "unwind-arm.h" #else #include "unwind-itanium.h" Modified: stable/9/lib/libcxxrt/Version.map ============================================================================== --- stable/9/lib/libcxxrt/Version.map Sat Jan 31 23:31:45 2015 (r278016) +++ stable/9/lib/libcxxrt/Version.map Sat Jan 31 23:48:59 2015 (r278017) @@ -26,6 +26,7 @@ CXXABI_1.3 { __cxa_pure_virtual; __cxa_rethrow; __cxa_throw; + __cxa_throw_bad_array_new_length; __cxa_type_match; __cxa_vec_cctor; __cxa_vec_cleanup; @@ -273,6 +274,9 @@ CXXRT_1.0 { "std::bad_alloc::bad_alloc(std::bad_alloc const&)"; "std::bad_alloc::bad_alloc()"; "std::bad_alloc::operator=(std::bad_alloc const&)"; + "std::bad_array_new_length::bad_array_new_length(std::bad_array_new_length const&)"; + "std::bad_array_new_length::bad_array_new_length()"; + "std::bad_array_new_length::operator=(std::bad_array_new_length const&)"; }; __cxa_allocate_dependent_exception; @@ -307,6 +311,7 @@ GLIBCXX_3.4 { "std::bad_typeid::~bad_typeid()"; "std::exception::~exception()"; "std::bad_alloc::~bad_alloc()"; + "std::bad_array_new_length::~bad_array_new_length()"; "std::exception::what() const"; @@ -320,17 +325,20 @@ GLIBCXX_3.4 { "vtable for std::bad_typeid"; "vtable for std::exception"; "vtable for std::type_info"; + "vtable for std::bad_array_new_length"; "typeinfo for std::bad_alloc"; "typeinfo for std::bad_typeid"; "typeinfo for std::bad_cast"; "typeinfo for std::exception"; "typeinfo for std::type_info"; + "typeinfo for std::bad_array_new_length"; "typeinfo name for std::bad_alloc"; "typeinfo name for std::bad_typeid"; "typeinfo name for std::bad_cast"; "typeinfo name for std::exception"; "typeinfo name for std::type_info"; + "typeinfo name for std::bad_array_new_length"; }; }; @@ -340,6 +348,7 @@ GLIBCXX_3.4.9 { "std::bad_typeid::what() const"; "std::bad_cast::what() const"; "std::bad_alloc::what() const"; + "std::bad_array_new_length::what() const"; }; } GLIBCXX_3.4;