Re: svn commit: r255426 - in head: lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/drm2/i915 sys/i386/ibcs2 sys/i386/linux sys/ia64/ia32 sys/kern sys/sparc64/sparc64 sys/sys

2013-09-10 Thread Alexey Dokuchaev
On Mon, Sep 09, 2013 at 06:12:00PM +, John Baldwin wrote:
> New Revision: 255426
> URL: http://svnweb.freebsd.org/changeset/base/255426
> 
> Log:
> [...]
>   To facilitate this, add a new parameter to vm_map_find() that specifies an
>   optional maximum virtual address.  While here, fix several callers of
>   vm_map_find() to use a VMFS_* constant for the findspace argument instead
>   of TRUE and FALSE.

This commit breaks NVidia driver port, and (again) there was no corresponding
__FreeBSD_version bump.

This is another recent incident with -CURRENT silently changing KPIs that are
publicly used.

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


Re: svn commit: r255426 - in head: lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/drm2/i915 sys/i386/ibcs2 sys/i386/linux sys/ia64/ia32 sys/kern sys/sparc64/sparc64 sys/sys

2013-09-10 Thread Ivan Klymenko
В Tue, 10 Sep 2013 09:23:23 +
Alexey Dokuchaev  пишет:

> This commit breaks NVidia driver port
and emulators/virtualbox-ose-kmod* too
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r255442 - in head/sys: fs/nullfs kern net netinet6 netnatm

2013-09-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Sep 10 10:05:59 2013
New Revision: 255442
URL: http://svnweb.freebsd.org/changeset/base/255442

Log:
  Fix the length calculation for the final block of a sendfile(2)
  transmission which could be tricked into rounding up to the nearest
  page size, leaking up to a page of kernel memory.  [13:11]
  
  In IPv6 and NetATM, stop SIOCSIFADDR, SIOCSIFBRDADDR, SIOCSIFDSTADDR
  and SIOCSIFNETMASK at the socket layer rather than pass them on to the
  link layer without validation or credential checks.  [SA-13:12]
  
  Prevent cross-mount hardlinks between different nullfs mounts of the
  same underlying filesystem.  [SA-13:13]
  
  Security: CVE-2013-5666
  Security: FreeBSD-SA-13:11.sendfile
  Security: CVE-2013-5691
  Security: FreeBSD-SA-13:12.ifioctl
  Security: CVE-2013-5710
  Security: FreeBSD-SA-13:13.nullfs
  Approved by:  re

Modified:
  head/sys/fs/nullfs/null_vnops.c
  head/sys/kern/uipc_syscalls.c
  head/sys/net/if.c
  head/sys/netinet6/in6.c
  head/sys/netnatm/natm.c

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Tue Sep 10 05:59:09 2013
(r255441)
+++ head/sys/fs/nullfs/null_vnops.c Tue Sep 10 10:05:59 2013
(r255442)
@@ -858,6 +858,15 @@ null_vptocnp(struct vop_vptocnp_args *ap
return (error);
 }
 
+static int
+null_link(struct vop_link_args *ap)
+{
+
+   if (ap->a_tdvp->v_mount != ap->a_vp->v_mount)
+   return (EXDEV);
+   return (null_bypass((struct vop_generic_args *)ap));
+}
+
 /*
  * Global vfs data structures
  */
@@ -871,6 +880,7 @@ struct vop_vector null_vnodeops = {
.vop_getwritemount =null_getwritemount,
.vop_inactive = null_inactive,
.vop_islocked = vop_stdislocked,
+   .vop_link = null_link,
.vop_lock1 =null_lock,
.vop_lookup =   null_lookup,
.vop_open = null_open,

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Tue Sep 10 05:59:09 2013
(r255441)
+++ head/sys/kern/uipc_syscalls.c   Tue Sep 10 10:05:59 2013
(r255442)
@@ -2221,11 +2221,10 @@ retry_space:
 * or the passed in nbytes.
 */
pgoff = (vm_offset_t)(off & PAGE_MASK);
-   if (nbytes)
-   rem = (nbytes - fsbytes - loopbytes);
-   else
-   rem = va.va_size -
-   offset - fsbytes - loopbytes;
+   rem = va.va_size - offset;
+   if (nbytes != 0)
+   rem = omin(rem, nbytes);
+   rem -= fsbytes + loopbytes;
xfsize = omin(PAGE_SIZE - pgoff, rem);
xfsize = omin(space - loopbytes, xfsize);
if (xfsize <= 0) {

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue Sep 10 05:59:09 2013(r255441)
+++ head/sys/net/if.c   Tue Sep 10 10:05:59 2013(r255442)
@@ -2553,11 +2553,23 @@ ifioctl(struct socket *so, u_long cmd, c
CURVNET_RESTORE();
return (EOPNOTSUPP);
}
+
+   /*
+* Pass the request on to the socket control method, and if the
+* latter returns EOPNOTSUPP, directly to the interface.
+*
+* Make an exception for the legacy SIOCSIF* requests.  Drivers
+* trust SIOCSIFADDR et al to come from an already privileged
+* layer, and do not perform any credentials checks or input
+* validation.
+*/
 #ifndef COMPAT_43
error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd,
 data,
 ifp, td));
-   if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL)
+   if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL &&
+   cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR &&
+   cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
error = (*ifp->if_ioctl)(ifp, cmd, data);
 #else
{
@@ -2601,7 +2613,9 @@ ifioctl(struct socket *so, u_long cmd, c
   data,
   ifp, td));
if (error == EOPNOTSUPP && ifp != NULL &&
-   ifp->if_ioctl != NULL)
+   ifp->if_ioctl != NULL &&
+   cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR &&
+   cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK)
   

svn commit: r255449 - head/sys/sys

2013-09-10 Thread Gleb Smirnoff
Author: glebius
Date: Tue Sep 10 10:38:15 2013
New Revision: 255449
URL: http://svnweb.freebsd.org/changeset/base/255449

Log:
  Make a bump for r255426.
  
  Approved by:  re (gjb)

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hTue Sep 10 10:15:33 2013(r255448)
+++ head/sys/sys/param.hTue Sep 10 10:38:15 2013(r255449)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 154  /* Master, propagated to newvers */
+#define __FreeBSD_version 155  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255426 - in head: lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/drm2/i915 sys/i386/ibcs2 sys/i386/linux sys/ia64/ia32 sys/kern sys/sparc64/sparc64 sys/sys

2013-09-10 Thread Gleb Smirnoff
On Tue, Sep 10, 2013 at 12:33:44PM +0300, Ivan Klymenko wrote:
I> В Tue, 10 Sep 2013 09:23:23 +
I> Alexey Dokuchaev  пишет:
I> 
I> > This commit breaks NVidia driver port
I> and emulators/virtualbox-ose-kmod* too

I've bumped to 155 in r255449.

Please fix the precious ports :)

-- 
Totus tuus, Glebius.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r255187 - in head/sys: conf crypto/aesni modules/aesni

2013-09-10 Thread Konstantin Belousov
On Mon, Sep 09, 2013 at 11:41:49PM -0700, John-Mark Gurney wrote:
> David O'Brien wrote this message on Mon, Sep 09, 2013 at 23:01 -0700:
> > On Tue, Sep 03, 2013 at 06:31:23PM +, John-Mark Gurney wrote:
> > > Log:
> > >   Use the fact that the AES-NI instructions can be pipelined to improve
> > >   performance... Use SSE2 instructions for calculating the XTS tweek
> > >   factor...  Let the compiler do more work and handle register allocation
> > >   by using intrinsics, now only the key schedule is in assembly...
> > 
> > Hi John-Mark,
> > Unfortunately this does not work with /usr/bin/gcc (which I still use as
> > /usr/bin/cc on this old IBM T60 laptop due to clang's enormous pestimation
> > on 'make world' and build times.
> > 
> > Please fix this ASAP or back it out out of 10-CURRENT as it does not work
> > with /usr/bin/gcc:
> > 
> > 1. /usr/bin/gcc cannot handle the "-maes" option.
> > I committed r255440 to address this.
> 
> Please back that out until you have an understand of what the real
> problem is...  I'm sad that the commit was approved w/o bothering to
> attempt to figure out the problem...
> 
> > 2. /usr/src/sys/modules/aesni/../../crypto/aesni/aesencdec.h:30:23: error: 
> > wmmintrin.h: No such file or directory
> > and then a cascade of errors follow.
> 
> Sounds like you don't have the latest in-tree gcc... I've been
> compiling the AES module w/ the in tree gcc for a while..  This is
> w/ the changes in r255185...
> 
> > For now, I've sent a patch to re@ for approval to remove the 'aesni'
> > module from the build if not using clang.  But the LINT build is
> > still broken with /usr/bin/gcc.
> 
> I'll strongly object to this change...
Sorry for my mistake, I agree with you.

IMO this change should be reverted.
> 
> > >   Replace .byte hard coded instructions w/ the proper instructions now
> > >   that both clang and gcc support them...
> > 
> > Is this out-of-tree latest GCC that supports this?
> 
> Nope, in-tree...  Sounds like you haven't installed the latest version
> of gcc in tree...
> 
> It could be a problem with a bad interaction w/ delete-old as glebius
> added the wmmintrin.h header to the delete-old target in r255354...
> 
> I'll take a closer look at this in the morning, but next time please
> attempt to contact the author before taking such actions...
> 
> -- 
>   John-Mark GurneyVoice: +1 415 225 5579
> 
>  "All that I will do, has been done, All that I have, has not."


pgprtzuzRPDHh.pgp
Description: PGP signature


Re: svn commit: r255437 - in head: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common

2013-09-10 Thread Davide Italiano
On Tue, Sep 10, 2013 at 3:46 AM, Xin LI  wrote:

[snip]

> +static clock_t
> +cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
> +int flag)
> +{
> +   sbintime_t sbt;
> +   sbintime_t pr;
> +
> +   sbt = tim * SBT_1NS;
> +   pr = res * SBT_1NS;
> +
> +   return (cv_timedwait_sbt(cvp, mp, sbt, pr, 0));
> +}
> +
>  #endif /* _KERNEL */
>

