Commit Graph

5783 Commits

Author SHA1 Message Date
Tijl Coosemans
cb784c9f28 MFC r275805:
Fix incorrect type of "invalids" argument in __iconv() prototype.

MFC r281550,281591:

Remove the const qualifier from iconv(3) to comply with POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

Adjust all code that calls iconv.

PR:		199099
2015-04-30 16:08:47 +00:00
Dimitry Andric
cff0befcb6 MFC r281775:
Pull in r229911 from upstream llvm trunk (by Benjamin Kramer):

  MC: Allow multiple comma-separated expressions on the .uleb128 directive.

  For compatiblity with GNU as. Binutils documents this as
  '.uleb128 expressions'. Subtle, isn't it?

Reported by:	sbruno
PR:		199554

MFC r281777:

Add llvm patch corresponding to r281775.
2015-04-23 22:06:02 +00:00
Allan Jude
d4f58e6e5a MFC: r277328:
Fix minor syntax and grammar errors in the markup of the ee(1) man page

Approved by:	eadler (mentor, implicit)
Sponsored by:	ScaleEngine Inc.
2015-04-16 00:44:05 +00:00
Xin LI
a2e7e7b1c2 Improve patch for SA-15:04.igmp to solve a potential buffer overflow.
Fix multiple vulnerabilities of ntp. [SA-15:07]

Fix bsdinstall(8) insecure default GELI keyfile permissions. [SA-15:08]

Fix Denial of Service with IPv6 Router Advertisements. [SA-15:09]
2015-04-07 20:20:24 +00:00
Dimitry Andric
e68b2ce611 MFC r280864:
Pull in r233552 from upstream libc++ trunk (by Eric Fiselier):

  [libcxx] Fix PR22771 - Support access control SFINAE in the library
  version of is_convertible.

  Summary:
  Currently the conversion check does not take place in a context where
  access control SFINAE is applied. This patch changes the context of
  the test expression so that SFINAE occurs if access control does not
  permit the conversion.

  Related bug: https://llvm.org/bugs/show_bug.cgi?id=22771

  Reviewers: mclow.lists, rsmith, dim

  Reviewed By: dim

  Subscribers: dim, rodrigc, emaste, cfe-commits

  Differential Revision: http://reviews.llvm.org/D8461

This fixes building clang, and other programs using libc++, with newer
versions of gcc (specifically, gcc 4.8 and higher).

Reported by:	rodrigc
2015-04-06 14:50:54 +00:00
Bryan Drewery
0c764bcbfd MFC r280870:
Fix --one-file-system to include the directory encountered rather than
  excluding it.  This was broken in 3.0.4 (r238856).

Relnotes:	yes
2015-04-03 18:01:51 +00:00
Hans Petter Selasky
7b3fee86e3 MFC r280264:
Define BINDIR for some test utilities.

Sponsored by:	Mellanox Technologies
2015-03-25 10:50:13 +00:00
Kenneth D. Merry
8493cf8e26 MFC sa(4) and mt(1) improvements.
This includes these changes: 279219, 279229, 279261, 279534, 279570,
280230, 280231.

In addition, bump __FreeBSD_version for the addition of the new
mtio(4) / sa(4) ioctls.

Thanks to Dan Langille, Harald Schmalzbauer and Rudolf Cejka for spending
a significant amount of time and effort testing these changes.

  ------------------------------------------------------------------------
  r279219 | ken | 2015-02-23 14:59:30 -0700 (Mon, 23 Feb 2015) | 282 lines

  Significant upgrades to sa(4) and mt(1).

  The primary focus of these changes is to modernize FreeBSD's
  tape infrastructure so that we can take advantage of some of the
  features of modern tape drives and allow support for LTFS.

  Significant changes and new features include:

   o sa(4) driver status and parameter information is now exported via an
     XML structure.  This will allow for changes and improvements later
     on that will not break userland applications.  The old MTIOCGET
     status ioctl remains, so applications using the existing interface
     will not break.

   o 'mt status' now reports drive-reported tape position information
     as well as the previously available calculated tape position
     information.  These numbers will be different at times, because
     the drive-reported block numbers are relative to BOP (Beginning
     of Partition), but the block numbers calculated previously via
     sa(4) (and still provided) are relative to the last filemark.
     Both numbers are now provided.  'mt status' now also shows the
     drive INQUIRY information, serial number and any position flags
     (BOP, EOT, etc.) provided with the tape position information.
     'mt status -v' adds information on the maximum possible I/O size,
     and the underlying values used to calculate it.

   o The extra sa(4) /dev entries (/dev/saN.[0-3]) have been removed.

     The extra devices were originally added as place holders for
     density-specific device nodes.  Some OSes (NetBSD, NetApp's OnTap
     and Solaris) have had device nodes that, when you write to them,
     will automatically select a given density for particular tape drives.

     This is a convenient way of switching densities, but it was never
     implemented in FreeBSD.  Only the device nodes were there, and that
     sometimes confused users.

     For modern tape devices, the density is generally not selectable
     (e.g. with LTO) or defaults to the highest availble density when
     the tape is rewritten from BOT (e.g. TS11X0).  So, for most users,
     density selection won't be necessary.  If they do need to select
     the density, it is easy enough to use 'mt density' to change it.

   o Protection information is now supported.  This is either a
     Reed-Solomon CRC or CRC32 that is included at the end of each block
     read and written.  On write, the tape drive verifies the CRC, and
     on read, the tape drive provides a CRC for the userland application
     to verify.

   o New, extensible tape driver parameter get/set interface.

   o Density reporting information.  For drives that support it,
     'mt getdensity' will show detailed information on what formats the
     tape drive supports, and what formats the tape drive supports.

   o Some mt(1) functionality moved into a new mt(3) library so that
     external applications can reuse the code.

   o The new mt(3) library includes helper routines to aid in parsing
     the XML output of the sa(4) driver, and build a tree of driver
     metadata.

   o Support for the MTLOAD (load a tape in the drive) and MTWEOFI
     (write filemark immediate) ioctls needed by IBM's LTFS
     implementation.

   o Improve device departure behavior for the sa(4) driver.  The previous
     implementation led to hangs when the device was open.

   o This has been tested on the following types of drives:
  	IBM TS1150
  	IBM TS1140
  	IBM LTO-6
  	IBM LTO-5
  	HP LTO-2
  	Seagate DDS-4
  	Quantum DLT-4000
  	Exabyte 8505
  	Sony DDS-2

  contrib/groff/tmac/doc-syms,
  share/mk/bsd.libnames.mk,
  lib/Makefile,
  	Add libmt.

  lib/libmt/Makefile,
  lib/libmt/mt.3,
  lib/libmt/mtlib.c,
  lib/libmt/mtlib.h,
  	New mt(3) library that contains functions moved from mt(1) and
  	new functions needed to interact with the updated sa(4) driver.

  	This includes XML parser helper functions that application writers
  	can use when writing code to query tape parameters.

  rescue/rescue/Makefile:
  	Add -lmt to CRUNCH_LIBS.

  src/share/man/man4/mtio.4
  	Clarify this man page a bit, and since it contains what is
  	essentially the mtio.h header file, add new ioctls and structure
  	definitions from mtio.h.

  src/share/man/man4/sa.4
  	Update BUGS and maintainer section.

  sys/cam/scsi/scsi_all.c,
  sys/cam/scsi/scsi_all.h:
  	Add SCSI SECURITY PROTOCOL IN/OUT CDB definitions and CDB building
  	functions.

  sys/cam/scsi/scsi_sa.c
  sys/cam/scsi/scsi_sa.h
  	Many tape driver changes, largely outlined above.

  	Increase the sa(4) driver read/write timeout from 4 to 32
  	minutes.  This is based on the recommended values for IBM LTO
  	5/6 drives.  This may also avoid timeouts for other tape
  	hardware that can take a long time to do retries and error
  	recovery.  Longer term, a better way to handle this is to ask
  	the drive for recommended timeout values using the REPORT
  	SUPPORTED OPCODES command.  Modern IBM and Oracle tape drives
  	at least support that command, and it would allow for more
  	accurate timeout values.

  	Add XML status generation.  This is done with a series of
  	macros to eliminate as much duplicate code as possible.  The
  	new XML-based status values are reported through the new
  	MTIOCEXTGET ioctl.

  	Add XML driver parameter reporting, using the new MTIOCPARAMGET
  	ioctl.

  	Add a new driver parameter setting interface, using the new
  	MTIOCPARAMSET and MTIOCSETLIST ioctls.

  	Add a new MTIOCRBLIM ioctl to get block limits information.

  	Add CCB/CDB building routines scsi_locate_16, scsi_locate_10,
  	and scsi_read_position_10().

  	scsi_locate_10 implements the LOCATE command, as does the
  	existing scsi_set_position() command.  It just supports
  	additional arguments and features.  If/when we figure out a
  	good way to provide backward compatibility for older
  	applications using the old function API, we can just revamp
  	scsi_set_position().  The same goes for
  	scsi_read_position_10() and the existing scsi_read_position()
  	function.

  	Revamp sasetpos() to take the new mtlocate structure as an
  	argument.  It now will use either scsi_locate_10() or
  	scsi_locate_16(), depending upon the arguments the user
  	supplies.  As before, once we change position we don't have a
  	clear idea of what the current logical position of the tape
  	drive is.

  	For tape drives that support long form position data, we
  	read the current position and store that for later reporting
  	after changing the position.  This should help applications
  	like Bacula speed tape access under FreeBSD once they are
  	modified to support the new ioctls.

  	Add a new quirk, SA_QUIRK_NO_LONG_POS, that is set for all
  	drives that report SCSI-2 or older, as well as drives that
  	report an Illegal Request type error for READ POSITION with
  	the long format.  So we should automatically detect drives
  	that don't support the long form and stop asking for it after
  	an initial try.

  	Add a partition number to the sa(4) softc.

  	Improve device departure handling. The previous implementation
  	led to hangs when the device was open.

  	If an application had the sa(4) driver open, and attempted to
  	close it after it went away, the cam_periph_release() call in
  	saclose() would cause the periph to get destroyed because that
  	was the last reference to it.  Because destroy_dev() was
  	called from the sa(4) driver's cleanup routine (sacleanup()),
  	and would block waiting for the close to happen, a deadlock
  	would result.

  	So instead of calling destroy_dev() from the cleanup routine,
  	call destroy_dev_sched_cb() from saoninvalidate() and wait for
  	the callback.

  	Acquire a reference for devfs in saregister(), and release it
  	in the new sadevgonecb() routine when all devfs devices for
  	the particular sa(4) driver instance are gone.

  	Add a new function, sasetupdev(), to centralize setting
  	per-instance devfs device parameters instead of repeating the
  	code in saregister().

  	Add an open count to the softc, so we know how many
  	peripheral driver references are a result of open
         	sessions.

  	Add the D_TRACKCLOSE flag to the cdevsw flags so
  	that we get a 1:1 mapping of open to close calls
  	instead of a N:1 mapping.

  	This should be a no-op for everything except the
  	control device, since we don't allow more than one
  	open on non-control devices.

  	However, since we do allow multiple opens on the
  	control device, the combination of the open count
  	and the D_TRACKCLOSE flag should result in an
  	accurate peripheral driver reference count, and an
  	accurate open count.

  	The accurate open count allows us to release all
  	peripheral driver references that are the result
  	of open contexts once we get the callback from devfs.

  sys/sys/mtio.h:
  	Add a number of new mt(4) ioctls and the requisite data
  	structures.  None of the existing interfaces been removed
  	or changed.

  	This includes definitions for the following new ioctls:

  	MTIOCRBLIM      /* get block limits */
  	MTIOCEXTLOCATE	/* seek to position */
  	MTIOCEXTGET     /* get tape status */
  	MTIOCPARAMGET	/* get tape params */
  	MTIOCPARAMSET	/* set tape params */
  	MTIOCSETLIST	/* set N params */

  usr.bin/mt/Makefile:
  	mt(1) now depends on libmt, libsbuf and libbsdxml.

  usr.bin/mt/mt.1:
  	Document new mt(1) features and subcommands.

  usr.bin/mt/mt.c:
  	Implement support for mt(1) subcommands that need to
  	use getopt(3) for their arguments.

  	Implement a new 'mt status' command to replace the old
  	'mt status' command.  The old status command has been
  	renamed 'ostatus'.

  	The new status function uses the MTIOCEXTGET ioctl, and
  	therefore parses the XML data to determine drive status.
  	The -x argument to 'mt status' allows the user to dump out
  	the raw XML reported by the kernel.

  	The new status display is mostly the same as the old status
  	display, except that it doesn't print the redundant density
  	mode information, and it does print the current partition
  	number and position flags.

  	Add a new command, 'mt locate', that will supersede the
  	old 'mt setspos' and 'mt sethpos' commands.  'mt locate'
  	implements all of the functionality of the MTIOCEXTLOCATE
  	ioctl, and allows the user to change the logical position
  	of the tape drive in a number of ways.  (Partition,
  	block number, file number, set mark number, end of data.)
  	The immediate bit and the explicit address bits are
  	implemented, but not documented in the man page.

  	Add a new 'mt weofi' command to use the new MTWEOFI ioctl.
  	This allows the user to ask the drive to write a filemark
  	without waiting around for the operation to complete.

  	Add a new 'mt getdensity' command that gets the XML-based
  	tape drive density report from the sa(4) driver and displays
  	it.  This uses the SCSI REPORT DENSITY SUPPORT command
  	to get comprehensive information from the tape drive about
  	what formats it is able to read and write.

  	Add a new 'mt protect' command that allows getting and setting
  	tape drive protection information.  The protection information
  	is a CRC tacked on to the end of every read/write from and to
  	the tape drive.

  Sponsored by:	Spectra Logic
  MFC after:	1 month

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r279229 | ken | 2015-02-23 22:43:16 -0700 (Mon, 23 Feb 2015) | 5 lines

  Fix printf format warnings on sparc64 and mips.

  Sponsored by:	Spectra Logic
  MFC after:	1 month

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r279261 | ken | 2015-02-24 21:30:23 -0700 (Tue, 24 Feb 2015) | 23 lines

  Fix several problems found by Coverity.

  lib/libmt/mtlib.c:
  	In mt_start_element(), make sure we don't overflow the
  	cur_sb array.  CID 1271325

  usr.bin/mt/mt.c:
  	In main(), bzero the mt_com structure so that we aren't
  	using any uninitialized stack variables.  CID 1271319

  	In mt_param(), only allow one -s and one -p argument.  This
  	will prevent a memory leak caused by overwriting the
  	param_name and/or param_value variables.  CID 1271320 and
  	CID 1271322

  	To make things simpler in mt_param(), make sure there
  	there is only one exit path for the function.  Make sure
  	the arguments are explicitly freed.

  Sponsored by:	Spectra Logic
  Pointed out by:	emaste
  MFC after:	1 month

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r279534 | ken | 2015-03-02 11:09:49 -0700 (Mon, 02 Mar 2015) | 18 lines

  Change the sa(4) driver to check for long position support on
  SCSI-2 devices.

  Some older tape devices claim to be SCSI-2, but actually do support
  long position information.  (Long position information includes
  the current file mark.)  For example, the COMPAQ SuperDLT1.

  So we now only disable the check on SCSI-1 and older devices.

  sys/cam/scsi/scsi_sa.c:
  	In saregister(), only disable fetching long position
  	information on SCSI-1 and older drives.  Update the
  	comment to explain why.

  Confirmed by:	dvl
  Sponsored by:	Spectra Logic
  MFC after:	3 weeks

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r279570 | ken | 2015-03-03 15:49:07 -0700 (Tue, 03 Mar 2015) | 21 lines

  Add density code for DAT-72, and notes on DAT-160.

  As it turns out, the density code for DAT-160 (0x48) is the same
  as for SDLT220.  Since the SDLT values are already in the table,
  we will leave them in place.

  Thanks to Harald Schmalzbauer for confirming the DAT-72 density code.

  lib/libmt/mtlib.c:
  	Add DAT-72 density code, and commented out DAT-160 density
  	code.  Explain why DAT-160 is commented out.  Add notes
  	explaining where the bpi values for these formats came from.

  usr.bin/mt/mt.1:
  	Add DAT-72 density code, and add a note explaining that
  	the SDLTTapeI(110) density code (0x48) is the same as
  	DAT-160.

  Sponsored by:	Spectra Logic
  MFC after:	3 weeks

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r280230 | ken | 2015-03-18 14:52:34 -0600 (Wed, 18 Mar 2015) | 25 lines

  Fix a couple of problems in the sa(4) media type reports.

  The only drives I have discovered so far that support medium type
  reports are newer HP LTO (LTO-5 and LTO-6) drives.  IBM drives
  only support the density reports.

  sys/cam/scsi/scsi_sa.h:
  	The number of possible density codes in the medium type
  	report is 9, not 8.  This caused problems parsing all of
  	the medium type report after this point in the structure.

  usr.bin/mt/mt.c:
  	Run the density codes returned in the medium type report
  	through denstostring(), just like the primary and secondary
  	density codes in the density report.  This will print the
  	density code in hex, and give a text description if it
  	is available.

  Thanks to Rudolf Cejka for doing extensive testing with HP LTO drives
  and Bacula and discovering these problems.

  Tested by:	Rudolf Cejka <cejkar at fit.vutbr.cz>
  Sponsored by:	Spectra Logic
  MFC after:	4 days

  ------------------------------------------------------------------------
  ------------------------------------------------------------------------
  r280231 | ken | 2015-03-18 14:54:54 -0600 (Wed, 18 Mar 2015) | 16 lines

  Improve the mt(1) rblim display.

  The granularity reported by READ BLOCK LIMITS is an exponent, not a
  byte value.  So a granularity of 0 means 2^0, or 1 byte.  A
  granularity of 1 means 2^1, or 2 bytes.

  Print out the individual block limits on separate lines to improve
  readability and avoid exceeding 80 columns.

  usr.bin/mt/mt.c:
  	Fix and improve the 'mt rblim' output.  Add a MT_PLURAL()
  	macro so we can print "byte" or "bytes" as appropriate.

  Sponsored by:	Spectra Logic
  MFC after:	4 days

  ------------------------------------------------------------------------

