Re: random malloc junk

2016-09-10 Thread Henri Kemppainen
> I selected 0xdf a long time ago as an alternative to the 0xd0 (Duh)
> byte used for new chunks. Both as a mnemonic for "free" and because it
> is likely to cause segfaults. A pointer ending in 0xdf often will be
> unaligned. Of course that won't work on all archs or all pointers.
>
> Random patterns are also likely to produce segfaults, using them as a
> pointer has a big chance of being unaligned or pointing to an unmapped
> page.

Did you ever try filling all allocations and frees with random data
to see if it exposes new bugs?  Having that option could be useful for
testing & development.

The d0 & df patterns can hide problems, I've found the hard way.  E.g.
in integer comparisons there's a good chance they will consistently
take you to the same branch, and that could be a branch where your
use of freed or unitialized memory doesn't manifest in any observable
malbehavior.  Random data would likely trigger such snafus.



Re: hardware recommendation for openbsd-based thin client?

2016-05-28 Thread Henri Kemppainen
I have a Shuttle DS437 and DS57U7 for desktop.  Fanless, small, and the former
in particular is pretty affordable.  These are sold as barebones so you only add
the components you need -- in your case, probably nothing but RAM.

Do note that the case must stand upright, so they're not as convenient as an APU
lying flat in an environment where random people can knock things over.



Re: a fanless board with msata

2015-08-29 Thread Henri Kemppainen
 I have been searching for a while for a fanless motherboard
 to use as my OpenBSD workstation with reasonable performance.
 
 The board should be a mini-ITX form factor
 so that I can use it in this enclosure that I like.
 http://www.mini-box.com/M350S-enclosure-with-picoPSU-80-and-60W-adapter
 

 There is a barebone system from Shuttle DS437 that fits your 
 requirements. I don't know it so I can not tell if it works as 
 workstation.