The Illumos cv_timedwait_hires() doesn't use 'res' argument so if you
want to be consistent with their behaviour you should pass '0' as
precision argument to cv_timedwait_sbt(). Also, I'm not sure there's
an 1:1 mapping between ours 'pr' and their 'res'. Even if there is,
considering you're dealing with nanoseconds I don't think you will see
great advantage from specifying precision argument in most of the
cases (hardware clock resolution is in the common case 10^-6).


> @@ -1473,7 +1473,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *
> "free_bpobj/bptree txg %llu",
> (longlong_t)scn->scn_visited_this_txg,
> (longlong_t)
> -   (gethrtime() - scn->scn_sync_start_time) / 
> MICROSEC,
> +   NSEC2MSEC(gethrtime() - scn->scn_sync_start_time),
> (longlong_t)tx->tx_txg);
> scn->scn_visited_this_txg = 0;
> /*

The usage of gethrtime() as-it-is in FreeBSD goes against your
precision requirements. In fact, it's implemented as a wrapper to
getnanouptime(), which could be defined as "fast but not precise" as
it read a cached value which is upadted from time to time rather than
going into the underlying hardware to get the information required.
More precisely speaking, in case hz=1000, you might be 1 millisecond
away from the value you're looking for.

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255450 - head/etc/rc.d

2013-09-10 Thread Cy Schubert
Author: cy
Date: Tue Sep 10 13:48:33 2013
New Revision: 255450
URL: http://svnweb.freebsd.org/changeset/base/255450

Log:
  ipfilter 5.1.2 no longer supports sysctl. Use ipf -V to determine if
  available (the kernel module is loaded or compiled into the kernel).
  
  Approved by:  glebius (mentor)
  Approved by:  re (blanket)

Modified:
  head/etc/rc.d/ipfilter
  head/etc/rc.d/ipfs
  head/etc/rc.d/ipmon

Modified: head/etc/rc.d/ipfilter
==
--- head/etc/rc.d/ipfilter  Tue Sep 10 10:38:15 2013(r255449)
+++ head/etc/rc.d/ipfilter  Tue Sep 10 13:48:33 2013(r255450)
@@ -29,7 +29,7 @@ required_modules="ipl:ipfilter"
 ipfilter_start()
 {
echo "Enabling ipfilter."
-   if [ `sysctl -n net.inet.ipf.fr_running` -le 0 ]; then
+   if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes'; then
${ipfilter_program:-/sbin/ipf} -E
fi
${ipfilter_program:-/sbin/ipf} -Fa
@@ -37,7 +37,6 @@ ipfilter_start()
${ipfilter_program:-/sbin/ipf} \
-f "${ipfilter_rules}" ${ipfilter_flags}
fi
-   ${ipfilter_program:-/sbin/ipf} -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -6 \
-f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
@@ -46,8 +45,7 @@ ipfilter_start()
 
 ipfilter_stop()
 {
-   # XXX - The ipf -D command is not effective for 'lkm's
-   if [ `sysctl -n net.inet.ipf.fr_running` -eq 1 ]; then
+   if ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes'; then
echo "Saving firewall state tables"
${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
echo "Disabling ipfilter."

Modified: head/etc/rc.d/ipfs
==
--- head/etc/rc.d/ipfs  Tue Sep 10 10:38:15 2013(r255449)
+++ head/etc/rc.d/ipfs  Tue Sep 10 13:48:33 2013(r255450)
@@ -23,7 +23,7 @@ ipfs_prestart()
if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
err 1  "${name} requires either ipfilter or ipnat enabled"
fi
-   if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
+   if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes' 
>/dev/null 2>&1; then
err 1 "ipfilter module is not loaded"
fi
return 0

Modified: head/etc/rc.d/ipmon
==
--- head/etc/rc.d/ipmon Tue Sep 10 10:38:15 2013(r255449)
+++ head/etc/rc.d/ipmon Tue Sep 10 13:48:33 2013(r255450)
@@ -23,7 +23,7 @@ ipmon_precmd()
if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then
err 1  "${name} requires either ipfilter or ipnat enabled"
fi
-   if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
+   if ! ${ipfilter_program:-/sbin/ipf} -V | grep -q 'Running: yes' 
>/dev/null 2>&1; then
err 1 "ipfilter module is not loaded"
fi
return 0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255451 - head/tools/regression/sockets/sendfile

2013-09-10 Thread Ed Maste
Author: emaste
Date: Tue Sep 10 13:51:19 2013
New Revision: 255451
URL: http://svnweb.freebsd.org/changeset/base/255451

Log:
  Add a sendfile regression test for transmit length > file size.
  
  This test identified the issue fixed in FreeBSD-SA-13:11.sendfile.
  
  Sponsored by: The FreeBSD Foundation
  Approved by:  re (glebius)

Modified:
  head/tools/regression/sockets/sendfile/sendfile.c

Modified: head/tools/regression/sockets/sendfile/sendfile.c
==
--- head/tools/regression/sockets/sendfile/sendfile.c   Tue Sep 10 13:48:33 
2013(r255450)
+++ head/tools/regression/sockets/sendfile/sendfile.c   Tue Sep 10 13:51:19 
2013(r255451)
@@ -74,12 +74,13 @@ struct sendfile_test {
uint32_thdr_length;
uint32_toffset;
uint32_tlength;
+   uint32_tfile_size;
 };
 
-intfile_fd;
-char   path[PATH_MAX];
-intlisten_socket;
-intaccept_socket;
+static int file_fd;
+static charpath[PATH_MAX];
+static int listen_socket;
+static int accept_socket;
 
 static int test_th(struct test_header *th, uint32_t *header_length,
uint32_t *offset, uint32_t *length);
@@ -92,6 +93,7 @@ static int new_test_socket(int *connect_
 static void init_th(struct test_header *th, uint32_t header_length, 
uint32_t offset, uint32_t length);
 static int send_test(int connect_socket, struct sendfile_test);
+static int write_test_file(size_t file_size);
 static void run_parent(void);
 static void cleanup(void);
 
@@ -278,15 +280,12 @@ send_test(int connect_socket, struct sen
if (len != 0)
FAIL_ERR("lseek")
 
-   if (test.length == 0) {
-   struct stat st;
-   if (fstat(file_fd, &st) < 0)
-   FAIL_ERR("fstat")
-   length = st.st_size - test.offset;
-   }
-   else {
+   struct stat st;
+   if (fstat(file_fd, &st) < 0)
+   FAIL_ERR("fstat")
+   length = st.st_size - test.offset;
+   if (test.length > 0 && test.length < (uint32_t)length)
length = test.length;
-   }
 
init_th(&th, test.hdr_length, test.offset, length);
 
@@ -336,17 +335,55 @@ send_test(int connect_socket, struct sen
return (0);
 }
 
+static int
+write_test_file(size_t file_size)
+{
+   char *page_buffer;
+   ssize_t len;
+   static size_t current_file_size = 0;
+
+   if (file_size == current_file_size)
+   return (0);
+   else if (file_size < current_file_size) {
+   if (ftruncate(file_fd, file_size) != 0)
+   FAIL_ERR("ftruncate");
+   current_file_size = file_size;
+   return (0);
+   }
+
+   page_buffer = malloc(file_size);
+   if (page_buffer == NULL)
+   FAIL_ERR("malloc")
+   bzero(page_buffer, file_size);
+
+   len = write(file_fd, page_buffer, file_size);
+   if (len < 0)
+   FAIL_ERR("write")
+
+   len = lseek(file_fd, 0, SEEK_SET);
+   if (len < 0)
+   FAIL_ERR("lseek")
+   if (len != 0)
+   FAIL("len != 0")
+
+   free(page_buffer);
+   current_file_size = file_size;
+   return (0);
+}
+
 static void
 run_parent(void)
 {
int connect_socket;
int status;
int test_num;
+   int test_count;
int pid;
+   size_t desired_file_size = 0;
 
const int pagesize = getpagesize();
 
-   struct sendfile_test tests[10] = {
+   struct sendfile_test tests[] = {
{ .hdr_length = 0, .offset = 0, .length = 1 },
{ .hdr_length = 0, .offset = 0, .length = pagesize },
{ .hdr_length = 0, .offset = 1, .length = 1 },
@@ -356,12 +393,23 @@ run_parent(void)
{ .hdr_length = 0, .offset = 0, .length = 0 },
{ .hdr_length = 0, .offset = pagesize, .length = 0 },
{ .hdr_length = 0, .offset = 2*pagesize, .length = 0 },
-   { .hdr_length = 0, .offset = TEST_PAGES*pagesize, .length = 0 }
+   { .hdr_length = 0, .offset = TEST_PAGES*pagesize, .length = 0 },
+   { .hdr_length = 0, .offset = 0, .length = pagesize,
+   .file_size = 1 }
};
 
-   printf("1..10\n");
+   test_count = sizeof(tests) / sizeof(tests[0]);
+   printf("1..%d\n", test_count);
 
-   for (test_num = 1; test_num <= 10; test_num++) {
+   for (test_num = 1; test_num <= test_count; test_num++) {
+
+   desired_file_size = tests[test_num - 1].file_size;
+   if (desired_file_size == 0)
+   desired_file_size = TEST_PAGES * pagesize;
+   if (write_test_file(desired_file_size) != 0) {
+   printf("not ok %d\n", test_num);
+   continue;
+   }
 
pid = fork();
if (

Re: svn commit: r255439 - head/sys/dev/cpuctl

2013-09-10 Thread Matthew Fleming
On Mon, Sep 9, 2013 at 10:17 PM, Konstantin Belousov wrote:

> Author: kib
> Date: Tue Sep 10 05:17:53 2013
> New Revision: 255439
> URL: http://svnweb.freebsd.org/changeset/base/255439
>
> Log:
>   Call free() on the pointer returned from malloc().
>
>   Reported and tested by:   Oliver Pinter 
>   Sponsored by: The FreeBSD Foundation
>   MFC after:3 days
>   Approved by:  re (delphij)
>
> Modified:
>   head/sys/dev/cpuctl/cpuctl.c
>
> Modified: head/sys/dev/cpuctl/cpuctl.c
>
> ==
> --- head/sys/dev/cpuctl/cpuctl.cTue Sep 10 03:48:18 2013
>  (r255438)
> +++ head/sys/dev/cpuctl/cpuctl.cTue Sep 10 05:17:53 2013
>  (r255439)
> @@ -295,10 +295,10 @@ cpuctl_do_update(int cpu, cpuctl_update_
>  static int
>  update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td)
>  {
> -   void *ptr = NULL;
> +   void *ptr;
> uint64_t rev0, rev1;
> uint32_t tmp[4];
> -   int is_bound = 0;
> +   int is_bound;
> int oldcpu;
> int ret;
>
> @@ -312,10 +312,11 @@ update_intel(int cpu, cpuctl_update_args
> }
>
> /*
> -* 16 byte alignment required.
> +* 16 byte alignment required.  Rely on the fact that
> +* malloc(9) always returns the pointer aligned at least on
> +* the size of the allocation.
>  */
> ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK);
> -   ptr = (void *)(16 + ((intptr_t)ptr & ~0xf));
> if (copyin(args->data, ptr, args->size) != 0) {
> DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed",
> __LINE__, args->data, ptr, args->size);
> @@ -408,10 +409,10 @@ fail:
>  static int
>  update_via(int cpu, cpuctl_update_args_t *args, struct thread *td)
>  {
> -   void *ptr = NULL;
> +   void *ptr;
> uint64_t rev0, rev1, res;
> uint32_t tmp[4];
> -   int is_bound = 0;
> +   int is_bound;
> int oldcpu;
> int ret;
>
> @@ -427,8 +428,7 @@ update_via(int cpu, cpuctl_update_args_t
> /*
>  * 4 byte alignment required.
>  */
> -   ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK);
> -   ptr = (void *)(16 + ((intptr_t)ptr & ~0xf));
> +   ptr = malloc(args->size, M_CPUCTL, M_WAITOK);
> if (copyin(args->data, ptr, args->size) != 0) {
> DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed",
> __LINE__, args->data, ptr, args->size);
>

I don't know exactly what the stock malloc(9) will return, but memguard(9),
under its default mode with vm.memguard.options having MG_GUARD_AROUND set
will align the returned pointer to only 16 bytes.  When I added that
feature I almost made it 8 bytes, but I think I saw that uma(9) had a
16-byte alignment so I preserved that.  I.e., this code does still work
with malloc(9) and memguard(9).

But why does this need 16 byte alignment?  Especially when one of the
comments says 4-byte alignment?

Thanks,
matthew
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255439 - head/sys/dev/cpuctl

2013-09-10 Thread Konstantin Belousov
On Tue, Sep 10, 2013 at 06:09:54PM +0300, Konstantin Belousov wrote:
> On Tue, Sep 10, 2013 at 07:29:51AM -0700, Matthew Fleming wrote:
> > I don't know exactly what the stock malloc(9) will return, but memguard(9),
> > under its default mode with vm.memguard.options having MG_GUARD_AROUND set
> > will align the returned pointer to only 16 bytes.  When I added that
> > feature I almost made it 8 bytes, but I think I saw that uma(9) had a
> > 16-byte alignment so I preserved that.  I.e., this code does still work
> > with malloc(9) and memguard(9).
> > 
> > But why does this need 16 byte alignment?  Especially when one of the
> > comments says 4-byte alignment?
> 
> The comment about 4-byte alignment is for VIA.
> 
> For Intel, citing the IA-32 SDM rev. 47, Vol.3, 9.11.6 Microcode Update 
> Loader:
> "The microcode update data requires a 16-byte boundary alignment".
> I.e. CPU takes the linear address of the buffer, which must be aligned
> on 16 bytes.

Sent too fast.  There is at least one more instance of the same use,
see bus_dmamem_alloc() in sys/x86/x86/busdma_machdep.c.


pgp_xbvmMXtdw.pgp
Description: PGP signature


Re: svn commit: r255439 - head/sys/dev/cpuctl

2013-09-10 Thread Konstantin Belousov
On Tue, Sep 10, 2013 at 07:29:51AM -0700, Matthew Fleming wrote:
> I don't know exactly what the stock malloc(9) will return, but memguard(9),
> under its default mode with vm.memguard.options having MG_GUARD_AROUND set
> will align the returned pointer to only 16 bytes.  When I added that
> feature I almost made it 8 bytes, but I think I saw that uma(9) had a
> 16-byte alignment so I preserved that.  I.e., this code does still work
> with malloc(9) and memguard(9).
> 
> But why does this need 16 byte alignment?  Especially when one of the
> comments says 4-byte alignment?

The comment about 4-byte alignment is for VIA.

For Intel, citing the IA-32 SDM rev. 47, Vol.3, 9.11.6 Microcode Update Loader:
"The microcode update data requires a 16-byte boundary alignment".
I.e. CPU takes the linear address of the buffer, which must be aligned
on 16 bytes.


pgp6xDL9EBt4r.pgp
Description: PGP signature


Re: svn commit: r255439 - head/sys/dev/cpuctl

2013-09-10 Thread John-Mark Gurney
Konstantin Belousov wrote this message on Tue, Sep 10, 2013 at 05:17 +:
> Author: kib
> Date: Tue Sep 10 05:17:53 2013
> New Revision: 255439
> URL: http://svnweb.freebsd.org/changeset/base/255439
> 
> Log:
>   Call free() on the pointer returned from malloc().

We really should add a KASSERT for these cases, incase this breaks in
the future..

> - ptr = (void *)(16 + ((intptr_t)ptr & ~0xf));

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255453 - head

2013-09-10 Thread John-Mark Gurney
Author: jmg
Date: Tue Sep 10 17:26:09 2013
New Revision: 255453
URL: http://svnweb.freebsd.org/changeset/base/255453

Log:
  add note about gcc and aesni...
  
  Approved by:  re (gjb, kib)

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Tue Sep 10 16:50:13 2013(r255452)
+++ head/UPDATING   Tue Sep 10 17:26:09 2013(r255453)
@@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
advised: libc, libprocstat, dhclient, tcpdump, hastd, hastctl,
kdump, procstat, rwho, rwhod, uniq.
 
+20130903:
+   AES-NI intrinsic support has been added to gcc.  The AES-NI module
+   has been updated to use this support.  A new gcc is required to build
+   the aesni module on both i386 and amd64.
+
 20130827:
 Thomas Dickey (vendor author thereof) reports that dialog(1) since
 2011/10/18 has a bug in handling --hline. Testers and I noticed the
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255452 - in head/sys: conf modules/aesni

2013-09-10 Thread David E. O'Brien
Author: obrien
Date: Tue Sep 10 16:50:13 2013
New Revision: 255452
URL: http://svnweb.freebsd.org/changeset/base/255452

Log:
  Back out r255440.  /usr/bin/gcc @r255185 (2013-09-03) can build this.
  
  Approved by:  re (kib)

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/aesni/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Sep 10 13:51:19 2013(r255451)
+++ head/sys/conf/files.amd64   Tue Sep 10 16:50:13 2013(r255452)
@@ -142,7 +142,7 @@ crypto/aesni/aeskeys_amd64.Soptional ae
 crypto/aesni/aesni.c   optional aesni
 aesni_wrap.o   optional aesni  \
dependency  "$S/crypto/aesni/aesni_wrap.c"  \
-   compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${PROF} -mmmx -msse ${COMPILER_TYPE:Mclang:S/clang/-maes} ${.IMPSRC}" \
+   compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${PROF} -mmmx -msse -maes ${.IMPSRC}" \
no-implicit-rule\
clean   "aesni_wrap.o"
 crypto/blowfish/bf_enc.c   optionalcrypto | ipsec

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Sep 10 13:51:19 2013(r255451)
+++ head/sys/conf/files.i386Tue Sep 10 16:50:13 2013(r255452)
@@ -128,7 +128,7 @@ crypto/aesni/aeskeys_i386.S optional aes
 crypto/aesni/aesni.c   optional aesni
 aesni_wrap.o   optional aesni  \
dependency  "$S/crypto/aesni/aesni_wrap.c"  \
-   compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${PROF} -mmmx -msse ${COMPILER_TYPE} ${COMPILER_TYPE:Mclang:S/clang/-maes} 
${.IMPSRC}" \
+   compile-with"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${PROF} -mmmx -msse -maes ${.IMPSRC}" \
no-implicit-rule\
clean   "aesni_wrap.o"
 crypto/des/arch/i386/des_enc.S optional crypto | ipsec | netsmb

Modified: head/sys/modules/aesni/Makefile
==
--- head/sys/modules/aesni/Makefile Tue Sep 10 13:51:19 2013
(r255451)
+++ head/sys/modules/aesni/Makefile Tue Sep 10 16:50:13 2013
(r255452)
@@ -12,7 +12,7 @@ OBJS+=aesni_wrap.o
 # Remove -nostdinc so we can get the intrinsics.
 aesni_wrap.o: aesni_wrap.c
${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} \
--mmmx -msse ${COMPILER_TYPE:Mclang:S/clang/-maes/} ${.IMPSRC}
+-mmmx -msse -maes ${.IMPSRC}
${CTFCONVERT_CMD}
 
 .include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255187 - in head/sys: conf crypto/aesni modules/aesni

2013-09-10 Thread David O'Brien
On Mon, Sep 09, 2013 at 11:41:49PM -0700, John-Mark Gurney wrote:
> David O'Brien wrote this message on Mon, Sep 09, 2013 at 23:01 -0700:
> Please back that out until you have an understand of what the real
> problem is...

Folks use FreeBSD for real work -- I have a window of opportunity to
install a new world + kernel.  When I tried updating this laptop in
early August the kernel build was broken.  It appeared broken again
this time.

The issue is you added a new feature to the GCC compiler
(r255185 2013-09-03), and then immediately consumed it in the kernel
build (r255187 2013-09-03 11:31:23).  You did not put anything in
UPDATING warning folks of this.


Robert Watson used to often remind folks that when we add features to
the toolchain we give a reasonable amount of time for them to work
their way into folks userland before using them in the kernel build.


My userland sources are from Sunday September 1st when I started my
'make buildworld' + 'mergemaster -p' + 'make installworld' +
'mergemaster -i' sequence.  Sorry it takes so long to build world with
clang on a T60.  I updated my kernel sources and tried to build a new
kernel before rebooting.  I had no reason to not expect a 2 day old
compiler could not build a kernel during a code freeze.

I've backed out r255440 as r255452.

Please add a note to UPDATING.

-- 
-- David  (obr...@freebsd.org)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r254882 - head/sys/dev/pci

2013-09-10 Thread Jean-Sébastien Pédron

Le 09/09/2013 17:51, John Baldwin a écrit :

Ok, let's punt on changing the API perhaps, but use the vgapci softc to find
the resource:


This patch builds for me, but I can't tell if it works, as my computer 
only uses the pmap_mapbios() case. That's also why I never noticed the 
bogus behavior earlier.


--
Jean-Sébastien Pédron
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255187 - in head/sys: conf crypto/aesni modules/aesni

2013-09-10 Thread John Baldwin
On Tuesday, September 10, 2013 12:51:27 pm David O'Brien wrote:
> On Mon, Sep 09, 2013 at 11:41:49PM -0700, John-Mark Gurney wrote:
> > David O'Brien wrote this message on Mon, Sep 09, 2013 at 23:01 -0700:
> > Please back that out until you have an understand of what the real
> > problem is...
> 
> Folks use FreeBSD for real work -- I have a window of opportunity to
> install a new world + kernel.  When I tried updating this laptop in
> early August the kernel build was broken.  It appeared broken again
> this time.
> 
> The issue is you added a new feature to the GCC compiler
> (r255185 2013-09-03), and then immediately consumed it in the kernel
> build (r255187 2013-09-03 11:31:23).  You did not put anything in
> UPDATING warning folks of this.
> 
> 
> Robert Watson used to often remind folks that when we add features to
> the toolchain we give a reasonable amount of time for them to work
> their way into folks userland before using them in the kernel build.
> 
> 
> My userland sources are from Sunday September 1st when I started my
> 'make buildworld' + 'mergemaster -p' + 'make installworld' +
> 'mergemaster -i' sequence.  Sorry it takes so long to build world with
> clang on a T60.  I updated my kernel sources and tried to build a new
> kernel before rebooting.  I had no reason to not expect a 2 day old
> compiler could not build a kernel during a code freeze.

Err, you are running head.  If you get a compile failure when you have updated 
your kernel to newer than world, your first reponse should be to make your 
kernel sources match your world, not committing an untested change.

Also, the level of change in the tree is always the _worst_ right at code 
freeze.  You can debate whether or not it should be that way, but in practice 
it always is and you should know better.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r254882 - head/sys/dev/pci

2013-09-10 Thread John Baldwin
On Tuesday, September 10, 2013 1:45:40 pm Jean-Sébastien Pédron wrote:
> Le 09/09/2013 17:51, John Baldwin a écrit :
> > Ok, let's punt on changing the API perhaps, but use the vgapci softc to 
find
> > the resource:
> 
> This patch builds for me, but I can't tell if it works, as my computer 
> only uses the pmap_mapbios() case. That's also why I never noticed the 
> bogus behavior earlier.

What if you try to force it to always use the PCIR_BIOS case?

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255426 - in head: lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/dev/drm2/i915 sys/i386/ibcs2 sys/i386/linux sys/ia64/ia32 sys/kern sys/sparc64/sparc64 sys/sys

2013-09-10 Thread John Baldwin
On Tuesday, September 10, 2013 5:23:23 am Alexey Dokuchaev wrote:
> On Mon, Sep 09, 2013 at 06:12:00PM +, John Baldwin wrote:
> > New Revision: 255426
> > URL: http://svnweb.freebsd.org/changeset/base/255426
> > 
> > Log:
> > [...]
> >   To facilitate this, add a new parameter to vm_map_find() that specifies an
> >   optional maximum virtual address.  While here, fix several callers of
> >   vm_map_find() to use a VMFS_* constant for the findspace argument instead
> >   of TRUE and FALSE.
> 
> This commit breaks NVidia driver port, and (again) there was no corresponding
> __FreeBSD_version bump.

My bad, I completely missed the version bump.  Userland consumers can use
#ifdef MAP_32BIT which is why I didn't add one.

> This is another recent incident with -CURRENT silently changing KPIs that are
> publicly used.

To be fair, these are fairly internal KPIs unlike, say, the cdevsw interface 
that
is widely used in many drivers.  You can count all of the internal and external
users of this function on two hands.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255454 - head/tools

2013-09-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Sep 10 18:34:38 2013
New Revision: 255454
URL: http://svnweb.freebsd.org/changeset/base/255454

Log:
  Make this more deterministic by sorting the libraries before processing
  them and ensuring that we always use the samme collation rules.
  
  Approved by:  re (gjb)

Modified:
  head/tools/make_libdeps.sh

Modified: head/tools/make_libdeps.sh
==
--- head/tools/make_libdeps.sh  Tue Sep 10 17:26:09 2013(r255453)
+++ head/tools/make_libdeps.sh  Tue Sep 10 18:34:38 2013(r255454)
@@ -28,6 +28,7 @@
 
 export PATH=/bin:/usr/bin
 
+LC_ALL=C   # make sort deterministic
 FS=': '# internal field separator
 LIBDEPENDS=./_libdeps  # intermediate output file
 USRSRC=${1:-/usr/src}  # source root
@@ -64,7 +65,7 @@ genlibdepends()
 {
(
cd ${USRSRC}
-   find ${LIBS} -mindepth 1 -name Makefile |
+   find -s ${LIBS} -mindepth 1 -name Makefile |
xargs grep -l 'bsd\.lib\.mk' |
while read makefile; do
libdir=$(dirname ${makefile})
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255455 - in head: kerberos5 kerberos5/lib/libheimipcc kerberos5/lib/libheimipcs kerberos5/lib/libkrb5 kerberos5/libexec/digest-service kerberos5/libexec/kcm share/mk tools/build/mk

2013-09-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Sep 10 18:40:43 2013
New Revision: 255455
URL: http://svnweb.freebsd.org/changeset/base/255455

Log:
  Clean up the Kerberos build by turning libheimipcc and libheimipcs into
  private shared libraries, instead of hacked-together archives of PIC
  objects.  This makes it possible to build a static libkrb5 that works.
  
  Reviewed by:  stas
  Approved by:  re (gjb)

Modified:
  head/kerberos5/Makefile.inc
  head/kerberos5/lib/libheimipcc/Makefile
  head/kerberos5/lib/libheimipcs/Makefile
  head/kerberos5/lib/libkrb5/Makefile
  head/kerberos5/libexec/digest-service/Makefile
  head/kerberos5/libexec/kcm/Makefile
  head/share/mk/bsd.libnames.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/kerberos5/Makefile.inc
==
--- head/kerberos5/Makefile.inc Tue Sep 10 18:34:38 2013(r255454)
+++ head/kerberos5/Makefile.inc Tue Sep 10 18:40:43 2013(r255455)
@@ -14,8 +14,6 @@ LDAPCFLAGS=   -I${OPENLDAPBASE}/include -D
 LDAPLDFLAGS=   -L${OPENLDAPBASE}/lib -Wl,-rpath,${OPENLDAPBASE}/lib
 .endif
 
-LIBHEIMIPCC=   ${.OBJDIR}/../../lib/libheimipcc/libheimipcc.a
-LIBHEIMIPCS=   ${.OBJDIR}/../../lib/libheimipcs/libheimipcs.a
 LIBVERS=   ${.OBJDIR}/../../lib/libvers/libvers.a
 LIBSL= ${.OBJDIR}/../../lib/libsl/libsl.a
 

Modified: head/kerberos5/lib/libheimipcc/Makefile
==
--- head/kerberos5/lib/libheimipcc/Makefile Tue Sep 10 18:34:38 2013
(r255454)
+++ head/kerberos5/lib/libheimipcc/Makefile Tue Sep 10 18:40:43 2013
(r255455)
@@ -1,7 +1,7 @@
 #$FreeBSD$
 
 LIB=   heimipcc
-INTERNALLIB=
+PRIVATELIB=
 LDADD= -lheimbase -lroken -lpthread
 DPADD= ${LIBHEIMBASE} ${LIBROKEN} ${LIBPTHREAD}
 
@@ -9,7 +9,6 @@ SRCS=   \
client.c \
common.c
 
-CFLAGS+=   -DPIC ${PICFLAG}
 CFLAGS+=   -I${KRB5DIR}/lib/roken \
-I${KRB5DIR}/base \
-I${KRB5DIR}/lib/ipc

Modified: head/kerberos5/lib/libheimipcs/Makefile
==
--- head/kerberos5/lib/libheimipcs/Makefile Tue Sep 10 18:34:38 2013
(r255454)
+++ head/kerberos5/lib/libheimipcs/Makefile Tue Sep 10 18:40:43 2013
(r255455)
@@ -1,7 +1,7 @@
 #$FreeBSD$
 
 LIB=   heimipcs
-INTERNALLIB=
+PRIVATELIB=
 LDADD= -lheimbase -lroken
 LDFLAGS=   -pthread
 DPADD= ${LIBHEIMBASE} ${LIBROKEN}
@@ -10,7 +10,6 @@ SRCS= \
server.c \
common.c
 
-CFLAGS+=   -DPIC ${PICFLAG}
 CFLAGS+=   -I${KRB5DIR}/lib/roken \
-I${KRB5DIR}/base \
-I${KRB5DIR}/lib/ipc -I.

Modified: head/kerberos5/lib/libkrb5/Makefile
==
--- head/kerberos5/lib/libkrb5/Makefile Tue Sep 10 18:34:38 2013
(r255454)
+++ head/kerberos5/lib/libkrb5/Makefile Tue Sep 10 18:40:43 2013
(r255455)
@@ -3,8 +3,9 @@
 LIB=   krb5
 LDFLAGS=   -Wl,--no-undefined
 VERSION_MAP= ${KRB5DIR}/lib/krb5/version-script.map
-LDADD= -lasn1 -lcom_err -lcrypt -lcrypto -lhx509 -lroken -lwind -lheimbase 
${LIBHEIMIPCC}
+LDADD= -lasn1 -lcom_err -lcrypt -lcrypto -lhx509 -lroken -lwind -lheimbase 
-lheimipcc
 DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBCRYPT} ${LIBCRYPTO} ${LIBHX509} 
${LIBROKEN} ${LIBWIND} ${LIBHEIMBASE} ${LIBHEIMIPCC}
+USEPRIVATELIB= heimipcc
 
 INCS=  heim_err.h \
heim_threads.h \

Modified: head/kerberos5/libexec/digest-service/Makefile
==
--- head/kerberos5/libexec/digest-service/Makefile  Tue Sep 10 18:34:38 
2013(r255454)
+++ head/kerberos5/libexec/digest-service/Makefile  Tue Sep 10 18:40:43 
2013(r255455)
@@ -8,10 +8,11 @@ CFLAGS+=  -I${KRB5DIR}/kdc \
-I${KRB5DIR}/lib/ipc \
-I${KRB5DIR}/lib/wind \
-I${KRB5DIR}/lib/roken
-DPADD= ${LIBHDB} ${LIBKDC} ${LIBHEIMIPCS} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} 
${LIBCRYPTO} \
-   ${LIBCRYPT} ${LIBVERS}
-LDADD= -lhdb -lkdc ${LIBHEIMIPCS} -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \
+DPADD= ${LIBHDB} ${LIBKDC} ${LIBHEIMIPCS} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} \
+   ${LIBCRYPTO} ${LIBCRYPT} ${LIBVERS}
+LDADD= -lhdb -lkdc -lheimipcs -lkrb5 -lroken -lasn1 -lcrypto -lcrypt \
${LIBVERS} -lheimntlm
+USEPRIVATELIB= heimipcs
 
 .include 
 