Sponsored by:	Spectra Logic
2015-03-24 14:36:10 +00:00
Edwin Groothuis
6915234ddf MFC of 280413,tzdata10:
Release 2015b - 2015-03-19 23:28:11 -0700

  Changes affecting future time stamps

    Mongolia will start observing DST again this year, from the last
    Saturday in March at 02:00 to the last Saturday in September at 00:00.
    (Thanks to Ganbold Tsagaankhuu.)

    Palestine will start DST on March 28, not March 27.  Also,
    correct the fall 2014 transition from September 26 to October 24.
    Adjust future predictions accordingly.  (Thanks to Steffen Thorsen.)

  Changes affecting past time stamps

    The 1982 zone shift in Pacific/Easter has been corrected, fixing a 2015a
    regression.  (Thanks to Stuart Bishop for reporting the problem.)

    Some more zones have been turned into links, when they differed
    from existing zones only for older time stamps.  As usual,
    these changes affect UTC offsets in pre-1970 time stamps only.
    Their old contents have been moved to the 'backzone' file.
    The affected zones are: America/Antigua, America/Cayman,
    Pacific/Midway, and Pacific/Saipan.

  Changes affecting time zone abbreviations

    Correct the 1992-2010 DST abbreviation in Volgograd from "MSK" to "MSD".
    (Thanks to Hank W.)
