diff: setpgid.2: no pgid argument

2014-05-24 Thread Abel Abraham Camarillo Ojeda
There is no pgid argument in the SYNOPSIS:

patch inline and attached.

Index: setpgid.2
===
RCS file: /cvs/src/lib/libc/sys/setpgid.2,v
retrieving revision 1.14
diff -u -p -r1.14 setpgid.2
--- setpgid.2   8 May 2013 14:19:44 -   1.14
+++ setpgid.2   24 May 2014 10:10:52 -
@@ -80,7 +80,7 @@ is either a session leader or not in the
 process.
 .It Bq Er EPERM
 The value of the
-.Fa pgid
+.Fa pgrp
 argument is neither the PID of the process indicated by the
 .Fa pid
 argument nor the process group ID of an existing process group in


patch
Description: Binary data


Re: PC-122 keyboard

2014-05-24 Thread Miod Vallat
 Is this the correct way to go about adding a sub-keymap to place
 the VT switch commands on dedicated keys?

Yes, this ought to work. You'll need to run `make includes' and
recompile sbin/kbd and/or sbin/wsconsctl for them to grok `.term122' as
a keymap suffix.

Miod



Re: pckbd volume keys (part 1), diff to test

2014-05-24 Thread Remi Locherer
On Fri, May 23, 2014 at 12:42:31PM +0200, Alexandre Ratchov wrote:
 On Wed, Apr 30, 2014 at 01:06:48AM +0200, Alexandre Ratchov wrote:
  This diff attempts to unify volume keys; it makes pckbd and ukbd
  volume keys behave like all other volume keys (acpithinkpad,
  acpiasus, macppc/abtn and similar drivers): simply adjust the
  hardware volume without passing keystroke events to upper layers
  (i.e. consume the keystroke).
  
  If your volume keys tend to mess the volume while in X (example
  mplayer), try this diff and see if it makes things better (or
  worse).
 
 No test reports so far. To test this: start X, then:
 
 - press the vol - button many times (don't hold is pressed),
   until volume goes to zero.
 
 - start a movie in mplayer, there's no sound as volume is zero.
 
 - press the vol + button and hold it down; now mplayer indicates
   the volume reached the maximum. Still you don't hear anything.
 
 Confusing, isn't it? Then rebuild the kernel with this diff and
 retry. With the diff volume keys are simple and deterministic: they
 simply adjust the volume and don't trigger hot-keys or whatever.
 
 -- Alexandre
 

I tried it on a Thinkpad X201 and on a Samsung 900X3F (dmesg from both
below). Works as advertised. I like it.

Remi



OpenBSD 5.5-current (GENERIC.MP) #142: Fri May 23 02:21:32 MDT 2014
t...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8357658624 (7970MB)
avail mem = 8126418944 (7749MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe0010 (78 entries)
bios0: vendor LENOVO version 6QET61WW (1.31 ) date 10/26/2010
bios0: LENOVO 3626GN8
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET ASF! BOOT SSDT TCPA DMAR SSDT 
SSDT SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP1(S4) EXP2(S4) EXP3(S4) 
EXP4(S4) EXP5(S4) EHC1(S3) EHC2(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz, 2926.48 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,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC
cpu0: 256KB 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 132MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.0, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz, 2926.00 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,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 4 (application processor)
cpu2: Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz, 2926.00 MHz
cpu2: 
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,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 2, package 0
cpu3 at mainbus0: apid 5 (application processor)
cpu3: Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz, 2926.00 MHz
cpu3: 
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,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 2, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 2, remapped to apid 1
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 13 (EXP1)
acpiprt3 at acpi0: bus -1 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
acpiprt5 at acpi0: bus 5 (EXP4)
acpiprt6 at acpi0: bus 2 (EXP5)
acpicpu0 at acpi0: C3, C1, PSS
acpicpu1 at acpi0: C3, C1, PSS
acpicpu2 at acpi0: C3, C1, PSS
acpicpu3 at acpi0: C3, C1, PSS
acpipwrres0 at acpi0: PUBS, resource for EHC1, EHC2
acpitz0 at acpi0: critical temperature is 100 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model 42T4694 serial  1523 type LION oem SANYO
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: GDCK not docked (0)
cpu0: Enhanced SpeedStep 2926 MHz: speeds: 2667, 2666, 2533, 2399, 2266, 2133, 
1999, 1866, 1733, 1599, 1466, 1333, 1199 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel Core Host rev 0x02
vga1 

X Font Service Protocol Erratum

2014-05-24 Thread Ted Unangst
From http://www.openbsd.org/errata55.html:

X Font Service Protocol  Font metadata file handling issues in libXfont
CVE-2014-0209: integer overflow of allocations in font metadata file parsing
CVE-2014-0210: unvalidated length fields when parsing xfs protocol replies
CVE-2014-0211: integer overflows calculating memory needs for xfs replies 
Please see the advisory for more information. 
http://lists.x.org/archives/xorg-announce/2014-May/002431.html

Source code patch:

untrusted comment: signature from openbsd 5.5 base secret key
RWRGy8gxk9N93+eLgi55eB+q+iJdk3vT7fqMhrHUN7dUsETsdek0CEyTtx7kXq9vjF5sYa/lCtsUIEgykH7yxDmuIuNUmE3wegc=

OpenBSD 5.5 errata 6, May 24, 2014:  X Font Service Protocol
 Font metadata file handling issues in libXfont

This is revision 2 of the patch (the first version forgot to use
signify).

Apply patch using:

signify -Vep /etc/signify/openbsd-55-base.pub -x 006_libXfont.patch.sig \
-m - | (cd /usr/xenocara  patch -p0)

Then build and install libXfont

cd /usr/xenocara/lib/libXfont
make -f Makefile.bsd-wrapper obj
make -f Makefile.bsd-wrapper build

Index: lib/libXfont/src/fc/fsconvert.c
===
RCS file: /cvs/OpenBSD/xenocara/lib/libXfont/src/fc/fsconvert.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 fsconvert.c
--- lib/libXfont/src/fc/fsconvert.c 4 Mar 2012 18:13:47 -   1.4
+++ lib/libXfont/src/fc/fsconvert.c 13 May 2014 19:42:23 -
@@ -118,6 +118,10 @@ _fs_convert_props(fsPropInfo *pi, fsProp
 for (i = 0; i  nprops; i++, dprop++, is_str++)
 {
memcpy(local_off, off_adr, SIZEOF(fsPropOffset));
+   if ((local_off.name.position = pi-data_len) ||
+   (local_off.name.length 
+(pi-data_len - local_off.name.position)))
+   goto bail;
dprop-name = MakeAtom(pdc[local_off.name.position],
   local_off.name.length, 1);
if (local_off.type != PropTypeString) {
@@ -125,10 +129,15 @@ _fs_convert_props(fsPropInfo *pi, fsProp
dprop-value = local_off.value.position;
} else {
*is_str = TRUE;
+   if ((local_off.value.position = pi-data_len) ||
+   (local_off.value.length 
+(pi-data_len - local_off.value.position)))
+   goto bail;
dprop-value = (INT32) MakeAtom(pdc[local_off.value.position],
local_off.value.length, 1);
if (dprop-value == BAD_RESOURCE)
{
+ bail:
free (pfi-props);
pfi-nprops = 0;
pfi-props = 0;
@@ -712,7 +721,12 @@ fs_alloc_glyphs (FontPtr pFont, int size
 FSGlyphPtr glyphs;
 FSFontPtr  fsfont = (FSFontPtr) pFont-fontPrivate;

-glyphs = malloc (sizeof (FSGlyphRec) + size);
+if (size  (INT_MAX - sizeof (FSGlyphRec)))
+   glyphs = malloc (sizeof (FSGlyphRec) + size);
+else
+   glyphs = NULL;
+if (glyphs == NULL)
+   return NULL;
 glyphs-next = fsfont-glyphs;
 fsfont-glyphs = glyphs;
 return (pointer) (glyphs + 1);
Index: lib/libXfont/src/fc/fserve.c
===
RCS file: /cvs/OpenBSD/xenocara/lib/libXfont/src/fc/fserve.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 fserve.c
--- lib/libXfont/src/fc/fserve.c4 Mar 2012 18:13:47 -   1.4
+++ lib/libXfont/src/fc/fserve.c13 May 2014 19:42:23 -
@@ -70,6 +70,7 @@ in this Software without prior written a
 #include   fservestr.h
 #include   X11/fonts/fontutil.h
 #include   errno.h
+#include   limits.h

 #include   time.h
 #define Time_t time_t
@@ -91,6 +92,15 @@ in this Software without prior written a
 (pci)-descent || \
 (pci)-characterWidth)

+/*
+ * SIZEOF(r) is in bytes, length fields in the protocol are in 32-bit words,
+ * so this converts for doing size comparisons.
+ */
+#define LENGTHOF(r)(SIZEOF(r)  2)
+
+/* Somewhat arbitrary limit on maximum reply size we'll try to read. */
+#define MAX_REPLY_LENGTH   ((64 * 1024 * 1024)  2)
+
 extern void ErrorF(const char *f, ...);

 static int fs_read_glyphs ( FontPathElementPtr fpe, FSBlockDataPtr blockrec );
@@ -206,9 +216,22 @@ _fs_add_rep_log (FSFpePtr conn, fsGeneri
 rep-sequenceNumber,
 conn-reqbuffer[i].opcode);
 }
+
+#define _fs_reply_failed(rep, name, op) do {\
+if (rep) {  \
+if (rep-type == FS_Error)  \
+fprintf (stderr, Error: %d Request: %s\n, \
+ ((fsError *)rep)-request, #name); \
+else\
+fprintf (stderr, Bad Length for %s Reply: %d %s %d\n,

[patch] libssl malloc check for NULL

2014-05-24 Thread Chris Hettrick
Hi tech@

Here are some missing checks for NULL after malloc().

Index: libssl/src/apps/apps.c
===
RCS file: /cvs/src/lib/libssl/src/apps/apps.c,v
retrieving revision 1.52
diff -u -p -r1.52 apps.c
--- libssl/src/apps/apps.c  23 May 2014 15:55:08 -  1.52
+++ libssl/src/apps/apps.c  25 May 2014 00:11:20 -
@@ -215,6 +215,8 @@ chopup_args(ARGS *arg, char *buf, int *a
if (arg-count == 0) {
arg-count = 20;
arg-data = (char **)malloc(sizeof(char *) * arg-count);
+   if (arg-data == NULL)
+   return 0;
}
for (i = 0; i  arg-count; i++)
arg-data[i] = NULL;
Index: libssl/src/apps/dgst.c
===
RCS file: /cvs/src/lib/libssl/src/apps/dgst.c,v
retrieving revision 1.34
diff -u -p -r1.34 dgst.c
--- libssl/src/apps/dgst.c  23 May 2014 16:10:02 -  1.34
+++ libssl/src/apps/dgst.c  25 May 2014 00:11:20 -
@@ -401,6 +401,11 @@ mac_end:
sigbio = BIO_new_file(sigfile, rb);
siglen = EVP_PKEY_size(sigkey);
sigbuf = malloc(siglen);
+   if (sigbuf == NULL) {
+   BIO_printf(bio_err, Out of memory\n);
+   ERR_print_errors(bio_err);
+   goto end;
+   }
if (!sigbio) {
BIO_printf(bio_err, Error opening signature file %s\n,
sigfile);
Index: libssl/src/apps/speed.c
===
RCS file: /cvs/src/lib/libssl/src/apps/speed.c,v
retrieving revision 1.44
diff -u -p -r1.44 speed.c
--- libssl/src/apps/speed.c 23 May 2014 16:10:02 -  1.44
+++ libssl/src/apps/speed.c 25 May 2014 00:11:20 -
@@ -2107,6 +2107,10 @@ do_multi(int multi)
static char sep[] = :;
 
fds = malloc(multi * sizeof *fds);
+   if (fds == NULL) {
+   fprintf(stderr, Out of memory\n);
+   exit(1);
+   }
for (n = 0; n  multi; ++n) {
if (pipe(fd) == -1) {
fprintf(stderr, pipe failure\n);
Index: libssl/src/apps/x509.c
===
RCS file: /cvs/src/lib/libssl/src/apps/x509.c,v
retrieving revision 1.44
diff -u -p -r1.44 x509.c
--- libssl/src/apps/x509.c  23 May 2014 16:10:02 -  1.44
+++ libssl/src/apps/x509.c  25 May 2014 00:11:20 -
@@ -746,6 +746,11 @@ bad:
 
z = i2d_X509(x, NULL);
m = malloc(z);
+   if (m == NULL) {
+   BIO_printf(bio_err, Out of memory\n);
+   ERR_print_errors(bio_err);
+   goto end;
+   }
 
d = (unsigned char *) m;
z = i2d_X509_NAME(X509_get_subject_name(x), d);
Index: libssl/src/crypto/asn1/bio_ndef.c
===
RCS file: /cvs/src/lib/libssl/src/crypto/asn1/bio_ndef.c,v
retrieving revision 1.6
diff -u -p -r1.6 bio_ndef.c
--- libssl/src/crypto/asn1/bio_ndef.c   22 May 2014 21:12:15 -  1.6
+++ libssl/src/crypto/asn1/bio_ndef.c   25 May 2014 00:11:22 -
@@ -164,6 +164,8 @@ ndef_prefix(BIO *b, unsigned char **pbuf
 
derlen = ASN1_item_ndef_i2d(ndef_aux-val, NULL, ndef_aux-it);
p = malloc(derlen);
+   if (p == NULL)
+   return 0;
ndef_aux-derbuf = p;
*pbuf = p;
derlen = ASN1_item_ndef_i2d(ndef_aux-val, p, ndef_aux-it);
@@ -232,6 +234,8 @@ ndef_suffix(BIO *b, unsigned char **pbuf
 
derlen = ASN1_item_ndef_i2d(ndef_aux-val, NULL, ndef_aux-it);
p = malloc(derlen);
+   if (p == NULL)
+   return 0;
ndef_aux-derbuf = p;
*pbuf = p;
derlen = ASN1_item_ndef_i2d(ndef_aux-val, p, ndef_aux-it);
Index: libssl/src/crypto/cms/cms_pwri.c
===
RCS file: /cvs/src/lib/libssl/src/crypto/cms/cms_pwri.c,v
retrieving revision 1.4
diff -u -p -r1.4 cms_pwri.c
--- libssl/src/crypto/cms/cms_pwri.c24 May 2014 15:55:21 -  1.4
+++ libssl/src/crypto/cms/cms_pwri.c25 May 2014 00:11:27 -
@@ -231,6 +231,8 @@ kek_unwrap_key(unsigned char *out, size_
return 0;
}
tmp = malloc(inlen);
+   if (tmp == NULL)
+   return 0;
/* setup IV by decrypting last two blocks */
EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, outl,
in  + inlen - 2 * blocklen, blocklen * 2);
Index: libssl/src/ssl/ssl_ciph.c
===
RCS file: