202134 Commits

Author SHA1 Message Date
ngie
4e454a93db MFC r298758:
Remove logically impossible test in scsidoinquiry(..)

It was already done 4 lines prior and the value of error didn't change

CID: 1011236
2016-05-04 07:33:58 +00:00
ngie
b9b6820e9d MFC r298753:
Fix va_list handling

- Add missing va_end's after corresponding va_start's to cleanup state
- Eliminate questionable bzero'ing of va_list passed in to
  do_buff_decode(..) and do_encode(..) from buff_{de,en}code_visit(..)
  and csio_{de,en}code_visit(..). Make va_list a pointer instead and
  pass NULL into the underlying functions to handler this in a portable
  way.
- Do some minor style(9) clean up in affected functions.

CID: 1018500-1018503
2016-05-04 00:39:03 +00:00
ngie
7c09989b4a MFC r298450:
Simplify always evaluated branch (`e != NULL`)

- xalloc(..) ensures that e will be non-null via malloc + err.
- `e` is already dereferenced above, so logically it's impossible
  to hit the lower test without crashing if it was indeed NULL.

CID: 1007408
2016-05-04 00:34:45 +00:00
ngie
544322815d MFC r298311,r298312:
r298311:

Make sure fmemopen succeeds in :test_append_binary_pos before calling ftell
on the FILE object

This fixes potential null pointer dereferences on failure

CID: 1254952

r298312:

Fix double fclose of `fp1` when freopen fails

freopen handles closing file descriptors on error, with the exception of
fdopen'ed descriptors, so closing an already fclose'd file descriptor is
incorrect

CID: 1338525
2016-05-04 00:30:36 +00:00
ngie
e47fda3568 MFC r298368,r298660:
r298368:

Fix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c

Ensure opening /dev/zero succeeds. Abort the test if it doesn't.

Also, use _PATH_DEVZERO instead of hardcoding "/dev/zero"

CID: 1251410

r298660:

Fix up r298368

Remove the semicolon accidentally added after the new conditional that tests
that /dev/zero is opened successfully.

CID: 1354980
2016-05-04 00:29:05 +00:00
ngie
2a062cd701 MFC r298448,r298464:
r298448:

Don't leak `string` in parse_define(..) when a macro has been found
and the parser token != TOK_ASSIGN

CID: 1007187, 1007188
Obtained from: Isilon OneFS (part of r445479)

r298464:

Use `sizeof(*uuser)` instead of `sizeof(struct usm_user)` for consistency with
the rest of the users in the file

No functional change
2016-05-04 00:25:20 +00:00
ngie
26e1356c45 MFC r298451,r298452,r298507,r298750:
r298451:

Don't use `entry` after free in the "already in lists" case

Return with 0 as it isn't an error.

CID: 1006085
Obtained from: Isilon OneFS (part of r493633)

r298452:

Don't try to free `string` (stack allocated char[])

Fix minor style with warnx call while in the neighborhood

CID: 1009683

r298507:

Fix looking for "UTC" at start of ptr by using strnmp instead of improperly
unrolled equivalent

CID: 1347118

r298750:

Use a better idiom for finding UTC prefixed timezones

Instead of copy-pasting the string literal for "UTC" 3 times and using
strlen, use a static char[3] buffer and sizeof(..).
2016-05-04 00:14:50 +00:00
markj
78b62c1962 MFC r295575, r295576, r295578, r295579, r295580:
Various NDP cleanups. No functional change intended.
2016-05-03 23:46:01 +00:00
markj
34e507b326 MFC r296479:
Fix fasttrap tracepoint locking.
2016-05-03 20:08:05 +00:00
markj
324b497d7e MFC r297771:
Initialize SDT probes during SI_SUB_DTRACE_PROVIDER.
2016-05-03 19:42:58 +00:00
jkim
6f828d9b4d Merge OpenSSL 1.0.1t.
Relnotes:	yes
2016-05-03 18:54:20 +00:00
pfg
621e8ca862 MFC r298556:
ifconfig: prevent some improbable signed integer overflows.

ic_nchans, from struct:ieee80211req_chaninfo, is an unsigned int.
Use an unsigned index to prevent overflowing the index.