2015-03-24 06:05:52 +00:00
Robert Watson
9a39ca5634 Merge an applicable subset of r263234 from HEAD to stable/10:
Update most userspace consumers of capability.h to use capsicum.h instead.

  auditdistd is not updated as I will make the change upstream and then do a
  vendor import sometime in the next week or two.

Note that a significant fraction does not apply, as FreeBSD 10 doesn't
contain a Capsicumised ping, casperd, libcasper, etc.  When these features
are merged, the capsicum.h change will need to be merged with them.

Sponsored by:	Google, Inc.
2015-03-19 12:32:48 +00:00
Dimitry Andric
c18abb86bb MFC r279757:
Pull in r228344 from upstream libc++ trunk (by Eric Fiselier):

  Get tests running with warnings. Fix warnings in headers and tests

This fixes a number of -Wunused-local-typedef warnings in libc++ headers.

MFC r279758:

Fix another -Wunused-local-typedef warning in libc++, in include/__tree.
2015-03-11 07:22:13 +00:00
Edwin Groothuis
0402ff325b MFC of 279706,tzdata10:
Release 2015a - 2015-01-29

Changes affecting future time stamps

    The Mexican state of Quintana Roo, represented by America/Cancun,
    will shift from Central Time with DST to Eastern Time without DST
    on 2015-02-01 at 02:00.  (Thanks to Steffen Thorsen and Gwillim Law.)

    Chile will not change clocks in April or thereafter; its new standard time
    will be its old daylight saving time.  This affects America/Santiago,
    Pacific/Easter, and Antarctica/Palmer.  (Thanks to Juan Correa.)

    New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
    (Thanks to Tim Parenti.)

  Changes affecting past time stamps

    Iceland observed DST in 1919 and 1921, and its 1939 fallback
    transition was Oct. 29, not Nov. 29.  Remove incorrect data from
    Shanks about time in Iceland between 1837 and 1908.

    Some more zones have been turned into links, when they differed
    from existing zones only for older time stamps.  As usual,
    these changes affect UTC offsets in pre-1970 time stamps only.
    Their old contents have been moved to the 'backzone' file.
    The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait,
    and Asia/Muscat.
