Re: CVS commit: othersrc/crypto/external/bsd/ssss/dist/src/libssss

2012-02-17 Thread Christos Zoulas
In article 20120217021118.ca61c17...@cvs.netbsd.org,
Alistair G. Crooks source-changes-d@NetBSD.org wrote:
+{
+  if ((share-io.base = calloc(1, size)) == NULL) {
+  (void) fprintf(stderr, allocate: can't calloc %zu\n, size);

warn() + __func__ instead?

christos



testing new postinstall check/fix pwd_mkdb

2012-02-17 Thread Alan Barrett
Is there anybody who has old versions of /etc/pwd.db 
and/etc/spwd.db (created under NetBSD-5 or earlier), on a system 
running the netbsd-6 branch?  Can you test whether postinstall 
check pwd_mkdb and postinstall fix pwd_pkdb work with the 
-current version of postinstall?


   # verify that you have an old pwd.db
   #
   # output should be either an error message,
   #db: Unknown key `VERSION\0x'
   # or lots of zeros:
   #VERSION\000 \000\000\000\000
   #
   db -N -Sb -Ub -To hash /etc/pwd.db 'VERSION\0';

   # obtain a new postinstall
   #
   cd src/usr.sbin/postinstall;
   cvs update -p -r1.130 postinstall postinstall.new;

   # run the new postinstall.
   #
   sh ./postinstall.new check pwd_mkdb;
   sh ./postinstall.new fix pwd_mkdb;

   # verify that your pwd.db has been updated
   #
   # output should be version 1, in big-endian or little-endian 32 bits:
   #VERSION\000 \001\000\000\000
   # or
   #VERSION\000 \000\000\000\001
   #
   db -N -Sb -Ub -To hash /etc/pwd.db 'VERSION\0';

--apb (Alan Barrett)


Re: CVS commit: src/usr.sbin/crash

2012-02-17 Thread Martin Husemann
On Fri, Feb 17, 2012 at 02:15:33PM +, Christos Zoulas wrote:
 I'd rather re-organize the contents of the files so that sparc64 is not
 different than everyone else.

I just needed a quick build fix - feel free to rename/move...

Martin


Re: CVS commit: othersrc/crypto/external/bsd/ssss/dist/src/libssss

2012-02-17 Thread Alistair Crooks
On Fri, Feb 17, 2012 at 02:18:00PM +, Christos Zoulas wrote:
 In article 20120217021118.ca61c17...@cvs.netbsd.org,
 Alistair G. Crooks source-changes-d@NetBSD.org wrote:
 +{
 +if ((share-io.base = calloc(1, size)) == NULL) {
 +(void) fprintf(stderr, allocate: can't calloc %zu\n, size);
 
 warn() + __func__ instead?

Indeed, thanks - I'm about to change lib on a fairly large scale RSN,
so I'll do the warn() pass then.

Thanks once again,
Alistair


Re: CVS commit: src/lib/libc/stdio

2012-02-17 Thread NONAKA Kimihiro
Hi,

2012/2/18 Christos Zoulas chris...@netbsd.org:

 Module Name:    src
 Committed By:   christos
 Date:           Fri Feb 17 19:57:53 UTC 2012

 Modified Files:
        src/lib/libc/stdio: vfwprintf.c

 Log Message:
 Fix: CVE-2012-0864 fprintf() positional argument abuse.
 Described in: http://www.phrack.org/issues.html?issue=67id=9#article
 Reported by Stefan Cornelius / Red Hat Security Response Team

 - convert internal positional arguments bookkeeping from int to size_t
 - provide overflow protection in positional argument spec
 - convert loops to memset
 - fix memory leaks
 - limit positional argument stack offset to the number of arguments required
  by the printf to avoid coredump from va_arg() exhaustion.

#   compile  libc/vfprintf.ln
CC=/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-gcc
/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-lint -chapbxzFS -w -X
272 -d /home/snapshot/20120217/root/i386/usr/include  -D_LIBC
-DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -DHESIOD -DINET6 -DNLS -DYP
-I/usr/src/lib/libc/include -I/usr/src/lib/libc -I/usr/src/sys
-I/usr/src/lib/libc/compat/../locale -I/usr/src/lib/libc/compat/stdlib
-I/usr/src/lib/libc/compat/../stdlib
-I/usr/src/lib/libc/../../common/lib/libc/quad
-I/usr/src/lib/libc/../../common/lib/libc/string
-I/usr/src/lib/libc/../../common/lib/libc/arch/i386/string
-D__DBINTERFACE_PRIVATE -I/usr/src/libexec/ld.elf_so
-I/usr/src/lib/libc/dlfcn -I/usr/src/lib/libc/gdtoa -DNO_FENV_H
-I/usr/src/lib/libc/arch/i386/gdtoa -DWITH_RUNE -I/usr/src/lib/libc
-DPOSIX_MISTAKE -DCOMPAT__RES -DUSE_POLL -DPORTMAP -DWIDE_DOUBLE
-DALL_STATE -DUSG_COMPAT -D_FORTIFY_SOURCE=2-i
/usr/src/lib/libc/stdio/vfprintf.c
/usr/src/lib/libc/stdio/vfwprintf.c(1934): warning: n unused in
function __grow_type_table [192]

*** Failed target:  vfprintf.ln
*** Failed command:
CC=/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-gcc
/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-lint -chapbxzFS -w -X
272 -d /home/snapshot/20120217/root/i386/usr/include -D_LIBC
-DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -DHESIOD -DINET6 -DNLS -DYP
-I/usr/src/lib/libc/include -I/usr/src/lib/libc -I/usr/src/sys
-I/usr/src/lib/libc/compat/../locale -I/usr/src/lib/libc/compat/stdlib
-I/usr/src/lib/libc/compat/../stdlib
-I/usr/src/lib/libc/../../common/lib/libc/quad
-I/usr/src/lib/libc/../../common/lib/libc/string
-I/usr/src/lib/libc/../../common/lib/libc/arch/i386/string
-D__DBINTERFACE_PRIVATE -I/usr/src/libexec/ld.elf_so
-I/usr/src/lib/libc/dlfcn -I/usr/src/lib/libc/gdtoa -DNO_FENV_H
-I/usr/src/lib/libc/arch/i386/gdtoa -DWITH_RUNE -I/usr/src/lib/libc
-DPOSIX_MISTAKE -DCOMPAT__RES -DUSE_POLL -DPORTMAP -DWIDE_DOUBLE
-DALL_STATE -DUSG_COMPAT -D_FORTIFY_SOURCE=2 -i
/usr/src/lib/libc/stdio/vfprintf.c
*** Error code 1

Stop.
nbmake: stopped in /usr/src/lib/libc


Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src

2012-02-17 Thread Julio Merino

On 2/17/12 5:43 PM, Matt Thomas wrote:


On Feb 17, 2012, at 2:36 PM, Julio Merino wrote:


Module Name:src
Committed By:   jmmv
Date:   Fri Feb 17 22:36:50 UTC 2012

Modified Files:
src/distrib/sets/lists/tests: module.mi
src/tests/modules: Makefile
Added Files:
src/tests/modules: t_abi_uvm.sh
src/tests/modules/k_uvm: Makefile k_uvm.c

Log Message:
Add a test to ensure that PAGE_SIZE is available in kernel modules.
This test reproduces the error condition in PR port-macppc/46041 and
therefore it is an xfail in this particular platform.


I explicitly made PAGE_SIZE unavailable for powerpc.  This was part
of having one consistent view for OEA,BOOKE,IBM4XX all which use
different page size.  So you can't rely on PAGE_SIZE.


So the modules are broken on purpose?


Re: CVS commit: src

2012-02-17 Thread Julio Merino

On 2/17/12 5:45 PM, Matt Thomas wrote:


On Feb 17, 2012, at 2:43 PM, Julio Merino wrote:


On 2/17/12 5:43 PM, Matt Thomas wrote:


On Feb 17, 2012, at 2:36 PM, Julio Merino wrote:


Module Name:src
Committed By:   jmmv
Date:   Fri Feb 17 22:36:50 UTC 2012

Modified Files:
src/distrib/sets/lists/tests: module.mi
src/tests/modules: Makefile
Added Files:
src/tests/modules: t_abi_uvm.sh
src/tests/modules/k_uvm: Makefile k_uvm.c

Log Message:
Add a test to ensure that PAGE_SIZE is available in kernel modules.
This test reproduces the error condition in PR port-macppc/46041 and
therefore it is an xfail in this particular platform.


I explicitly made PAGE_SIZE unavailable for powerpc.  This was part
of having one consistent view for OEA,BOOKE,IBM4XX all which use
different page size.  So you can't rely on PAGE_SIZE.


So the modules are broken on purpose?


Yes.


Interesting.  If that's the case, shouldn't we break PAGE_SIZE for all 
platforms and keep things consistent?


The modules that are broken (see the referenced PR for a list) fail due 
to a missing uvmexp_pagesize symbol (*not* PAGE_SIZE itself), which I 
assumed was there to prevent depending on the PAGE_SIZE compile-time 
constant.  I understand this information not being statically-available 
because of variable-page sizes in these platforms.


Re: CVS commit: src

2012-02-17 Thread Julio Merino

On 2/17/12 5:58 PM, Matt Thomas wrote:


On Feb 17, 2012, at 2:54 PM, Julio Merino wrote:


On 2/17/12 5:45 PM, Matt Thomas wrote:


On Feb 17, 2012, at 2:43 PM, Julio Merino wrote:

So the modules are broken on purpose?


Yes.


Interesting.  If that's the case, shouldn't we break PAGE_SIZE for all 
platforms and keep things consistent?


For those with variable page sizes (like powerpc or mips), yes.


I was asking about *all* platforms regardless of whether they have 
static or variable page sizes.  Keeping this inconsistent seems like a 
very easy way of writing non-portable code...



The modules that are broken (see the referenced PR for a list) fail due to a 
missing uvmexp_pagesize symbol (*not* PAGE_SIZE itself), which I assumed was 
there to prevent depending on the PAGE_SIZE compile-time constant.  I 
understand this information not being statically-available because of 
variable-page sizes in these platforms.


properly should use uvmexp.pagesize instead.


Aha, I see.  Does it make sense to keep the test after renaming 
PAGE_SIZE to uvmexp.pagesize?  It's a public symbol after all and we 
really should have tests for these, I think.


Do we need to go over the broken modules one by one and replace 
PAGE_SIZE with uvmexp.pagesize?  (I'm expecting this won't be as easy as 
it sounds due to preprocessor conditionals et. al.)


Thanks!


re: CVS commit: src

2012-02-17 Thread matthew green

  Module Name:src
  Committed By:   jmmv
  Date:   Fri Feb 17 22:36:50 UTC 2012
  
  Modified Files:
  src/distrib/sets/lists/tests: module.mi
  src/tests/modules: Makefile
  Added Files:
  src/tests/modules: t_abi_uvm.sh
  src/tests/modules/k_uvm: Makefile k_uvm.c
  
  Log Message:
  Add a test to ensure that PAGE_SIZE is available in kernel modules.
  This test reproduces the error condition in PR port-macppc/46041 and
  therefore it is an xfail in this particular platform.
 
 I explicitly made PAGE_SIZE unavailable for powerpc.  This was part
 of having one consistent view for OEA,BOOKE,IBM4XX all which use
 different page size.  So you can't rely on PAGE_SIZE.

why can't you define it to a variable like sparc does?


.mrg.


Re: CVS commit: src

2012-02-17 Thread Matt Thomas

On Feb 17, 2012, at 3:02 PM, Julio Merino wrote:

 On 2/17/12 5:58 PM, Matt Thomas wrote:
 
 On Feb 17, 2012, at 2:54 PM, Julio Merino wrote:
 
 On 2/17/12 5:45 PM, Matt Thomas wrote:
 
 On Feb 17, 2012, at 2:43 PM, Julio Merino wrote:
 So the modules are broken on purpose?
 
 Yes.
 
 Interesting.  If that's the case, shouldn't we break PAGE_SIZE for all 
 platforms and keep things consistent?
 
 For those with variable page sizes (like powerpc or mips), yes.
 
 I was asking about *all* platforms regardless of whether they have static or 
 variable page sizes.  Keeping this inconsistent seems like a very easy way of 
 writing non-portable code...

Again they should use PAGE_SIZE which can be constant or not.
No reason for a non-constant PAGE_SIZE on alpha or vax which has fixed sized 
pages.

 The modules that are broken (see the referenced PR for a list) fail due to 
 a missing uvmexp_pagesize symbol (*not* PAGE_SIZE itself), which I assumed 
 was there to prevent depending on the PAGE_SIZE compile-time constant.  I 
 understand this information not being statically-available because of 
 variable-page sizes in these platforms.
 
 properly should use uvmexp.pagesize instead.
 
 Aha, I see.  Does it make sense to keep the test after renaming PAGE_SIZE to 
 uvmexp.pagesize?  It's a public symbol after all and we really should have 
 tests for these, I think.
 
 Do we need to go over the broken modules one by one and replace PAGE_SIZE 
 with uvmexp.pagesize?  (I'm expecting this won't be as easy as it sounds due 
 to preprocessor conditionals et. al.)

They should still use PAGE_SIZE which should evaluate to uvmexp.pagesize

Re: CVS commit: src

2012-02-17 Thread Matt Thomas

On Feb 17, 2012, at 2:54 PM, Julio Merino wrote:

 On 2/17/12 5:45 PM, Matt Thomas wrote:
 
 On Feb 17, 2012, at 2:43 PM, Julio Merino wrote:
 
 On 2/17/12 5:43 PM, Matt Thomas wrote:
 
 On Feb 17, 2012, at 2:36 PM, Julio Merino wrote:
 
 Module Name:  src
 Committed By: jmmv
 Date: Fri Feb 17 22:36:50 UTC 2012
 
 Modified Files:
   src/distrib/sets/lists/tests: module.mi
   src/tests/modules: Makefile
 Added Files:
   src/tests/modules: t_abi_uvm.sh
   src/tests/modules/k_uvm: Makefile k_uvm.c
 
 Log Message:
 Add a test to ensure that PAGE_SIZE is available in kernel modules.
 This test reproduces the error condition in PR port-macppc/46041 and
 therefore it is an xfail in this particular platform.
 
 I explicitly made PAGE_SIZE unavailable for powerpc.  This was part
 of having one consistent view for OEA,BOOKE,IBM4XX all which use
 different page size.  So you can't rely on PAGE_SIZE.
 
 So the modules are broken on purpose?
 
 Yes.
 
 Interesting.  If that's the case, shouldn't we break PAGE_SIZE for all 
 platforms and keep things consistent?

For those with variable page sizes (like powerpc or mips), yes.

 The modules that are broken (see the referenced PR for a list) fail due to a 
 missing uvmexp_pagesize symbol (*not* PAGE_SIZE itself), which I assumed was 
 there to prevent depending on the PAGE_SIZE compile-time constant.  I 
 understand this information not being statically-available because of 
 variable-page sizes in these platforms.

properly should use uvmexp.pagesize instead.

Re: CVS commit: src

2012-02-17 Thread Julio Merino

On 2/17/12 7:11 PM, Julio Merino wrote:

On 2/17/12 6:42 PM, Matt Thomas wrote:


On Feb 17, 2012, at 3:11 PM, Julio Merino wrote:


On 2/17/12 6:06 PM, Matt Thomas wrote:


On Feb 17, 2012, at 3:02 PM, Julio Merino wrote:

Aha, I see. Does it make sense to keep the test after renaming
PAGE_SIZE to uvmexp.pagesize? It's a public symbol after all and we
really should have tests for these, I think.

Do we need to go over the broken modules one by one and replace
PAGE_SIZE with uvmexp.pagesize? (I'm expecting this won't be as
easy as it sounds due to preprocessor conditionals et. al.)


They should still use PAGE_SIZE which should evaluate to
uvmexp.pagesize


Now you lost me. You started saying that PAGE_SIZE is explicitly not
available, and now you say that the modules have to use PAGE_SIZE?

The problem is that PAGE_SIZE is NOT being evaluated to
uvmexp.pagesize as you mention. It's being evaluated to
uvmexp_pagesize, which does not exist and thus causes the module to
not load. And that's what this test is all about.


Hmmm. I think uvmexp_pagesize, etal is there to avoid needed uvmexp
defined.

The problem was:

--- uvm_param.h 29 Nov 2011 07:43:54 - 1.26
+++ uvm_param.h 17 Feb 2012 23:40:50 -
@@ -134,7 +134,7 @@
* If MIN_PAGE_SIZE and MAX_PAGE_SIZE are not equal, then we must use
* non-constant PAGE_SIZE, et al for LKMs.
*/
-#if (MIN_PAGE_SIZE != MAX_PAGE_SIZE) defined(_LKM)
+#if (MIN_PAGE_SIZE != MAX_PAGE_SIZE) (defined(_LKM) ||
defined(MODULAR))
#undef PAGE_SIZE
#undef PAGE_MASK
#undef PAGE_SHIFT



I have applied this patch and rebuilt the affected test module... and it
still won't load. Wasn't that supposed to be _MODULE instead of MODULAR?


Oh, but even doing that change, the module won't load either.  PAGE_SIZE 
still ends up being defined as uvmexp_pagesize... which I believe is 
correct, right? because the size must be represented as a variable... 
but that variable is not available in the built kernel.


Re: CVS commit: src

2012-02-17 Thread Masao Uebayashi
As discussed somewhere some time ago, I think PAGE_SIZE and other
constants should be provided via sysconf(9).

If you don't like indirection, you'd use pre-link binaries (== static kernel).

On Sat, Feb 18, 2012 at 9:14 AM, Julio Merino j...@julipedia.org wrote:
 On 2/17/12 7:11 PM, Julio Merino wrote:

 On 2/17/12 6:42 PM, Matt Thomas wrote:


 On Feb 17, 2012, at 3:11 PM, Julio Merino wrote:

 On 2/17/12 6:06 PM, Matt Thomas wrote:


 On Feb 17, 2012, at 3:02 PM, Julio Merino wrote:

 Aha, I see. Does it make sense to keep the test after renaming
 PAGE_SIZE to uvmexp.pagesize? It's a public symbol after all and we
 really should have tests for these, I think.

 Do we need to go over the broken modules one by one and replace
 PAGE_SIZE with uvmexp.pagesize? (I'm expecting this won't be as
 easy as it sounds due to preprocessor conditionals et. al.)


 They should still use PAGE_SIZE which should evaluate to
 uvmexp.pagesize


 Now you lost me. You started saying that PAGE_SIZE is explicitly not
 available, and now you say that the modules have to use PAGE_SIZE?

 The problem is that PAGE_SIZE is NOT being evaluated to
 uvmexp.pagesize as you mention. It's being evaluated to
 uvmexp_pagesize, which does not exist and thus causes the module to
 not load. And that's what this test is all about.


 Hmmm. I think uvmexp_pagesize, etal is there to avoid needed uvmexp
 defined.

 The problem was:

 --- uvm_param.h 29 Nov 2011 07:43:54 - 1.26
 +++ uvm_param.h 17 Feb 2012 23:40:50 -
 @@ -134,7 +134,7 @@
 * If MIN_PAGE_SIZE and MAX_PAGE_SIZE are not equal, then we must use
 * non-constant PAGE_SIZE, et al for LKMs.
 */
 -#if (MIN_PAGE_SIZE != MAX_PAGE_SIZE) defined(_LKM)
 +#if (MIN_PAGE_SIZE != MAX_PAGE_SIZE) (defined(_LKM) ||
 defined(MODULAR))
 #undef PAGE_SIZE
 #undef PAGE_MASK
 #undef PAGE_SHIFT



 I have applied this patch and rebuilt the affected test module... and it
 still won't load. Wasn't that supposed to be _MODULE instead of MODULAR?


 Oh, but even doing that change, the module won't load either.  PAGE_SIZE
 still ends up being defined as uvmexp_pagesize... which I believe is
 correct, right? because the size must be represented as a variable... but
 that variable is not available in the built kernel.