Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-05 Thread John DiMarco
In message <20170505091608.gd17...@sci.irofti.net>you write:
>>  0:6:0: Cirrus Logic CS4610 SoundFusion
>>  0x: Vendor ID: 1013 Product ID: 6001
>>  0x0004: Command: 0106 Status: 0200
>>  0x0008: Class: 04 Subclass: 01 Interface: 00 Revision: 01
>
>This says you do have clcs(4) hardware on your laptop. What is the exact
>error you are seeing when booting the original kernel?

Hmm, yes, you're quite right, it does look like the onboard sound
chip is a CS4610.  http://www.lenovo.com/psref/pdf/twbook.pdf (p48) 
I never particularly cared much about the sound card (though there's no
harm in getting it to work correctly), the main reason I still use this
ancient laptop is its superb keyboard.

Anyway, I re-enabled clcs; dmesg appended below

Thanks,

John
--
John DiMarco    http://www.cs.toronto.edu/~jdd
IT Director, Department of Computer Science, University of Toronto  
Office: SF3302  1-416-978-5300  Fx:1-416-946-5464  Skype:jddimarco


OpenBSD 6.1 (GENERIC) #1: Wed May  3 01:51:12 CEST 2017
rob...@syspatch-61-i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Celeron ("GenuineIntel" 686-class, 256KB L2 cache) 398 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,PERF
real mem  = 301285376 (287MB)
avail mem = 282808320 (269MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 11/20/99, BIOS32 rev. 0 @ 0xfd820, SMBIOS rev. 2.2 @ 
0xf6cf0 (55 entries)
bios0: vendor IBM version "INET30WW" date 11/20/1999
bios0: IBM 26454BU
acpi at bios0 function 0x0 not configured
apm0 at bios0: Power Management spec V1.2
pcibios0 at bios0: rev 2.1 @ 0xfd880/0x800
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xf9e20/112 (5 entries)
pcibios0: PCI Exclusive IRQs: 11
pcibios0: PCI Interrupt Router at 000:07:0 ("Intel 82371AB PIIX4 ISA" rev 0x00)
pcibios0: PCI bus #5 is the last bus
bios0: ROM list: 0xc/0xc000
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82443BX AGP" rev 0x03
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0x4000, size 0x400
ppb0 at pci0 dev 1 function 0 "Intel 82443BX AGP" rev 0x03
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 "Neomagic Magicgraph NM2200" rev 0x20
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
cbb0 at pci0 dev 2 function 0 "TI PCI1251 CardBus" rev 0x00: irq 11
cbb1 at pci0 dev 2 function 1 "TI PCI1251 CardBus" rev 0x00: irq 11
clcs0 at pci0 dev 6 function 0 "Cirrus Logic CS4610 SoundFusion" rev 0x01: irq 
11
reset_codec: AC97 inputs slot ready timeout
clcs0: AC97 write fail (DCV!=0) for add=0x26 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x00 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x00 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x00 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x00 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x02 data=0x8000
clcs0: AC97 write fail (DCV!=0) for add=0x06 data=0x8000
clcs0: AC97 write fail (DCV!=0) for add=0x20 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x04 data=0x8000
clcs0: AC97 write fail (DCV!=0) for add=0x38 data=0x8080
clcs0: AC97 write fail (DCV!=0) for add=0x36 data=0x8080
clcs0: AC97 write fail (DCV!=0) for add=0x36 data=0x8080
clcs0: AC97 write fail (DCV!=0) for add=0x36 data=0x8080
clcs0: AC97 write fail (DCV!=0) for add=0x36 data=0x8080
clcs0: AC97 write fail (DCV!=0) for add=0x08 data=0x0f0f
clcs0: AC97 write fail (DCV!=0) for add=0x0a data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x0c data=0x8008
clcs0: AC97 write fail (DCV!=0) for add=0x0e data=0x8008
clcs0: AC97 write fail (DCV!=0) for add=0x0e data=0x8008
clcs0: AC97 write fail (DCV!=0) for add=0x20 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x10 data=0x8808
clcs0: AC97 write fail (DCV!=0) for add=0x12 data=0x8808
clcs0: AC97 write fail (DCV!=0) for add=0x14 data=0x8808
clcs0: AC97 write fail (DCV!=0) for add=0x16 data=0x8808
clcs0: AC97 write fail (DCV!=0) for add=0x18 data=0x8808
clcs0: AC97 write fail (DCV!=0) for add=0x1a data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x1c data=0x8000
clcs0: AC97 write fail (DCV!=0) for add=0x1e data=0x8000
clcs0: AC97 write fail (DCV!=0) for add=0x20 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x20 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x22 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x22 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x26 data=0x
clcs0: AC97 write fail (DCV!=0) for add=0x2a data=0x
clcs0: AC97 read prob. (DCV!=0) for add=0x7c
clcs0: AC97 read prob. (DCV!=0) for add=0x7e
clcs0: AC97 read prob. (DCV!=0) for add=0x00
ac97: codec id not read
clcs0: AC97 read prob. (DCV!=0) for add=0x28
clcs0: AC97 read prob. (DCV!=0) for add=0x02
clcs0: AC97 write fail (DCV!=0) for add=0x02 data=0x

Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-05 Thread Paul Irofti
>  0:6:0: Cirrus Logic CS4610 SoundFusion
>   0x: Vendor ID: 1013 Product ID: 6001
>   0x0004: Command: 0106 Status: 0200
>   0x0008: Class: 04 Subclass: 01 Interface: 00 Revision: 01

This says you do have clcs(4) hardware on your laptop. What is the exact
error you are seeing when booting the original kernel?

>   0x000c: BIST: 00 Header Type: 00 Latency Timer: 20 Cache Line Size: 00
>   0x0010: BAR mem 32bit addr: 0x5010/0x1000
>   0x0014: BAR mem 32bit addr: 0x5000/0x0010
>   0x0018: BAR empty ()
>   0x001c: BAR empty ()
>   0x0020: BAR empty ()
>   0x0024: BAR empty ()
>   0x0028: Cardbus CIS: 
>   0x002c: Subsystem Vendor ID: 1014 Product ID: 1010
>   0x0030: Expansion ROM Base Address: 
>   0x0038: 
>   0x003c: Interrupt Pin: 01 Line: 0b Min Gnt: 04 Max Lat: 18
>   0x: 60011013 02000106 04010001 2000
>   0x0010: 5010 5000  
>   0x0020:    10101014
>   0x0030:    1804010b
>   0x0040:    
>   0x0050:    
>   0x0060:    
>   0x0070:    
>   0x0080:    
>   0x0090:    
>   0x00a0:    
>   0x00b0:    
>   0x00c0:    
>   0x00d0:    
>   0x00e0:    
>   0x00f0:    



Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-04 Thread Theo de Raadt
> >In message <20170504150753.GH72850@t430s.bluhm.invalid>you write:
> >>On Thu, May 04, 2017 at 09:43:07AM -0400, j...@cs.toronto.edu wrote:
> >>>   However in OpenBSD 6.1, attempting to run config in this way fails,
> >>>   with the message:
> >>>   config: kvm_openfiles: /dev/mem: Operation not permitted
> >>
> >>Putting kern.allowkmem=1 into /etc/sysctl.conf and reboot should help.
> >
> >Yes, that workaround does the trick, thanks.
> 
> Played with it a bit more.  Instead of kern.allowkmem=1 in /etc/sysctl.conf,
> a better workaround appears to be to boot into single-user mode and run
> config from there.  It's better in that leaving kern.allowkmem at 0 is a
> more secure setting.  This is a completely acceptable workaround.
> 
> Perhaps mention in the config man page to use single-user mode when
> kern.allowkmem is 0?

yes, singleuser use is better.

To be frank, I want to kill kern.allowkmem eventually.



Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-04 Thread John DiMarco
>In message <20170504150753.GH72850@t430s.bluhm.invalid>you write:
>>On Thu, May 04, 2017 at 09:43:07AM -0400, j...@cs.toronto.edu wrote:
>>> However in OpenBSD 6.1, attempting to run config in this way fails,
>>> with the message:
>>> config: kvm_openfiles: /dev/mem: Operation not permitted
>>
>>Putting kern.allowkmem=1 into /etc/sysctl.conf and reboot should help.
>
>Yes, that workaround does the trick, thanks.

Played with it a bit more.  Instead of kern.allowkmem=1 in /etc/sysctl.conf,
a better workaround appears to be to boot into single-user mode and run
config from there.  It's better in that leaving kern.allowkmem at 0 is a
more secure setting.  This is a completely acceptable workaround.

Perhaps mention in the config man page to use single-user mode when
kern.allowkmem is 0?

Regards,

John
--
John DiMarco    http://www.cs.toronto.edu/~jdd
IT Director, Department of Computer Science, University of Toronto  
Office: SF3302  1-416-978-5300  Fx:1-416-946-5464  Skype:jddimarco



Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-04 Thread John DiMarco
In message <20170504150753.GH72850@t430s.bluhm.invalid>you write:
>On Thu, May 04, 2017 at 09:43:07AM -0400, j...@cs.toronto.edu wrote:
>>  However in OpenBSD 6.1, attempting to run config in this way fails,
>>  with the message:
>>  config: kvm_openfiles: /dev/mem: Operation not permitted
>
>Putting kern.allowkmem=1 into /etc/sysctl.conf and reboot should help.

Yes, that workaround does the trick, thanks.

Regards,

John
--
John DiMarco    http://www.cs.toronto.edu/~jdd
IT Director, Department of Computer Science, University of Toronto  
Office: SF3302  1-416-978-5300  Fx:1-416-946-5464  Skype:jddimarco



Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-04 Thread Theo Buehler
> The problem here is config(8) -u needs kvm(3) to access the changes made
> during boot in UKC, with OpenBSD 6.1 access to /dev/{,k}mem was disabled
> at securelevel > 0.

Right, and we should probably add the usual text to the description of
the -u flag (text taken from tcpbench -k):

Index: config.8
===
RCS file: /var/cvs/src/usr.sbin/config/config.8,v
retrieving revision 1.63
diff -u -p -r1.63 config.8
--- config.81 May 2017 06:39:25 -   1.63
+++ config.84 May 2017 15:20:39 -
@@ -130,6 +130,11 @@ If so, compare the running kernel with t
 .Pq Ar infile .
 If they seem to be the same, apply all configuration changes performed at
 boot.
+Using this option requires read access to
+.Pa /dev/mem ,
+which may be restricted based upon the value of the
+.Ar kern.allowkmem
+.Xr sysctl 8 .
 .El
 .Sh KERNEL BUILDING
 The output of



Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-04 Thread Bryan Steele
On Thu, May 04, 2017 at 09:43:07AM -0400, j...@cs.toronto.edu wrote:
> 
> >Synopsis:On 6.1/i386, config -e -u -o bsd.new bsd reports 
> >"kvm_openfiles: /dev/mem: Operation not permitted
> >Category:system
> >Environment:
>   System  : OpenBSD 6.1
>   Details : OpenBSD 6.1 (GENERIC) #1: Wed May  3 01:51:12 CEST 2017
>
> rob...@syspatch-61-i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> 
>   Architecture: OpenBSD.i386
>   Machine : i386
> >Description:
>   My thinkpad is so old that it requires ACPI to be disabled in the
>   kernel, else the kernel will not boot.  It also requires clcs to
>   be disabled (the clcs probing code mistakenly thinks the hardware
>   is present on my thinkpad, which it isn't). To create a kernel 
>   (bsd.new) where acpi and clcs is disabled by default, I typically do 
>   this:
>   config -e -u -o bsd.new bsd
>   (then I interactively disable acpi and clcs and save the result). 
>   Then I rename bsd to bsd.old and bsd.new to bsd and reboot.
>   
>   However in OpenBSD 6.1, attempting to run config in this way fails,
>   with the message:
>   config: kvm_openfiles: /dev/mem: Operation not permitted
> 
> >How-To-Repeat:
>   config -e -u -o bsd.new bsd
> >Fix:
> Workaround: It's possible to work around this by manually compiling and 
>   installing a custom kernel where ACPI is disabled, or, on every boot, 
>   booting with -c and disabling ACPI.  Both workarounds are suboptimal.
> 
> 
> dmesg:
> OpenBSD 6.1 (GENERIC) #1: Wed May  3 01:51:12 CEST 2017
> rob...@syspatch-61-i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> cpu0: Intel Celeron ("GenuineIntel" 686-class, 256KB L2 cache) 398 MHz
> cpu0: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,PERF
> real mem  = 301285376 (287MB)
> avail mem = 282808320 (269MB)
> User Kernel Config
> UKC> disable acpi
> 492 acpi0 disabled
> UKC> disable clcs
>  87 clcs* disabled
> ..

The problem here is config(8) -u needs kvm(3) to access the changes made
during boot in UKC, with OpenBSD 6.1 access to /dev/{,k}mem was disabled
at securelevel > 0.

http://marc.info/?l=openbsd-cvs=147481705211536=2

You can still do, and retype the changes you require to be saved:
# config -e -o /bsd.new /bsd

Of course, sending a proper report about the issues with have with acpi
and clcs might better.

-Bryan.



Re: config in 6.1 reports /dev/mem: Operation not permitted

2017-05-04 Thread Alexander Bluhm
On Thu, May 04, 2017 at 09:43:07AM -0400, j...@cs.toronto.edu wrote:
>   However in OpenBSD 6.1, attempting to run config in this way fails,
>   with the message:
>   config: kvm_openfiles: /dev/mem: Operation not permitted

Putting kern.allowkmem=1 into /etc/sysctl.conf and reboot should help.

bluhm