2015-03-06 21:56:44 +00:00
Ed Maste
f51809fde9 MFC r279301: GNU nm: Avoid NULL dereference
bfd_dwarf2_find_line() calls find_line() with NULL functionname_ptr,
  which resulted in a crash on certain ELF objects.

  This change was implemented independently from upstream binutils, but
  I have checked that the crash does not happen there.

Sponsored by:	The FreeBSD Foundation
2015-03-04 01:10:09 +00:00
Dimitry Andric
4d705f8d93 MFC r279307:
Make libcxxrt's parsing of DWARF exception handling tables work on
architectures with strict alignment, by using memcpy() instead of
directly reading fields.

Reported by:	Daisuke Aoyama <aoyama@peach.ne.jp>
Reviewed by:	imp, bapt
Tested by:	bapt
Differential Revision: https://reviews.freebsd.org/D1967

MFC r279310:

Since newer versions of compiler-rt require unwind.h, and we want to use
the copy in libcxxrt for it, fix the arm-specific header to define the
_Unwind_Action type.

Submitted by:	andrew
2015-03-01 00:47:37 +00:00
Ed Maste
87db394f62 Implement the -fuse-ld= option.
Merge upstream Clang revision 211785:
  This commit implements the -fuse-ld= option, so that the user
  can specify -fuse-ld=bfd to use ld.bfd.

  This commit re-applies r194328 with some test case changes.
  It seems that r194328 was breaking macosx or mingw build
  because clang can't find ld.bfd or ld.gold in the given sysroot.
  We should use -B to specify the executable search path instead.

  Patch originally by David Chisnall.

This is a direct commit to stable/10 as this is change is already
included in Clang 3.5 in HEAD. The patch is also reworked slightly for
Clang 3.4.1.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
2015-02-25 22:32:32 +00:00
Dimitry Andric
ac5ca8e935 Add clang patches corresponding to r279289. 2015-02-25 17:54:18 +00:00
Dimitry Andric
e276373d35 Pull in r199571 from upstream clang trunk (by Ted Kremenek):
Harden InitListExpr::isStringLiteralInit() against getInit()
  returning null.

  This led to a crash on invalid code (sorry, no good test case).

  Fixes <rdar://problem/15831804>.

This fixes an assertion when compiling certain incorrect code, as
reported upstream in http://llvm.org/PR22684 .

Direct commit to stable/10 and stable/9, since head has clang 3.5.1,
which already includes this change.

Reported by:	hbowden@securelabsllc.com
2015-02-25 17:27:02 +00:00
Tijl Coosemans
68f6e9f8f3 MFC r278586:
Fix ldscripts such that ld(1) collects the .fini_array section in the same
order as the .init_array section.  Finalisation routines need to be called
in the opposite order as their corresponding initialisation routines but
rtld(1) handles that by calling the function pointers in .fini_array in
reverse order.

Reviewed by:	kib
2015-02-25 08:39:48 +00:00
John Baldwin
beeb3a0d3e MFC 274817,274878,276801,276840,278976:
Improve support for XSAVE with debuggers.
- Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed
  to match what Linux does in that 1) it dumps the entire XSAVE area
  including the fxsave state, and 2) it stashes a copy of the current
  xsave mask in the unused padding between the fxsave state and the
  xstate header at the same location used by Linux.
- Teach readelf() to recognize NT_X86_XSTATE notes.
- Change PT_GET/SETXSTATE to take the entire XSAVE state instead of
  only the extra portion. This avoids having to always make two
  ptrace() calls to get or set the full XSAVE state.
- Add a PT_GET_XSTATE_INFO which returns the length of the current
  XSTATE save area (so the size of the buffer needed for PT_GETXSTATE)
  and the current XSAVE mask (%xcr0).
2015-02-23 18:38:41 +00:00
Dimitry Andric
d0b9134b94 Add clang patches corresponding to r278788. 2015-02-14 23:28:09 +00:00
Dimitry Andric
b2d899defa Pull in r201130 from upstream clang trunk (by Ted Kremenek):
Fix PCH deserialization bug with local static symbols being treated
  as local extern.

  This triggered a miscompilation of code using Boost's
  function_template.hpp when it was included inside a PCH file.  A
  local static within that header would be treated as local extern,
  resulting in the wrong mangling.  This only occurred during PCH
  deserialization.

  Fixes <rdar://problem/15975816> and <rdar://problem/15926311>.

