svn commit: r296439 - in stable/9/sys: boot/common kern

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Mon Mar  7 07:57:57 2016
New Revision: 296439
URL: https://svnweb.freebsd.org/changeset/base/296439

Log:
  MFC r296419 (by kib):
  
  In the link_elf_obj.c, handle sections of type SHT_AMD64_UNWIND same
  as SHT_PROGBITS.  This is needed after the clang 3.8 import, which
  generates that type for .eh_frame section, which had SHT_PROGBITS type
  before.
  
  Reported by:  Nikolai Lifanov 
  PR:   207729
  Tested by:dim (previous version)
  Sponsored by: The FreeBSD Foundation
  
  MFC r296428:
  
  Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
  the boot loader should not skip over these anymore while loading images.
  Otherwise the kernel can still panic when it doesn't find the .eh_frame
  section belonging to the .rela.eh_frame section.
  
  Unfortunately this will require installing boot loaders from sys/boot
  before attempting to boot with a new kernel.
  
  Reviewed by:  kib

Modified:
  stable/9/sys/boot/common/load_elf_obj.c
  stable/9/sys/kern/link_elf_obj.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/boot/   (props changed)

Modified: stable/9/sys/boot/common/load_elf_obj.c
==
--- stable/9/sys/boot/common/load_elf_obj.c Mon Mar  7 07:54:48 2016
(r296438)
+++ stable/9/sys/boot/common/load_elf_obj.c Mon Mar  7 07:57:57 2016
(r296439)
@@ -228,6 +228,9 @@ __elfN(obj_loadimage)(struct preloaded_f
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#if defined(__i386__) || defined(__amd64__)
+   case SHT_AMD64_UNWIND:
+#endif
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
shdr[i].sh_addr = (Elf_Addr)lastaddr;
lastaddr += shdr[i].sh_size;

Modified: stable/9/sys/kern/link_elf_obj.c
==
--- stable/9/sys/kern/link_elf_obj.cMon Mar  7 07:54:48 2016
(r296438)
+++ stable/9/sys/kern/link_elf_obj.cMon Mar  7 07:57:57 2016
(r296439)
@@ -255,6 +255,9 @@ link_elf_link_preload(linker_class_t cls
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
ef->nprogtab++;
break;
case SHT_SYMTAB:
@@ -325,9 +328,16 @@ link_elf_link_preload(linker_class_t cls
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
ef->progtab[pb].addr = (void *)shdr[i].sh_addr;
if (shdr[i].sh_type == SHT_PROGBITS)
ef->progtab[pb].name = "<>";
+#ifdef __amd64__
+   else if (shdr[i].sh_type == SHT_AMD64_UNWIND)
+   ef->progtab[pb].name = "<>";
+#endif
else
ef->progtab[pb].name = "<>";
ef->progtab[pb].size = shdr[i].sh_size;
@@ -553,6 +563,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
ef->nprogtab++;
break;
case SHT_SYMTAB:
@@ -659,6 +672,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
alignmask = shdr[i].sh_addralign - 1;
mapsize += alignmask;
mapsize &= ~alignmask;
@@ -721,6 +737,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
alignmask = shdr[i].sh_addralign - 1;
mapbase += alignmask;
mapbase &= ~alignmask;
@@ -729,6 +748,10 @@ link_elf_load_file(linker_class_t cls, c
ef->shstrtab + shdr[i].sh_name;
else if (shdr[i].sh_type == SHT_PROGBITS)
ef->progtab[pb].name = "<>";
+#ifdef __amd64__
+   else if (shdr[i].sh_type == SHT_AMD64_UNWIND)
+   ef->progtab[pb].name = "<>";
+#endif
else
ef->progtab[pb].name = "<>";
if 

svn commit: r296438 - in stable/10/sys: boot/common kern

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Mon Mar  7 07:54:48 2016
New Revision: 296438
URL: https://svnweb.freebsd.org/changeset/base/296438

Log:
  MFC r296419 (by kib):
  
  In the link_elf_obj.c, handle sections of type SHT_AMD64_UNWIND same
  as SHT_PROGBITS.  This is needed after the clang 3.8 import, which
  generates that type for .eh_frame section, which had SHT_PROGBITS type
  before.
  
  Reported by:  Nikolai Lifanov 
  PR:   207729
  Tested by:dim (previous version)
  Sponsored by: The FreeBSD Foundation
  
  MFC r296428:
  
  Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
  the boot loader should not skip over these anymore while loading images.
  Otherwise the kernel can still panic when it doesn't find the .eh_frame
  section belonging to the .rela.eh_frame section.
  
  Unfortunately this will require installing boot loaders from sys/boot
  before attempting to boot with a new kernel.
  
  Reviewed by:  kib

Modified:
  stable/10/sys/boot/common/load_elf_obj.c
  stable/10/sys/kern/link_elf_obj.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/boot/common/load_elf_obj.c
==
--- stable/10/sys/boot/common/load_elf_obj.cMon Mar  7 07:49:01 2016
(r296437)
+++ stable/10/sys/boot/common/load_elf_obj.cMon Mar  7 07:54:48 2016
(r296438)
@@ -221,6 +221,9 @@ __elfN(obj_loadimage)(struct preloaded_f
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#if defined(__i386__) || defined(__amd64__)
+   case SHT_AMD64_UNWIND:
+#endif
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
shdr[i].sh_addr = (Elf_Addr)lastaddr;
lastaddr += shdr[i].sh_size;

Modified: stable/10/sys/kern/link_elf_obj.c
==
--- stable/10/sys/kern/link_elf_obj.c   Mon Mar  7 07:49:01 2016
(r296437)
+++ stable/10/sys/kern/link_elf_obj.c   Mon Mar  7 07:54:48 2016
(r296438)
@@ -257,6 +257,9 @@ link_elf_link_preload(linker_class_t cls
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
ef->nprogtab++;
break;
case SHT_SYMTAB:
@@ -327,9 +330,16 @@ link_elf_link_preload(linker_class_t cls
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
ef->progtab[pb].addr = (void *)shdr[i].sh_addr;
if (shdr[i].sh_type == SHT_PROGBITS)
ef->progtab[pb].name = "<>";
+#ifdef __amd64__
+   else if (shdr[i].sh_type == SHT_AMD64_UNWIND)
+   ef->progtab[pb].name = "<>";
+#endif
else
ef->progtab[pb].name = "<>";
ef->progtab[pb].size = shdr[i].sh_size;
@@ -553,6 +563,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
ef->nprogtab++;
break;
case SHT_SYMTAB:
@@ -659,6 +672,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
alignmask = shdr[i].sh_addralign - 1;
mapsize += alignmask;
mapsize &= ~alignmask;
@@ -726,6 +742,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+   case SHT_AMD64_UNWIND:
+#endif
alignmask = shdr[i].sh_addralign - 1;
mapbase += alignmask;
mapbase &= ~alignmask;
@@ -734,6 +753,10 @@ link_elf_load_file(linker_class_t cls, c
ef->shstrtab + shdr[i].sh_name;
else if (shdr[i].sh_type == SHT_PROGBITS)
ef->progtab[pb].name = "<>";
+#ifdef __amd64__
+   else if (shdr[i].sh_type == SHT_AMD64_UNWIND)
+   ef->progtab[pb].name = "<>";
+#endif
else
ef->progtab[pb].name = "<>";
if (ef->progtab[pb].name != NULL && 
@@ -755,7 +778,11 @@ 

svn commit: r296437 - in stable: 10/contrib/binutils/bfd 9/contrib/binutils/bfd

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Mon Mar  7 07:49:01 2016
New Revision: 296437
URL: https://svnweb.freebsd.org/changeset/base/296437

Log:
  MFC r295901:
  
  Fix a problem in ld, causing it to sometimes print messages similar to
  "invalid string offset 65521 >= 27261 for section `.strtab'". for object
  files produced by recent versions of clang.
  
  In BFD's elf_create_symbuf() function, the size of the symbol buffer
  ('ssymbuf') is not calculated correctly, and the initial value for the
  'ssym' variable is off by one, since 'ssymbuf' has shndx_count + 1
  members.

Modified:
  stable/10/contrib/binutils/bfd/elf.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/9/contrib/binutils/bfd/elf.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Modified: stable/10/contrib/binutils/bfd/elf.c
==
--- stable/10/contrib/binutils/bfd/elf.cMon Mar  7 07:46:17 2016
(r296436)
+++ stable/10/contrib/binutils/bfd/elf.cMon Mar  7 07:49:01 2016
(r296437)
@@ -8934,14 +8934,14 @@ elf_create_symbuf (bfd_size_type symcoun
shndx_count++;
 
   ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
-   + (indbufend - indbuf) * sizeof (*ssymbuf));
+   + (indbufend - indbuf) * sizeof (*ssym));
   if (ssymbuf == NULL)
 {
   free (indbuf);
   return NULL;
 }
 
-  ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count);
+  ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count + 1);
   ssymbuf->ssym = NULL;
   ssymbuf->count = shndx_count;
   ssymbuf->st_shndx = 0;
___
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: r296437 - in stable: 10/contrib/binutils/bfd 9/contrib/binutils/bfd

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Mon Mar  7 07:49:01 2016
New Revision: 296437
URL: https://svnweb.freebsd.org/changeset/base/296437

Log:
  MFC r295901:
  
  Fix a problem in ld, causing it to sometimes print messages similar to
  "invalid string offset 65521 >= 27261 for section `.strtab'". for object
  files produced by recent versions of clang.
  
  In BFD's elf_create_symbuf() function, the size of the symbol buffer
  ('ssymbuf') is not calculated correctly, and the initial value for the
  'ssym' variable is off by one, since 'ssymbuf' has shndx_count + 1
  members.

Modified:
  stable/9/contrib/binutils/bfd/elf.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/binutils/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/binutils/bfd/elf.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/contrib/binutils/bfd/elf.c
==
--- stable/9/contrib/binutils/bfd/elf.c Mon Mar  7 07:46:17 2016
(r296436)
+++ stable/9/contrib/binutils/bfd/elf.c Mon Mar  7 07:49:01 2016
(r296437)
@@ -8934,14 +8934,14 @@ elf_create_symbuf (bfd_size_type symcoun
shndx_count++;
 
   ssymbuf = bfd_malloc ((shndx_count + 1) * sizeof (*ssymbuf)
-   + (indbufend - indbuf) * sizeof (*ssymbuf));
+   + (indbufend - indbuf) * sizeof (*ssym));
   if (ssymbuf == NULL)
 {
   free (indbuf);
   return NULL;
 }
 
-  ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count);
+  ssym = (struct elf_symbuf_symbol *) (ssymbuf + shndx_count + 1);
   ssymbuf->ssym = NULL;
   ssymbuf->count = shndx_count;
   ssymbuf->st_shndx = 0;
___
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: r296436 - in stable/10/cddl/contrib/opensolaris/cmd: zfs zpool

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Mon Mar  7 07:46:17 2016
New Revision: 296436
URL: https://svnweb.freebsd.org/changeset/base/296436

Log:
  MFC r295844:
  
  Fix "invalid type '(null)'" usage messages in zfs(8) and zpool(8).
  
  Currently, zfs(8) and zpool(8) print "invalid type '(null)'" or similar
  messages, if you pass in invalid types, sources or column names for "zfs
  get", "zfs list" and "zpool get".  This is because the commands use
  getsubopt(3), and in case of failure, they print 'value', which is NULL
  when sub options don't match.
  
  They should print 'suboptarg' instead, which is the documented way to
  get at the non-matching sub option value.
  
  Reviewed by:  smh
  Differential Revision: https://reviews.freebsd.org/D5365

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Sun Mar  6 
21:32:54 2016(r296435)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Mon Mar  7 
07:46:17 2016(r296436)
@@ -1712,7 +1712,7 @@ zfs_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid column name "
-   "'%s'\n"), value);
+   "'%s'\n"), suboptarg);
usage(B_FALSE);
}
}
@@ -1749,7 +1749,7 @@ zfs_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid source "
-   "'%s'\n"), value);
+   "'%s'\n"), suboptarg);
usage(B_FALSE);
}
}
@@ -1785,7 +1785,7 @@ zfs_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid type '%s'\n"),
-   value);
+   suboptarg);
usage(B_FALSE);
}
}
@@ -3155,7 +3155,7 @@ zfs_do_list(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid type '%s'\n"),
-   value);
+   suboptarg);
usage(B_FALSE);
}
}

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Sun Mar  6 
21:32:54 2016(r296435)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Mar  7 
07:46:17 2016(r296436)
@@ -5431,7 +5431,7 @@ zpool_do_get(int argc, char **argv)
default:
(void) fprintf(stderr,
gettext("invalid column name "
-   "'%s'\n"), value);
+   "'%s'\n"), suboptarg);
usage(B_FALSE);
}
}
___
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: r296428 - head/sys/boot/common