Adopt unsigned integers in other cases where it is useful
to be aware of the unsigned quantities and there is no
risk of the values being negative.
2016-05-03 15:04:56 +00:00
mav
04acf11bf4 MFC r298103: Simplify memory allocation for NS requests.
Since we no longer need additional buffers for request and response IOCBs,
we can increase receive space by 192 bytes, that is enough for fetching 48
more ports.  The new limit is 1020 fabric ports per virtual port.
2016-05-03 08:35:35 +00:00
mav
1ab6aa5702 MFC r297818: Update 25xx chips firmware from 7.03.00 to 8.03.00.
While the same update is also available for 24xx chips, it seems have
a problem with disabling virtual ports -- firmware handles the request,
but does not respong on it, causing timeout in driver.
2016-05-03 08:07:38 +00:00
mav
f85d7e90f0 MFC r297991: Extract virtual port address from RQSTYPE_RPT_ID_ACQ.
This should close the race between request arriving on new target mode
virtual port and its scanner thread finally fetch its address for request
routing.
2016-05-03 08:05:31 +00:00
mav
25b28f1fd9 MFC r297915: Filter Port Database Changed notifications.
For some reason firmware sends Port Database Changed notifications in case
of explicit login requests from the driver when target port is unavailabe.
Those notifications don't give driver any new information, but only cause
infinite scan loop.
2016-05-03 08:04:34 +00:00
mav
ff8ad51170 MFC r297912: Respect NVRAM topology settings on 24xx and above chips. 2016-05-03 08:03:51 +00:00
mav
6befb93a07 MFC r297867: Make all CT Pass-Through (name server requests) asynchronous.
Previously we had to do it synchronously because we could not drop the lock
due to potential scratch memory use conflicts.  Previous commits fixed that
collision, so here it goes -- slower and less reliable external requests
are executed asynchronously without spinning in tight loop and with more
safe timeout handling.
2016-05-03 08:03:07 +00:00
mav
06db58bc8a MFC r297859: Switch isp_getpdb() to synchronous IOCB DMA area.
While technically it is not IOCB, it is synchronous and can be called from
different places, so calling FC_SCRATCH_ACQUIRE() here is inconvenient.
2016-05-03 08:02:00 +00:00
mav
4031b92c41 MFC r297858: Allocate separate DMA area for synchronous IOCB execution.
Usually IOCBs should be put on queue for asynchronous processing and should
not require additional DMA memory.  But there are some cases like aborts and
resets that for external reasons has to be synchronous.  Give those cases
separate 2*64 byte DMA area to decouple them from other DMA scratch area
users, using it for asynchronous requests.
2016-05-03 08:00:54 +00:00
mav
2cdcbd6f18 MFC r297856: Reimplement ISP_TSK_MGMT IOCTL via asynchronous request.
I am not sure this code is not completely dead, but it used DMA scratch
are without good reason and asked to be refactored.
2016-05-03 07:59:42 +00:00
mav
94d37b829d MFC r297854: Add couple missing memory barriers. 2016-05-03 07:58:51 +00:00
mav
a200cc391e MFC r297817: Polish debugging IOCB dumping.
Add few more missing cases, unify byte order.
2016-05-03 07:58:11 +00:00
mav
87a9091b59 MFC r297751: Register symbolic port/node names in FC name server.
This is cosmetics that simplifies identification of new ports on FC switch.

It would be good to use target name from CTL here instead of hostname, but
it is not passed here through CAM now.
2016-05-03 07:57:26 +00:00
mav
b0556d6f4f MFC r297741: Reduce code duplication when executing Passthrough IOCB. 2016-05-03 07:56:42 +00:00
mav
7f17c80898 MFC r297522: Pass through some new block device features. 2016-05-03 07:52:06 +00:00
mav
74a61ec0b0 MFC r297921: Add hint.ahci.X.quirks tunable for some odd cases. 2016-05-03 07:50:58 +00:00
mav
192eaa31f9 MFC r297963: Remove watchdog timer stop check.
There are bunch of reports that this check fails at least on Nuvoton
NCT6776 chips.  I don't see why this check needed there, and Linux does
not have it either.  So far this check only made watchdogd unstopable.
2016-05-03 07:49:40 +00:00
mav
896cbb26a0 MFC r297243: Polish wbwd(4) driver and add more supported chips. 2016-05-03 07:48:52 +00:00
delphij
8b0d0aa157 MFC r298192: MFV r298178:
Update file to 5.26.