This fixes a crash in audio/murmur, which is using both PCH and Boost.

Direct commit to stable/10 and stable/9, since head has clang 3.5.1,
which already includes this change.

Reported by:	smh
PR:		197389
2015-02-14 23:25:39 +00:00
Dimitry Andric
56aef3cfa6 Synchronize the default C++ stack in stable/10 with head, by merging
almost all recent changes to libc++ and libcxxrt.

MFC r256642:
  Since C++ typeinfo objects are currently not guaranteed to be merged at
  runtime by the dynamic linker, check for their equality in libcxxrt by
  not only comparing the typeinfo's name pointers, but also comparing the
  full names, if necessary.  (This is similar to what GNU libstdc++ does
  in its default configuration.)  The 'deep' check can be turned off again
  by defining LIBCXXRT_MERGED_TYPEINFO, and recompiling libcxxrt.

  Reviewed by:	theraven

MFC r270522 (by rdivacky):
  The standard we compile libc++ with is called c++11 not c++0x.

MFC r273066 (by bapt):
  Import patch from libc++ r197313 which allows using libc++ headers with gcc

  Differential Revision:	https://reviews.freebsd.org/D942
  Reviewed by:	imp

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 r273382 (by bapt):
  Fix build by marking the new functions as weak
  This is a temporary fix

MFC r273407 (by bapt):
  When using an external gcc 4.8+ and not building libstdc++ then create in the objectdir a
  fake libstdc++.so and libstdc++.a which is a symlink on libc++ that allow g++ to satisfy
  its links dependencies in the least hackish way.
  Please note that this hacky libstds++ never get installed on the final system

  Reviewed by:	imp

MFC r273434 (by bapt):
  Do not define bad_array_new_length::bad_array_new_length in libc++ anymore
  when used in combinaison with libcxxrt since it is now defined there already.
  This fixes building world

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

MFC r277217:
  Import libc++ trunk r224926.  This fixes a number of bugs, completes
  C++14 support[1], adds more C++1z features[2], and fixes the following
  LWG issues[3]:

  1450: Contradiction in regex_constants
  2003: String exception inconsistency in erase.
  2075: Progress guarantees, lock-free property, and scheduling
	assumptions
  2104: unique_lock move-assignment should not be noexcept
  2112: User-defined classes that cannot be derived from
  2132: std::function ambiguity
  2135: Unclear requirement for exceptions thrown in
	condition_variable::wait()
  2142: packaged_task::operator() synchronization too broad?
  2182: Container::[const_]reference types are misleadingly specified
  2186: Incomplete action on async/launch::deferred
  2188: Reverse iterator does not fully support targets that overload
	operator&
  2193: Default constructors for standard library containers are explicit
  2205: Problematic postconditions of regex_match and regex_search
  2213: Return value of std::regex_replace
  2240: Probable misuse of term "function scope" in [thread.condition]
  2252: Strong guarantee on vector::push_back() still broken with C++11?
  2257: Simplify container requirements with the new algorithms
  2258: a.erase(q1, q2) unable to directly return q2
  2263: Comparing iterators and allocator pointers with different
	const-character
  2268: Setting a default argument in the declaration of a member
	function assign of std::basic_string
  2271: regex_traits::lookup_classname specification unclear
  2272: quoted should use char_traits::eq for character comparison
  2278: User-defined literals for Standard Library types
  2280: begin / end for arrays should be constexpr and noexcept
  2285: make_reverse_iterator
  2288: Inconsistent requirements for shared mutexes
  2291: std::hash is vulnerable to collision DoS attack
  2293: Wrong facet used by num_put::do_put
  2299: Effects of inaccessible key_compare::is_transparent type are not
	clear
  2301: Why is std::tie not constexpr?
  2304: Complexity of count in unordered associative containers
  2306: match_results::reference should be value_type&, not const
	value_type&
  2308: Clarify container destructor requirements w.r.t. std::array
  2313: tuple_size should always derive from integral_constant<size_t, N>
  2314: apply() should return decltype(auto) and use decay_t before
	tuple_size
  2315: weak_ptr should be movable
  2316: weak_ptr::lock() should be atomic
  2317: The type property queries should be UnaryTypeTraits returning
	size_t
  2320: select_on_container_copy_construction() takes allocators, not
	containers
  2322: Associative(initializer_list, stuff) constructors are
	underspecified
  2323: vector::resize(n, t)'s specification should be simplified
  2324: Insert iterator constructors should use addressof()
  2329: regex_match()/regex_search() with match_results should forbid
	temporary strings
  2330: regex("meow", regex::icase) is technically forbidden but should
	be permitted
  2332: regex_iterator/regex_token_iterator should forbid temporary
	regexes
  2339: Wording issue in nth_element
  2341: Inconsistency between basic_ostream::seekp(pos) and
	basic_ostream::seekp(off, dir)
  2344: quoted()'s interaction with padding is unclear
  2346: integral_constant's member functions should be marked noexcept
  2350: min, max, and minmax should be constexpr
  2356: Stability of erasure in unordered associative containers
  2357: Remaining "Assignable" requirement
  2359: How does regex_constants::nosubs affect basic_regex::mark_count()?
  2360: reverse_iterator::operator*() is unimplementable

  [1] http://libcxx.llvm.org/cxx1y_status.html
  [2] http://libcxx.llvm.org/cxx1z_status.html
  [3] http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html

  Exp-run:	antoine