2016-03-06 Thread Dimitry Andric
On 07 Mar 2016, at 02:11, Julian Elischer  wrote:
> 
> On 6/03/2016 7:57 AM, Dimitry Andric wrote:
>> Author: dim
>> Date: Sun Mar  6 15:57:43 2016
>> New Revision: 296428
>> URL: https://svnweb.freebsd.org/changeset/base/296428
>> 
>> Log:
>>   Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
>>   the boot loader should not skip over these anymore while loading images.
>>   Otherwise the kernel can still panic when it doesn't find the .eh_frame
>>   section belonging to the .rela.eh_frame section.
>>  Unfortunately this will require installing boot loaders from sys/boot
>>   before attempting to boot with a new kernel.
> 
> what happens to someone who doesn't replace their bootblocks?
> Or is this just the loader?

This just about the loaders, e.g. loader, loader.efi and zfsloader.


> The general way we have handled this sort of thing in the past is that we do 
> something
> that produces a nagging message for a decent time before it becomes mandatory.
> 
> I don't like the idea of people being caught unaware by this..
> 
> Can you please give a more detailed description of what happens?

If you preload modules with .eh_frame sections in them (such as
aesni.ko) from your loader.conf, your kernel will panic very early in
the boot.

If you don't preload any modules, or load only modules without .eh_frame
sections (most of of them), there is no issue at all.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r296428 - head/sys/boot/common

2016-03-06 Thread Larry Rosenman
On Sun, Mar 06, 2016 at 05:11:11PM -0800, Julian Elischer wrote:
> On 6/03/2016 7:57 AM, Dimitry Andric wrote:
> > Author: dim
> > Date: Sun Mar  6 15:57:43 2016
> > New Revision: 296428
> > URL: https://svnweb.freebsd.org/changeset/base/296428
> >
> > Log:
> >Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
> >the boot loader should not skip over these anymore while loading images.
> >Otherwise the kernel can still panic when it doesn't find the .eh_frame
> >section belonging to the .rela.eh_frame section.
> >
> >Unfortunately this will require installing boot loaders from sys/boot
> >before attempting to boot with a new kernel.
> 
> what happens to someone who doesn't replace their bootblocks?
> Or is this just the loader?
> 
> The general way we have handled this sort of thing in the past is that 
> we do something
> that produces a nagging message for a decent time before it becomes 
> mandatory.
> 
> I don't like the idea of people being caught unaware by this..
> 
> Can you please give a more detailed description of what happens?


In this case it's the loader.  I just upgraded a second laptop and did NOT 
replace
the boot block (boot1.efi), but DID populate /boot (and actually a full world), 
and 
it booted fine,