Relnotes:	yes
2016-05-02 05:46:47 +00:00
jamie
aeea68e0cf MFC r298888: typo
Submitted by:	Jimmy Olgeni
2016-05-01 16:49:32 +00:00
jamie
f235f50008 MFC r295471:
Add new rc.conf parameter "jail_reverse_stop"

  When a user defines "jail_list" in rc.conf the jails are started in the
  order defined. Currently the jails are not are stopped in reverse order
  which may break dependencies between jails/services and prevent a clean
  shutdown. The new parameter "jail_reverse_stop" will shutdown jails in
  "jail_list" in reverse order when set to "YES".

  Please note that this does not affect manual invocation of the jail rc
  script. If a user runs the command

    # service jail stop jail1 jail2 jail3

  the jails will be stopped in exactly the order specified regardless of
  jail_reverse_stop being defined in rc.conf.

MFC r295568:

  Document the new jail_reverse_stop parameter

  While here clean up the documentation for jail_list

PR:		196152
Submitted by:	feld
2016-04-30 15:06:18 +00:00
wblock
8ed4b37d5a MFC r298525:
Add a single example of adding a user that roughly corresponds with the
adduser example in the Handbook.
2016-04-30 14:47:45 +00:00
arybchik
0d1a0cd2ea MFC r298735
sfxge(4): do not use RxQ index as label

Labels are limitted by 32 on EF10. It is not sufficient on powerful hosts.
Since only one RxQ is running over each EvQ, zero label may be used.

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
PR:             208267
Differential Revision:  https://reviews.freebsd.org/D6121
2016-04-30 06:35:20 +00:00
jamie
7552516031 MFC r298584:
Note the existence of module-specific jail paramters, starting with the
  linux.* parameters when linux emulation is loaded.

MFC r298585:

  Encapsulate SYSV IPC objects in jails.  Define per-module parameters
  sysvmsg, sysvsem, and sysvshm, with the following bahavior:

  inherit: allow full access to the IPC primitives.  This is the same as
  the current setup with allow.sysvipc is on.  Jails and the base system
  can see (and moduly) each other's objects, which is generally considered
  a bad thing (though may be useful in some circumstances).

  disable: all no access, same as the current setup with allow.sysvipc off.

  new: A jail may see use the IPC objects that it has created.  It also
  gets its own IPC key namespace, so different jails may have their own
  objects using the same key value.  The parent jail (or base system) can
  see the jail's IPC objects, but not its keys.

PR:		48471
2016-04-30 04:02:32 +00:00
jamie
8f24180547 MFC r297367:
Move the various per-type arrays of OSD data into a single structure array.

MFC r297422:

  Add osd_reserve() and osd_set_reserved(), which allow M_WAITOK allocation
  of an OSD array.
2016-04-30 04:01:22 +00:00
jamie
0621c28d20 MFC r298565:
Add a new jail OSD method, PR_METHOD_REMOVE.  It's called when a jail is
  removed from the user perspective, i.e. when the last pr_uref goes away,
  even though the jail mail still exist in the dying state.  It will also
  be called if either PR_METHOD_CREATE or PR_METHOD_SET fail.

MFC r298683:

  Delay removing the last jail reference in prison_proc_free, and instead
  put it off into the pr_task.  This is similar to prison_free, and in fact
  uses the same task even though they do something slightly different.

MFC r298566:

  Pass the current/new jail to PR_METHOD_CHECK, which pushes the call
  until after the jail is found or created.  This requires unlocking the
  jail for the call and re-locking it afterward, but that works because
  nothing in the jail has been changed yet, and other processes won't
  change the important fields as long as allprison_lock remains held.

  Keep better track of name vs namelc in kern_jail_set.  Name should
  always be the hierarchical name (relative to the caller), and namelc
  the last component.