MFC r277944:
  Partially revert r273382, to reduce diffs against upstream.  This was a
  temporary fix to solve a conflict with an older version of libc++, and
  it is no longer relevant.

MFC r278010:
  Revert r256642, not only to reduce diffs against upstream libcxxrt, but
  also because it is the wrong approach: comparing typeinfo names deeply
  causes trouble if two loaded DSOs use independent types of the same
  name.

  In addition, this particular change was never merged to FreeBSD 10.x and
  9.x, so let's get rid of it before it ends up in an 11.x release.

  Discussed with:	theraven, joerg@netbsd

MFC r278016:
  Import libcxxrt master 1cb607e89f6135bbc10f3d3b6fba1f983e258dcc.

  Interesting fixes:
  1cb607e Correct gcc version check for __cxa_begin_catch() declaration
          with or without throw()
2015-02-13 22:05:54 +00:00
Dimitry Andric
846fa61305 MFC r271931:
Add a few missing llvm/clang patches, update the other ones to be able
to apply with the same patch options onto a fresh upstream llvm/clang
3.4.1 checkout, and use approximately the same header tempate for them.
2015-02-13 21:31:43 +00:00
Dimitry Andric
cde4efbb1e MFC r271025, r271029, r271030 (by sbruno):
MFV:  Only emit movw on ARMv6T2

Building for the FreeBSD default target ARMv6 was emitting movw ASM on certain
test cases (found building qmake4/5 for ARM).  Don't do that, moreover, the AS
in base doesn't understand this instruction for this target.  One would need
to use --integrated-as to get this to build if desired.

http://llvm.org/viewvc/llvm-project?view=revision&revision=216989

Submitted by:	ian
Reviewed by:	dim
Obtained from:	llvm.org
2015-02-13 21:19:02 +00:00
Ian Lepore
ccf8029fb7 MFC r272519:
Add movw and movt relocations to the list of relocations against function
  names that must not be adjusted.
2015-02-12 03:16:57 +00:00
Jilles Tjoelker
f4d783b1ee MFC r278038: ttyname_r(): Return actual error, not always [ENOTTY].
Adjust the test that used to fail because of this bug.

PR:		191936
2015-02-08 22:24:03 +00:00
Hiren Panchasara
038db4361f MFC r277202
ntpd tries to bind to IPv6 interfaces in 'tentative' state and fails as IPv6 is
actually disabled. Fix it by making ntpd ignore such interfaces.
2015-02-03 20:08:05 +00:00
Pedro F. Giffuni
2a2e2dc91b MFV r277814, r277868, r277869:
amd: Add extra check for NULL before deref.

MFV	r277841:
Fix a clang 3.6.0 warning (from dim)

CID:		274421
Obtained from:	NetBSD
MFC after:	4 days
2015-02-03 14:36:48 +00:00
Dimitry Andric
f2cb88b4da Revert r278017 (MFC of r273381 and r276417) and r278018 (MFC of r273434)
until I can figure out why it leads to link failures in some scenarios.
2015-02-01 02:29:58 +00:00
Dimitry Andric
a97043fa2b MFC r273434 (by bapt):
Do not define bad_array_new_length::bad_array_new_length in libc++ anymore
when used in combinaison with libcxxrt since it is now defined there already.
This fixes building world
2015-02-01 01:42:38 +00:00
Dimitry Andric
22a6677490 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
2015-01-31 23:48:59 +00:00
Pedro F. Giffuni
5b94cfde1f MFC r277608, r277656, r277659:
Small upstream fixes for GDB.

GDB: Fix memset thinkos.

2005-03-25  Anthony Green  <green@redhat.com>

       * 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  <jimb@redhat.com>

       * 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  <kettenis@gnu.org>

      * corelow.c (get_core_register_section): Replace usage of sprintf
      and strcpy with xstrprintf and xstrdup.

CID:	604160, 604161, 604162, 604163
CID:	1006819 1008254
2015-01-28 02:25:48 +00:00
Luigi Rizzo
8c127f58e3 Merge 272659:
Add netmap support to libpcap. Tcpdump and other native pcap clients
can now run directly on netmap ports using netmap:foo or valeXX:YY
as device names.

Modifications to existing code are small and trivial,
the netmap-specific code is all in a new file.

Please be aware that in netmap mode the physical interface is
disconnected from the host stack, so libpcap will steal the traffic
not just make a copy.

For the full version of the code (including linux and autotools support) see
	https://code.google.com/p/netmap-libpcap/
2015-01-26 03:26:37 +00:00
Enji Cooper
3a01293b7e MFC r277278:
r277278 (by ngie):

  Fix lib/libthr/tests/detach_test

  - Eliminate race with liberal use of sleep(3) [1]
  - Fix NetBSD-specific implementation way of testing result from pthread_cancel
    by testing with `td` instead of `NULL` [2]

  PR: 196738 [1]
  PR: 191906 [2]

  Sponsored by: EMC / Isilon Storage Division