> 
> >
> >Reviewed by: kib
> >MFC after:   2 weeks
> >X-MFC-With:  r296419
> >
> > Modified:
> >head/sys/boot/common/load_elf_obj.c
> >
> > Modified: head/sys/boot/common/load_elf_obj.c
> > ==
> > --- head/sys/boot/common/load_elf_obj.c Sun Mar  6 14:37:49 2016
> > (r296427)
> > +++ head/sys/boot/common/load_elf_obj.c Sun Mar  6 15:57:43 2016
> > (r296428)
> > @@ -221,6 +221,9 @@ __elfN(obj_loadimage)(struct preloaded_f
> > switch (shdr[i].sh_type) {
> > case SHT_PROGBITS:
> > case SHT_NOBITS:
> > +#if defined(__i386__) || defined(__amd64__)
> > +   case SHT_AMD64_UNWIND:
> > +#endif
> > lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
> > shdr[i].sh_addr = (Elf_Addr)lastaddr;
> > lastaddr += shdr[i].sh_size;
> >
> >
> 
> ___
> 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"

-- 
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-642-9640 E-Mail: l...@lerctr.org
US Mail: 7011 W Parmer Ln, Apt 1115, Austin, TX 78729-6961
___
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: r296428 - head/sys/boot/common

2016-03-06 Thread Julian Elischer

On 6/03/2016 7:57 AM, Dimitry Andric wrote:

Author: dim
Date: Sun Mar  6 15:57:43 2016
New Revision: 296428
URL: https://svnweb.freebsd.org/changeset/base/296428

Log:
   Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
   the boot loader should not skip over these anymore while loading images.
   Otherwise the kernel can still panic when it doesn't find the .eh_frame
   section belonging to the .rela.eh_frame section.
   
   Unfortunately this will require installing boot loaders from sys/boot

   before attempting to boot with a new kernel.


what happens to someone who doesn't replace their bootblocks?
Or is this just the loader?

The general way we have handled this sort of thing in the past is that 
we do something
that produces a nagging message for a decent time before it becomes 
mandatory.


I don't like the idea of people being caught unaware by this..

Can you please give a more detailed description of what happens?

   
   Reviewed by:	kib

   MFC after:   2 weeks
   X-MFC-With:  r296419

Modified:
   head/sys/boot/common/load_elf_obj.c

Modified: head/sys/boot/common/load_elf_obj.c
==
--- head/sys/boot/common/load_elf_obj.c Sun Mar  6 14:37:49 2016
(r296427)
+++ head/sys/boot/common/load_elf_obj.c Sun Mar  6 15:57:43 2016
(r296428)
@@ -221,6 +221,9 @@ __elfN(obj_loadimage)(struct preloaded_f
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#if defined(__i386__) || defined(__amd64__)
+   case SHT_AMD64_UNWIND:
+#endif
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
shdr[i].sh_addr = (Elf_Addr)lastaddr;
lastaddr += shdr[i].sh_size;




___
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: r296428 - head/sys/boot/common

2016-03-06 Thread Adrian Chadd
Oh wow, i didn't know at all that limits broke booting in this way.
Sorry :( This is the first time I've heard about it.



-a


On 6 March 2016 at 16:38, Warner Losh  wrote:
>
>
> On Sun, Mar 6, 2016 at 4:44 PM, Nikolai Lifanov 
> wrote:
>>
>> On March 6, 2016 4:13:34 PM EST, Dimitry Andric  wrote:
>> >On 06 Mar 2016, at 20:57, Nikolai Lifanov 
>> >wrote:
>> >>
>> >> On 2016-03-06 11:17, Dimitry Andric wrote:
>> >>> On 06 Mar 2016, at 17:00, Oliver Pinter
>> > wrote:
>>  On 3/6/16, Dimitry Andric  wrote:
>> > Author: dim
>> > Date: Sun Mar  6 15:57:43 2016
>> > New Revision: 296428
>> > URL: https://svnweb.freebsd.org/changeset/base/296428
>> > Log:
>> > Since kernel modules can now contain sections of type
>> >SHT_AMD64_UNWIND,
>> > the boot loader should not skip over these anymore while loading
>> >images.
>> > Otherwise the kernel can still panic when it doesn't find the
>> >.eh_frame
>> > section belonging to the .rela.eh_frame section.
>> > Unfortunately this will require installing boot loaders from
>> >sys/boot
>> > before attempting to boot with a new kernel.
>>  Could you please add a note about this to UPDATING file?
>> >>> I am a bit torn on this, because normally we always tell people to
>> >>> install the kernel first, reboot, then run make installworld (which
>> >also
>> >>> installs the boot loaders).
>> >>> However, in this case, people might depend on their boot loader
>> >loading
>> >>> modules which are required to make the system boot at all.  So if
>> >they
>> >>> happened to forget updating their boot loader first, a panic might
>> >be
>> >>> the result.
>> >>> I wonder what a failsafe and acceptable upgrade scenario is, in this
>> >>> case.  Normally the procedure is something like:
>> >>>  make buildworld
>> >>>  make buildkernel (with KERNCONF=whatever, if needed)
>> >>>  make installkernel (again with KERNCONF, if needed)
>> >>>  reboot (to single user, but cheating is possible usually)
>> >>>  mergemaster -p
>> >>>  make installworld
>> >>> This could maybe be modified to:
>> >>>  make buildworld
>> >>>  make buildkernel (with KERNCONF=whatever, if needed)
>> >>>  make installkernel (again with KERNCONF, if needed)
>> >>>  make -C sys/boot install
>> >>>  reboot (to single user, but cheating is possible usually)
>> >>>  mergemaster -p
>> >>>  make installworld
>> >>> E.g. insert the step which installs the boot loaders just after (or
>> >>> before) the step which installs the kernel.
>> >>> Is something like this acceptable as a one-time workaround, or maybe
>> >it
>> >>> is better in general, in case we ever add other new features to the
>> >boot
>> >>> loaders?
>> >>> -Dimitry
>> >>
>> >> In my opinion, boot *blocks* (boot1) should be updated seldomly and
>> >not on every install.
>> >> All (?) instances of not updating these resulting in a failed boot
>> >have an UPDATING
>> >> entry or a similar warning (like the one during "zpool upgrade").
>> >
>> >Well, each time you run make installworld, almost all the files in
>> >/boot
>> >(except for configuration) get reinstalled.  For e.g. mbr, boot1 and
>> >such, this has no consequences at all, until you install them into some
>> >partition using gpart, but changes to loader, loader.efi or zfsloader
>> >*will* affect the next startup.
>> >
>> >Per a suggestion from Kostik, maybe it would be nice to have a separate
>> >"make installboot" target, which installs just the components in /boot.
>> >This could then be used before or after "make installkernel".
>> >
>> >-Dimitry
>>
>> The bootcode gets installed to boot, but deployed with gpart, cp, sliced
>> in half and dd, etc. And that's to one or more partitions.
>> I don't think that a separate install target that just stages boot1 to
>> /boot is valuable.
>
>
> I think it is. First, the boot code you talk about doesn't matter *AT*ALL*
> for this
> change. It needn't be deployed to be safe. We've had a few rare cases where
> you
> do need new boot code as well, but they seem to happen about once a decade
> or so.
>
> Personally, I always install both a kernel and userspace at the same time
> when
> upgrading, though sometimes just the kernel. Usually it just doesn't matter.
> In
> this case, I'll know I need new boot blocks. I'm kinda of the opinion that
> the boot
> loader should be part of installkernel, but I can see how others may
> disagree and
> that's likely too much POLA to do now (it should have been done in the 4.0
> time
> frame when we went to a tertiary boot loader).
>
> With the recent expansion of limits, however, it's become critical that you
> have
> a new kernel on boot so that limits used by the rc system are set correctly
> (the
> new code has no fallback, but fails for limits it doesn't know about, which
> is
> super lame, and should be fixed, but until it is we're stuck with 

Re: svn commit: r296428 - head/sys/boot/common

2016-03-06 Thread Warner Losh
On Sun, Mar 6, 2016 at 4:44 PM, Nikolai Lifanov 
wrote:

> On March 6, 2016 4:13:34 PM EST, Dimitry Andric  wrote:
> >On 06 Mar 2016, at 20:57, Nikolai Lifanov 
> >wrote:
> >>
> >> On 2016-03-06 11:17, Dimitry Andric wrote:
> >>> On 06 Mar 2016, at 17:00, Oliver Pinter
> > wrote:
>  On 3/6/16, Dimitry Andric  wrote:
> > Author: dim
> > Date: Sun Mar  6 15:57:43 2016
> > New Revision: 296428
> > URL: https://svnweb.freebsd.org/changeset/base/296428
> > Log:
> > Since kernel modules can now contain sections of type
> >SHT_AMD64_UNWIND,
> > the boot loader should not skip over these anymore while loading
> >images.
> > Otherwise the kernel can still panic when it doesn't find the
> >.eh_frame
> > section belonging to the .rela.eh_frame section.
> > Unfortunately this will require installing boot loaders from
> >sys/boot
> > before attempting to boot with a new kernel.
>  Could you please add a note about this to UPDATING file?
> >>> I am a bit torn on this, because normally we always tell people to
> >>> install the kernel first, reboot, then run make installworld (which
> >also
> >>> installs the boot loaders).
> >>> However, in this case, people might depend on their boot loader
> >loading
> >>> modules which are required to make the system boot at all.  So if
> >they
> >>> happened to forget updating their boot loader first, a panic might
> >be
> >>> the result.
> >>> I wonder what a failsafe and acceptable upgrade scenario is, in this
> >>> case.  Normally the procedure is something like:
> >>>  make buildworld
> >>>  make buildkernel (with KERNCONF=whatever, if needed)
> >>>  make installkernel (again with KERNCONF, if needed)
> >>>  reboot (to single user, but cheating is possible usually)
> >>>  mergemaster -p
> >>>  make installworld
> >>> This could maybe be modified to:
> >>>  make buildworld
> >>>  make buildkernel (with KERNCONF=whatever, if needed)
> >>>  make installkernel (again with KERNCONF, if needed)
> >>>  make -C sys/boot install
> >>>  reboot (to single user, but cheating is possible usually)
> >>>  mergemaster -p
> >>>  make installworld
> >>> E.g. insert the step which installs the boot loaders just after (or
> >>> before) the step which installs the kernel.
> >>> Is something like this acceptable as a one-time workaround, or maybe
> >it
> >>> is better in general, in case we ever add other new features to the
> >boot
> >>> loaders?
> >>> -Dimitry
> >>
> >> In my opinion, boot *blocks* (boot1) should be updated seldomly and
> >not on every install.
> >> All (?) instances of not updating these resulting in a failed boot
> >have an UPDATING
> >> entry or a similar warning (like the one during "zpool upgrade").
> >
> >Well, each time you run make installworld, almost all the files in
> >/boot
> >(except for configuration) get reinstalled.  For e.g. mbr, boot1 and
> >such, this has no consequences at all, until you install them into some
> >partition using gpart, but changes to loader, loader.efi or zfsloader
> >*will* affect the next startup.
> >
> >Per a suggestion from Kostik, maybe it would be nice to have a separate
> >"make installboot" target, which installs just the components in /boot.
> >This could then be used before or after "make installkernel".
> >
> >-Dimitry
>
> The bootcode gets installed to boot, but deployed with gpart, cp, sliced
> in half and dd, etc. And that's to one or more partitions.
> I don't think that a separate install target that just stages boot1 to
> /boot is valuable.
>

I think it is. First, the boot code you talk about doesn't matter *AT*ALL*
for this
change. It needn't be deployed to be safe. We've had a few rare cases where
you
do need new boot code as well, but they seem to happen about once a decade
or so.

Personally, I always install both a kernel and userspace at the same time
when
upgrading, though sometimes just the kernel. Usually it just doesn't
matter. In
this case, I'll know I need new boot blocks. I'm kinda of the opinion that
the boot
loader should be part of installkernel, but I can see how others may
disagree and
that's likely too much POLA to do now (it should have been done in the 4.0
time
frame when we went to a tertiary boot loader).

With the recent expansion of limits, however, it's become critical that you
have
a new kernel on boot so that limits used by the rc system are set correctly
(the
new code has no fallback, but fails for limits it doesn't know about, which
is
super lame, and should be fixed, but until it is we're stuck with needing a
new kernel. This also means, btw, that a 10.x kernel has no chance of
booting
an 11.x userland, which is somewhat contrary to traditional practice in the
project).

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To 

Re: svn commit: r296428 - head/sys/boot/common

2016-03-06 Thread Nikolai Lifanov
On March 6, 2016 4:13:34 PM EST, Dimitry Andric  wrote:
>On 06 Mar 2016, at 20:57, Nikolai Lifanov 
>wrote:
>> 
>> On 2016-03-06 11:17, Dimitry Andric wrote:
>>> On 06 Mar 2016, at 17:00, Oliver Pinter
> wrote:
 On 3/6/16, Dimitry Andric  wrote:
> Author: dim
> Date: Sun Mar  6 15:57:43 2016
> New Revision: 296428
> URL: https://svnweb.freebsd.org/changeset/base/296428
> Log:
> Since kernel modules can now contain sections of type
>SHT_AMD64_UNWIND,
> the boot loader should not skip over these anymore while loading
>images.
> Otherwise the kernel can still panic when it doesn't find the
>.eh_frame
> section belonging to the .rela.eh_frame section.
> Unfortunately this will require installing boot loaders from
>sys/boot
> before attempting to boot with a new kernel.
 Could you please add a note about this to UPDATING file?
>>> I am a bit torn on this, because normally we always tell people to
>>> install the kernel first, reboot, then run make installworld (which
>also
>>> installs the boot loaders).
>>> However, in this case, people might depend on their boot loader
>loading
>>> modules which are required to make the system boot at all.  So if
>they
>>> happened to forget updating their boot loader first, a panic might
>be
>>> the result.
>>> I wonder what a failsafe and acceptable upgrade scenario is, in this
>>> case.  Normally the procedure is something like:
>>>  make buildworld
>>>  make buildkernel (with KERNCONF=whatever, if needed)
>>>  make installkernel (again with KERNCONF, if needed)
>>>  reboot (to single user, but cheating is possible usually)
>>>  mergemaster -p
>>>  make installworld
>>> This could maybe be modified to:
>>>  make buildworld
>>>  make buildkernel (with KERNCONF=whatever, if needed)
>>>  make installkernel (again with KERNCONF, if needed)
>>>  make -C sys/boot install
>>>  reboot (to single user, but cheating is possible usually)
>>>  mergemaster -p
>>>  make installworld
>>> E.g. insert the step which installs the boot loaders just after (or
>>> before) the step which installs the kernel.
>>> Is something like this acceptable as a one-time workaround, or maybe
>it
>>> is better in general, in case we ever add other new features to the
>boot
>>> loaders?
>>> -Dimitry
>> 
>> In my opinion, boot *blocks* (boot1) should be updated seldomly and
>not on every install.
>> All (?) instances of not updating these resulting in a failed boot
>have an UPDATING
>> entry or a similar warning (like the one during "zpool upgrade").
>
>Well, each time you run make installworld, almost all the files in
>/boot
>(except for configuration) get reinstalled.  For e.g. mbr, boot1 and
>such, this has no consequences at all, until you install them into some
>partition using gpart, but changes to loader, loader.efi or zfsloader
>*will* affect the next startup.
>
>Per a suggestion from Kostik, maybe it would be nice to have a separate
>"make installboot" target, which installs just the components in /boot.
>This could then be used before or after "make installkernel".
>
>-Dimitry

The bootcode gets installed to boot, but deployed with gpart, cp, sliced in 
half and dd, etc. And that's to one or more partitions.
I don't think that a separate install target that just stages boot1 to /boot is 
valuable.


- Nikolai Lifanov
___
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: r296435 - in head/lib/libedit: . TEST edit/readline

2016-03-06 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Mar  6 21:32:54 2016
New Revision: 296435
URL: https://svnweb.freebsd.org/changeset/base/296435

Log:
  Revert r296175
  Undo update of libedit 2016-02-27
  
  Something in libedit appears to be causing breakage in lldb38.
  The changes are not generally huge but they are suficient to
  to justify reverting for now.
  
  Reported by:  novel, bapt

Modified:
  head/lib/libedit/Makefile
  head/lib/libedit/TEST/tc1.c
  head/lib/libedit/TEST/wtc1.c
  head/lib/libedit/chared.c
  head/lib/libedit/chared.h
  head/lib/libedit/chartype.c
  head/lib/libedit/chartype.h
  head/lib/libedit/common.c
  head/lib/libedit/config.h
  head/lib/libedit/edit/readline/readline.h
  head/lib/libedit/editline.3
  head/lib/libedit/el.c
  head/lib/libedit/el.h
  head/lib/libedit/eln.c
  head/lib/libedit/emacs.c
  head/lib/libedit/filecomplete.c
  head/lib/libedit/hist.c
  head/lib/libedit/hist.h
  head/lib/libedit/histedit.h
  head/lib/libedit/history.c
  head/lib/libedit/keymacro.c
  head/lib/libedit/makelist
  head/lib/libedit/map.c
  head/lib/libedit/parse.c
  head/lib/libedit/prompt.c
  head/lib/libedit/prompt.h
  head/lib/libedit/read.c
  head/lib/libedit/read.h
  head/lib/libedit/readline.c
  head/lib/libedit/refresh.c
  head/lib/libedit/refresh.h
  head/lib/libedit/search.c
  head/lib/libedit/search.h
  head/lib/libedit/sig.c
  head/lib/libedit/sig.h
  head/lib/libedit/sys.h
  head/lib/libedit/terminal.c
  head/lib/libedit/terminal.h
  head/lib/libedit/tokenizer.c
  head/lib/libedit/tty.c
  head/lib/libedit/tty.h
  head/lib/libedit/vi.c
Directory Properties:
  head/lib/libedit/   (props changed)
  head/lib/libedit/edit/readline/   (props changed)

Modified: head/lib/libedit/Makefile
==
--- head/lib/libedit/Makefile   Sun Mar  6 18:41:48 2016(r296434)
+++ head/lib/libedit/Makefile   Sun Mar  6 21:32:54 2016(r296435)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
+#  $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -6,7 +6,7 @@ LIB=edit
 SHLIB_MAJOR=   7
 SHLIBDIR?= /lib
 
-OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -34,6 +34,7 @@ CLEANFILES+= common.h editline.c emacs.h
 
 INCS=  histedit.h
 
+OSRCS+=eln.c
 SRCS+= tokenizern.c historyn.c
 CLEANFILES+=   tokenizern.c historyn.c
 CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR

Modified: head/lib/libedit/TEST/tc1.c
==
--- head/lib/libedit/TEST/tc1.c Sun Mar  6 18:41:48 2016(r296434)
+++ head/lib/libedit/TEST/tc1.c Sun Mar  6 21:32:54 2016(r296435)
@@ -1,4 +1,4 @@
-/* $NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $ */
+/* $NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 __FBSDID("$FreeBSD$");
@@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$");
 /*
  * test.c: A little test program
  */
+#include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 #include 
+#include 
+#include 
 
 #include "histedit.h"
 
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
/* Add a user-defined function  */
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
-   /* Bind tab to it   */
+   /* Bind tab to it   */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
 
/*

Modified: head/lib/libedit/TEST/wtc1.c
==
--- head/lib/libedit/TEST/wtc1.cSun Mar  6 18:41:48 2016
(r296434)
+++ head/lib/libedit/TEST/wtc1.cSun Mar  6 21:32:54 2016
(r296435)
@@ -5,16 +5,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include "../histedit.h"
 

Modified: head/lib/libedit/chared.c
==
--- head/lib/libedit/chared.c   Sun Mar  6 18:41:48 2016(r296434)
+++ head/lib/libedit/chared.c   Sun Mar  6 21:32:54 2016

Re: svn commit: r296428 - head/sys/boot/common

2016-03-06 Thread Dimitry Andric
On 06 Mar 2016, at 20:57, Nikolai Lifanov  wrote:
> 
> On 2016-03-06 11:17, Dimitry Andric wrote:
>> On 06 Mar 2016, at 17:00, Oliver Pinter  
>> wrote:
>>> On 3/6/16, Dimitry Andric  wrote:
 Author: dim
 Date: Sun Mar  6 15:57:43 2016
 New Revision: 296428
 URL: https://svnweb.freebsd.org/changeset/base/296428
 Log:
 Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
 the boot loader should not skip over these anymore while loading images.
 Otherwise the kernel can still panic when it doesn't find the .eh_frame
 section belonging to the .rela.eh_frame section.
 Unfortunately this will require installing boot loaders from sys/boot
 before attempting to boot with a new kernel.
>>> Could you please add a note about this to UPDATING file?
>> I am a bit torn on this, because normally we always tell people to
>> install the kernel first, reboot, then run make installworld (which also
>> installs the boot loaders).
>> However, in this case, people might depend on their boot loader loading
>> modules which are required to make the system boot at all.  So if they
>> happened to forget updating their boot loader first, a panic might be
>> the result.
>> I wonder what a failsafe and acceptable upgrade scenario is, in this
>> case.  Normally the procedure is something like:
>>  make buildworld
>>  make buildkernel (with KERNCONF=whatever, if needed)
>>  make installkernel (again with KERNCONF, if needed)
>>  reboot (to single user, but cheating is possible usually)
>>  mergemaster -p
>>  make installworld
>> This could maybe be modified to:
>>  make buildworld
>>  make buildkernel (with KERNCONF=whatever, if needed)
>>  make installkernel (again with KERNCONF, if needed)
>>  make -C sys/boot install
>>  reboot (to single user, but cheating is possible usually)
>>  mergemaster -p
>>  make installworld
>> E.g. insert the step which installs the boot loaders just after (or
>> before) the step which installs the kernel.
>> Is something like this acceptable as a one-time workaround, or maybe it
>> is better in general, in case we ever add other new features to the boot
>> loaders?
>> -Dimitry
> 
> In my opinion, boot *blocks* (boot1) should be updated seldomly and not on 
> every install.
> All (?) instances of not updating these resulting in a failed boot have an 
> UPDATING
> entry or a similar warning (like the one during "zpool upgrade").

Well, each time you run make installworld, almost all the files in /boot
(except for configuration) get reinstalled.  For e.g. mbr, boot1 and
such, this has no consequences at all, until you install them into some
partition using gpart, but changes to loader, loader.efi or zfsloader
*will* affect the next startup.

Per a suggestion from Kostik, maybe it would be nice to have a separate
"make installboot" target, which installs just the components in /boot.
This could then be used before or after "make installkernel".

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r296428 - head/sys/boot/common

2016-03-06 Thread Nikolai Lifanov

On 2016-03-06 11:17, Dimitry Andric wrote:
On 06 Mar 2016, at 17:00, Oliver Pinter  
wrote:


On 3/6/16, Dimitry Andric  wrote:

Author: dim
Date: Sun Mar  6 15:57:43 2016
New Revision: 296428
URL: https://svnweb.freebsd.org/changeset/base/296428

Log:
 Since kernel modules can now contain sections of type 
SHT_AMD64_UNWIND,
 the boot loader should not skip over these anymore while loading 
images.
 Otherwise the kernel can still panic when it doesn't find the 
.eh_frame

 section belonging to the .rela.eh_frame section.

 Unfortunately this will require installing boot loaders from 
sys/boot

 before attempting to boot with a new kernel.


Could you please add a note about this to UPDATING file?


I am a bit torn on this, because normally we always tell people to
install the kernel first, reboot, then run make installworld (which 
also

installs the boot loaders).

However, in this case, people might depend on their boot loader loading
modules which are required to make the system boot at all.  So if they
happened to forget updating their boot loader first, a panic might be
the result.

I wonder what a failsafe and acceptable upgrade scenario is, in this
case.  Normally the procedure is something like:

  make buildworld
  make buildkernel (with KERNCONF=whatever, if needed)
  make installkernel (again with KERNCONF, if needed)
  reboot (to single user, but cheating is possible usually)
  mergemaster -p
  make installworld

This could maybe be modified to:

  make buildworld
  make buildkernel (with KERNCONF=whatever, if needed)
  make installkernel (again with KERNCONF, if needed)
  make -C sys/boot install
  reboot (to single user, but cheating is possible usually)
  mergemaster -p
  make installworld

E.g. insert the step which installs the boot loaders just after (or
before) the step which installs the kernel.

Is something like this acceptable as a one-time workaround, or maybe it
is better in general, in case we ever add other new features to the 
boot

loaders?

-Dimitry


In my opinion, boot *blocks* (boot1) should be updated seldomly and not 
on every install.
All (?) instances of not updating these resulting in a failed boot have 
an UPDATING

entry or a similar warning (like the one during "zpool upgrade").

- Nikolai Lifanov
___
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: r296434 - head/lib/libc/tests/string

2016-03-06 Thread Jilles Tjoelker
Author: jilles
Date: Sun Mar  6 18:41:48 2016
New Revision: 296434
URL: https://svnweb.freebsd.org/changeset/base/296434

Log:
  libc: Add some tests for memcmp().

Added:
  head/lib/libc/tests/string/memcmp_test.c   (contents, props changed)
Modified:
  head/lib/libc/tests/string/Makefile

Modified: head/lib/libc/tests/string/Makefile
==
--- head/lib/libc/tests/string/Makefile Sun Mar  6 18:40:02 2016
(r296433)
+++ head/lib/libc/tests/string/Makefile Sun Mar  6 18:41:48 2016
(r296434)
@@ -1,5 +1,6 @@
 # $FreeBSD$
 
+ATF_TESTS_C+=  memcmp_test
 ATF_TESTS_C+=  stpncpy_test
 ATF_TESTS_C+=  strerror2_test
 ATF_TESTS_C+=  wcscasecmp_test

Added: head/lib/libc/tests/string/memcmp_test.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/tests/string/memcmp_test.cSun Mar  6 18:41:48 2016
(r296434)
@@ -0,0 +1,124 @@
+/*-
+ * Copyright (c) 2016 Jilles Tjoelker 
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+ATF_TC_WITHOUT_HEAD(zero);
+ATF_TC_BODY(zero, tc)
+{
+
+   assert(memcmp("a", "b", 0) == 0);
+   assert(memcmp("", "", 0) == 0);
+}
+
+ATF_TC_WITHOUT_HEAD(eq);
+ATF_TC_BODY(eq, tc)
+{
+   unsigned char data1[256], data2[256];
+   int i;
+
+   for (i = 0; i < 256; i++)
+   data1[i] = data2[i] = i ^ 0x55;
+   for (i = 1; i < 256; i++)
+   assert(memcmp(data1, data2, i) == 0);
+   for (i = 1; i < 256; i++)
+   assert(memcmp(data1 + i, data2 + i, 256 - i) == 0);
+}
+
+ATF_TC_WITHOUT_HEAD(neq);
+ATF_TC_BODY(neq, tc)
+{
+   unsigned char data1[256], data2[256];
+   int i;
+
+   for (i = 0; i < 256; i++) {
+   data1[i] = i;
+   data2[i] = i ^ 0x55;
+   }
+   for (i = 1; i < 256; i++)
+   assert(memcmp(data1, data2, i) != 0);
+   for (i = 1; i < 256; i++)
+   assert(memcmp(data1 + i, data2 + i, 256 - i) != 0);
+}
+
+ATF_TC_WITHOUT_HEAD(diff);
+ATF_TC_BODY(diff, tc)
+{
+   unsigned char data1[256], data2[256];
+   int i;
+
+   memset(data1, 'a', sizeof(data1));
+   memset(data2, 'a', sizeof(data2));
+   data1[128] = 255;
+   data2[128] = 0;
+   for (i = 1; i < 66; i++) {
+   assert(memcmp(data1 + 128, data2 + 128, i) == 255);
+   assert(memcmp(data2 + 128, data1 + 128, i) == -255);
+   assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == 255);
+   assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == -255);
+   assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == 255);
+   assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == -255);
+   }
+   data1[128] = 'c';
+   data2[128] = 'e';
+   for (i = 1; i < 66; i++) {
+   assert(memcmp(data1 + 128, data2 + 128, i) == -2);
+   assert(memcmp(data2 + 128, data1 + 128, i) == 2);
+   assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2);
+   assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2);
+   assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2);
+   assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2);
+   }
+   memset(data1 + 129, 'A', sizeof(data1) - 129);
+   memset(data2 + 129, 'Z', sizeof(data2) - 129);
+   for (i = 1; i < 66; i++) {
+   assert(memcmp(data1 + 

svn commit: r296431 - in releng/10.3: lib/libc/db/hash usr.bin/cap_mkdb usr.sbin/pwd_mkdb usr.sbin/services_mkdb

2016-03-06 Thread David Malone
Author: dwmalone
Date: Sun Mar  6 18:22:24 2016
New Revision: 296431
URL: https://svnweb.freebsd.org/changeset/base/296431

Log:
  Merge 296424 from stable/10 - contains the following changes to -current:
  
  r295924: Make sure that hash-based db files fsync befor closing/syncing.
  r295925: We no longer need O_SYNC pwd_mkd
  r295465: We no longer need O_SYNC on services_mkdb
  r295800: We no longer need O_SYNC on cap_mkdb
  
  Approved by:  re (marius)

Modified:
  releng/10.3/lib/libc/db/hash/hash.c
  releng/10.3/usr.bin/cap_mkdb/cap_mkdb.c
  releng/10.3/usr.sbin/pwd_mkdb/pwd_mkdb.c
  releng/10.3/usr.sbin/services_mkdb/services_mkdb.c
Directory Properties:
  releng/10.3/   (props changed)

Modified: releng/10.3/lib/libc/db/hash/hash.c
==
--- releng/10.3/lib/libc/db/hash/hash.c Sun Mar  6 17:34:21 2016
(r296430)
+++ releng/10.3/lib/libc/db/hash/hash.c Sun Mar  6 18:22:24 2016
(r296431)
@@ -422,8 +422,10 @@ hdestroy(HTAB *hashp)
if (hashp->tmp_buf)
free(hashp->tmp_buf);
 
-   if (hashp->fp != -1)
+   if (hashp->fp != -1) {
+   (void)_fsync(hashp->fp);
(void)_close(hashp->fp);
+   }
 
free(hashp);
 
@@ -458,6 +460,8 @@ hash_sync(const DB *dbp, u_int32_t flags
return (0);
if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
return (ERROR);
+   if (hashp->fp != -1 && _fsync(hashp->fp) != 0)
+   return (ERROR);
hashp->new_file = 0;
return (0);
 }

Modified: releng/10.3/usr.bin/cap_mkdb/cap_mkdb.c
==
--- releng/10.3/usr.bin/cap_mkdb/cap_mkdb.c Sun Mar  6 17:34:21 2016
(r296430)
+++ releng/10.3/usr.bin/cap_mkdb/cap_mkdb.c Sun Mar  6 18:22:24 2016
(r296431)
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
if ((capname = strdup(buf)) == NULL)
errx(1, "strdup failed");
-   if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR | O_SYNC,
+   if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,
DEFFILEMODE, DB_HASH, )) == NULL)
err(1, "%s", buf);
 

Modified: releng/10.3/usr.sbin/pwd_mkdb/pwd_mkdb.c
==
--- releng/10.3/usr.sbin/pwd_mkdb/pwd_mkdb.cSun Mar  6 17:34:21 2016
(r296430)
+++ releng/10.3/usr.sbin/pwd_mkdb/pwd_mkdb.cSun Mar  6 18:22:24 2016
(r296431)
@@ -225,14 +225,14 @@ main(int argc, char *argv[])
clean = FILE_INSECURE;
cp(buf2, buf, PERM_INSECURE);
dp = dbopen(buf,
-   O_RDWR|O_EXCL|O_SYNC, PERM_INSECURE, DB_HASH, );
+   O_RDWR|O_EXCL, PERM_INSECURE, DB_HASH, );
if (dp == NULL)
error(buf);
 
clean = FILE_SECURE;
cp(sbuf2, sbuf, PERM_SECURE);
sdp = dbopen(sbuf,
-   O_RDWR|O_EXCL|O_SYNC, PERM_SECURE, DB_HASH, );
+   O_RDWR|O_EXCL, PERM_SECURE, DB_HASH, );
if (sdp == NULL)
error(sbuf);
 
@@ -289,13 +289,13 @@ main(int argc, char *argv[])
method = 0;
} else {
dp = dbopen(buf,
-   O_RDWR|O_CREAT|O_EXCL|O_SYNC, PERM_INSECURE, DB_HASH, 
);
+   O_RDWR|O_CREAT|O_EXCL, PERM_INSECURE, DB_HASH, );
if (dp == NULL)
error(buf);
clean = FILE_INSECURE;
 
sdp = dbopen(sbuf,
-   O_RDWR|O_CREAT|O_EXCL|O_SYNC, PERM_SECURE, DB_HASH, 
);
+   O_RDWR|O_CREAT|O_EXCL, PERM_SECURE, DB_HASH, );
if (sdp == NULL)
error(sbuf);
clean = FILE_SECURE;

Modified: releng/10.3/usr.sbin/services_mkdb/services_mkdb.c
==
--- releng/10.3/usr.sbin/services_mkdb/services_mkdb.c  Sun Mar  6 17:34:21 
2016(r296430)
+++ releng/10.3/usr.sbin/services_mkdb/services_mkdb.c  Sun Mar  6 18:22:24 
2016(r296431)
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
err(1, "Cannot install exit handler");
 
(void)snprintf(tname, sizeof(tname), "%s.tmp", dbname);
-   db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL | O_SYNC,
+   db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL,
(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH), DB_HASH, );
if (!db)
err(1, "Error opening temporary database `%s'", tname);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r296430 - head

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Sun Mar  6 17:34:21 2016
New Revision: 296430
URL: https://svnweb.freebsd.org/changeset/base/296430

Log:
  Add an UPDATING entry about installing the boot loaders after installing
  the kernel, on amd64.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Sun Mar  6 17:24:02 2016(r296429)
+++ head/UPDATING   Sun Mar  6 17:34:21 2016(r296430)
@@ -31,6 +31,20 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20160306:
+   On amd64, clang 3.8.0 can now insert sections of type AMD64_UNWIND into
+   kernel modules.  Therefore, if you load any kernel modules at boot time,
+   please install the boot loaders after you install the kernel, but before
+   rebooting, e.g.:
+
+   make buildworld
+   make kernel KERNCONF=YOUR_KERNEL_HERE
+   make -C sys/boot install
+   
+
+   Then follow the usual steps, described in the General Notes section,
+   below.
+
 20160305:
Clang, llvm, lldb and compiler-rt have been upgraded to 3.8.0.  Please
see the 20141231 entry below for information about prerequisites and
___
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: r296429 - head/bin/sh

2016-03-06 Thread Jilles Tjoelker
Author: jilles
Date: Sun Mar  6 17:24:02 2016
New Revision: 296429
URL: https://svnweb.freebsd.org/changeset/base/296429

Log:
  sh: Fix some dead stores.
  
  Found by: clang static analyzer

Modified:
  head/bin/sh/expand.c
  head/bin/sh/histedit.c

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cSun Mar  6 15:57:43 2016(r296428)
+++ head/bin/sh/expand.cSun Mar  6 17:24:02 2016(r296429)
@@ -463,7 +463,6 @@ expbackq(union node *cmd, int quoted, in
argbackq = saveargbackq;
 
p = in.buf;
-   lastc = '\0';
nnl = 0;
if (!quoted && flag & EXP_SPLIT)
ifs = ifsset() ? ifsval() : " \t\n";
@@ -1288,7 +1287,7 @@ patmatch(const char *pattern, const char
if (wc == 0)
goto backtrack;
} else
-   wc = (unsigned char)*q++;
+   q++;
break;
case '*':
c = *p;

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Sun Mar  6 15:57:43 2016(r296428)
+++ head/bin/sh/histedit.c  Sun Mar  6 17:24:02 2016(r296429)
@@ -359,7 +359,7 @@ histcmd(int argc, char **argv __unused)
 * cursor, set it back to the current
 * entry.
 */
-   retval = history(hist, ,
+   history(hist, ,
H_NEXT_EVENT, oldhistnum);
}
} else
___
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: r296428 - head/sys/boot/common

2016-03-06 Thread Oliver Pinter
On 3/6/16, Dimitry Andric  wrote:
> On 06 Mar 2016, at 17:00, Oliver Pinter 
> wrote:
>>
>> On 3/6/16, Dimitry Andric  wrote:
>>> Author: dim
>>> Date: Sun Mar  6 15:57:43 2016
>>> New Revision: 296428
>>> URL: https://svnweb.freebsd.org/changeset/base/296428
>>>
>>> Log:
>>>  Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
>>>  the boot loader should not skip over these anymore while loading
>>> images.
>>>  Otherwise the kernel can still panic when it doesn't find the .eh_frame
>>>  section belonging to the .rela.eh_frame section.
>>>
>>>  Unfortunately this will require installing boot loaders from sys/boot
>>>  before attempting to boot with a new kernel.
>>
>> Could you please add a note about this to UPDATING file?
>
> I am a bit torn on this, because normally we always tell people to
> install the kernel first, reboot, then run make installworld (which also
> installs the boot loaders).
>
> However, in this case, people might depend on their boot loader loading
> modules which are required to make the system boot at all.  So if they
> happened to forget updating their boot loader first, a panic might be
> the result.
>
> I wonder what a failsafe and acceptable upgrade scenario is, in this
> case.  Normally the procedure is something like:
>
>   make buildworld
>   make buildkernel (with KERNCONF=whatever, if needed)
>   make installkernel (again with KERNCONF, if needed)
>   reboot (to single user, but cheating is possible usually)
>   mergemaster -p
>   make installworld
>
> This could maybe be modified to:
>
>   make buildworld
>   make buildkernel (with KERNCONF=whatever, if needed)
>   make installkernel (again with KERNCONF, if needed)
>   make -C sys/boot install
>   reboot (to single user, but cheating is possible usually)
>   mergemaster -p
>   make installworld
>
> E.g. insert the step which installs the boot loaders just after (or
> before) the step which installs the kernel.
>
> Is something like this acceptable as a one-time workaround, or maybe it
> is better in general, in case we ever add other new features to the boot
> loaders?

If I'm not wrong, the bootloaders are self-contained (using libstand,
and statically linked) same as the kernel, so they are not depend from
the other parts of the system, and they already lives under the
${SRCTOP}/sys with the kernel, so logically bootloader belong to the
kernel and it's acceptable from me to update them under the
installkernel phase. The question is with this method everything
working fine or this would break something?

>
> -Dimitry
>
>
___
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: r296428 - head/sys/boot/common

2016-03-06 Thread Dimitry Andric
On 06 Mar 2016, at 17:00, Oliver Pinter  wrote:
> 
> On 3/6/16, Dimitry Andric  wrote:
>> Author: dim
>> Date: Sun Mar  6 15:57:43 2016
>> New Revision: 296428
>> URL: https://svnweb.freebsd.org/changeset/base/296428
>> 
>> Log:
>>  Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
>>  the boot loader should not skip over these anymore while loading images.
>>  Otherwise the kernel can still panic when it doesn't find the .eh_frame
>>  section belonging to the .rela.eh_frame section.
>> 
>>  Unfortunately this will require installing boot loaders from sys/boot
>>  before attempting to boot with a new kernel.
> 
> Could you please add a note about this to UPDATING file?

I am a bit torn on this, because normally we always tell people to
install the kernel first, reboot, then run make installworld (which also
installs the boot loaders).

However, in this case, people might depend on their boot loader loading
modules which are required to make the system boot at all.  So if they
happened to forget updating their boot loader first, a panic might be
the result.

I wonder what a failsafe and acceptable upgrade scenario is, in this
case.  Normally the procedure is something like:

  make buildworld
  make buildkernel (with KERNCONF=whatever, if needed)
  make installkernel (again with KERNCONF, if needed)
  reboot (to single user, but cheating is possible usually)
  mergemaster -p
  make installworld

This could maybe be modified to:

  make buildworld
  make buildkernel (with KERNCONF=whatever, if needed)
  make installkernel (again with KERNCONF, if needed)
  make -C sys/boot install
  reboot (to single user, but cheating is possible usually)
  mergemaster -p
  make installworld

E.g. insert the step which installs the boot loaders just after (or
before) the step which installs the kernel.

Is something like this acceptable as a one-time workaround, or maybe it
is better in general, in case we ever add other new features to the boot
loaders?

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r296428 - head/sys/boot/common

2016-03-06 Thread Oliver Pinter
On 3/6/16, Dimitry Andric  wrote:
> Author: dim
> Date: Sun Mar  6 15:57:43 2016
> New Revision: 296428
> URL: https://svnweb.freebsd.org/changeset/base/296428
>
> Log:
>   Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
>   the boot loader should not skip over these anymore while loading images.
>   Otherwise the kernel can still panic when it doesn't find the .eh_frame
>   section belonging to the .rela.eh_frame section.
>
>   Unfortunately this will require installing boot loaders from sys/boot
>   before attempting to boot with a new kernel.

Could you please add a note about this to UPDATING file?

>
>   Reviewed by:kib
>   MFC after:  2 weeks
>   X-MFC-With: r296419
>
> Modified:
>   head/sys/boot/common/load_elf_obj.c
>
> Modified: head/sys/boot/common/load_elf_obj.c
> ==
> --- head/sys/boot/common/load_elf_obj.c   Sun Mar  6 14:37:49 2016
> (r296427)
> +++ head/sys/boot/common/load_elf_obj.c   Sun Mar  6 15:57:43 2016
> (r296428)
> @@ -221,6 +221,9 @@ __elfN(obj_loadimage)(struct preloaded_f
>   switch (shdr[i].sh_type) {
>   case SHT_PROGBITS:
>   case SHT_NOBITS:
> +#if defined(__i386__) || defined(__amd64__)
> + case SHT_AMD64_UNWIND:
> +#endif
>   lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
>   shdr[i].sh_addr = (Elf_Addr)lastaddr;
>   lastaddr += shdr[i].sh_size;
> ___
> svn-src-h...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
>
___
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: r296428 - head/sys/boot/common

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Sun Mar  6 15:57:43 2016
New Revision: 296428
URL: https://svnweb.freebsd.org/changeset/base/296428

Log:
  Since kernel modules can now contain sections of type SHT_AMD64_UNWIND,
  the boot loader should not skip over these anymore while loading images.
  Otherwise the kernel can still panic when it doesn't find the .eh_frame
  section belonging to the .rela.eh_frame section.
  
  Unfortunately this will require installing boot loaders from sys/boot
  before attempting to boot with a new kernel.
  
  Reviewed by:  kib
  MFC after:2 weeks
  X-MFC-With:   r296419

Modified:
  head/sys/boot/common/load_elf_obj.c

Modified: head/sys/boot/common/load_elf_obj.c
==
--- head/sys/boot/common/load_elf_obj.c Sun Mar  6 14:37:49 2016
(r296427)
+++ head/sys/boot/common/load_elf_obj.c Sun Mar  6 15:57:43 2016
(r296428)
@@ -221,6 +221,9 @@ __elfN(obj_loadimage)(struct preloaded_f
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#if defined(__i386__) || defined(__amd64__)
+   case SHT_AMD64_UNWIND:
+#endif
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);
shdr[i].sh_addr = (Elf_Addr)lastaddr;
lastaddr += shdr[i].sh_size;
___
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: r296427 - head

2016-03-06 Thread Dimitry Andric
Author: dim
Date: Sun Mar  6 14:37:49 2016
New Revision: 296427
URL: https://svnweb.freebsd.org/changeset/base/296427

Log:
  Add another libclang_rt library to ObsoleteFiles, so the enclosing
  directory can be removed completely.
  
  Noticed by:   Oliver Hartmann 

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Mar  6 11:41:08 2016(r296426)
+++ head/ObsoleteFiles.inc  Sun Mar  6 14:37:49 2016(r296427)
@@ -106,6 +106,8 @@ OLD_FILES+=usr/lib/clang/3.7.1/include/x
 OLD_FILES+=usr/lib/clang/3.7.1/include/xtestintrin.h
 OLD_DIRS+=usr/lib/clang/3.7.1/include
 OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-i386.a
+OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-preinit-i386.a
+OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-preinit-x86_64.a
 OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-x86_64.a
 OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan_cxx-i386.a
 OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan_cxx-x86_64.a
___
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: r296426 - in head/sys/arm: allwinner allwinner/a20 conf

2016-03-06 Thread Andrew Turner
Author: andrew
Date: Sun Mar  6 11:41:08 2016
New Revision: 296426
URL: https://svnweb.freebsd.org/changeset/base/296426

Log:
  Add SMP support for the Allwinner A31 and A31s. This updated the existing
  code for the A20 to use the new PLATFORM_SMP interface, and extends it to
  add support for the new SoCs allowing for both to coexist within the same
  kernel.
  
  Submitted by: Emmanuel Vadot 
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D5342

Added:
  head/sys/arm/allwinner/aw_mp.c
 - copied, changed from r296425, head/sys/arm/allwinner/a20/a20_mp.c
  head/sys/arm/allwinner/aw_mp.h   (contents, props changed)
Deleted:
  head/sys/arm/allwinner/a20/a20_mp.c
Modified:
  head/sys/arm/allwinner/a20/files.a20
  head/sys/arm/allwinner/allwinner_machdep.c
  head/sys/arm/conf/A20

Modified: head/sys/arm/allwinner/a20/files.a20
==
--- head/sys/arm/allwinner/a20/files.a20Sun Mar  6 08:52:03 2016
(r296425)
+++ head/sys/arm/allwinner/a20/files.a20Sun Mar  6 11:41:08 2016
(r296426)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
 arm/allwinner/a20/a20_padconf.cstandard
-arm/allwinner/a20/a20_mp.c optionalsmp
+arm/allwinner/aw_mp.c  optionalsmp
 arm/allwinner/a20/a20_if_dwc.c optionaldwc

Modified: head/sys/arm/allwinner/allwinner_machdep.c
==
--- head/sys/arm/allwinner/allwinner_machdep.c  Sun Mar  6 08:52:03 2016
(r296425)
+++ head/sys/arm/allwinner/allwinner_machdep.c  Sun Mar  6 11:41:08 2016
(r296426)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -152,6 +153,10 @@ static platform_method_t a20_methods[] =
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,a20_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 
@@ -160,6 +165,10 @@ static platform_method_t a31_methods[] =
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,a31_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 
@@ -168,6 +177,10 @@ static platform_method_t a31s_methods[] 
PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
 
+#ifdef SMP
+   PLATFORMMETHOD(platform_mp_start_ap,a31_mp_start_ap),
+   PLATFORMMETHOD(platform_mp_setmaxid,aw_mp_setmaxid),
+#endif
PLATFORMMETHOD_END,
 };
 

Copied and modified: head/sys/arm/allwinner/aw_mp.c (from r296425, 
head/sys/arm/allwinner/a20/a20_mp.c)
==
--- head/sys/arm/allwinner/a20/a20_mp.c Sun Mar  6 08:52:03 2016
(r296425, copy source)
+++ head/sys/arm/allwinner/aw_mp.c  Sun Mar  6 11:41:08 2016
(r296426)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2014 Ganbold Tsagaankhuu 
+ * Copyright (c) 2016 Emmanuel Vadot 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,53 +39,69 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
-#defineCPUCFG_BASE 0x01c25c00
+#include 
+#include 
+
+/* Register for all dual-core SoC */
+#defineA20_CPUCFG_BASE 0x01c25c00
+/* Register for all quad-core SoC */
+#defineCPUCFG_BASE 0x01f01c00
 #defineCPUCFG_SIZE 0x400
+#definePRCM_BASE   0x01f01400
+#definePRCM_SIZE   0x800
+
+#defineCPU_OFFSET  0x40
+#defineCPU_OFFSET_CTL  0x04
+#defineCPU_OFFSET_STATUS   0x08
+#defineCPU_RST_CTL(cpuid)  ((cpuid + 1) * CPU_OFFSET)
+#defineCPU_CTL(cpuid)  (((cpuid + 1) * CPU_OFFSET) + 
CPU_OFFSET_CTL)
+#defineCPU_STATUS(cpuid)   (((cpuid + 1) * CPU_OFFSET) + 
CPU_OFFSET_STATUS)
+
+#defineCPU_RESET   (1 << 0)
+#defineCPU_CORE_RESET  (1 << 1)
 