Modified: head/kerberos5/libexec/kcm/Makefile
==
--- head/kerberos5/libexec/kcm/Makefile Tue Sep 10 18:34:38 2013
(r255454)
+++ head/kerberos5/libexec/kcm/Makefile Tue Sep 10 18:40:43 2013
(r255455)
@@ -21,8 +21,9 @@ CFLAGS+=-I${KRB5DIR}/lib/krb5 -I${KRB5DI
-I${KRB5DIR}/kcm -I${KRB5DIR}/lib/ipc ${LDAPCFLAGS}
 DPADD= ${LIBHDB} ${LIBKRB5} ${LIBROKEN} ${LIBASN1} ${LIBHEIMNTLM} \
${LIBHEIMIPCS} ${LIBCRY

svn commit: r255457 - head/usr.sbin/pkg

2013-09-10 Thread Baptiste Daroussin
Author: bapt
Date: Tue Sep 10 20:56:01 2013
New Revision: 255457
URL: http://svnweb.freebsd.org/changeset/base/255457

Log:
  Add support to detect arm vs armv6
  
  There are two different versions of the ARM ABI depending on the
  TARGET_ARCH. As these are sligntly different a package built for
  one may not work on another. We need to detect which one we are on
  by parsing the .ARM.attributes section.
  
  This will only work on the ARM EABI as this section is part of the
  ABI definition. As armv6 only supports the ARM EABI this is not a
  problem for the oabi.
  
  Older versions of libelf in FreeBSD fail to read the
  .ARM.attributes section needed. As armv6 is unsupported on these
  versions we can assume we are running on arm.
  
  Submitted by: andrew
  Approved by:  re (delphij)
  Obtained from:pkgng git

Modified:
  head/usr.sbin/pkg/config.c

Modified: head/usr.sbin/pkg/config.c
==
--- head/usr.sbin/pkg/config.c  Tue Sep 10 19:00:32 2013(r255456)
+++ head/usr.sbin/pkg/config.c  Tue Sep 10 20:56:01 2013(r255457)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -100,6 +101,138 @@ elf_corres_to_string(struct _elf_corres 
return ("unknown");
 }
 
+static const char *
+aeabi_parse_arm_attributes(void *data, size_t length) 
+{
+   uint32_t sect_len;
+   uint8_t *section = data;
+
+#defineMOVE(len) do {\
+   assert(length >= (len));  \
+   section += (len); \
+   length -= (len);  \
+} while (0)
+
+   if (length == 0 || *section != 'A')
+   return (NULL);
+
+   MOVE(1);
+
+   /* Read the section length */
+   if (length < sizeof(sect_len))
+   return (NULL);
+
+   memcpy(§_len, section, sizeof(sect_len));
+
+   /*
+* The section length should be no longer than the section it is within
+*/
+   if (sect_len > length)
+   return (NULL);
+
+   MOVE(sizeof(sect_len));
+
+   /* Skip the vendor name */
+   while (length != 0) {
+   if (*section == '\0')
+   break;
+   MOVE(1);
+   }
+   if (length == 0)
+   return (NULL);
+   MOVE(1);
+
+   while (length != 0) {
+   uint32_t tag_length;
+
+   switch(*section) {
+   case 1: /* Tag_File */
+   MOVE(1);
+   if (length < sizeof(tag_length))
+   return (NULL);
+   memcpy(&tag_length, section, sizeof(tag_length));
+   break;
+   case 2: /* Tag_Section */
+   case 3: /* Tag_Symbol */
+   default:
+   return (NULL);
+   }
+   /* At least space for the tag and size */
+   if (tag_length <= 5)
+   return (NULL);
+   tag_length--;
+   /* Check the tag fits */
+   if (tag_length > length)
+   return (NULL);
+
+#define  MOVE_TAG(len) do {   \
+   assert(tag_length >= (len));  \
+   MOVE(len);\
+   tag_length -= (len);  \
+} while(0)
+
+   MOVE(sizeof(tag_length));
+   tag_length -= sizeof(tag_length);
+
+   while (tag_length != 0) {
+   uint8_t tag;
+
+   assert(tag_length >= length);
+
+   tag = *section;
+   MOVE_TAG(1);
+
+   /*
+* These tag values come from:
+* 
+* Addenda to, and Errata in, the ABI for the
+* ARM Architecture. Release 2.08, section 2.3.
+*/
+   if (tag == 6) { /* == Tag_CPU_arch */
+   uint8_t val;
+
+   val = *section;
+   /*
+* We don't support values that require
+* more than one byte.
+*/
+   if (val & (1 << 7))
+   return (NULL);
+
+   /* We have an ARMv4 or ARMv5 */
+   if (val <= 5)
+   return ("arm");
+   else /* We have an ARMv6+ */
+   return ("armv6");
+   } else if (tag == 4 || tag == 5 || tag == 32 ||
+   tag == 65 || tag == 67) {
+   while (*section != '\0' && length != 0)
+   MOVE_TAG(1);
+   if (tag_length == 0)
+   return (NULL);
+   /* Skip the last byte */
+  

Re: svn commit: r255067 - head/sys/kern

2013-09-10 Thread Davide Italiano
> ==
> --- head/sys/kern/kern_synch.c  Fri Aug 30 10:10:22 2013(r255066)
> +++ head/sys/kern/kern_synch.c  Fri Aug 30 10:39:56 2013(r255067)
> @@ -356,10 +356,7 @@ msleep_spin_sbt(void *ident, struct mtx
>  int
>  pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
>  {
> -   int sbt_sec;
> -
> -   sbt_sec = sbintime_getsec(sbt);
> -   KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0"));
> +   KASSERT(sbt >= 0, ("pause: timeout must be >= 0"));
>

Hi Hans,
sorry for the late answer/review but I completely missed this patch
when you posted on mailing lists.
That said, I think this commit is correct and also makes the code more
readable. As an added bonus, this fixes a "bug" introduced while
hacking on callout rejuvenation. The original assertion was actually
checking for timo  >= 0 but when we switched to 'struct bintime' for
callout that assertion was changed to check for bt.sec >=0. After
that, when we introduced sbintime_t that assertion was never changed
back to his original form, which is more correct. Also, the assertion
message is more explicative, at least IMHO.

Thanks,

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2013-09-10 Thread Colin Percival
Author: cperciva
Date: Tue Sep 10 21:16:18 2013
New Revision: 255459
URL: http://svnweb.freebsd.org/changeset/base/255459

Log:
  Remove documentation describing functionality which geom(4) does not,
  in fact, provide.
  
  Reviewed by:  phk
  MFC after:3 days
  Approved by:  re (gjb)

Modified:
  head/share/man/man4/geom.4

Modified: head/share/man/man4/geom.4
==
--- head/share/man/man4/geom.4  Tue Sep 10 21:09:20 2013(r255458)
+++ head/share/man/man4/geom.4  Tue Sep 10 21:16:18 2013(r255459)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 14, 2013
+.Dd September 10, 2013
 .Dt GEOM 4
 .Os
 .Sh NAME
@@ -354,24 +354,6 @@ only be done with their cooperation.
 Finally: the spoiling only happens when the write count goes from
 zero to non-zero and the retasting happens only when the write count goes
 from non-zero to zero.
-.It Em INSERT/DELETE
-are very special operations which allow a new geom
-to be instantiated between a consumer and a provider attached to
-each other and to remove it again.
-.Pp
-To understand the utility of this, imagine a provider
-being mounted as a file system.
-Between the DEVFS geom's consumer and its provider we insert
-a mirror module which configures itself with one mirror
-copy and consequently is transparent to the I/O requests
-on the path.
-We can now configure yet a mirror copy on the mirror geom,
-request a synchronization, and finally drop the first mirror
-copy.
-We have now, in essence, moved a mounted file system from one
-disk to another while it was being used.
-At this point the mirror geom can be deleted from the path
-again; it has served its purpose.
 .It Em CONFIGURE
 is the process where the administrator issues instructions
 for a particular class to instantiate itself.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255067 - head/sys/kern

2013-09-10 Thread Davide Italiano
On Tue, Sep 10, 2013 at 11:16 PM, Davide Italiano  wrote:
>> ==
>> --- head/sys/kern/kern_synch.c  Fri Aug 30 10:10:22 2013(r255066)
>> +++ head/sys/kern/kern_synch.c  Fri Aug 30 10:39:56 2013(r255067)
>> @@ -356,10 +356,7 @@ msleep_spin_sbt(void *ident, struct mtx
>>  int
>>  pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
>>  {
>> -   int sbt_sec;
>> -
>> -   sbt_sec = sbintime_getsec(sbt);
>> -   KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0"));
>> +   KASSERT(sbt >= 0, ("pause: timeout must be >= 0"));
>>
>
> Hi Hans,
> sorry for the late answer/review but I completely missed this patch
> when you posted on mailing lists.
> That said, I think this commit is correct and also makes the code more
> readable. As an added bonus, this fixes a "bug" introduced while
> hacking on callout rejuvenation. The original assertion was actually
> checking for timo  >= 0 but when we switched to 'struct bintime' for
> callout that assertion was changed to check for bt.sec >=0. After
> that, when we introduced sbintime_t that assertion was never changed
> back to his original form, which is more correct. Also, the assertion
> message is more explicative, at least IMHO.
>
> Thanks,
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare

I've just noticed the comment just before pause_sbt() still refers to
pause() function and should be rephrased to reflect the new world
order, if you're interested in seeing this fixed.

Thanks,

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255460 - in head: . secure/lib/libssh secure/libexec/sftp-server secure/libexec/ssh-keysign secure/libexec/ssh-pkcs11-helper secure/usr.bin/scp secure/usr.bin/sftp secure/usr.bin/ssh s...

2013-09-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Sep 10 22:26:11 2013
New Revision: 255460
URL: http://svnweb.freebsd.org/changeset/base/255460

Log:
  Clean up the OpenSSH build.  It is now possible to build most components
  as static binaries, if desired.  The one exception is sshd, which runs
  into trouble due to libpam.a's includion of pam_ssh.
  
  Make OpenSSH use LDNS if available.  This allows it to verify signed
  SSHFP records.
  
  Approved by:  re (blanket)

Modified:
  head/Makefile.inc1
  head/secure/lib/libssh/Makefile
  head/secure/libexec/sftp-server/Makefile
  head/secure/libexec/ssh-keysign/Makefile
  head/secure/libexec/ssh-pkcs11-helper/Makefile
  head/secure/usr.bin/scp/Makefile
  head/secure/usr.bin/sftp/Makefile
  head/secure/usr.bin/ssh-add/Makefile
  head/secure/usr.bin/ssh-agent/Makefile
  head/secure/usr.bin/ssh-keygen/Makefile
  head/secure/usr.bin/ssh-keyscan/Makefile
  head/secure/usr.bin/ssh/Makefile
  head/secure/usr.sbin/sshd/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Sep 10 21:16:18 2013(r255459)
+++ head/Makefile.inc1  Tue Sep 10 22:26:11 2013(r255460)
@@ -1470,8 +1470,8 @@ _prebuild_libs=   ${_kerberos5_lib_libasn1
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libzfs_core} \
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
-   ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
-   ${_secure_lib_libssl}
+   ${_secure_lib_libcrypto} ${_lib_libldns} \
+   ${_secure_lib_libssh} ${_secure_lib_libssl}
 
 .if ${MK_ATF} != "no"
 _lib_atf_libatf_c= lib/atf/libatf-c
@@ -1507,9 +1507,16 @@ cddl/lib/libzfs_core__L: cddl/lib/libnvp
 _secure_lib_libcrypto= secure/lib/libcrypto
 _secure_lib_libssl= secure/lib/libssl
 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
+.if ${MK_LDNS} != "no"
+_lib_libldns= lib/libldns
+lib/libldns__L: secure/lib/libcrypto__L
+.endif
 .if ${MK_OPENSSH} != "no"
 _secure_lib_libssh= secure/lib/libssh
 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
+.if ${MK_LDNS} != "no"
+secure/lib/libssh__L: lib/libldns__L
+.endif
 .if ${MK_KERBEROS_SUPPORT} != "no"
 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \

Modified: head/secure/lib/libssh/Makefile
==
--- head/secure/lib/libssh/Makefile Tue Sep 10 21:16:18 2013
(r255459)
+++ head/secure/lib/libssh/Makefile Tue Sep 10 22:26:11 2013
(r255460)
@@ -21,17 +21,22 @@ SRCS=   authfd.c authfile.c bufaux.c bufbn
 # compiled directly into sshd instead.
 
 # Portability layer
-SRCS+= bsd-misc.c fmt_scaled.c getrrsetbyname.c glob.c \
+SRCS+= bsd-misc.c fmt_scaled.c glob.c \
openssl-compat.c port-tun.c strtonum.c timingsafe_bcmp.c \
vis.c xcrypt.c xmmap.c
 
-.if defined(COMPAT_GETADDRINFO)
-SRCS+= getaddrinfo.c getnameinfo.c name6.c rcmd.c bindresvport.c
+.if ${MK_LDNS} == "no"
+SRCS+= getrrsetbyname.c
+.else
+LDNSDIR=   ${.CURDIR}/../../../contrib/ldns
+CFLAGS+=   -DHAVE_LDNS=1 -I${LDNSDIR}
+SRCS+= getrrsetbyname-ldns.c
+DPADD+=${LIBLDNS}
+LDADD+=-lldns
+USEPRIVATELIB+= ldns
 .endif
 
 CFLAGS+= -I${SSHDIR} -include ssh_namespace.h
-DPADD= ${LIBZ}
-LDADD= -lz
 
 .if ${MK_KERBEROS_SUPPORT} != "no"
 CFLAGS+= -DGSSAPI -DHAVE_GSSAPI_GSSAPI_H=1 -DKRB5 -DHEIMDAL
@@ -45,8 +50,8 @@ CFLAGS+= -DNONE_CIPHER_ENABLED
 
 NO_LINT=
 
-DPADD+=${LIBCRYPTO} ${LIBCRYPT}
-LDADD+=-lcrypto -lcrypt
+DPADD+=${LIBCRYPTO} ${LIBCRYPT} ${LIBZ}
+LDADD+=-lcrypto -lcrypt -lz
 
 .include 
 

Modified: head/secure/libexec/sftp-server/Makefile
==
--- head/secure/libexec/sftp-server/MakefileTue Sep 10 21:16:18 2013
(r255459)
+++ head/secure/libexec/sftp-server/MakefileTue Sep 10 22:26:11 2013
(r255460)
@@ -1,17 +1,31 @@
 # $FreeBSD$
 
+.include 
+
 PROG=   sftp-server
 SRCS=   sftp-server.c sftp-common.c sftp-server-main.c
 MAN=   sftp-server.8
 CFLAGS+=-I${SSHDIR} -include ssh_namespace.h
 
-# required when linking with a dynamic libssh 
+.if !defined(NO_SHARED)
+# required when linking with a dynamic libssh
 SRCS+= roaming_dummy.c
+.endif
 
-DPADD= ${LIBSSH} ${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
-LDADD=  -lssh -lcrypt -lcrypto -lz
+DPADD= ${LIBSSH}
+LDADD=  -lssh
 USEPRIVATELIB= ssh
 
+.if ${MK_LDNS} != "no"
+CFLAGS+=   -DHAVE_LDNS=1
+#DPADD+=   ${LIBLDNS}
+#LDADD+=   -lldns
+#USEPRIVATELIB+= ldns
+.endif
+
+DPADD+=${LIBCRYPT} ${LIBCRYPTO} ${LIBZ}
+LDADD+=-lcrypt -lcrypto -lz
+
 .include 
 
 .PATH: ${SSHDIR}

Modified: head/secure/libexec/ssh-keysign/Makefile

svn commit: r255461 - head/crypto/openssh

2013-09-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Sep 10 22:30:22 2013
New Revision: 255461
URL: http://svnweb.freebsd.org/changeset/base/255461

Log:
  Change the default value of VerifyHostKeyDNS to "yes" if compiled with
  LDNS.  With that setting, OpenSSH will silently accept host keys that
  match verified SSHFP records.  If an SSHFP record exists but could not
  be verified, OpenSSH will print a message and prompt the user as usual.
  
  Approved by:  re (blanket)

Modified:
  head/crypto/openssh/readconf.c
  head/crypto/openssh/ssh_config
  head/crypto/openssh/ssh_config.5

Modified: head/crypto/openssh/readconf.c
==
--- head/crypto/openssh/readconf.c  Tue Sep 10 22:26:11 2013
(r255460)
+++ head/crypto/openssh/readconf.c  Tue Sep 10 22:30:22 2013
(r255461)
@@ -1435,8 +1435,14 @@ fill_default_options(Options * options)
options->enable_ssh_keysign = 0;
if (options->rekey_limit == -1)
options->rekey_limit = 0;
+#if HAVE_LDNS
+   if (options->verify_host_key_dns == -1)
+   /* automatically trust a verified SSHFP record */
+   options->verify_host_key_dns = 1;
+#else
if (options->verify_host_key_dns == -1)
options->verify_host_key_dns = 0;
+#endif
if (options->server_alive_interval == -1)
options->server_alive_interval = 0;
if (options->server_alive_count_max == -1)

Modified: head/crypto/openssh/ssh_config
==
--- head/crypto/openssh/ssh_config  Tue Sep 10 22:26:11 2013
(r255460)
+++ head/crypto/openssh/ssh_config  Tue Sep 10 22:30:22 2013
(r255461)
@@ -46,4 +46,5 @@
 #   PermitLocalCommand no
 #   VisualHostKey no
 #   ProxyCommand ssh -q -W %h:%p gateway.example.com
+#   VerifyHostKeyDNS yes
 #   VersionAddendum FreeBSD-20130515

Modified: head/crypto/openssh/ssh_config.5
==
--- head/crypto/openssh/ssh_config.5Tue Sep 10 22:26:11 2013
(r255460)
+++ head/crypto/openssh/ssh_config.5Tue Sep 10 22:30:22 2013
(r255461)
@@ -1219,7 +1219,10 @@ The argument must be
 or
 .Dq ask .
 The default is
-.Dq no .
+.Dq yes
+if compiled with LDNS and
+.Dq no
+otherwise.
 Note that this option applies to protocol version 2 only.
 .Pp
 See also
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255462 - head

2013-09-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Sep 10 22:40:38 2013
New Revision: 255462
URL: http://svnweb.freebsd.org/changeset/base/255462

Log:
  Missed in r255386: libssh is more than just the .so file itself.
  
  Approved by:  re (blanket)

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Sep 10 22:30:22 2013(r255461)
+++ head/ObsoleteFiles.inc  Tue Sep 10 22:40:38 2013(r255462)
@@ -39,8 +39,14 @@
 # done
 
 # 20130908: libssh becomes private
+OLD_FILES+=usr/lib/libssh.a
+OLD_FILES+=usr/lib/libssh.so
 OLD_LIBS+=usr/lib/libssh.so.5
+OLD_FILES+=usr/lib/libssh_p.a
+OLD_FILES+=usr/lib32/libssh.a
+OLD_FILES+=usr/lib32/libssh.so
 OLD_LIBS+=usr/lib32/libssh.so.5
+OLD_FILES+=usr/lib32/libssh_p.a
 # 20130903: gnupatch is no more
 OLD_FILES+=usr/bin/gnupatch
 OLD_FILES+=usr/share/man/man1/gnupatch.1.gz
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255463 - head/usr.bin/bmake

2013-09-10 Thread Simon J. Gerraty
Author: sjg
Date: Tue Sep 10 23:31:38 2013
New Revision: 255463
URL: http://svnweb.freebsd.org/changeset/base/255463

Log:
  Stick to traditional DEFAULT_SYS_PATH (/usr/share/mk)
  
  Reviewed by:  obrien
  Approved by:  re

Modified:
  head/usr.bin/bmake/Makefile

Modified: head/usr.bin/bmake/Makefile
==
--- head/usr.bin/bmake/Makefile Tue Sep 10 22:40:38 2013(r255462)
+++ head/usr.bin/bmake/Makefile Tue Sep 10 23:31:38 2013(r255463)
@@ -167,6 +167,7 @@ accept test:
 # override some simple things
 BINDIR= /usr/bin
 MANDIR= /usr/share/man/man
+DEFAULT_SYS_PATH= /usr/share/mk
 
 # make sure we get this
 CFLAGS+= ${COPTS.${.IMPSRC:T}}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255457 - head/usr.sbin/pkg

2013-09-10 Thread Nathan Whitehorn

On 09/10/13 15:56, Baptiste Daroussin wrote:

Author: bapt
Date: Tue Sep 10 20:56:01 2013
New Revision: 255457
URL: http://svnweb.freebsd.org/changeset/base/255457

Log:
   Add support to detect arm vs armv6
   
   There are two different versions of the ARM ABI depending on the

   TARGET_ARCH. As these are sligntly different a package built for
   one may not work on another. We need to detect which one we are on
   by parsing the .ARM.attributes section.
   
   This will only work on the ARM EABI as this section is part of the

   ABI definition. As armv6 only supports the ARM EABI this is not a
   problem for the oabi.
   
   Older versions of libelf in FreeBSD fail to read the

   .ARM.attributes section needed. As armv6 is unsupported on these
   versions we can assume we are running on arm.
   


Picking a random commit: I don't suppose we can just use MACHINE_ARCH 
for these identifiers? It encapsulates everything needed for compatibility.

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


Re: svn commit: r255457 - head/usr.sbin/pkg

2013-09-10 Thread Baptiste Daroussin
On Tue, Sep 10, 2013 at 10:29:38PM -0500, Nathan Whitehorn wrote:
> On 09/10/13 15:56, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Tue Sep 10 20:56:01 2013
> > New Revision: 255457
> > URL: http://svnweb.freebsd.org/changeset/base/255457
> >
> > Log:
> >Add support to detect arm vs armv6
> >
> >There are two different versions of the ARM ABI depending on the
> >TARGET_ARCH. As these are sligntly different a package built for
> >one may not work on another. We need to detect which one we are on
> >by parsing the .ARM.attributes section.
> >
> >This will only work on the ARM EABI as this section is part of the
> >ABI definition. As armv6 only supports the ARM EABI this is not a
> >problem for the oabi.
> >
> >Older versions of libelf in FreeBSD fail to read the
> >.ARM.attributes section needed. As armv6 is unsupported on these
> >versions we can assume we are running on arm.
> >
> 
> Picking a random commit: I don't suppose we can just use MACHINE_ARCH 
> for these identifiers? It encapsulates everything needed for compatibility.
> -Nathan

Yes we probably can, it encapsulates everything since recently! It wasn't the
case when ABI string was defined, and it lacks an important part of why the ABI
string has been designed on pkgng: making a package match multiple arch via
simple glob on the ABI line.

So as I already said to Warner, Yes now that it properly works on all arches we
could use it but that is not that easy.

People wanting to go that way should:
1. provide a way for pkgng to extract MARCHE_ARCH out of a binary (/bin/ls)
(dynamic cross installation ABI detection)
2. provide a way to create multiarch ABI out of MACHINE_ARCH
3. provide an upgrade path with compatibility for the current string (pkgng is
already largely deployed)
4. have time to do it

There is so much work pending on pkgng, in particular for 10.0 that I just have
no time to work on it.

regards,
Bapt


pgpN4p1e_0JgY.pgp
Description: PGP signature


svn commit: r255467 - head/sys/kern

2013-09-10 Thread Konstantin Belousov
Author: kib
Date: Wed Sep 11 06:41:15 2013
New Revision: 255467
URL: http://svnweb.freebsd.org/changeset/base/255467

Log:
  Implement sendfile(2) for the posix shared memory segment file descriptor,
  in addition to the regular files.
  
  Requested by: alc
  Discussed with:   emaste
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  Approved by:  re (hrs)

Modified:
  head/sys/kern/uipc_shm.c
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cWed Sep 11 06:16:12 2013(r255466)
+++ head/sys/kern/uipc_shm.cWed Sep 11 06:41:15 2013(r255467)
@@ -134,7 +134,7 @@ static struct fileops shm_ops = {
.fo_close = shm_close,
.fo_chmod = shm_chmod,
.fo_chown = shm_chown,
-   .fo_sendfile = invfo_sendfile,
+   .fo_sendfile = vn_sendfile,
.fo_seek = shm_seek,
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
 };

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Wed Sep 11 06:16:12 2013
(r255466)
+++ head/sys/kern/uipc_syscalls.c   Wed Sep 11 06:41:15 2013
(r255467)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -86,7 +88,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -1850,8 +1852,6 @@ getsockaddr(namp, uaddr, len)
return (error);
 }
 
-#include 
-
 struct sendfile_sync {
struct mtx  mtx;
struct cv   cv;
@@ -1917,6 +1917,10 @@ do_sendfile(struct thread *td, struct se
cap_rights_t rights;
int error;
 
+   /*
+* File offset must be positive.  If it goes beyond EOF
+* we send only the header/trailer and no payload data.
+*/
if (uap->offset < 0)
return (EINVAL);
 
@@ -1978,79 +1982,240 @@ freebsd4_sendfile(struct thread *td, str
 }
 #endif /* COMPAT_FREEBSD4 */
 
-int
-vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
-struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags,
-int kflags, struct thread *td)
+static int
+sendfile_readpage(vm_object_t obj, struct vnode *vp, int nd,
+off_t off, int xfsize, int bsize, struct thread *td, vm_page_t *res)
 {
-   struct vnode *vp = fp->f_vnode;
-   struct file *sock_fp;
-   struct vm_object *obj = NULL;
-   struct socket *so = NULL;
-   struct mbuf *m = NULL;
-   struct sf_buf *sf;
-   struct vm_page *pg;
-   struct vattr va;
-   struct sendfile_sync *sfs = NULL;
-   cap_rights_t rights;
-   off_t off, xfsize, fsbytes = 0, sbytes = 0, rem = 0;
-   int bsize, error, hdrlen = 0, mnw = 0;
+   vm_page_t m;
+   vm_pindex_t pindex;
+   ssize_t resid;
+   int error, readahead, rv;
+
+   pindex = OFF_TO_IDX(off);
+   VM_OBJECT_WLOCK(obj);
+   m = vm_page_grab(obj, pindex, (vp != NULL ? VM_ALLOC_NOBUSY |
+   VM_ALLOC_IGN_SBUSY : 0) | VM_ALLOC_WIRED | VM_ALLOC_NORMAL);
 
-   vn_lock(vp, LK_SHARED | LK_RETRY);
-   if (vp->v_type == VREG) {
-   bsize = vp->v_mount->mnt_stat.f_iosize;
-   if (nbytes == 0) {
-   error = VOP_GETATTR(vp, &va, td->td_ucred);
-   if (error != 0) {
-   VOP_UNLOCK(vp, 0);
-   obj = NULL;
-   goto out;
+   /*
+* Check if page is valid for what we need, otherwise initiate I/O.
+*
+* The non-zero nd argument prevents disk I/O, instead we
+* return the caller what he specified in nd.  In particular,
+* if we already turned some pages into mbufs, nd == EAGAIN
+* and the main function send them the pages before we come
+* here again and block.
+*/
+   if (m->valid != 0 && vm_page_is_valid(m, off & PAGE_MASK, xfsize)) {
+   if (vp == NULL)
+   vm_page_xunbusy(m);
+   VM_OBJECT_WUNLOCK(obj);
+   *res = m;
+   return (0);
+   } else if (nd != 0) {
+   if (vp == NULL)
+   vm_page_xunbusy(m);
+   error = nd;
+   goto free_page;
+   }
+
+   /*
+* Get the page from backing store.
+*/
+   error = 0;
+   if (vp != NULL) {
+   VM_OBJECT_WUNLOCK(obj);
+   readahead = sfreadahead * MAXBSIZE;
+
+   /*
+* Use vn_rdwr() instead of the pager interface for
+* the vnode, to allow the read-ahead.
+*
+ 

svn commit: r255468 - head/usr.sbin/pkg

2013-09-10 Thread Baptiste Daroussin
Author: bapt
Date: Wed Sep 11 06:42:55 2013
New Revision: 255468
URL: http://svnweb.freebsd.org/changeset/base/255468

Log:
  Cleanup elf macros
  
  Only define EF_MIPS_ABI when not already supplied
  Remove old now unused ARM macros
  
  Reported by:  imp
  Approved by:  re (kib)

Modified:
  head/usr.sbin/pkg/elf_tables.h

Modified: head/usr.sbin/pkg/elf_tables.h
==
--- head/usr.sbin/pkg/elf_tables.h  Wed Sep 11 06:41:15 2013
(r255467)
+++ head/usr.sbin/pkg/elf_tables.h  Wed Sep 11 06:42:55 2013
(r255468)
@@ -58,16 +58,12 @@ static struct _elf_corres endian_corres[
{ -1, NULL}
 };
 
-#define EF_MIPS_ABI0xF000
+#ifndef EF_MIPS_ABI
+#define EF_MIPS_ABI0xf000
+#endif
 #define E_MIPS_ABI_O32 0x1000
 #define E_MIPS_ABI_N32 0x0020
 
-#define EF_ARM_NEW_ABI 0x80
-#define EF_ARM_OLD_ABI 0x100
-
-#define EF_ARM_SOFT_FLOAT  0x200
-#define EF_ARM_VFP_FLOAT   0x400
-
 #define NT_VERSION 1
 #define NT_ARCH2
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"