2015-01-25 00:28:15 +00:00
Xin LI
c590b07003 MFC r276577: MFV r276568:
Update file to 5.22.
2015-01-23 18:48:59 +00:00
Enji Cooper
1c4f6e0272 MFC r276806:
r276806 (by ngie):

  Remove unnecessary .include of bsd.own.mk

  Sponsored by: EMC / Isilon Storage Division
2015-01-23 00:35:47 +00:00
Enji Cooper
6316b6ce41 MFC r276671,r277357:
r276671 (by ngie):

  Expect :arithmetic_ops_body to fail with syntax errors on FreeBSD

  Sponsored by: EMC / Isilon Storage Division

r277357 (by ngie):

  Expect :overflow to fail with FreeBSD's expr as it doesn't have stringent
  overflow checks like NetBSD's expr does

  PR: 196867
2015-01-23 00:34:19 +00:00
Enji Cooper
415df41faa MFC r276590:
r276590 (by jilles):

  Link lib/libc/c063 tests to the build.

  Some files lack required #include <sys/stat.h>. The #ifdef is per ngie's
  request; the includes are clearly necessary for struct stat.

  The faccessat test fails because it tries to use AT_SYMLINK_NOFOLLOW with
  faccessat(), which is not specified by POSIX.1-2008.

  Differential Revision:	https://reviews.freebsd.org/D1411
  Reviewed by:	ngie
2015-01-20 21:48:42 +00:00
Edward Tomasz Napierala
178109a716 MFC r275680:
Add fstyp(8).  This utility, named after its SVR4 counterpart, detects
filesystems.  It differs from file(1) in that it gives machine-parseable
output, it outputs filesystem labels, doesn't get confused by other
formats metadata, and runs in Capsicum sandbox.

Differential Revision:	https://reviews.freebsd.org/D1255
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2015-01-20 20:39:29 +00:00
Enji Cooper
e5bb1fa9ab MFC r276805:
X-MFC note: the svn:mergeinfo for this MFC was accidentally committed via
            r277371

r276805 (by ngie):

  Build contrib/ofed/usr.{bin,lib} in parallel

  Sponsored by: EMC / Isilon Storage Division
2015-01-19 07:29:28 +00:00
Enji Cooper
97bfca6e46 MFC r276804:
r276804 (by ngie):

  Fix 'make depend' before infiniband headers have been installed to build host
  by removing space between -I and the header directory

  Sponsored by: EMC / Isilon Storage Division
2015-01-19 07:24:18 +00:00
Enji Cooper
ba1876a12f MFC r277272:
r277272 (by ngie):

  Don't call abort on usage errors; print out the usage message instead

  PR: 196793
  Sponsored by: EMC / Isilon Storage Division
2015-01-19 07:19:56 +00:00
Hans Petter Selasky
588f815b3a MFC r277212:
Fix compilation for 32-bit architectures.

PR:		196580
Sponsored by:	Mellanox Technologies
2015-01-19 06:57:51 +00:00
Konstantin Belousov
497595a554 Fix known issues which blow up the process after dlopen("libthr.so")
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

MFC r276630:
Remove interposing, fix malloc, reinstall signal handlers wrappers on
libthr load.

MFC r276681:
Avoid calling internal libc function through PLT or accessing data
though GOT.

MFC r277032:
Reduce the size of the interposing table and amount of
cancellation-handling code in the libthr.

MFC note:
r276646 ("do not erronously export 'openat' symbol from rtld") is not
applicable to stable/10 yet, since PATHFDS support was not merged.
2015-01-18 11:54:20 +00:00
Dimitry Andric
dfc3b66ae7 MFC r276517:
Pull in r200010 from upstream libc++ trunk (by Marshall Clow):

  Rename some internal templates to avoid conflict with complier
  intrinsics. __is_constructible --> __libcpp_is_constructible,
  __is_nothrow_constructible --> __libcpp_is_nothrow_constructible, and
  __is_nothrow_assignable --> __libcpp_is_nothrow_assignable. No
  functionality change.

Pull in r206805 from upstream libc++ trunk (by Marshall Clow):

  Use compiler intrinsic __is_constructible if available

This should fix building parts of world with -std=c++11 enabled.

Reported by:	Oliver Hartmann <ohartman@zedat.fu-berlin.de>
2015-01-17 12:54:02 +00:00
Pedro F. Giffuni
3fb7710fb8 MFC r272947, r272950:
tcpd: complete function prototypes.
tcpd.h: add prototype for hosts_ctl

This clears up at least a build issues on mysql-server
ports. While here also replace some spaces with tabs
in our headers.

PR:	32808
PR:	42336
2015-01-17 01:20:28 +00:00
Hans Petter Selasky
d71f5e8a26 MFC r276981:
Fix support for ConnectX2 hardware.

Sponsored by:	Mellanox Technologies
2015-01-14 05:29:35 +00:00
Jung-uk Kim
b305890a6c MFC: r274460, r274475
Increase MAXTABLE to the maxmimum possible value and regen test cases.
2015-01-12 20:14:31 +00:00
Hajimu UMEMOTO
c4e5588b5e Correct comparison of IPv6 wildcard address.
MFH:		r276814
2015-01-11 18:39:27 +00:00
Hans Petter Selasky
9a010225f7 MFC r276815:
Fix for compilation issue. Don't use the "abs()" function for unsigned
computations.

PR:		196597
Sponsored by:	Mellanox Technologies
2015-01-11 14:36:26 +00:00