-#defineCPU0_RST_CTL0x40
-#defineCPU0_CTL0x44
-#defineCPU0_STATUS 0x48
-#defineCPU1_RST_CTL0x80
-#defineCPU1_CTL0x84
-#defineCPU1_STATUS 0x88
 #defineCPUCFG_GENCTL   0x184
 #defineCPUCFG_P_REG0   0x1a4
-#define   

svn commit: r296425 - stable/10/sbin/ifconfig

2016-03-06 Thread Kristof Provost
Author: kp
Date: Sun Mar  6 08:52:03 2016
New Revision: 296425
URL: https://svnweb.freebsd.org/changeset/base/296425

Log:
  MFC r295836:
  ifconfig(8): can't use 'name' or 'description' when creating interface with 
auto numbering
  
  If one does 'ifconfig tap create name blah', it will return error because the
  'name' command doesn't properly populate the request sent to ioctl(...). The
  'description' command has the same bug, and is also fixed with this patch.
  
  If one does 'ifconfig tap create mtu 9000 name blah', it DOES work, but 'tap0'
  (or other sequence number) is echoed, instead of the expected 'blah'. 
(assuming
  the name change actually succeeded)
  
  PR:   206876
  Submitted by:   Marie Helene Kvello-Aune 
  Differential Revision:  https://reviews.freebsd.org/D5341