I am using the Shuttle DS437 as a desktop, with an mSATA SSD, and it works
really well.  However, it probably isn't what Jan is looking for, since
it can only take one additional 2.5 disk.  The board's form factor also
probably isn't mini-ITX, so you're stuck with the case Shuttle put it into
(which I'm ok with).

OpenBSD 5.8 (GENERIC.MP) #1228: Tue Aug  4 23:22:43 MDT 2015
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8462385152 (8070MB)
avail mem = 8202022912 (7822MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xeb580 (73 entries)
bios0: vendor American Megatrends Inc. version 1.02 date 03/18/2015
bios0: Shuttle Inc. DS437
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT MCFG SLIC HPET SSDT SSDT SSDT
acpi0: wakeup devices P0P1(S4) USB1(S3) USB2(S3) USB3(S3) USB4(S3) USB5(S3) 
USB6(S3) USB7(S3) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) 
PXSX(S4) RP04(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Celeron(R) CPU 1037U @ 1.80GHz, 1796.21 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Celeron(R) CPU 1037U @ 1.80GHz, 1795.93 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,XSAVE,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf800, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus 1 (RP01)
acpiprt3 at acpi0: bus 2 (RP02)
acpiprt4 at acpi0: bus 3 (RP03)
acpiprt5 at acpi0: bus 4 (RP04)
acpiprt6 at acpi0: bus -1 (RP05)
acpiprt7 at acpi0: bus -1 (RP06)
acpiprt8 at acpi0: bus -1 (RP07)
acpiprt9 at acpi0: bus -1 (RP08)
acpiprt10 at acpi0: bus -1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiprt13 at acpi0: bus -1 (PEG3)
acpiec0 at acpi0: not present
acpicpu0 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: FN00, resource for FAN0
acpipwrres1 at acpi0: FN01, resource for FAN1
acpipwrres2 at acpi0: FN02, resource for FAN2
acpipwrres3 at acpi0: FN03, resource for FAN3
acpipwrres4 at acpi0: FN04, resource for FAN4
acpitz0 at acpi0: critical temperature is 106 degC
acpitz1 at acpi0: critical temperature is 106 degC
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 not present
acpibat2 at acpi0: BAT2 not present
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: LID0
acpivideo0 at acpi0: GFX0
cpu0: Enhanced SpeedStep 1796 MHz: speeds: 1800, 1700, 1600, 1500, 1400, 1300, 
1200, 1100, 1000, 900, 800, 774 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel Core 3G Host rev 0x09
vga1 at pci0 dev 2 function 0 Intel HD Graphics 2500 rev 0x09
intagp at vga1 not configured
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: 1920x1200
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
Intel 7 Series MEI rev 0x04 at pci0 dev 22 function 0 not configured
ehci0 at pci0 dev 26 function 0 Intel 7 Series USB rev 0x04: apic 2 int 16
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 Intel 7 Series HD Audio rev 0x04: msi
azalia0: codecs: Realtek ALC662, Intel/0x2806, using Realtek ALC662
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 Intel 7 Series PCIE rev 0xc4: msi
pci1 at ppb0 bus 1
iwn0 at pci1 dev 0 function 0 Intel Centrino Advanced-N 6235 rev 0x24: msi, 
MIMO 2T2R, AGN, address 80:00:0b:63:a3:44
ppb1 at pci0 dev 28 function 1 

Re: null checks before free()

2014-12-14 Thread Henri Kemppainen
Checking for NULL has nothing to do with double frees.  Like the
man page explains, free(NULL) is a no-op.  It does absolutely nothing,
and there is no reason for your application to check if a pointer
is NULL before calling free on it.

Double-free is what happens when you try to free an allocated address
that has already been freed.  NULL is not such an address.  Checking
for NULL does not prevent double frees from occurring.



Re: firefox crashes very often on amd64 5.5

2014-09-08 Thread Henri Kemppainen
Bump you rlimits or provide more information.



dlopen after dlclose crash

2014-08-18 Thread Henri Kemppainen
Hi, I encountered this problem while trying an application that uses SDL2.
It turns out that SDL2 opens, closes, and reopens some shared objects from
the X11 sets.  And doing that in the specific order it does, one of the
eventual dlopen calls will crash.  Here's a minimal test case:

$ ls -ctlah /usr/X11R6/lib/libX{cursor,randr}.so*
-rw-r--r--  1 root  wheel  47.2K Aug 16 19:57 /usr/X11R6/lib/libXrandr.so.7.0
-rw-r--r--  1 root  wheel  49.2K Aug 16 19:57 /usr/X11R6/lib/libXcursor.so.5.0
-rw-r--r--  1 root  wheel  43.0K Jun 30  2013 /usr/X11R6/lib/libXrandr.so.6.2
-rw-r--r--  1 root  wheel  47.6K Jun 30  2013 /usr/X11R6/lib/libXcursor.so.4.0

$ cat test.c
#include dlfcn.h

main() {
void *a, *b;
int flag = RTLD_NOW|RTLD_LOCAL;

a = dlopen(libXcursor.so, flag);
b = dlopen(libXrandr.so, flag);
dlclose(a);
dlclose(b);
dlopen(libXcursor.so, flag);
return 0;
}

$ cc test.c

$ ./a.out   
  
Bus error (core dumped) 

$ gdb a.out a.out.core 
[ .. snip .. ]
#0  _dl_cache_grpsym_list (object=0x110be2bb7400) at
  /usr/src/libexec/ld.so/library_subr.c:555

warning: Source file is more recent than executable.

555 _dl_link_grpsym(n-data, 0);
(gdb) p n
$1 = (struct dep_node *) 0xdfdfdfdfdfdfdfdf

(gdb) bt
#0  _dl_cache_grpsym_list (object=0x110be2bb7400)
at /usr/src/libexec/ld.so/library_subr.c:555
#1  0x110ba94082fd in _dl_cache_grpsym_list (object=0x110c140a0c00)
at /usr/src/libexec/ld.so/library_subr.c:558
#2  0x110ba94082fd in _dl_cache_grpsym_list (object=0x110c140a0800)
at /usr/src/libexec/ld.so/library_subr.c:558
#3  0x110ba9403267 in _dl_load_dep_libs (object=0x110c140a0800, flags=1,
  booting=0)
at /usr/src/libexec/ld.so/loader.c:347
#4  0x110ba9405f99 in dlopen (libname=0x110921800dff libXcursor.so,
  flags=Variable flags is not available.)
at /usr/src/libexec/ld.so/dlfcn.c:107
#5  0x110921700dda in main () from /tmp/a.out

---


There are some other combinations of shared objects that will also result in
the same crash.  It can be worked around by changing the order in which they
are opened or closed (changing both works too).  Nothing in the man page
suggests to me that the order should be critical, so this looks like a bug.

