svn commit: r302542 - head/usr.bin/mail

2016-07-10 Thread Xin LI
Author: delphij
Date: Mon Jul 11 05:44:58 2016
New Revision: 302542
URL: https://svnweb.freebsd.org/changeset/base/302542

Log:
  Use _PATH_DEVNULL instead of hardcoding.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/mail/collect.c

Modified: head/usr.bin/mail/collect.c
==
--- head/usr.bin/mail/collect.c Mon Jul 11 05:17:48 2016(r302541)
+++ head/usr.bin/mail/collect.c Mon Jul 11 05:44:58 2016(r302542)
@@ -339,9 +339,9 @@ cont:
int nullfd, tempfd, rc;
char tempname2[PATHSIZE];
 
-   if ((nullfd = open("/dev/null", O_RDONLY, 0))
+   if ((nullfd = open(_PATH_DEVNULL, O_RDONLY, 0))
== -1) {
-   warn("/dev/null");
+   warn(_PATH_DEVNULL);
break;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302541 - head/sys/dev/hyperv/storvsc

2016-07-10 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 05:17:48 2016
New Revision: 302541
URL: https://svnweb.freebsd.org/changeset/base/302541

Log:
  hyperv/stor: Fix the INQUIRY checks
  
  Don't check the area that the host has not filled.
  
  PR:   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209443
  PR:   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210425
  Submitted by: Hongjiang Zhang 
  Reviewed by:  sephe, Dexuan Cui 
  MFC after:3 days
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6955

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Jul 11 
04:52:11 2016(r302540)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cMon Jul 11 
05:17:48 2016(r302541)
@@ -1939,62 +1939,24 @@ create_storvsc_request(union ccb *ccb, s
 }
 
 /*
- * Modified based on scsi_print_inquiry which is responsible to
- * print the detail information for scsi_inquiry_data.
- *
+ * SCSI Inquiry checks qualifier and type.
+ * If qualifier is 011b, means the device server is not capable
+ * of supporting a peripheral device on this logical unit, and
+ * the type should be set to 1Fh.
+ * 
  * Return 1 if it is valid, 0 otherwise.
  */
 static inline int
 is_inquiry_valid(const struct scsi_inquiry_data *inq_data)
 {
uint8_t type;
-   char vendor[16], product[48], revision[16];
-
-   /*
-* Check device type and qualifier
-*/
-   if (!(SID_QUAL_IS_VENDOR_UNIQUE(inq_data) ||
-   SID_QUAL(inq_data) == SID_QUAL_LU_CONNECTED))
+   if (SID_QUAL(inq_data) != SID_QUAL_LU_CONNECTED) {
return (0);
-
+   }
type = SID_TYPE(inq_data);
-   switch (type) {
-   case T_DIRECT:
-   case T_SEQUENTIAL:
-   case T_PRINTER:
-   case T_PROCESSOR:
-   case T_WORM:
-   case T_CDROM:
-   case T_SCANNER:
-   case T_OPTICAL:
-   case T_CHANGER:
-   case T_COMM:
-   case T_STORARRAY:
-   case T_ENCLOSURE:
-   case T_RBC:
-   case T_OCRW:
-   case T_OSD:
-   case T_ADC:
-   break;
-   case T_NODEVICE:
-   default:
+   if (type == T_NODEVICE) {
return (0);
}
-
-   /*
-* Check vendor, product, and revision
-*/
-   cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor),
-   sizeof(vendor));
-   cam_strvis(product, inq_data->product, sizeof(inq_data->product),
-   sizeof(product));
-   cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision),
-   sizeof(revision));
-   if (strlen(vendor) == 0  ||
-   strlen(product) == 0 ||
-   strlen(revision) == 0)
-   return (0);
-
return (1);
 }
 
@@ -2071,7 +2033,6 @@ storvsc_io_done(struct hv_storvsc_reques
ccb->ccb_h.status &= ~CAM_STATUS_MASK;
if (vm_srb->scsi_status == SCSI_STATUS_OK) {
const struct scsi_generic *cmd;
-
/*
 * Check whether the data for INQUIRY cmd is valid or
 * not.  Windows 10 and Windows 2016 send all zero
@@ -2080,23 +2041,59 @@ storvsc_io_done(struct hv_storvsc_reques
cmd = (const struct scsi_generic *)
((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
 csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes);
-   if (cmd->opcode == INQUIRY &&
-   /* 
-* XXX: Temporary work around disk hot plugin on win2k12r2,
-* only filtering the invalid disk on win10 or 2016 server.
-* So, the hot plugin on win10 and 2016 server needs
-* to be fixed.
+   if (cmd->opcode == INQUIRY) {
+   /*
+* The host of Windows 10 or 2016 server will response
+* the inquiry request with invalid data for unexisted 
device:
+   [0x7f 0x0 0x5 0x2 0x1f ... ]
+* But on windows 2012 R2, the response is:
+   [0x7f 0x0 0x0 0x0 0x0 ]
+* That is why here wants to validate the inquiry response.
+* The validation will skip the INQUIRY whose response is 
short,
+* which is less than SHORT_INQUIRY_LENGTH (36).
+*
+* For more information about INQUIRY, please refer to:
+*  
ftp://ftp.avc-pioneer.com/Mtfuji_7/Proposal/Jun09/INQUIRY.pdf
 */
-   vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN10 && 
-   is_inquiry_valid(
-   (const struct scsi_inquiry_data *)csio->data_ptr) == 0) {
+   const 

svn commit: r302540 - in head/sys/dev/hyperv: include vmbus

2016-07-10 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Jul 11 04:52:11 2016
New Revision: 302540
URL: https://svnweb.freebsd.org/changeset/base/302540

Log:
  hyperv/vmbus: Implement a new set of APIs for post message Hypercall
  
  And use this new APIs for Initial Contact post message Hypercall.
  More post message Hypercalls will be converted.
  
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D6830

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/hyperv.c
  head/sys/dev/hyperv/vmbus/hyperv_reg.h
  head/sys/dev/hyperv/vmbus/hyperv_var.h
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_reg.h
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hMon Jul 11 04:50:32 2016
(r302539)
+++ head/sys/dev/hyperv/include/hyperv.hMon Jul 11 04:52:11 2016
(r302540)
@@ -77,10 +77,6 @@ typedef uint8_t  hv_bool_uint8_t;
 #define HV_VMBUS_VERSION_WIN8  ((2 << 16) | (4))
 #define HV_VMBUS_VERSION_WIN8_1((3 << 16) | (0))
 
-#define HV_VMBUS_VERSION_INVALID   -1
-
-#define HV_VMBUS_VERSION_CURRENT   HV_VMBUS_VERSION_WIN8_1
-
 /*
  * Make maximum size of pipe payload of 16K
  */
@@ -537,20 +533,6 @@ typedef struct {
uint32_tchild_rel_id;
 } __packed hv_vmbus_channel_relid_released;
 
-typedef struct {
-   hv_vmbus_channel_msg_header header;
-   uint32_tvmbus_version_requested;
-   uint32_tpadding2;
-   uint64_tinterrupt_page;
-   uint64_tmonitor_page_1;
-   uint64_tmonitor_page_2;
-} __packed hv_vmbus_channel_initiate_contact;
-
-typedef struct {
-   hv_vmbus_channel_msg_header header;
-   hv_bool_uint8_t version_supported;
-} __packed hv_vmbus_channel_version_response;
-
 typedef hv_vmbus_channel_msg_header hv_vmbus_channel_unload;
 
 #define HW_MACADDR_LEN 6

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 04:50:32 2016
(r302539)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Jul 11 04:52:11 2016
(r302540)
@@ -40,29 +40,30 @@
  * Internal functions
  */
 
-typedef void (*vmbus_msg_handler)(const hv_vmbus_channel_msg_header *msg);
-
 typedef struct hv_vmbus_channel_msg_table_entry {
hv_vmbus_channel_msg_typemessageType;
-   vmbus_msg_handler   messageHandler;
+   void(*messageHandler)
+   (struct vmbus_softc *sc,
+const struct vmbus_message *msg);
 } hv_vmbus_channel_msg_table_entry;
 
 static voidvmbus_channel_on_offer_internal(void *context);
 static voidvmbus_channel_on_offer_rescind_internal(void *context);
 
-static voidvmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr);
-static voidvmbus_channel_on_open_result(
-   const hv_vmbus_channel_msg_header *hdr);
-static voidvmbus_channel_on_offer_rescind(
-   const hv_vmbus_channel_msg_header *hdr);
-static voidvmbus_channel_on_gpadl_created(
-   const hv_vmbus_channel_msg_header *hdr);
-static voidvmbus_channel_on_gpadl_torndown(
-   const hv_vmbus_channel_msg_header *hdr);
-static voidvmbus_channel_on_offers_delivered(
-   const hv_vmbus_channel_msg_header *hdr);
-static voidvmbus_channel_on_version_response(
-   const hv_vmbus_channel_msg_header *hdr);
+static voidvmbus_channel_on_offer(struct vmbus_softc *,
+   const struct vmbus_message *);
+static voidvmbus_channel_on_open_result(struct vmbus_softc *,
+   const struct vmbus_message *);
+static voidvmbus_channel_on_offer_rescind(struct vmbus_softc *,
+   const struct vmbus_message *);
+static voidvmbus_channel_on_gpadl_created(struct vmbus_softc *,
+   const struct vmbus_message *);
+static voidvmbus_channel_on_gpadl_torndown(struct vmbus_softc *,
+   const struct vmbus_message *);
+static voidvmbus_channel_on_offers_delivered(struct vmbus_softc *,
+   const struct vmbus_message *);
+static voidvmbus_channel_on_version_response(struct vmbus_softc *,
+   const struct vmbus_message *);
 
 /**
  * Channel message dispatch table
@@ -398,8 +399,11 @@ vmbus_channel_select_defcpu(struct hv_vm
  * object to process the offer synchronously
  */
 static void
-vmbus_channel_on_offer(const 

svn commit: r302539 - stable/11/usr.sbin/freebsd-update

2016-07-10 Thread Xin LI
Author: delphij
Date: Mon Jul 11 04:50:32 2016
New Revision: 302539
URL: https://svnweb.freebsd.org/changeset/base/302539

Log:
  MFC r302534:
  
  Allow - in distribution names.  This is needed for freebsd-update to
  work with 11.0+, where the debugging symbols use a new naming scheme
  for release distribution files.
  
  Errata candidate.
  
  Approved by:  re (gjb)

Modified:
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh
==
--- stable/11/usr.sbin/freebsd-update/freebsd-update.sh Mon Jul 11 04:21:38 
2016(r302538)
+++ stable/11/usr.sbin/freebsd-update/freebsd-update.sh Mon Jul 11 04:50:32 
2016(r302539)
@@ -1250,7 +1250,7 @@ fetch_metadata_sanity () {
 
# Check that the first four fields make sense.
if gunzip -c < files/$1.gz |
-   grep -qvE "^[a-z]+\|[0-9a-z]+\|${P}+\|[fdL-]\|"; then
+   grep -qvE "^[a-z]+\|[0-9a-z-]+\|${P}+\|[fdL-]\|"; then
fetch_metadata_bogus ""
return 1
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302537 - stable/9/usr.sbin/freebsd-update

2016-07-10 Thread Xin LI
Author: delphij
Date: Mon Jul 11 04:12:15 2016
New Revision: 302537
URL: https://svnweb.freebsd.org/changeset/base/302537

Log:
  MFC r302534:
  
  Allow - in distribution names.  This is needed for freebsd-update to work
  with 11.0+, where the debugging symbols use a new naming scheme for release
  distribution files.
  
  Errata candidate.

Modified:
  stable/9/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/9/usr.sbin/freebsd-update/   (props changed)

Modified: stable/9/usr.sbin/freebsd-update/freebsd-update.sh
==
--- stable/9/usr.sbin/freebsd-update/freebsd-update.sh  Mon Jul 11 04:11:33 
2016(r302536)
+++ stable/9/usr.sbin/freebsd-update/freebsd-update.sh  Mon Jul 11 04:12:15 
2016(r302537)
@@ -1229,7 +1229,7 @@ fetch_metadata_sanity () {
 
# Check that the first four fields make sense.
if gunzip -c < files/$1.gz |
-   grep -qvE "^[a-z]+\|[0-9a-z]+\|${P}+\|[fdL-]\|"; then
+   grep -qvE "^[a-z]+\|[0-9a-z-]+\|${P}+\|[fdL-]\|"; then
fetch_metadata_bogus ""
return 1
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302536 - stable/10/usr.sbin/freebsd-update

2016-07-10 Thread Xin LI
Author: delphij
Date: Mon Jul 11 04:11:33 2016
New Revision: 302536
URL: https://svnweb.freebsd.org/changeset/base/302536

Log:
  MFC r302534:
  
  Allow - in distribution names.  This is needed for freebsd-update to work
  with 11.0+, where the debugging symbols use a new naming scheme for release
  distribution files.
  
  Errata candidate.

Modified:
  stable/10/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/freebsd-update/freebsd-update.sh
==
--- stable/10/usr.sbin/freebsd-update/freebsd-update.sh Mon Jul 11 03:34:32 
2016(r302535)
+++ stable/10/usr.sbin/freebsd-update/freebsd-update.sh Mon Jul 11 04:11:33 
2016(r302536)
@@ -1250,7 +1250,7 @@ fetch_metadata_sanity () {
 
# Check that the first four fields make sense.
if gunzip -c < files/$1.gz |
-   grep -qvE "^[a-z]+\|[0-9a-z]+\|${P}+\|[fdL-]\|"; then
+   grep -qvE "^[a-z]+\|[0-9a-z-]+\|${P}+\|[fdL-]\|"; then
fetch_metadata_bogus ""
return 1
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302535 - head/usr.sbin/ypldap

2016-07-10 Thread Marcelo Araujo
Author: araujo
Date: Mon Jul 11 03:34:32 2016
New Revision: 302535
URL: https://svnweb.freebsd.org/changeset/base/302535

Log:
  Do not allow whitespace in macro names.
  
  Obtained from:OpenBSD (r1.19).

Modified:
  head/usr.sbin/ypldap/parse.y

Modified: head/usr.sbin/ypldap/parse.y
==
--- head/usr.sbin/ypldap/parse.yMon Jul 11 03:31:12 2016
(r302534)
+++ head/usr.sbin/ypldap/parse.yMon Jul 11 03:34:32 2016
(r302535)
@@ -144,6 +144,14 @@ include: INCLUDE STRING
{
;
 
 varset : STRING '=' STRING {
+   char *s = $1;
+   while (*s++) {
+   if (isspace((unsigned char) *s)) {
+   yyerror("macro name cannot contain "
+ "whitespace");
+   YYERROR;
+   }
+   }
if (symset($1, $3, 0) == -1)
fatal("cannot store variable");
free($1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302534 - head/usr.sbin/freebsd-update

2016-07-10 Thread Xin LI
Author: delphij
Date: Mon Jul 11 03:31:12 2016
New Revision: 302534
URL: https://svnweb.freebsd.org/changeset/base/302534

Log:
  Allow - in distribution names.  This is needed for freebsd-update to work
  with 11.0+, where the debugging symbols use a new naming scheme for release
  distribution files.
  
  Errata candidate.
  
  Approved by:  cperciva
  Differential Revision:https://reviews.freebsd.org/D7170

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Mon Jul 11 00:03:39 
2016(r302533)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Mon Jul 11 03:31:12 
2016(r302534)
@@ -1250,7 +1250,7 @@ fetch_metadata_sanity () {
 
# Check that the first four fields make sense.
if gunzip -c < files/$1.gz |
-   grep -qvE "^[a-z]+\|[0-9a-z]+\|${P}+\|[fdL-]\|"; then
+   grep -qvE "^[a-z]+\|[0-9a-z-]+\|${P}+\|[fdL-]\|"; then
fetch_metadata_bogus ""
return 1
fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302533 - head/usr.bin/mail

2016-07-10 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jul 11 00:03:39 2016
New Revision: 302533
URL: https://svnweb.freebsd.org/changeset/base/302533

Log:
  mail(1): Fix a comment.
  
  Obtained from:NetBSD (CVS Rev 1.29)

Modified:
  head/usr.bin/mail/collect.c

Modified: head/usr.bin/mail/collect.c
==
--- head/usr.bin/mail/collect.c Sun Jul 10 20:42:18 2016(r302532)
+++ head/usr.bin/mail/collect.c Mon Jul 11 00:03:39 2016(r302533)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
 #include "extern.h"
 
 /*
- * Read a message from standard output and return a read file to it
+ * Read a message from standard input and return a read file to it
  * or NULL on error.
  */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302532 - head

2016-07-10 Thread Garrett Cooper
Author: ngie
Date: Sun Jul 10 20:42:18 2016
New Revision: 302532
URL: https://svnweb.freebsd.org/changeset/base/302532

Log:
  Correct OLD_LIBS change done in r298840
  
  libkvm.so lives in /lib, not /usr/lib
  
  MFC after: 3 days
  X-MFC note: ^/stable/11 only
  X-MFC with: r298840
  Submitted by: Herbert J. Skuhra 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Jul 10 20:22:04 2016(r302531)
+++ head/ObsoleteFiles.inc  Sun Jul 10 20:42:18 2016(r302532)
@@ -203,7 +203,7 @@ OLD_FILES+=usr/share/man/man9/rman_await
 # 20160517: ReiserFS removed
 OLD_FILES+=usr/share/man/man5/reiserfs.5.gz
 # 20160430: kvm_getfiles(3) removed from kvm(3)
-OLD_LIBS+=usr/lib/libkvm.so.6
+OLD_LIBS+=lib/libkvm.so.6
 OLD_FILES+=usr/share/man/man3/kvm_getfiles.3.gz
 # 20160423: remove mroute6d
 OLD_FILES+=etc/rc.d/mroute6d
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298840 - in head: . lib/libkvm

2016-07-10 Thread Ngie Cooper (yaneurabeya)

> On Jul 10, 2016, at 01:30, Herbert J. Skuhra  wrote:
> 
> Garrett Cooper skrev:
>> 
>> Author: ngie
>> Date: Sat Apr 30 09:21:13 2016
>> New Revision: 298840
>> URL: https://svnweb.freebsd.org/changeset/base/298840
>> 
>> Log:
>>  Remove kvm_getfiles(3)
>> 
>>  This libcall has been broken since (at least) r174989/8.0-RELEASE.
>> 
>>  Bump SHLIB_MAJOR for the change
>> 
>>  Differential Revision: https://reviews.freebsd.org/D6052
>>  Relnotes: yes
>>  Reviewed by: jhb, markj
>>  Sponsored by: EMC / Isilon Storage Division

Yes, it should be :/.


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r302531 - head/sys/dev/ntb/ntb_hw

2016-07-10 Thread Alexander Motin
Author: mav
Date: Sun Jul 10 20:22:04 2016
New Revision: 302531
URL: https://svnweb.freebsd.org/changeset/base/302531

Log:
  Revert odd change, setting limit registers before base.
  
  I don't know what errata is mentioned there, I was unable to find it, but
  setting limit before the base simply does not work at all.  According to
  specification attempt to set limit out of the present window range resets
  it to zero, effectively disabling it.  And that is what I see in practice.
  
  Fixing this properly disables access for remote side to our memory until
  respective xlat is negotiated and set.  As I see, Linux does the same.

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==
--- head/sys/dev/ntb/ntb_hw/ntb_hw.cSun Jul 10 19:52:26 2016
(r302530)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.cSun Jul 10 20:22:04 2016
(r302531)
@@ -1699,26 +1699,22 @@ xeon_set_sbar_base_and_limit(struct ntb_
bar_addr = 0;
}
 
-   /*
-* Set limit registers first to avoid an errata where setting the base
-* registers locks the limit registers.
-*/
if (!bar_is_64bit(ntb, idx)) {
-   ntb_reg_write(4, lmt_reg, bar_addr);
-   reg_val = ntb_reg_read(4, lmt_reg);
-   (void)reg_val;
-
ntb_reg_write(4, base_reg, bar_addr);
reg_val = ntb_reg_read(4, base_reg);
(void)reg_val;
-   } else {
-   ntb_reg_write(8, lmt_reg, bar_addr);
-   reg_val = ntb_reg_read(8, lmt_reg);
-   (void)reg_val;
 
+   ntb_reg_write(4, lmt_reg, bar_addr);
+   reg_val = ntb_reg_read(4, lmt_reg);
+   (void)reg_val;
+   } else {
ntb_reg_write(8, base_reg, bar_addr);
reg_val = ntb_reg_read(8, base_reg);
(void)reg_val;
+
+   ntb_reg_write(8, lmt_reg, bar_addr);
+   reg_val = ntb_reg_read(8, lmt_reg);
+   (void)reg_val;
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302530 - head/sys/dev/ntb/ntb_hw

2016-07-10 Thread Alexander Motin
Author: mav
Date: Sun Jul 10 19:52:26 2016
New Revision: 302530
URL: https://svnweb.freebsd.org/changeset/base/302530

Log:
  Fix wrong copy/paste in r302510.

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==
--- head/sys/dev/ntb/ntb_hw/ntb_hw.cSun Jul 10 19:15:29 2016
(r302529)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.cSun Jul 10 19:52:26 2016
(r302530)
@@ -1833,7 +1833,7 @@ xeon_setup_b2b_mw(struct ntb_softc *ntb,
} else {
ntb_reg_write(4, xlat_reg, MSI_INTEL_ADDR_BASE);
ntb->msix_xlat = ntb_reg_read(4, xlat_reg);
-   ntb_reg_write(8, lmt_reg, 0);
+   ntb_reg_write(4, lmt_reg, 0);
}
 
ntb->peer_lapic_bar =  >bar_info[bar_num];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302529 - head/sys/dev/ntb

2016-07-10 Thread Alexander Motin
Author: mav
Date: Sun Jul 10 19:15:29 2016
New Revision: 302529
URL: https://svnweb.freebsd.org/changeset/base/302529

Log:
  Remove callout_reset(link_work) from ntb_transport_attach().
  
  At that point link is quite likely not established yet, so messing with
  scratch registers is premature there.  Original commit message mentioned
  code diff reduction from Linux, but this line is not present in Linux now.

Modified:
  head/sys/dev/ntb/ntb_transport.c

Modified: head/sys/dev/ntb/ntb_transport.c
==
--- head/sys/dev/ntb/ntb_transport.cSun Jul 10 18:28:15 2016
(r302528)
+++ head/sys/dev/ntb/ntb_transport.cSun Jul 10 19:15:29 2016
(r302529)
@@ -394,7 +394,6 @@ ntb_transport_attach(device_t dev)
nt->link_is_up = false;
NTB_LINK_ENABLE(ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO);
 
-   callout_reset(>link_work, 0, ntb_transport_link_work, nt);
if (enable_xeon_watchdog != 0)
callout_reset(>link_watchdog, 0, xeon_link_watchdog_hb, nt);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302528 - in head/sys: arm/allwinner arm/allwinner/clk arm/nvidia arm/nvidia/tegra124 dev/dwc dev/extres/clk dev/extres/hwreset dev/extres/phy dev/extres/regulator dev/iicbus/twsi dev/u...

2016-07-10 Thread Michal Meloun
Author: mmel
Date: Sun Jul 10 18:28:15 2016
New Revision: 302528
URL: https://svnweb.freebsd.org/changeset/base/302528

Log:
  EXTRES: Add OF node as argument to all _get_by_ofw_() functions.
  In some cases, the driver must handle given properties located in
  specific OF subnode. Instead of creating duplicate set of function, add
  'node' as argument to existing functions, defaulting it to device OF node.
  
  MFC after: 3 weeks

Modified:
  head/sys/arm/allwinner/a10_ahci.c
  head/sys/arm/allwinner/a10_codec.c
  head/sys/arm/allwinner/a10_dmac.c
  head/sys/arm/allwinner/a10_ehci.c
  head/sys/arm/allwinner/a10_fb.c
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/allwinner/a10_hdmi.c
  head/sys/arm/allwinner/a10_mmc.c
  head/sys/arm/allwinner/aw_if_dwc.c
  head/sys/arm/allwinner/aw_rsb.c
  head/sys/arm/allwinner/aw_usbphy.c
  head/sys/arm/allwinner/clk/aw_ahbclk.c
  head/sys/arm/allwinner/clk/aw_apbclk.c
  head/sys/arm/allwinner/clk/aw_axiclk.c
  head/sys/arm/allwinner/clk/aw_codecclk.c
  head/sys/arm/allwinner/clk/aw_cpuclk.c
  head/sys/arm/allwinner/clk/aw_cpusclk.c
  head/sys/arm/allwinner/clk/aw_debeclk.c
  head/sys/arm/allwinner/clk/aw_gate.c
  head/sys/arm/allwinner/clk/aw_gmacclk.c
  head/sys/arm/allwinner/clk/aw_hdmiclk.c
  head/sys/arm/allwinner/clk/aw_lcdclk.c
  head/sys/arm/allwinner/clk/aw_mmcclk.c
  head/sys/arm/allwinner/clk/aw_modclk.c
  head/sys/arm/allwinner/clk/aw_pll.c
  head/sys/arm/allwinner/clk/aw_usbclk.c
  head/sys/arm/allwinner/if_awg.c
  head/sys/arm/allwinner/if_emac.c
  head/sys/arm/nvidia/tegra124/tegra124_cpufreq.c
  head/sys/arm/nvidia/tegra124/tegra124_pmc.c
  head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c
  head/sys/arm/nvidia/tegra_ahci.c
  head/sys/arm/nvidia/tegra_efuse.c
  head/sys/arm/nvidia/tegra_ehci.c
  head/sys/arm/nvidia/tegra_i2c.c
  head/sys/arm/nvidia/tegra_pcie.c
  head/sys/arm/nvidia/tegra_rtc.c
  head/sys/arm/nvidia/tegra_sdhci.c
  head/sys/arm/nvidia/tegra_soctherm.c
  head/sys/arm/nvidia/tegra_uart.c
  head/sys/arm/nvidia/tegra_usbphy.c
  head/sys/dev/dwc/if_dwc.c
  head/sys/dev/extres/clk/clk.c
  head/sys/dev/extres/clk/clk.h
  head/sys/dev/extres/clk/clk_fixed.c
  head/sys/dev/extres/hwreset/hwreset.c
  head/sys/dev/extres/hwreset/hwreset.h
  head/sys/dev/extres/phy/phy.c
  head/sys/dev/extres/phy/phy.h
  head/sys/dev/extres/regulator/regulator.c
  head/sys/dev/extres/regulator/regulator.h
  head/sys/dev/iicbus/twsi/a10_twsi.c
  head/sys/dev/uart/uart_dev_snps.c
  head/sys/dev/usb/controller/generic_ohci.c

Modified: head/sys/arm/allwinner/a10_ahci.c
==
--- head/sys/arm/allwinner/a10_ahci.c   Sun Jul 10 17:16:56 2016
(r302527)
+++ head/sys/arm/allwinner/a10_ahci.c   Sun Jul 10 18:28:15 2016
(r302528)
@@ -313,12 +313,12 @@ ahci_a10_attach(device_t dev)
return (ENXIO);
 
/* Enable clocks */
-   error = clk_get_by_ofw_index(dev, 0, _pll);
+   error = clk_get_by_ofw_index(dev, 0, 0, _pll);
if (error != 0) {
device_printf(dev, "Cannot get PLL clock\n");
goto fail;
}
-   error = clk_get_by_ofw_index(dev, 1, _gate);
+   error = clk_get_by_ofw_index(dev, 0, 1, _gate);
if (error != 0) {
device_printf(dev, "Cannot get gate clock\n");
goto fail;

Modified: head/sys/arm/allwinner/a10_codec.c
==
--- head/sys/arm/allwinner/a10_codec.c  Sun Jul 10 17:16:56 2016
(r302527)
+++ head/sys/arm/allwinner/a10_codec.c  Sun Jul 10 18:28:15 2016
(r302528)
@@ -786,12 +786,12 @@ a10codec_attach(device_t dev)
}
 
/* Get clocks */
-   error = clk_get_by_ofw_name(dev, "apb", _apb);
+   error = clk_get_by_ofw_name(dev, 0, "apb", _apb);
if (error != 0) {
device_printf(dev, "cannot find apb clock\n");
goto fail;
}
-   error = clk_get_by_ofw_name(dev, "codec", _codec);
+   error = clk_get_by_ofw_name(dev, 0, "codec", _codec);
if (error != 0) {
device_printf(dev, "cannot find codec clock\n");
goto fail;

Modified: head/sys/arm/allwinner/a10_dmac.c
==
--- head/sys/arm/allwinner/a10_dmac.c   Sun Jul 10 17:16:56 2016
(r302527)
+++ head/sys/arm/allwinner/a10_dmac.c   Sun Jul 10 18:28:15 2016
(r302528)
@@ -124,7 +124,7 @@ a10dmac_attach(device_t dev)
mtx_init(>sc_mtx, "a10 dmac", NULL, MTX_SPIN);
 
/* Activate DMA controller clock */
-   error = clk_get_by_ofw_index(dev, 0, );
+   error = clk_get_by_ofw_index(dev, 0, 0, );
if (error != 0) {
device_printf(dev, "cannot get clock\n");
return (error);

Modified: head/sys/arm/allwinner/a10_ehci.c

svn commit: r302527 - stable/11/sys/powerpc/conf

2016-07-10 Thread Glen Barber
Author: gjb
Date: Sun Jul 10 17:16:56 2016
New Revision: 302527
URL: https://svnweb.freebsd.org/changeset/base/302527

Log:
  Turn off WITNESS, INVARIANTS, etc., in the powerpc GENERIC64
  kernel configuration, missed after the stable/11 branch.
  
  Approved by:  re (kib)
  PR:   210974
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/powerpc/conf/GENERIC64

Modified: stable/11/sys/powerpc/conf/GENERIC64
==
--- stable/11/sys/powerpc/conf/GENERIC64Sun Jul 10 14:17:36 2016
(r302526)
+++ stable/11/sys/powerpc/conf/GENERIC64Sun Jul 10 17:16:56 2016
(r302527)
@@ -82,14 +82,6 @@ options  INCLUDE_CONFIG_FILE # Inclu
 # Debugging support.  Always need this:
 optionsKDB # Enable kernel debugger support.
 optionsKDB_TRACE   # Print a stack trace for a panic.
-# For full debugger support use (turn off in stable branch):
-optionsDDB #Support DDB
-#options   DEADLKRES   #Enable the deadlock resolver
-optionsINVARIANTS  #Enable calls of extra sanity checking
-optionsINVARIANT_SUPPORT   #Extra sanity checks of internal 
structures, required by INVARIANTS
-optionsWITNESS #Enable checks to detect deadlocks and 
cycles
-optionsWITNESS_SKIPSPIN#Don't run witness on spinlocks for 
speed
-optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
 
 # Make an SMP-capable kernel by default
 optionsSMP # Symmetric MultiProcessor Kernel
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302526 - head/sys/kern

2016-07-10 Thread Robert Watson
Author: rwatson
Date: Sun Jul 10 14:17:36 2016
New Revision: 302526
URL: https://svnweb.freebsd.org/changeset/base/302526

Log:
  In process-descriptor close(2) and fstat(2), audit target process
  information.  pgkill(2) already audits target process ID.
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/sys_procdesc.c

Modified: head/sys/kern/sys_procdesc.c
==
--- head/sys/kern/sys_procdesc.cSun Jul 10 13:42:33 2016
(r302525)
+++ head/sys/kern/sys_procdesc.cSun Jul 10 14:17:36 2016
(r302526)
@@ -1,10 +1,15 @@
 /*-
- * Copyright (c) 2009 Robert N. M. Watson
+ * Copyright (c) 2009, 2016 Robert N. M. Watson
  * All rights reserved.
  *
  * This software was developed at the University of Cambridge Computer
  * Laboratory with support from a grant from Google, Inc.
  *
+ * Portions of this software were developed by BAE Systems, the University of
+ * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL
+ * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent
+ * Computing (TC) research program.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -383,6 +388,7 @@ procdesc_close(struct file *fp, struct t
sx_xunlock(_lock);
} else {
PROC_LOCK(p);
+   AUDIT_ARG_PROCESS(p);
if (p->p_state == PRS_ZOMBIE) {
/*
 * If the process is already dead and just awaiting
@@ -529,6 +535,7 @@ procdesc_stat(struct file *fp, struct st
sx_slock(_lock);
if (pd->pd_proc != NULL) {
PROC_LOCK(pd->pd_proc);
+   AUDIT_ARG_PROCESS(pd->pd_proc);
 
/* Set birth and [acm] times to process start time. */
pstart = pd->pd_proc->p_stats->p_start;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302525 - in head/sys: kern sys

2016-07-10 Thread Robert Watson
Author: rwatson
Date: Sun Jul 10 13:42:33 2016
New Revision: 302525
URL: https://svnweb.freebsd.org/changeset/base/302525

Log:
  Do allow auditing of read(2) and write(2) system calls, by assigning
  those system calls audit event identifiers AUE_READ and AUE_WRITE.
  While auditing file-descriptor I/O is not required by the Common
  Criteria, in practice this proves useful for both live and forensic
  analysis.
  
  NB: freebsd32 already assigns AUE_READ and AUE_WRITE to read(2) and
  write(2).
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.master
  head/sys/sys/sysproto.h

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Sun Jul 10 11:49:10 2016(r302524)
+++ head/sys/kern/init_sysent.c Sun Jul 10 13:42:33 2016(r302525)
@@ -49,8 +49,8 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },  
/* 0 = syscall */
{ AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 1 = exit */
{ 0, (sy_call_t *)sys_fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 2 = fork */
-   { AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 3 = read */
-   { AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 4 = write */
+   { AS(read_args), (sy_call_t *)sys_read, AUE_READ, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 3 = read */
+   { AS(write_args), (sy_call_t *)sys_write, AUE_WRITE, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },   /* 4 = write */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */
{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },   /* 6 = close */
{ AS(wait4_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 7 = wait4 */

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Sun Jul 10 11:49:10 2016
(r302524)
+++ head/sys/kern/syscalls.master   Sun Jul 10 13:42:33 2016
(r302525)
@@ -62,9 +62,9 @@
 1  AUE_EXITSTD { void sys_exit(int rval); } exit \
sys_exit_args void
 2  AUE_FORKSTD { int fork(void); }
-3  AUE_NULLSTD { ssize_t read(int fd, void *buf, \
+3  AUE_READSTD { ssize_t read(int fd, void *buf, \
size_t nbyte); }
-4  AUE_NULLSTD { ssize_t write(int fd, const void *buf, \
+4  AUE_WRITE   STD { ssize_t write(int fd, const void *buf, \
size_t nbyte); }
 5  AUE_OPEN_RWTC   STD { int open(char *path, int flags, int mode); }
 ; XXX should be{ int open(const char *path, int flags, ...); }

Modified: head/sys/sys/sysproto.h
==
--- head/sys/sys/sysproto.h Sun Jul 10 11:49:10 2016(r302524)
+++ head/sys/sys/sysproto.h Sun Jul 10 13:42:33 2016(r302525)
@@ -2508,8 +2508,8 @@ int   freebsd10_pipe(struct thread *, stru
 #defineSYS_AUE_syscall AUE_NULL
 #defineSYS_AUE_exitAUE_EXIT
 #defineSYS_AUE_forkAUE_FORK
-#defineSYS_AUE_readAUE_NULL
-#defineSYS_AUE_write   AUE_NULL
+#defineSYS_AUE_readAUE_READ
+#defineSYS_AUE_write   AUE_WRITE
 #defineSYS_AUE_openAUE_OPEN_RWTC
 #defineSYS_AUE_close   AUE_CLOSE
 #defineSYS_AUE_wait4   AUE_WAIT4
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302524 - head/sys/vm

2016-07-10 Thread Robert Watson
Author: rwatson
Date: Sun Jul 10 11:49:10 2016
New Revision: 302524
URL: https://svnweb.freebsd.org/changeset/base/302524

Log:
  When mmap(2) is used with a vnode, capture vnode attributes in the
  audit trail.  This was not required for Common Criteria auditing
  (which requires only that the intent to read or write be audited
  at the time of open(2)), but is useful for contemporary live
  analysis and forensics.
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Sun Jul 10 10:53:50 2016(r302523)
+++ head/sys/vm/vm_mmap.c   Sun Jul 10 11:49:10 2016(r302524)
@@ -1245,6 +1245,7 @@ vm_mmap_vnode(struct thread *td, vm_size
locktype = LK_SHARED;
if ((error = vget(vp, locktype, td)) != 0)
return (error);
+   AUDIT_ARG_VNODE1(vp);
foff = *foffp;
flags = *flagsp;
obj = vp->v_object;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302523 - head/sys/dev/extres/clk

2016-07-10 Thread Jared McNeill
Author: jmcneill
Date: Sun Jul 10 10:53:50 2016
New Revision: 302523
URL: https://svnweb.freebsd.org/changeset/base/302523

Log:
  Add clk_get_by_ofw_node_index, which is like clk_get_by_ofw_index but
  operates on a specific OF node instead of the pass in device's OF node.
  
  Reviewed by:  andrew, mmel
  Differential Revision:https://reviews.freebsd.org/D6957

Modified:
  head/sys/dev/extres/clk/clk.c
  head/sys/dev/extres/clk/clk.h

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Sun Jul 10 10:38:28 2016
(r302522)
+++ head/sys/dev/extres/clk/clk.c   Sun Jul 10 10:53:50 2016
(r302523)
@@ -1198,13 +1198,7 @@ clk_get_by_id(device_t dev, struct clkdo
 int
 clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk)
 {
-   phandle_t cnode, parent, *cells;
-   device_t clockdev;
-   int ncells, rv;
-   struct clkdom *clkdom;
-   struct clknode *clknode;
-
-   *clk = NULL;
+   phandle_t cnode;
 
cnode = ofw_bus_get_node(dev);
if (cnode <= 0) {
@@ -1213,6 +1207,20 @@ clk_get_by_ofw_index(device_t dev, int i
return (ENXIO);
}
 
+   return (clk_get_by_ofw_node_index(dev, cnode, idx, clk));
+}
+
+int
+clk_get_by_ofw_node_index(device_t dev, phandle_t cnode, int idx, clk_t *clk)
+{
+   phandle_t parent, *cells;
+   device_t clockdev;
+   int ncells, rv;
+   struct clkdom *clkdom;
+   struct clknode *clknode;
+
+   *clk = NULL;
+
rv = ofw_bus_parse_xref_list_alloc(cnode, "clocks", "#clock-cells", idx,
, , );
if (rv != 0) {

Modified: head/sys/dev/extres/clk/clk.h
==
--- head/sys/dev/extres/clk/clk.h   Sun Jul 10 10:38:28 2016
(r302522)
+++ head/sys/dev/extres/clk/clk.h   Sun Jul 10 10:53:50 2016
(r302523)
@@ -131,6 +131,8 @@ const char *clk_get_name(clk_t clk);
 #ifdef FDT
 int clk_get_by_ofw_index(device_t dev, int idx, clk_t *clk);
 int clk_get_by_ofw_name(device_t dev, const char *name, clk_t *clk);
+int clk_get_by_ofw_node_index(device_t dev, phandle_t node, int idx,
+clk_t *clk);
 int clk_parse_ofw_out_names(device_t dev, phandle_t node,
 const char ***out_names, uint32_t **indices);
 int clk_parse_ofw_clk_name(device_t dev, phandle_t node, const char **name);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302522 - head/sys/arm/allwinner

2016-07-10 Thread Jared McNeill
Author: jmcneill
Date: Sun Jul 10 10:38:28 2016
New Revision: 302522
URL: https://svnweb.freebsd.org/changeset/base/302522

Log:
  Align descriptors and data buffers to 32 bits. This restriction is
  described in the A20 (and later) user manuals.

Modified:
  head/sys/arm/allwinner/a10_mmc.c
  head/sys/arm/allwinner/a10_mmc.h

Modified: head/sys/arm/allwinner/a10_mmc.c
==
--- head/sys/arm/allwinner/a10_mmc.cSun Jul 10 10:21:22 2016
(r302521)
+++ head/sys/arm/allwinner/a10_mmc.cSun Jul 10 10:38:28 2016
(r302522)
@@ -316,7 +316,8 @@ a10_mmc_setup_dma(struct a10_mmc_softc *
 
/* Allocate the DMA descriptor memory. */
dma_desc_size = sizeof(struct a10_mmc_dma_desc) * A10_MMC_DMA_SEGS;
-   error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), 1, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev),
+   A10_MMC_DMA_ALIGN, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
dma_desc_size, 1, dma_desc_size, 0, NULL, NULL, >a10_dma_tag);
if (error)
@@ -334,7 +335,8 @@ a10_mmc_setup_dma(struct a10_mmc_softc *
return (sc->a10_dma_map_err);
 
/* Create the DMA map for data transfers. */
-   error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), 1, 0,
+   error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev),
+   A10_MMC_DMA_ALIGN, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
A10_MMC_DMA_MAX_SIZE * A10_MMC_DMA_SEGS, A10_MMC_DMA_SEGS,
A10_MMC_DMA_MAX_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL,

Modified: head/sys/arm/allwinner/a10_mmc.h
==
--- head/sys/arm/allwinner/a10_mmc.hSun Jul 10 10:21:22 2016
(r302521)
+++ head/sys/arm/allwinner/a10_mmc.hSun Jul 10 10:38:28 2016
(r302522)
@@ -196,4 +196,7 @@ struct a10_mmc_dma_desc {
uint32_t next;
 };
 
+/* DMA descriptors and data buffers must be aligned to 32-bits */
+#defineA10_MMC_DMA_ALIGN   4
+
 #endif /* _A10_MMC_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302521 - head/sys/arm/allwinner

2016-07-10 Thread Jared McNeill
Author: jmcneill
Date: Sun Jul 10 10:21:22 2016
New Revision: 302521
URL: https://svnweb.freebsd.org/changeset/base/302521

Log:
  In the absence of a bus-width property, default to 4-bit bus width instead
  of 1-bit.

Modified:
  head/sys/arm/allwinner/a10_mmc.c

Modified: head/sys/arm/allwinner/a10_mmc.c
==
--- head/sys/arm/allwinner/a10_mmc.cSun Jul 10 10:17:38 2016
(r302520)
+++ head/sys/arm/allwinner/a10_mmc.cSun Jul 10 10:21:22 2016
(r302521)
@@ -255,7 +255,7 @@ a10_mmc_attach(device_t dev)
a10_mmc_pio_mode ? "disabled" : "enabled");
 
if (OF_getencprop(node, "bus-width", _width, sizeof(uint32_t)) <= 0)
-   bus_width = 1;
+   bus_width = 4;
 
sc->a10_host.f_min = 40;
sc->a10_host.f_max = 5000;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302520 - head/share/man/man4

2016-07-10 Thread Alexander Motin
Author: mav
Date: Sun Jul 10 10:17:38 2016
New Revision: 302520
URL: https://svnweb.freebsd.org/changeset/base/302520

Log:
  Replace NTB man page with more detailed and up to date.
  
  Sponsored by: iXsystems, Inc.

Added:
  head/share/man/man4/if_ntb.4   (contents, props changed)
  head/share/man/man4/ntb_hw.4   (contents, props changed)
  head/share/man/man4/ntb_transport.4   (contents, props changed)
Deleted:
  head/share/man/man4/ntb.4
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSun Jul 10 09:50:21 2016
(r302519)
+++ head/share/man/man4/MakefileSun Jul 10 10:17:38 2016
(r302520)
@@ -374,7 +374,9 @@ MAN=aac.4 \
ng_vlan.4 \
nmdm.4 \
nsp.4 \
-   ${_ntb.4} \
+   ${_ntb_hw.4} \
+   ${_ntb_transport.4} \
+   ${_if_ntb.4} \
null.4 \
numa.4 \
${_nvd.4} \
@@ -678,8 +680,7 @@ MLINKS+=netintro.4 net.4 \
netintro.4 networking.4
 MLINKS+=${_nfe.4} ${_if_nfe.4}
 MLINKS+=nge.4 if_nge.4
-MLINKS+=${_ntb.4} ${_if_ntb.4} \
-   ${_ntb.4} ${_ntb_hw.4}
+MLINKS+=${_ntb_hw.4} ${_ntb.4}
 MLINKS+=${_nxge.4} ${_if_nxge.4}
 MLINKS+=ow.4 onewire.4
 MLINKS+=patm.4 if_patm.4
@@ -820,6 +821,7 @@ _if_ntb.4=  if_ntb.4
 _ioat.4=   ioat.4
 _ntb.4=ntb.4
 _ntb_hw.4= ntb_hw.4
+_ntb_transport.4=ntb_transport.4
 _qlxge.4=  qlxge.4
 _qlxgb.4=  qlxgb.4
 _qlxgbe.4= qlxgbe.4

Added: head/share/man/man4/if_ntb.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/if_ntb.4Sun Jul 10 10:17:38 2016
(r302520)
@@ -0,0 +1,86 @@
+.\"
+.\" Copyright (c) 2016 Alexander Motin 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd July 10, 2016
+.Dt IF_NTB 4
+.Os
+.Sh NAME
+.Nm if_ntb
+.Nd Virtual Ethernet interface for Non-Transparent Bridges
+.Sh SYNOPSIS
+To compile this driver into your kernel,
+place the following lines in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device if_ntb"
+.Ed
+.Pp
+Or, to load the driver as a module at boot, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_ntb_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hw.if_ntb.num_queues
+Number of transport queues to use per interface.
+Default is 1.
+.El
+.Sh DESCRIPTION
+The
+.Nm
+driver attaches on top of the
+.Xr ntb_transport 4
+driver to utilize its resources to create virtual Ethernet interface between
+the systems.
+Interface capabilities depend on the underlying transport.
+Typical MTU is about 64KB to reduce overhead.
+By default one queue is used, but more may be configured.
+The MAC address for interface is randomly generated.
+.Pp
+The
+.Nm
+driver does not implement any real hardware offload, but since PCIe link is
+protected by CRC32, in some situations it may be possible to save some CPU
+cycles by enabling fake checksum offload on both link sides via setting
+.Cm rxcsum
+and
+.Cm txcsum
+interface options.
+.Sh SEE ALSO
+.Xr ntb_transport 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was developed by Intel and originally written by
+.An Carl Delsey Aq Mt c...@freebsd.org .
+Later improvements were done by
+.An Conrad E. Meyer Aq Mt c...@freebsd.org
+and
+.An Alexander Motin Aq Mt m...@freebsd.org .

Added: head/share/man/man4/ntb_hw.4

svn commit: r302519 - head/sys/kern

2016-07-10 Thread Robert Watson
Author: rwatson
Date: Sun Jul 10 09:50:21 2016
New Revision: 302519
URL: https://svnweb.freebsd.org/changeset/base/302519

Log:
  Audit the file-descriptor number argument for openat(2).  Remove a comment
  about the desirability of auditing the number, as it was in fact in the
  wrong place (in the common path for open(2) and openat(2), and only the
  latter accepts a file-descriptor argument).  Where other ABIs support
  openat(2), it may be necessary to do additional argument auditing as it is
  not performed in kern_openat(9).
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cSun Jul 10 08:38:10 2016
(r302518)
+++ head/sys/kern/vfs_syscalls.cSun Jul 10 09:50:21 2016
(r302519)
@@ -942,6 +942,7 @@ int
 sys_openat(struct thread *td, struct openat_args *uap)
 {
 
+   AUDIT_ARG_FD(uap->fd);
return (kern_openat(td, uap->fd, uap->path, UIO_USERSPACE, uap->flag,
uap->mode));
 }
@@ -962,7 +963,6 @@ kern_openat(struct thread *td, int fd, c
 
AUDIT_ARG_FFLAGS(flags);
AUDIT_ARG_MODE(mode);
-   /* XXX: audit dirfd */
cap_rights_init(, CAP_LOOKUP);
flags_to_rights(flags, );
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298627 - in head/sys: arm/allwinner arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/arm arm/at91 arm/broadcom/bcm2835 arm/cavium/cns11xx arm/freescale arm/freescale/im

2016-07-10 Thread Herbert J. Skuhra
Hei,

Ruslan Bukin skrev:
> 
> Author: br
> Date: Tue Apr 26 11:53:37 2016
> New Revision: 298627
> URL: https://svnweb.freebsd.org/changeset/base/298627
> 
> Log:
>   Move arm's devmap to some generic place, so it can be used
>   by other architectures.
>   
>   Reviewed by:imp
>   Differential Revision:  https://reviews.freebsd.org/D6091
>   Sponsored by:   DARPA, AFRL
>   Sponsored by:   HEIF5

Should we have

# 20160426: arm's devmap moved
OLD_FILES+=usr/include/machine/devmap.h

in ObsoleteFiles.inc ?

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


Re: svn commit: r302517 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux modules/linux modules/linux_common

2016-07-10 Thread Chagin Dmitry
On Sun, Jul 10, 2016 at 11:30:17AM +0300, Konstantin Belousov wrote:
> On Sun, Jul 10, 2016 at 08:22:04AM +, Dmitry Chagin wrote:
> > Author: dchagin
> > Date: Sun Jul 10 08:22:04 2016
> > New Revision: 302517
> > URL: https://svnweb.freebsd.org/changeset/base/302517
> > 
> > Log:
> >   Fix a copy/paste bug introduced during X86_64 Linuxulator work.
> >   FreeBSD support NX bit on X86_64 processors out of the box, for i386 
> > emulation
> >   use READ_IMPLIES_EXEC flag, introduced in r302515.
> >   
> >   While here move common part of mmap() and mprotect() code to the files in 
> > compat/linux
> >   to reduce code dupcliation between Linuxulator's.
> >   
> >   Reported by:Johannes Jost Meixner, Shawn Webb
> >   
> >   MFC after:1 week
> >   XMFC with:r302515, r302516
> > 
> > Added:
> >   head/sys/compat/linux/linux_mmap.c   (contents, props changed)
> >   head/sys/compat/linux/linux_mmap.h   (contents, props changed)
> > Modified:
> >   head/sys/amd64/linux/linux.h
> >   head/sys/amd64/linux/linux_machdep.c
> >   head/sys/amd64/linux32/linux.h
> >   head/sys/amd64/linux32/linux32_machdep.c
> >   head/sys/i386/linux/linux.h
> >   head/sys/i386/linux/linux_machdep.c
> >   head/sys/modules/linux/Makefile
> >   head/sys/modules/linux_common/Makefile
> 
> Do conf/files.{i386,amd64} need update as well ?

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


svn commit: r302518 - head/sys/conf

2016-07-10 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 10 08:38:10 2016
New Revision: 302518
URL: https://svnweb.freebsd.org/changeset/base/302518

Log:
  Add linux_mmap.c to the appropriate conf/files.
  
  Reported by:  kib@
  MFC after:1 week

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Sun Jul 10 08:22:04 2016(r302517)
+++ head/sys/conf/files.amd64   Sun Jul 10 08:38:10 2016(r302518)
@@ -533,6 +533,7 @@ compat/linux/linux_ioctl.c  optionalcomp
 compat/linux/linux_ipc.c   optionalcompat_linux32
 compat/linux/linux_mib.c   optionalcompat_linux32
 compat/linux/linux_misc.c  optionalcompat_linux32
+compat/linux/linux_mmap.c  optionalcompat_linux32
 compat/linux/linux_signal.coptionalcompat_linux32
 compat/linux/linux_socket.coptionalcompat_linux32
 compat/linux/linux_stats.c optionalcompat_linux32

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Sun Jul 10 08:22:04 2016(r302517)
+++ head/sys/conf/files.i386Sun Jul 10 08:38:10 2016(r302518)
@@ -96,6 +96,7 @@ compat/linux/linux_ioctl.coptional comp
 compat/linux/linux_ipc.c   optional compat_linux
 compat/linux/linux_mib.c   optional compat_linux
 compat/linux/linux_misc.c  optional compat_linux
+compat/linux/linux_mmap.c  optional compat_linux
 compat/linux/linux_signal.coptional compat_linux
 compat/linux/linux_socket.coptional compat_linux
 compat/linux/linux_stats.c optional compat_linux
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298840 - in head: . lib/libkvm

2016-07-10 Thread Herbert J. Skuhra
Garrett Cooper skrev:
> 
> Author: ngie
> Date: Sat Apr 30 09:21:13 2016
> New Revision: 298840
> URL: https://svnweb.freebsd.org/changeset/base/298840
> 
> Log:
>   Remove kvm_getfiles(3)
>   
>   This libcall has been broken since (at least) r174989/8.0-RELEASE.
>   
>   Bump SHLIB_MAJOR for the change
>   
>   Differential Revision: https://reviews.freebsd.org/D6052
>   Relnotes: yes
>   Reviewed by: jhb, markj
>   Sponsored by: EMC / Isilon Storage Division
> 
> Deleted:
>   head/lib/libkvm/kvm_file.c
>   head/lib/libkvm/kvm_getfiles.3
> Modified:
>   head/ObsoleteFiles.inc
>   head/lib/libkvm/Makefile
>   head/lib/libkvm/kvm.3
>   head/lib/libkvm/kvm.h
> 
> Modified: head/ObsoleteFiles.inc
> ==
> --- head/ObsoleteFiles.incSat Apr 30 09:13:26 2016(r298839)
> +++ head/ObsoleteFiles.incSat Apr 30 09:21:13 2016(r298840)
> @@ -38,6 +38,9 @@
>  #   xargs -n1 | sort | uniq -d;
>  # done
>  
> +# 20160430: kvm_getfiles(3) removed from kvm(3)
> +OLD_LIBS+=usr/lib/libkvm.so.6
 ^^^ 
I guess this should be

+OLD_LIBS+=lib/libkvm.so.6

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


Re: svn commit: r302517 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux modules/linux modules/linux_common

2016-07-10 Thread Konstantin Belousov
On Sun, Jul 10, 2016 at 08:22:04AM +, Dmitry Chagin wrote:
> Author: dchagin
> Date: Sun Jul 10 08:22:04 2016
> New Revision: 302517
> URL: https://svnweb.freebsd.org/changeset/base/302517
> 
> Log:
>   Fix a copy/paste bug introduced during X86_64 Linuxulator work.
>   FreeBSD support NX bit on X86_64 processors out of the box, for i386 
> emulation
>   use READ_IMPLIES_EXEC flag, introduced in r302515.
>   
>   While here move common part of mmap() and mprotect() code to the files in 
> compat/linux
>   to reduce code dupcliation between Linuxulator's.
>   
>   Reported by:Johannes Jost Meixner, Shawn Webb
>   
>   MFC after:  1 week
>   XMFC with:  r302515, r302516
> 
> Added:
>   head/sys/compat/linux/linux_mmap.c   (contents, props changed)
>   head/sys/compat/linux/linux_mmap.h   (contents, props changed)
> Modified:
>   head/sys/amd64/linux/linux.h
>   head/sys/amd64/linux/linux_machdep.c
>   head/sys/amd64/linux32/linux.h
>   head/sys/amd64/linux32/linux32_machdep.c
>   head/sys/i386/linux/linux.h
>   head/sys/i386/linux/linux_machdep.c
>   head/sys/modules/linux/Makefile
>   head/sys/modules/linux_common/Makefile

Do conf/files.{i386,amd64} need update as well ?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302517 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux modules/linux modules/linux_common

2016-07-10 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 10 08:22:04 2016
New Revision: 302517
URL: https://svnweb.freebsd.org/changeset/base/302517

Log:
  Fix a copy/paste bug introduced during X86_64 Linuxulator work.
  FreeBSD support NX bit on X86_64 processors out of the box, for i386 emulation
  use READ_IMPLIES_EXEC flag, introduced in r302515.
  
  While here move common part of mmap() and mprotect() code to the files in 
compat/linux
  to reduce code dupcliation between Linuxulator's.
  
  Reported by:Johannes Jost Meixner, Shawn Webb
  
  MFC after:1 week
  XMFC with:r302515, r302516

Added:
  head/sys/compat/linux/linux_mmap.c   (contents, props changed)
  head/sys/compat/linux/linux_mmap.h   (contents, props changed)
Modified:
  head/sys/amd64/linux/linux.h
  head/sys/amd64/linux/linux_machdep.c
  head/sys/amd64/linux32/linux.h
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/i386/linux/linux.h
  head/sys/i386/linux/linux_machdep.c
  head/sys/modules/linux/Makefile
  head/sys/modules/linux_common/Makefile

Modified: head/sys/amd64/linux/linux.h
==
--- head/sys/amd64/linux/linux.hSun Jul 10 08:17:16 2016
(r302516)
+++ head/sys/amd64/linux/linux.hSun Jul 10 08:22:04 2016
(r302517)
@@ -139,13 +139,6 @@ struct l_rlimit {
l_ulong rlim_max;
 };
 
-/* mmap options */
-#defineLINUX_MAP_SHARED0x0001
-#defineLINUX_MAP_PRIVATE   0x0002
-#defineLINUX_MAP_FIXED 0x0010
-#defineLINUX_MAP_ANON  0x0020
-#defineLINUX_MAP_GROWSDOWN 0x0100
-
 /*
  * stat family of syscalls
  */

Modified: head/sys/amd64/linux/linux_machdep.c
==
--- head/sys/amd64/linux/linux_machdep.cSun Jul 10 08:17:16 2016
(r302516)
+++ head/sys/amd64/linux/linux_machdep.cSun Jul 10 08:22:04 2016
(r302517)
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -122,181 +123,19 @@ linux_set_upcall_kse(struct thread *td, 
return (0);
 }
 
-#define STACK_SIZE  (2 * 1024 * 1024)
-#define GUARD_SIZE  (4 * PAGE_SIZE)
-
 int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
-   struct proc *p = td->td_proc;
-   struct mmap_args /* {
-   caddr_t addr;
-   size_t len;
-   int prot;
-   int flags;
-   int fd;
-   long pad;
-   off_t pos;
-   } */ bsd_args;
-   int error;
-   struct file *fp;
-   cap_rights_t rights;
-
-   LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx",
-   args->addr, args->len, args->prot,
-   args->flags, args->fd, args->pgoff);
-
-   error = 0;
-   bsd_args.flags = 0;
-   fp = NULL;
-
-   /*
-* Linux mmap(2):
-* You must specify exactly one of MAP_SHARED and MAP_PRIVATE
-*/
-   if (! ((args->flags & LINUX_MAP_SHARED) ^
-   (args->flags & LINUX_MAP_PRIVATE)))
-   return (EINVAL);
-
-   if (args->flags & LINUX_MAP_SHARED)
-   bsd_args.flags |= MAP_SHARED;
-   if (args->flags & LINUX_MAP_PRIVATE)
-   bsd_args.flags |= MAP_PRIVATE;
-   if (args->flags & LINUX_MAP_FIXED)
-   bsd_args.flags |= MAP_FIXED;
-   if (args->flags & LINUX_MAP_ANON)
-   bsd_args.flags |= MAP_ANON;
-   else
-   bsd_args.flags |= MAP_NOSYNC;
-   if (args->flags & LINUX_MAP_GROWSDOWN)
-   bsd_args.flags |= MAP_STACK;
-
-   /*
-* PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC
-* on Linux/i386. We do this to ensure maximum compatibility.
-* Linux/ia64 does the same in i386 emulation mode.
-*/
-   bsd_args.prot = args->prot;
-   if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
-   bsd_args.prot |= PROT_READ | PROT_EXEC;
-
-   /* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
-   bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : args->fd;
-   if (bsd_args.fd != -1) {
-   /*
-* Linux follows Solaris mmap(2) description:
-* The file descriptor fildes is opened with
-* read permission, regardless of the
-* protection options specified.
-*/
-
-   error = fget(td, bsd_args.fd,
-   cap_rights_init(, CAP_MMAP), );
-   if (error != 0 )
-   return (error);
-   if (fp->f_type != DTYPE_VNODE) {
-   fdrop(fp, td);
-   return (EINVAL);
-   }
-
-   /* Linux mmap() just fails for O_WRONLY files */
-   if (!(fp->f_flag & FREAD)) {
-   fdrop(fp, 

svn commit: r302516 - in head/sys: amd64/linux amd64/linux32 i386/linux

2016-07-10 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 10 08:17:16 2016
New Revision: 302516
URL: https://svnweb.freebsd.org/changeset/base/302516

Log:
  Regen for r302215 (Linux personality).

Modified:
  head/sys/amd64/linux/linux_proto.h
  head/sys/amd64/linux/linux_syscall.h
  head/sys/amd64/linux/linux_syscalls.c
  head/sys/amd64/linux/linux_sysent.c
  head/sys/amd64/linux/linux_systrace_args.c
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux/linux_proto.h
==
--- head/sys/amd64/linux/linux_proto.h  Sun Jul 10 08:15:50 2016
(r302515)
+++ head/sys/amd64/linux/linux_proto.h  Sun Jul 10 08:17:16 2016
(r302516)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 
2016-05-21 08:01:14Z dchagin 
+ * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 
2016-07-10 08:15:50Z dchagin 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -499,7 +499,7 @@ struct linux_mknod_args {
char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
 };
 struct linux_personality_args {
-   char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)];
+   char per_l_[PADL_(l_uint)]; l_uint per; char per_r_[PADR_(l_uint)];
 };
 struct linux_ustat_args {
char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
@@ -1397,6 +1397,13 @@ int  linux_finit_module(struct thread *, 
 
 #endif /* COMPAT_FREEBSD7 */
 
+
+#ifdef COMPAT_FREEBSD10
+
+#definenosys   linux_nosys
+
+#endif /* COMPAT_FREEBSD10 */
+
 #defineLINUX_SYS_AUE_linux_openAUE_OPEN_RWTC
 #defineLINUX_SYS_AUE_linux_newstat AUE_STAT
 #defineLINUX_SYS_AUE_linux_newfstatAUE_FSTAT

Modified: head/sys/amd64/linux/linux_syscall.h
==
--- head/sys/amd64/linux/linux_syscall.hSun Jul 10 08:15:50 2016
(r302515)
+++ head/sys/amd64/linux/linux_syscall.hSun Jul 10 08:17:16 2016
(r302516)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 
2016-05-21 08:01:14Z dchagin 
+ * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 
2016-07-10 08:15:50Z dchagin 
  */
 
 #defineLINUX_SYS_read  0

Modified: head/sys/amd64/linux/linux_syscalls.c
==
--- head/sys/amd64/linux/linux_syscalls.c   Sun Jul 10 08:15:50 2016
(r302515)
+++ head/sys/amd64/linux/linux_syscalls.c   Sun Jul 10 08:17:16 2016
(r302516)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 
2016-05-21 08:01:14Z dchagin 
+ * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 
2016-07-10 08:15:50Z dchagin 
  */
 
 const char *linux_syscallnames[] = {

Modified: head/sys/amd64/linux/linux_sysent.c
==
--- head/sys/amd64/linux/linux_sysent.c Sun Jul 10 08:15:50 2016
(r302515)
+++ head/sys/amd64/linux/linux_sysent.c Sun Jul 10 08:17:16 2016
(r302516)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux/syscalls.master 300359 
2016-05-21 08:01:14Z dchagin 
+ * created from FreeBSD: head/sys/amd64/linux/syscalls.master 302515 
2016-07-10 08:15:50Z dchagin 
  */
 
 #include 

Modified: head/sys/amd64/linux/linux_systrace_args.c
==
--- head/sys/amd64/linux/linux_systrace_args.c  Sun Jul 10 08:15:50 2016
(r302515)
+++ head/sys/amd64/linux/linux_systrace_args.c  Sun Jul 10 08:17:16 2016
(r302516)
@@ -1120,7 +1120,7 @@ systrace_args(int sysnum, void *params, 
/* linux_personality */
case 135: {
struct linux_personality_args *p = params;
-   iarg[0] = p->per; /* l_ulong */
+   iarg[0] = p->per; /* l_uint */
*n_args = 1;
break;
}
@@ -4112,7 +4112,7 @@ systrace_entry_setargdesc(int sysnum, in
case 135:
switch(ndx) {
case 0:
-   p = "l_ulong";
+   p = "l_uint";
break;
  

svn commit: r302515 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux

2016-07-10 Thread Dmitry Chagin
Author: dchagin
Date: Sun Jul 10 08:15:50 2016
New Revision: 302515
URL: https://svnweb.freebsd.org/changeset/base/302515

Log:
  Implement Linux personality() system call mainly due to READ_IMPLIES_EXEC 
flag.
  In Linux if this flag is set, PROT_READ implies PROT_EXEC for mmap().
  Linux/i386 set this flag automatically if the binary requires executable 
stack.
  
  READ_IMPLIES_EXEC flag will be used in the next Linux mmap() commit.

Added:
  head/sys/compat/linux/linux_persona.h   (contents, props changed)
Modified:
  head/sys/amd64/linux/syscalls.master
  head/sys/amd64/linux32/syscalls.master
  head/sys/compat/linux/linux_emul.c
  head/sys/compat/linux/linux_emul.h
  head/sys/compat/linux/linux_misc.c
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/syscalls.master
==
--- head/sys/amd64/linux/syscalls.masterSun Jul 10 08:04:02 2016
(r302514)
+++ head/sys/amd64/linux/syscalls.masterSun Jul 10 08:15:50 2016
(r302515)
@@ -270,7 +270,7 @@
 133AUE_MKNOD   STD { int linux_mknod(char *path, l_int mode, \
l_dev_t dev); }
 134AUE_USELIB  UNIMPL  uselib
-135AUE_PERSONALITY STD { int linux_personality(l_ulong per); }
+135AUE_PERSONALITY STD { int linux_personality(l_uint per); }
 136AUE_NULLSTD { int linux_ustat(l_dev_t dev, \
struct l_ustat *ubuf); }
 137AUE_STATFS  STD { int linux_statfs(char *path, \

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Sun Jul 10 08:04:02 2016
(r302514)
+++ head/sys/amd64/linux32/syscalls.master  Sun Jul 10 08:15:50 2016
(r302515)
@@ -238,7 +238,7 @@
 134AUE_BDFLUSH STD { int linux_bdflush(void); }
 135AUE_NULLSTD { int linux_sysfs(l_int option, \
l_ulong arg1, l_ulong arg2); }
-136AUE_PERSONALITY STD { int linux_personality(l_ulong per); }
+136AUE_PERSONALITY STD { int linux_personality(l_uint per); }
 137AUE_NULLUNIMPL  afs_syscall
 138AUE_SETFSUIDSTD { int linux_setfsuid16(l_uid16_t uid); }
 139AUE_SETFSGIDSTD { int linux_setfsgid16(l_gid16_t gid); }

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Sun Jul 10 08:04:02 2016
(r302514)
+++ head/sys/compat/linux/linux_emul.c  Sun Jul 10 08:15:50 2016
(r302515)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
 
@@ -127,7 +128,7 @@ linux_proc_init(struct thread *td, struc
 /* epoll should be destroyed in a case of exec. */
pem = pem_find(p);
KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n"));
-
+   pem->persona = 0;
if (pem->epoll != NULL) {
emd = pem->epoll;
pem->epoll = NULL;
@@ -220,6 +221,9 @@ linux_proc_exec(void *arg __unused, stru
 {
struct thread *td = curthread;
struct thread *othertd;
+#if defined(__amd64__)
+   struct linux_pemuldata *pem;
+#endif
 
/*
 * In a case of execing from linux binary properly detach
@@ -243,6 +247,17 @@ linux_proc_exec(void *arg __unused, stru
linux_proc_init(td, NULL, 0);
else
linux_proc_init(td, td, 0);
+#if defined(__amd64__)
+   /*
+* An IA32 executable which has executable stack will have the
+* READ_IMPLIES_EXEC personality flag set automatically.
+*/
+   if (SV_PROC_FLAG(td->td_proc, SV_ILP32) &&
+   imgp->stack_prot & VM_PROT_EXECUTE) {
+   pem = pem_find(p);
+   pem->persona |= LINUX_READ_IMPLIES_EXEC;
+   }
+#endif
}
 }
 

Modified: head/sys/compat/linux/linux_emul.h
==
--- head/sys/compat/linux/linux_emul.h  Sun Jul 10 08:04:02 2016
(r302514)
+++ head/sys/compat/linux/linux_emul.h  Sun Jul 10 08:15:50 2016
(r302515)
@@ -67,6 +67,7 @@ struct linux_pemuldata {
uint32_tflags;  /* process emuldata flags */
struct sx   pem_sx; /* lock for this struct */
void*epoll; /* epoll data */
+   uint32_tpersona;/* process execution domain */
 };
 
 #defineLINUX_PEM_XLOCK(p)  sx_xlock(&(p)->pem_sx)

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

svn commit: r302514 - in head/sys: kern vm

2016-07-10 Thread Robert Watson
Author: rwatson
Date: Sun Jul 10 08:04:02 2016
New Revision: 302514
URL: https://svnweb.freebsd.org/changeset/base/302514

Log:
  Audit file-descriptor arguments to I/O system calls such as
  read(2), write(2), dup(2), and mmap(2).  This auditing is not
  required by the Common Criteria (and hence was not being
  performed), but is valuable in both contemporary live analysis
  and forensic use cases.
  
  MFC after:3 days
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/kern/sys_generic.c
  head/sys/vm/vm_mmap.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cSun Jul 10 04:33:16 2016
(r302513)
+++ head/sys/kern/kern_descrip.cSun Jul 10 08:04:02 2016
(r302514)
@@ -820,6 +820,9 @@ kern_dup(struct thread *td, u_int mode, 
MPASS((flags & ~(FDDUP_FLAG_CLOEXEC)) == 0);
MPASS(mode < FDDUP_LASTMODE);
 
+   AUDIT_ARG_FD(old);
+   /* XXXRW: if (flags & FDDUP_FIXED) AUDIT_ARG_FD2(new); */
+
/*
 * Verify we have a valid descriptor to dup from and possibly to
 * dup to. Unlike dup() and dup2(), fcntl()'s F_DUPFD should

Modified: head/sys/kern/sys_generic.c
==
--- head/sys/kern/sys_generic.c Sun Jul 10 04:33:16 2016(r302513)
+++ head/sys/kern/sys_generic.c Sun Jul 10 08:04:02 2016(r302514)
@@ -363,6 +363,8 @@ dofileread(td, fd, fp, auio, offset, fla
struct uio *ktruio = NULL;
 #endif
 
+   AUDIT_ARG_FD(fd);
+
/* Finish zero length reads right here */
if (auio->uio_resid == 0) {
td->td_retval[0] = 0;
@@ -576,6 +578,7 @@ dofilewrite(td, fd, fp, auio, offset, fl
struct uio *ktruio = NULL;
 #endif
 
+   AUDIT_ARG_FD(fd);
auio->uio_rw = UIO_WRITE;
auio->uio_td = td;
auio->uio_offset = offset;

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Sun Jul 10 04:33:16 2016(r302513)
+++ head/sys/vm/vm_mmap.c   Sun Jul 10 08:04:02 2016(r302514)
@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -206,6 +207,7 @@ sys_mmap(td, uap)
pos = uap->pos;
 
fp = NULL;
+   AUDIT_ARG_FD(uap->fd);
 
/*
 * Ignore old flags that used to be defined but did not do anything.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"