Re: implement CLOCK_VIRTUAL and CLOCK_PROF

2014-10-16 Thread Joerg Jung

 Am 16.10.2014 um 06:50 schrieb Philip Guenther guent...@gmail.com:
 
 On Wed, Oct 15, 2014 at 2:08 PM, Todd C. Miller
 todd.mil...@courtesan.com wrote:
 On Wed, 15 Oct 2014 21:53:47 +0200, Alexandre Ratchov wrote:
 On Wed, Oct 15, 2014 at 11:37:26AM -0600, Todd C. Miller wrote:
 Since this came up in another thread.  Trivial implementations of
 CLOCK_VIRTUAL and CLOCK_PROF, modeled after what FreeBSD does.
 
 out of curiousity, what program needs these?
 
 Possibly none, but we currently define CLOCK_VIRTUAL but don't
 actually support it.
 
 IMO we should just delete CLOCK_VIRTUAL from sys/_time.h and clock_gettime(2).

I agree.



LibreSSL 2.1.1 released.

2014-10-16 Thread Bob Beck
We have released LibreSSL 2.1.1- which should be arriving in the
LIbreSSL directory of an OpenBSD mirror near you very soon.

This release includes:

* Address POODLE attack by disabling SSLv3 by default
* Fix Eliptical Curve cipher selection bug
 (https://github.com/libressl-portable/portable/issues/35)

As well as continued ongoing fixes as we proactively change the
codebase to reflect modern safe programming practices. The success of
this is reflected in the fact that LibreSSL was not vulnerable to the
two memory leak issues released on OpenSSL Tuesday - They were in
fact initially
fixed in LibreSSL.

As noted before, we welcome feedback from the broader community.

Enjoy,

-Bob



Re: implement CLOCK_VIRTUAL and CLOCK_PROF

2014-10-16 Thread Todd C. Miller
On Wed, 15 Oct 2014 21:50:44 -0700, Philip Guenther wrote:

 IMO we should just delete CLOCK_VIRTUAL from sys/_time.h and clock_gettime(2)

Easy enough.

 - todd

Index: sys/sys/_time.h
===
RCS file: /home/cvs/openbsd/src/sys/sys/_time.h,v
retrieving revision 1.6
diff -u -r1.6 _time.h
--- sys/sys/_time.h 6 Oct 2013 01:27:49 -   1.6
+++ sys/sys/_time.h 16 Oct 2014 12:47:02 -
@@ -33,7 +33,6 @@
 #define _SYS__TIME_H_
 
 #define CLOCK_REALTIME 0
-#define CLOCK_VIRTUAL  1
 #define CLOCK_PROCESS_CPUTIME_ID   2
 #define CLOCK_MONOTONIC3
 #define CLOCK_THREAD_CPUTIME_ID4
Index: lib/libc/sys/clock_gettime.2
===
RCS file: /home/cvs/openbsd/src/lib/libc/sys/clock_gettime.2,v
retrieving revision 1.24
diff -u -r1.24 clock_gettime.2
--- lib/libc/sys/clock_gettime.221 Jan 2014 03:15:45 -  1.24
+++ lib/libc/sys/clock_gettime.216 Oct 2014 12:43:33 -
@@ -62,9 +62,6 @@
 .Bl -tag -width CLOCK_MONOTONIC
 .It Dv CLOCK_REALTIME
 time that increments as a wall clock should
-.It Dv CLOCK_VIRTUAL
-time that increments only when
-the CPU is running in user mode on behalf of the calling process
 .It Dv CLOCK_PROCESS_CPUTIME_ID
 time that increments when the CPU is running in user or kernel mode
 on behalf of the calling process



Re: implement CLOCK_VIRTUAL and CLOCK_PROF

2014-10-16 Thread Stuart Henderson
On 2014/10/16 07:33, Todd C. Miller wrote:
 On Wed, 15 Oct 2014 21:50:44 -0700, Philip Guenther wrote:
 
  IMO we should just delete CLOCK_VIRTUAL from sys/_time.h and 
  clock_gettime(2)
 
 Easy enough.

ports should be pretty much OK with this, if there's any breakage it
will be minor and can be handled affterwards.



Re: implement CLOCK_VIRTUAL and CLOCK_PROF

2014-10-16 Thread Mark Kettenis
 From: Todd C. Miller todd.mil...@courtesan.com
 Date: Thu, 16 Oct 2014 07:33:23 -0600
 
 On Wed, 15 Oct 2014 21:50:44 -0700, Philip Guenther wrote:
 
  IMO we should just delete CLOCK_VIRTUAL from sys/_time.h and 
  clock_gettime(2)
 
 Easy enough.

ok kettenis@

 Index: sys/sys/_time.h
 ===
 RCS file: /home/cvs/openbsd/src/sys/sys/_time.h,v
 retrieving revision 1.6
 diff -u -r1.6 _time.h
 --- sys/sys/_time.h   6 Oct 2013 01:27:49 -   1.6
 +++ sys/sys/_time.h   16 Oct 2014 12:47:02 -
 @@ -33,7 +33,6 @@
  #define _SYS__TIME_H_
  
  #define CLOCK_REALTIME   0
 -#define CLOCK_VIRTUAL1
  #define CLOCK_PROCESS_CPUTIME_ID 2
  #define CLOCK_MONOTONIC  3
  #define CLOCK_THREAD_CPUTIME_ID  4
 Index: lib/libc/sys/clock_gettime.2
 ===
 RCS file: /home/cvs/openbsd/src/lib/libc/sys/clock_gettime.2,v
 retrieving revision 1.24
 diff -u -r1.24 clock_gettime.2
 --- lib/libc/sys/clock_gettime.2  21 Jan 2014 03:15:45 -  1.24
 +++ lib/libc/sys/clock_gettime.2  16 Oct 2014 12:43:33 -
 @@ -62,9 +62,6 @@
  .Bl -tag -width CLOCK_MONOTONIC
  .It Dv CLOCK_REALTIME
  time that increments as a wall clock should
 -.It Dv CLOCK_VIRTUAL
 -time that increments only when
 -the CPU is running in user mode on behalf of the calling process
  .It Dv CLOCK_PROCESS_CPUTIME_ID
  time that increments when the CPU is running in user or kernel mode
  on behalf of the calling process
 
 



Conditional include in make(1)

2014-10-16 Thread Mark Kettenis
Hi Marc,

Is there a reason why conditional includes (sinclude/-include) aren't
enabled in OpenBSD?

I'm asking because the Xorg people now use it in one of the xserver
Makefile.  We could of course try to convince them to revert the
change they made.  But it is a somewhat useful feature.

Thanks,

Mark



Re: armv7: banana pi, Allwinner A20 board

2014-10-16 Thread Patrick Wildt
I do believe that this is a pmap issue.

I just got hands on an Allwinner A20 and suffered the same issues:
pool_setlowat crashing randomly, same for ahci and so on.

I believe we are not syncing the PTEs correctly.

Here’s the snippet from PTE_SYNC(), but PTE_SYNC_RANGE() has
the same issue:

#define PTE_SYNC(pte)   \
do {\
if (PMAP_NEEDS_PTE_SYNC) {  \
paddr_t pa; \
cpu_drain_writebuf();   \
cpu_dcache_wb_range((vaddr_t)(pte), sizeof(pt_entry_t));\
if (cpu_sdcache_enabled()) {\
(void)pmap_extract(pmap_kernel(), (vaddr_t)(pte), pa); \
cpu_sdcache_wb_range((vaddr_t)(pte), (paddr_t)(pa), \
sizeof(pt_entry_t));\
};  \
cpu_drain_writebuf();   \
}   \
} while (/*CONSTCOND*/0)

I believe that when we change things in the pagetables, we need to make
sure the tables are synced before we’re going to use them.  In our case
we believe that we are using uncached pagetables, which means that
every write will directly hit the tables.

But that does not have an affect on the write buffer.  The write buffer is still
there and has to be cleared manually.  If it isn’t, and something accesses
an area which was just mapped, then we’re fucked.

Therefore I firmly believe that the cpu_drain_writebuf() call has to be made
regardless of PMAP_NEEDS_PTE_SYNC and that it has to be called before
that if-clause.

Doing that fixes my issues.

\Patrick

 Am 09.10.2014 um 22:55 schrieb SASANO Takayoshi u...@mx5.nisiq.net:
 
 Hello,
 
 Here is the log of new image.
 Booting with -c option, UKC still hangs up.
 
 I hope the log helps debugging.
 
 Regards,
 
 -- 
 SASANO Takayoshi u...@mx5.nisiq.net
 
 U-Boot SPL 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04)
 Board: Bananapi
 DRAM: 1024 MiB
 CPU: 96000Hz, AXI/AHB/APB: 3/2/2
 spl: not an uImage at 1600
 
 
 U-Boot 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04) Allwinner 
 Technology
 
 CPU:   Allwinner A20 (SUN7I)
 Board: Bananapi
 I2C:   ready
 DRAM:  1 GiB
 MMC:   SUNXI SD/MMC: 0
 *** Warning - bad CRC, using default environment
 
 In:serial
 Out:   serial
 Err:   serial
 Net:   dwmac.1c5
 Hit any key to stop autoboot:  0 
 reading uEnv.txt
 118 bytes read in 16 ms (6.8 KiB/s)
 Loaded environment from uEnv.txt
 Running uenvcmd ...
 reading bsd.umg
 7386560 bytes read in 364 ms (19.4 MiB/s)
 ## Booting kernel from Legacy Image at 6000 ...
   Image Name:   boot
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:7386496 Bytes = 7 MiB
   Load Address: 4080
   Entry Point:  4080
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
 
 Starting kernel ...
 
 
 OpenBSD/sunxi booting ...
 arg0 0x0 arg1 0x10bb arg2 0x4100
 atag core flags 0 pagesize 0 rootdev 0
 atag cmdline [sd0i:/bsd -c]
 atag mem start 0x4000 size 0x4000
 bootfile: sd0i:/bsd
 bootargs: -c
 memory size derived from u-boot
 bootconf.mem[0].address = 4000 pages 262144/0x4000
 Allocating page tables
 freestart = 0x40f0c000, free_pages = 258292 (0x0003f0f4)
 IRQ stack: p0x40f3a000 v0xc0f3a000
 ABT stack: p0x40f3b000 v0xc0f3b000
 UND stack: p0x40f3c000 v0xc0f3c000
 SVC stack: p0x40f3d000 v0xc0f3d000
 Creating L1 page table at 0x40f0c000
 Mapping kernel
 Constructing L2 page tables
 undefined page pmap [ using 170728 bytes of bsd ELF symbol table ]
 Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.
 Copyright (c) 1995-2014 OpenBSD. All rights reserved.  http://www.OpenBSD.org
 
 kernel does not support -c; continuing..
 OpenBSD 5.6-current (RAMDISK-SUNXI) #1: Thu Oct  9 21:03:32 AEDT 2014
r...@armv7.jsg.id.au:/usr/src/sys/arch/armv7/compile/RAMDISK-SUNXI
 real mem  = 1073741824 (1024MB)
 avail mem = 1036165120 (988MB)
 warning: no entropy supplied by boot loader
 mainbus0 at root
 cortex0 at mainbus0
 ampintc0 at cortex0 nirq 160
 cpu0 at mainbus0: ARM Cortex A7 rev 4 (ARMv7 core)
 cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
 cpu0: 32KB(32b/l,2way) I-cache, 32KB(64b/l,4way) wr-back D-cache
 sunxi0 at mainbus0: A20
 sxipio0 at sunxi0
 sxiccmu0 at sunxi0
 sxitimer0 at sunxi0: ticktimer 100hz @ 32KHz
 sxitimer1 at sunxi0: stattimer 128hz @ 32KHz
 sxitimer2 at sunxi0: cntrtimer @ 32KHz
 sxidog0 at sunxi0
 sxirtc0 at sunxi0
 sxiuart0 at sunxi0: console
 sxiuart1 at sunxi0
 sxiuart2 at sunxi0
 sxiuart3 at sunxi0
 sxiuart4 at sunxi0
 sxiuart5 at sunxi0
 sxiuart6 at