I might dig deeper once I find the time, but perhaps someone already
familiar with the code might want to take a look at it before I waste a
week on it ;-)

-Henri

OpenBSD 5.6 (GENERIC.MP) #333: Fri Aug  8 00:20:21 MDT 2014
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 1047068672 (998MB)
avail mem = 1010466816 (963MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xf0760 (31 entries)
bios0: vendor American Megatrends Inc. version 0201 date 02/10/2010
bios0: ASUSTeK Computer INC. 1001PX
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC MCFG ECDT OEMB HPET GSCI SSDT
acpi0: wakeup devices P0P1(S4) P0P4(S4) P0P5(S4) P0P6(S4) P0P7(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 2333.32 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG,LAHF,PERF
cpu0: 512KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 166MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.0.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Atom(TM) CPU N450 @ 1.66GHz, 1666.48 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,MOVBE,NXE,LONG,LAHF,PERF
cpu1: 512KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 1, remapped to apid 2
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiec0 at acpi0
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 4 (P0P4)
acpiprt2 at acpi0: bus 2 (P0P5)
acpiprt3 at acpi0: bus -1 (P0P6)
acpiprt4 at acpi0: bus 1 (P0P7)
acpicpu0 at acpi0: C2, C1, PSS
acpicpu1 at acpi0: C2, C1, PSS
acpitz0 at acpi0: critical temperature is 98 degC
acpibat0 at acpi0: BAT0 model 1001PX serial   type LION oem ASUS
acpiac0 at acpi0: AC unit online
acpiasus0 at acpi0
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibtn2 at acpi0: PWRB
cpu0: Enhanced SpeedStep 2333 MHz: speeds: 1667, 1333, 1000 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel Pineview DMI rev 0x00
vga1 at pci0 dev 2 function 0 Intel Pineview Video rev 0x00

Re: spdy support on base nginx

2013-09-08 Thread Henri Kemppainen
No, it doesn't.  The code was committed on 2013-06-01, though it's not
enabled.



Re: Exploits

2013-09-07 Thread Henri Kemppainen
You could've searched the archives.

http://www.openbsd.org/errata40.html#m_dup1



Re: ifconfig(8) --frontend

2013-08-04 Thread Henri Kemppainen
 Doing this on the terminal is simply a waste of time and it would be rational
 to have a GUI for at least this subset of the full ifconfig functionality.

Care to elaborate on that?  What makes it slow for you on the terminal?  What
would a GUI need to have to be faster?  Don't tell me you want 3D-accelerated
kitty pics.



Re: EeePC, 5.0: acpitz gets wrong temperature

2011-11-02 Thread Henri Kemppainen
  I just installed a snapshot (dated Oct 19) of -current on a new EeePC
  1001PXD. The installation itself went fine. However, on the first boot,
  even before I can see the login prompt, acpitz decides to shutdown the
  machine:
  acpitz0: critical temperature exceeded 255C (5282K), shutting down

[..]

 `dmesg' with this patch is at:
 http://tar-jx.bz/stuff/dmesg.lapin-5.0-nohaltoncrit

From your dmesg:
 acpiec _REG failed, broken BIOS

ASUS has a BIOS update (0702; 2011.04.13) with the this description:
 Update EC firmware

I'd try that.  Tell me if it fixes the problem.



Re: smtpd and virtuals

2011-10-10 Thread Henri Kemppainen
 In manXX.tgz (since 4.8) and also on web-cgi, the smtpd.conf(5) man
 page references makemap(8) more than once ...
 ... with explicit instructions to use that man page as a guide when
 making db maps and/or understanding the format of plain maps.

 [..]

 This has been the case for over a year every single time I've looked
 at web-cgi and on multiple iterations of base ...
 ... and I've been trying very hard to exhaust myself there before coming here.

 Suffice to say this is not optimum.

I agree this isn't ideal.  On the other hand, having a system ship with
two overlapping  incompatible alternatives is a rather exceptional case,
and there's no way to automagically please everyone.  One could suggest
renaming the manuals (and binaries?) and installing them both, but that's
nasty and ugly, and probably not worth it, if one of the daemons is to
be axed anyway.

There's surely a good reason smtpd isn't the default yet, and there's
a good reason I kept hearing that smtpd isn't considered ready for
production yet, back when I started using it.  The message is rather
clear to me: you may play with it, as long as you know what you're doing,
and are okay with the possibility of problems.  Finding the manual is a
part of knowing what you're doing :-)  I can see why one could get
confused though, even if the title lines for these (installed) manuals
contain sendmail.

 If not, what can be done about users who read the man pages and have
 issues as a result?

I don't know what can be done about users, but I know what the users can
do: try figure out what is lacking or misleading, maybe contact the
developer(s), and propose a change.  Something like this:

Index: makemap.8
===
RCS file: /cvs/src/usr.sbin/smtpd/makemap.8,v
retrieving revision 1.14
diff -u -p -r1.14 makemap.8
--- makemap.8   3 Sep 2010 11:22:36 -   1.14
+++ makemap.8   10 Oct 2011 19:10:51 -
@@ -90,11 +90,14 @@ accept for domain map primary deliver 
 .Ed
 .Sh VIRTUAL DOMAINS
 Virtual domains are kept in maps.
-To create single virtual address, add
-.Dq u...@example.com   user
+To create a virtual domain, add
+.Dq example.com kittens
 to the virtual map.
-To handle all mail destined to any user at example.com, add
-.Dq @example.com   user
+To create a virtual address for one user under that domain, add
+.Dq u...@example.com user
+to the virtual map.
+To catch all mail destined to the domain, add
+.Dq @example.com user
 to the virtual map.
 .Pp
 In addition to adding an entry to the virtual map,

The need to have a value for the domain key is a bit ugly.  I noticed
the stdio backend is happy with empty values, allowing for a pretty list
under a colon terminated domain name:
  virtual.domain:
  user1@virtual.domainuser1
  user2@virtual.domainuser2

  another.domain:
  user3@another.domainuser3
  user4@another.domainuser4
  ..

Makemap doesn't like it, though.



Re: smtpd and virtuals

2011-10-08 Thread Henri Kemppainen
 Hi.

 inet - hosting.com - mail.hosting.com

 smtpd.conf ...

 listen on ext
 map virtuals { source plain /etc/mail/virtuals.plain }
 accept from all for virtual virtuals relay

 virtuals.plain ...

 postmas...@hosted.com somewh...@gmail.com

[..]

 If I send mail to the virtual domain I get bounces back to the
 originating server - recipient rejected.
 If I check the default log (/var/log/maillog) on the mail machine I
 see the mail is getting that far and the same error is there -
 recipient rejected.

There's something odd about virtuals; though the code I'm running is no
longer current (5.0-BETA, to be precise).  Here's what makemap.8 says:
Virtual domains are kept in maps.  To create single virtual address,
add ``u...@example.com user'' to the virtual map.  To handle all mail
destined to any user at example.com, add ``@example.com user'' to the
virtual map.

I tried this with a very minimal local setup.  smtpd.conf:
listen on lo0

map aliases { source plain /etc/mail/aliases }
map virtual { source plain /etc/mail/virtual }

accept for virtual virtual deliver to mbox
accept for local alias aliases deliver to mbox

virtual:
somebody@virtual.domain duclare

Trying to send to address gets me recipient rejected:
$ echo test|mail somebody@virtual.domain
  send-mail: 530 5.0.0 Recipient rejected: somebody@virtual.domain

I added some debug printfs, and they show that map_stdio_lookup is called
with key=virtual.domain.  There is no such key, and the mail is rejected.
Out of curiosity, I added a matching line to virtual just to see what
happens:
virtual.domain  duclare
somebody@virtual.domain duclare

With this setup, the mail command above works, and my local user receives
the message.  Smtpd makes these lookups:
 map_stdio_lookup [key=virtual.domain]
aliases_vdomain_exist: 'virtual.domain' exists
 map_stdio_lookup [key=somebody@virtual.domain]
aliases_virtual_exist: 'somebody@virtual.domain' exists
 map_stdio_lookup [key=somebody@virtual.domain]
aliases_virtual_get: 'somebody@virtual.domain' resolved to 1 nodes
lka_resolve_node: node is local username: duclare

I hope Gilles can tell whether this is a documentation bug or code bug.  Or
maybe I just missed something obvious (such as a sufficiently recent
snapshot) :-).