Modified:
  stable/10/sbin/ifconfig/ifclone.c
  stable/10/sbin/ifconfig/ifconfig.c
  stable/10/sbin/ifconfig/ifconfig.h

Modified: stable/10/sbin/ifconfig/ifclone.c
==
--- stable/10/sbin/ifconfig/ifclone.c   Sun Mar  6 08:40:21 2016
(r296424)
+++ stable/10/sbin/ifconfig/ifclone.c   Sun Mar  6 08:52:03 2016
(r296425)
@@ -144,11 +144,12 @@ ifclonecreate(int s, void *arg)
}
 
/*
-* If we get a different name back than we put in, print it.
+* If we get a different name back than we put in, update record and
+* indicate it should be printed later.
 */
if (strncmp(name, ifr.ifr_name, sizeof(name)) != 0) {
strlcpy(name, ifr.ifr_name, sizeof(name));
-   printf("%s\n", name);
+   printifname = 1;
}
 }
 

Modified: stable/10/sbin/ifconfig/ifconfig.c
==
--- stable/10/sbin/ifconfig/ifconfig.c  Sun Mar  6 08:40:21 2016
(r296424)
+++ stable/10/sbin/ifconfig/ifconfig.c  Sun Mar  6 08:52:03 2016
(r296425)
@@ -93,6 +93,7 @@ int   clearaddr;
 intnewaddr = 1;
 intverbose;
 intnoload;