MFC r298668:

  Use crcopysafe in jail_attach.

PR:		48471
2016-04-30 03:19:07 +00:00
jamie
5a2943388b MFC r298564:
Remove the PR_REMOVE flag, which was meant as a temporary marker for
  a jail that might be seen mid-removal.  It hasn't been doing the right
  thing since at least the ability to resurrect dying jails, and such
  resurrection also makes it unnecessary.
2016-04-30 03:05:36 +00:00
kp
3f7a5f2148 MFC r298664
msdosfs: Prevent buffer overflow when expanding win95 names

In win2unixfn() we expand Windows 95 style long names. In some cases that
requires moving the data in the nbp->nb_buf buffer backwards to make room. That
code failed to check for overflows, leading to a stack overflow in win2unixfn().

We now check for this event, and mark the entire conversion as failed in that
case. This means we present the 8 character, dos style, name instead.

PR: 204643
Differential Revision:      https://reviews.freebsd.org/D6015
2016-04-29 20:19:41 +00:00
hselasky
f33895ae71 MFC r297696 and r298424:
Add new USB quirks.

Submitted by:	AJ <aleksanderlothe@live.com>
PR:		208623
Submitted by:	Naram Qashat <cyberbotx@cyberbotx.com>
PR:		208642
2016-04-29 11:37:06 +00:00
hselasky
31f48361b3 MFC r298458:
Add missing set of the current VNET when inputting IP packets in IPoIB.

This fixes a kernel panic when using IPoIB with VIMAGE and infiniband.

PR:		208957
Sponsored by:	Mellanox Technologies
Tested by:	Justin Clift <justin@postgresql.org>
2016-04-29 11:29:52 +00:00
hselasky
d89f9c0938 MFC r297968:
Remove some unused fields.

Sponsored by:	Mellanox Technologies
2016-04-29 11:18:48 +00:00
hselasky
18741cdbc9 MFC r297967:
Ensure the received IP header gets 32-bits aligned.

The FreeBSD's TCP/IP stack assumes that the IP-header is 32-bits aligned
when decoding it. Else unaligned 32-bit memory access can happen, which
not all processor architectures support.

Sponsored by:	Mellanox Technologies
2016-04-29 11:14:02 +00:00
hselasky
02ad600f2e MFC r297966:
Add missing port_up checks.

When downing a mlxen network adapter we need to check the port_up variable
to ensure we don't continue to transmit data or restart timers which can
reside in freed memory.

Sponsored by:	Mellanox Technologies
2016-04-29 11:06:24 +00:00
pfg
d58ddf1ae8 MFC r298640:
ed(1): switch two statements so we check the index before dereferencing.
2016-04-29 03:12:14 +00:00
pfg
a9fdf41ec6 MFC r298551, r298679, r298680:
fsck_ffs: use uint32_t for closedisk().

fs_ncg is of type uint32_t, and we were indexing it with an int.
Fixed this using an unsigned type.

Reviewed by:	mckusick
2016-04-29 03:04:56 +00:00
pfg
9bfc50da6e MFC r298530:
patch(1): avoid signed integer overflow when debugging.

Integer i is used to index p_end of type LINENUM (actually long).
Match the types.
2016-04-29 02:56:03 +00:00
jamie
1d5d3749a4 MFC r298562:
Make jail(8) interpret escape codes in fstab the same as getfsent(3).

PR:		208663
2016-04-28 01:40:47 +00:00
jamie
896a089c37 MFC r298516:
Don't remove the /var/run/jail_name.id file if a jail fails to start.
  This messes up ezjail (and possibly others), when attempting to start
  a jail that already exists.

PR:		208806
Reviewed by:	tj
2016-04-28 01:31:07 +00:00
pfg
4d78336c42 MFC r298521;
regex: prevent two improbable signed integer overflows.

In matcher() we used an integer to index nsub of type size_t.
In print() we used an integer to index nstates of type sopno,
typedef'd long.
In both cases the indexes never take negative values.

Match the types to avoid any error.
2016-04-28 01:11:25 +00:00