+intprintifname = 0;
 
 intsupmedia = 0;
 intprintkeys = 0;  /* Print keying material for interfaces. */
@@ -108,6 +109,8 @@ static struct afswtch *af_getbyname(cons
 static struct afswtch *af_getbyfamily(int af);
 static void af_other_status(int);
 
+void printifnamemaybe(void);
+
 static struct option *opts = NULL;
 
 void
@@ -141,6 +144,12 @@ usage(void)
exit(1);
 }
 
+void printifnamemaybe()
+{
+   if (printifname)
+   printf("%s\n", name);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -156,6 +165,12 @@ main(int argc, char *argv[])
size_t iflen;
 
all = downonly = uponly = namesonly = noload = verbose = 0;
+   
+   /*
+* Ensure we print interface name when expected to,
+* even if we terminate early due to error.
+*/
+   atexit(printifnamemaybe);
 
/* Parse leading line options */
strlcpy(options, "adklmnuv", sizeof(options));
@@ -856,6 +871,8 @@ setifname(const char *val, int dummy __u
 const struct afswtch *afp)
 {
char *newname;
+   
+   strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
 
newname = strdup(val);
if (newname == NULL)
@@ -865,6 +882,7 @@ setifname(const char *val, int dummy __u
free(newname);
err(1, "ioctl SIOCSIFNAME (set name)");
}
+   printifname = 1;
strlcpy(name, newname, sizeof(name));
free(newname);
 }
@@ -876,6 +894,8 @@ setifdescr(const char *val, int dummy __
 {
char *newdescr;
 
+   strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+   
ifr.ifr_buffer.length = strlen(val) + 1;
if (ifr.ifr_buffer.length == 1) {
ifr.ifr_buffer.buffer = newdescr = NULL;

Modified: stable/10/sbin/ifconfig/ifconfig.h
==
--- stable/10/sbin/ifconfig/ifconfig.h  Sun Mar  6 08:40:21 2016
(r296424)
+++ stable/10/sbin/ifconfig/ifconfig.h  Sun Mar  6 08:52:03 2016
(r296425)
@@ -133,6 +133,7 @@ extern  int supmedia;
 extern int printkeys;
 extern int newaddr;
 extern int verbose;
+extern int printifname;
 
 void   setifcap(const char *, int value, int s, const struct afswtch *);
 
___
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: r296424 - in stable/10: lib/libc/db/hash usr.bin/cap_mkdb usr.sbin/pwd_mkdb usr.sbin/services_mkdb

2016-03-06 Thread David Malone
Author: dwmalone
Date: Sun Mar  6 08:40:21 2016
New Revision: 296424
URL: https://svnweb.freebsd.org/changeset/base/296424

Log:
  MFC:
  r295924: Make sure that hash-based db files fsync befor closing/syncing.
  r295925: We no longer need O_SYNC pwd_mkd
  r295465: We no longer need O_SYNC on services_mkdb
  r295800: We no longer need O_SYNC on cap_mkdb
  
  This should improve the performance of building db files.

Modified:
  stable/10/lib/libc/db/hash/hash.c
  stable/10/usr.bin/cap_mkdb/cap_mkdb.c
  stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c
  stable/10/usr.sbin/services_mkdb/services_mkdb.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/db/hash/hash.c
==
--- stable/10/lib/libc/db/hash/hash.c   Sun Mar  6 04:38:08 2016
(r296423)
+++ stable/10/lib/libc/db/hash/hash.c   Sun Mar  6 08:40:21 2016
(r296424)
@@ -422,8 +422,10 @@ hdestroy(HTAB *hashp)
if (hashp->tmp_buf)
free(hashp->tmp_buf);
 
-   if (hashp->fp != -1)
+   if (hashp->fp != -1) {
+   (void)_fsync(hashp->fp);
(void)_close(hashp->fp);
+   }
 
free(hashp);
 
@@ -458,6 +460,8 @@ hash_sync(const DB *dbp, u_int32_t flags
return (0);
if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
return (ERROR);
+   if (hashp->fp != -1 && _fsync(hashp->fp) != 0)
+   return (ERROR);
hashp->new_file = 0;
return (0);
 }

Modified: stable/10/usr.bin/cap_mkdb/cap_mkdb.c
==
--- stable/10/usr.bin/cap_mkdb/cap_mkdb.c   Sun Mar  6 04:38:08 2016
(r296423)
+++ stable/10/usr.bin/cap_mkdb/cap_mkdb.c   Sun Mar  6 08:40:21 2016
(r296424)
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
if ((capname = strdup(buf)) == NULL)
errx(1, "strdup failed");
-   if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR | O_SYNC,
+   if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,
DEFFILEMODE, DB_HASH, )) == NULL)
err(1, "%s", buf);
 

Modified: stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c
==
--- stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c  Sun Mar  6 04:38:08 2016
(r296423)
+++ stable/10/usr.sbin/pwd_mkdb/pwd_mkdb.c  Sun Mar  6 08:40:21 2016
(r296424)
@@ -225,14 +225,14 @@ main(int argc, char *argv[])
clean = FILE_INSECURE;
cp(buf2, buf, PERM_INSECURE);
dp = dbopen(buf,
-   O_RDWR|O_EXCL|O_SYNC, PERM_INSECURE, DB_HASH, );
+   O_RDWR|O_EXCL, PERM_INSECURE, DB_HASH, );
if (dp == NULL)
error(buf);
 
clean = FILE_SECURE;
cp(sbuf2, sbuf, PERM_SECURE);
sdp = dbopen(sbuf,
-   O_RDWR|O_EXCL|O_SYNC, PERM_SECURE, DB_HASH, );
+   O_RDWR|O_EXCL, PERM_SECURE, DB_HASH, );
if (sdp == NULL)
error(sbuf);
 
@@ -289,13 +289,13 @@ main(int argc, char *argv[])
method = 0;
} else {
dp = dbopen(buf,
-   O_RDWR|O_CREAT|O_EXCL|O_SYNC, PERM_INSECURE, DB_HASH, 
);
+   O_RDWR|O_CREAT|O_EXCL, PERM_INSECURE, DB_HASH, );
if (dp == NULL)
error(buf);
clean = FILE_INSECURE;
 
sdp = dbopen(sbuf,
-   O_RDWR|O_CREAT|O_EXCL|O_SYNC, PERM_SECURE, DB_HASH, 
);
+   O_RDWR|O_CREAT|O_EXCL, PERM_SECURE, DB_HASH, );
if (sdp == NULL)
error(sbuf);
clean = FILE_SECURE;

Modified: stable/10/usr.sbin/services_mkdb/services_mkdb.c
==
--- stable/10/usr.sbin/services_mkdb/services_mkdb.cSun Mar  6 04:38:08 
2016(r296423)
+++ stable/10/usr.sbin/services_mkdb/services_mkdb.cSun Mar  6 08:40:21 
2016(r296424)
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
err(1, "Cannot install exit handler");
 
(void)snprintf(tname, sizeof(tname), "%s.tmp", dbname);
-   db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL | O_SYNC,
+   db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL,
(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH), DB_HASH, );
if (!db)
err(1, "Error opening temporary database `%s'", tname);
___
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"