Re: on-line kernel debugging

2018-04-24 Thread Philip Guenther
On Wed, Apr 25, 2018 at 1:54 AM, Il Ka  wrote:
>
> I am also interested in kernel debugging.
> > but we do support running gdb inside a system against its running kernel
> Thank you for this recipe, but is it true that live debug does not work for
> some cases?
> You can't set break point in wsconsole and tty and debug them nor you can
> debug kernel that
> is frozen, and it seems that remote debug
> (like http://www.netbsd.org/docs/kernel/kgdb.html)
> is not supported by obsd, right?
>

Correct.



> Is it because of security reasons?
>

No one was using it, it got in the way of development that was in progress,
and none of the developers was interested in fixing it.  If someone wants
it and can keep it from being in the way of other work, then some form of
it could come back in, but if it would just decay into an impediment then
that would be a waste of time.


Philip Guenther


Re: Despite the man, wsmouse(4) can't be shared between X(1) and wsmoused(8) (workaround included)

2018-04-24 Thread Jason McIntyre
On Tue, Apr 24, 2018 at 05:40:44PM +0300, IL Ka wrote:
> Hello Jason,
> Thank you.
> 
> So, "wsmouse(4)"'s "/dev/wsmouse" multiplexer allows only exclusivie access
> now, right?
> 
> Should not we also document it in wsmouse(4) like
> "/dev/wsmouse is multiplexer for all mice,
> and can only be accessed exclusively by eitherws(4)/synaptics(4) or
> wsmoused(8)"
> 
> 
> Ilya.

morning.

no one objected to the diff i mailed, so i committed it.

as to your points above, i'm unsure. it only really affects (practically
speaking) wsmoused, right? so that seems the sane place. still if you
feel strongly, mail a diff and see if anyone bites.

jmc



Re: options(4) improvements

2018-04-24 Thread Jason McIntyre
On Tue, Apr 24, 2018 at 07:13:01PM +0300, IL Ka wrote:
> Hello  Jason,
> here is new patch.
> 

thanks. but it still doesn't apply, and it will be a pain to adjust by
hand...

Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--
|diff --git share/man/man4/options.4 share/man/man4/options.4
|index 9ef493cf6..b0b0605c2 100644
|--- share/man/man4/options.4
|+++ share/man/man4/options.4
--
Patching file options.4 using Plan A...
Hunk #1 succeeded at 83.
Hunk #2 succeeded at 113.
Hunk #3 succeeded at 123.
patch:  malformed patch at line 44: kernel.

jmc

> 
> 
> diff --git share/man/man4/options.4 share/man/man4/options.4
> index 9ef493cf6..b0b0605c2 100644
> --- share/man/man4/options.4
> +++ share/man/man4/options.4
> @@ -83,8 +83,7 @@ system call.
>  .It Cd option DDB
>  Compiles in a kernel debugger for diagnosing kernel problems.
>  See
> -.Xr ddb 4
> -for details.
> +.Xr ddb 4 .
>  .It Cd option DDB_SAFE_CONSOLE
>  Allows a break into the kernel debugger during boot.
>  Useful when debugging problems that can cause
> @@ -114,8 +113,7 @@ Adds code to the kernel for kernel profiling with
>  Adds hooks for the system call tracing facility, which allows users to
>  watch the system call invocation behavior of processes.
>  See
> -.Xr ktrace 1
> -for details.
> +.Xr ktrace 1 .
>  .It Cd option NO_PROPOLICE
>  Do not compile the kernel with the ProPolice stack protection.
>  See
> @@ -125,8 +123,7 @@ for more information about ProPolice.
>  Adds hooks for the process tracing facility, allowing a process to
>  control and observe another process.
>  See
> -.Xr ptrace 2
> -for details.
> +.Xr ptrace 2 .
>  .It Cd option SMALL_KERNEL
>  Removes some features and some optimizations from the kernel to reduce the
>  size of the resulting kernel binary.
> @@ -135,13 +132,11 @@ for general purpose kernels.
>  .It Cd option VFSLCKDEBUG
>  Turns on debugging for the Virtual File System interface.
>  See
> -.Xr vfs 9
> -for details.
> +.Xr vfs 9 .
>  .It Cd option WITNESS
>  Compiles in a lock checker for detecting lock order violations in the
> kernel.
>  See
> -.Xr witness 4
> -for details.
> +.Xr witness 4 .
>  .It Cd option WITNESS_COUNT= Ns Ar integer
>  Maximum number of lock types that are tracked by
>  .Xr witness 4 .
> @@ -154,8 +149,7 @@ Includes code for the ISO 9660 + Rock Ridge file
> system, which is the
>  standard file system used on many CD-ROMs.
>  It also supports Joliet extensions.
>  See
> -.Xr mount_cd9660 8
> -for details.
> +.Xr mount_cd9660 8 .
>  .It Cd option EXT2FS
>  Includes code implementing the Second Extended File System
>  .Em ( EXT2FS ) ,
> @@ -175,8 +169,7 @@ differing byte-orders.
>  That is, a big-endian machine will not be able to read an
>  ext2fs filesystem created on an i386 or other little-endian machine.
>  See
> -.Xr mount_ext2fs 8
> -for details.
> +.Xr mount_ext2fs 8 .
>  .It Cd option FFS
>  Includes code implementing the Berkeley Fast File System
>  .Em ( FFS ) .
> @@ -193,8 +186,7 @@ for
>  .Pa /tmp
>  or similar mount points.
>  See
> -.Xr mount_mfs 8
> -for details.
> +.Xr mount_mfs 8 .
>  .It Cd option MSDOSFS
>  Includes support for the MS-DOS FAT file system.
>  The kernel also implements the Windows 95
> @@ -202,8 +194,7 @@ extensions which permit the use of longer, mixed-case
> file names.
>  See
>  .Xr mount_msdos 8
>  and
> -.Xr fsck_msdos 8
> -for details.
> +.Xr fsck_msdos 8 .
>  .It Cd option NFSCLIENT
>  Include the client side of the
>  .Em NFS
> @@ -217,18 +208,15 @@ for details on NFS.
>  .It Cd option NTFS
>  Includes support for reading NTFS file systems.
>  See
> -.Xr mount_ntfs 8
> -for details.
> +.Xr mount_ntfs 8 .
>  .It Cd option UDF
>  Includes code for the UDF file systems typically found on DVD discs.
>  See
> -.Xr mount_udf 8
> -for details.
> +.Xr mount_udf 8 .
>  .It Cd option TMPFS
>  Includes code for the TMPFS efficient memory file system.
>  See
> -.Xr mount_tmpfs 8
> -for details.
> +.Xr mount_tmpfs 8 .
>  .El
>  .Sh FILE SYSTEM OPTIONS
>  .Bl -ohang
> @@ -256,8 +244,7 @@ retaining the safety of synchronous metadata updates.
>  .Pp
>  Soft updates must be enabled on a per-filesystem basis.
>  See
> -.Xr mount 8
> -for details.
> +.Xr mount 8 .
>  .Pp
>  Processors with a small kernel address space, such as the sun4 and sun4c,
> do
>  not have enough kernel memory to support soft updates.
> @@ -282,8 +269,7 @@ work.
>  See
>  .Xr mountd 8
>  and
> -.Xr nfsd 8
> -for details.
> +.Xr nfsd 8 .
>  .It Cd option QUOTA
>  Enables kernel support for file system quotas.
>  See
> @@ -291,8 +277,7 @@ See
>  .Xr edquota 8 ,
>  .Xr repquota 8 ,
>  and
> -.Xr quota 1
> -for details.
> +.Xr quota 1 .
>  Note that quotas only work on
>  .Dq ffs
>  file systems, although
> @@ -309,6 +294,8 @@ in large directories.
>  Provide in-kernel support for controlling VGA framebuffer mapping
>  and PCI configuration registers by user-processes
>  (such as an X Window System server).
> +Se

[PATCH] [www] faq/faq10.html - remove telnet warnings

2018-04-24 Thread Raf Czlonka
Hi all,

Telnet warnings have been removed over two years ago[0][1].

[0] 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/skeyinit/skeyinit.c.diff?r1=1.60&r2=1.61&f=h
[1] 
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/skey/skey.c.diff?r1=1.30&r2=1.31&f=h

Regards,

Raf

Index: faq/faq10.html
===
RCS file: /cvs/www/faq/faq10.html,v
retrieving revision 1.277
diff -u -p -r1.277 faq10.html
--- faq/faq10.html  2 Apr 2018 02:48:19 -   1.277
+++ faq/faq10.html  25 Apr 2018 03:23:01 -
@@ -238,9 +238,6 @@ your S/Key secret passphrase, which must
 
 
 $ skeyinit
-Reminder - Only use this method if you are directly connected
-   or have an encrypted channel.  If you are using telnet,
-   exit with no password and use skeyinit -s.
 Password:
 [Adding ericj with md5]
 Enter new secret passphrase:
@@ -266,7 +263,6 @@ to find out what command to run:
 $ skeyinfo -v
 otp-md5 95 oshi45820
 $ otp-md5 95 oshi45820
-Reminder - Do not use this program while logged in via telnet.
 Enter secret passphrase:
 NOOK CHUB HOYT SAC DOLE FUME
 
@@ -275,7 +271,6 @@ In order to generate a list of S/Key pas
 
 
 $ otp-md5 -n 5 95 oshi45820
-Reminder - Do not use this program while logged in via telnet.
 Enter secret passphrase:
 91: SHIM SET LEST HANS SMUG BOOT
 92: SUE ARTY YAW SEED KURD BAND



Re: on-line kernel debugging

2018-04-24 Thread Il Ka
Hello,

I am also interested in kernel debugging.
> but we do support running gdb inside a system against its running kernel
Thank you for this recipe, but is it true that live debug does not work for
some cases?
You can't set break point in wsconsole and tty and debug them nor you can
debug kernel that 
is frozen, and it seems that remote debug 
(like http://www.netbsd.org/docs/kernel/kgdb.html)
is not supported by obsd, right?

Is it because of security reasons?






--
Sent from: 
http://openbsd-archive.7691.n7.nabble.com/openbsd-dev-tech-f151936.html



Re: [patch] unify wm setting for xinit (xinitrc) and xenodm (Xsession), move to it config.site

2018-04-24 Thread Il Ka
> Or one could read the FAQ and copy xinitrc to .xinitrc (or Xsession to 
> .xsession) in their home directory and use vi to add their preferred
> window manager? 
Sure)
But still there is inconsistence between how xinit and xenodm configure
their wms: xinit has it as configure parameter, and xenodm has hardcode.

I was trying to unify it for the next step: use symbolic link or shell
script 
instead of real wm to make it configurable by installation process
(install.sub).

It is not hard to run ``rcctl enable xenodm`` manually, but obsd
provides this functionality using installation script:
https://github.com/openbsd/src/blob/master/distrib/miniroot/install.sub#L2053

So my idea was that after
"Do you want the X Window System to be started by xenodm(1)?" [yes]
we may have
"Choose window manager[fvwm,cwm,twm]" [fvwm]

Do you think we do not need it?





--
Sent from: 
http://openbsd-archive.7691.n7.nabble.com/openbsd-dev-tech-f151936.html



Re: [patch] unify wm setting for xinit (xinitrc) and xenodm (Xsession), move to it config.site

2018-04-24 Thread gjones

On 04/24/18 17:10, IL Ka wrote:

Hello,

There are 2 separate places with fvwm hardcoded in Xenocara:
1) xinitrc (used by xinit/startx)
2) Xsession (used by xenodm)

xinit's configure.ac has separate setting for it, so I
added same setting for xenodm configure.ac, recreated configure script
and extracted setting to config.site.

One can now change fvwm to cwm in config.site, and rebuild X11.

I also have an idea (not implemented yet) to have soft link
(i.e. /etc/X11/wm) and use it in both scripts.

We can then add step to sys/distrib/miniroot/install.sub
that asks user if she wants to have {fvwm,cwm,twm} and create
approprite link.
So, one may choose window manager as part of installation process
and have it for xenodm and startx.

diff --git app/xenodm/config/Xsession.in app/xenodm/config/Xsession.in
index 1a1b6ab2..f840c888 100644
--- app/xenodm/config/Xsession.in
+++ app/xenodm/config/Xsession.in
@@ -71,6 +71,6 @@ else
 @XRDB_PROGRAM@ -load "$resources"
 fi
 @bindir@/xterm &
-   @bindir@/fvwm
+   @bindir@/@WM@
  fi
  do_exit
diff --git app/xenodm/configure app/xenodm/configure
index 1686d7e2..04c0873a 100755
--- app/xenodm/configure
+++ app/xenodm/configure
@@ -672,6 +672,7 @@ XENODM_CFLAGS
  SHELL_CMD
  WTMP_FILE
  UTMP_FILE
+WM
  DEFAULTVT
  XENODMLOGDIR
  XENODMSCRIPTDIR
@@ -843,6 +844,7 @@ with_xenodmconfigdir
  with_xenodmscriptdir
  with_logdir
  with_default_vt
+with_wm
  with_utmp_file
  with_wtmp_file
  with_color_pixmap
@@ -1553,6 +1555,7 @@ Optional Packages:
(default=/var/log)
--with-default-vt=
specify default vt to start xenodm on
(default=none)
+  --with-wm=WMPath to default window manager
--with-utmp-file=
specify file to pass to sessreg -u for current
logins
@@ -18809,6 +18812,16 @@ fi



+
+# Check whether --with-wm was given.
+if test "${with_wm+set}" = set; then :
+  withval=$with_wm; WM="$withval"
+else
+  WM="fvwm"
+fi
+
+
+
  # Ideally we'd just pull out UTMP_FILE & WTMP_FILE from 
  # but that's not easy to do in autoconf

diff --git app/xenodm/configure.ac app/xenodm/configure.ac
index 76702564..45a0ff40 100644
--- app/xenodm/configure.ac
+++ app/xenodm/configure.ac
@@ -93,6 +93,12 @@ AC_ARG_WITH(default-vt,
 [DEFAULTVT="$withval"], [[DEFAULTVT=""]])
  AC_SUBST(DEFAULTVT)

+AC_ARG_WITH(wm,
+AS_HELP_STRING([--with-wm=WM], [Path to default window manager]),
+[WM="$withval"],
+[WM="fvwm"])
+AC_SUBST(WM)
+
  # Ideally we'd just pull out UTMP_FILE & WTMP_FILE from 
  # but that's not easy to do in autoconf
  AC_ARG_WITH(utmp_file,
diff --git etc/config.site etc/config.site
index 2681f486..b3223582 100644
--- etc/config.site
+++ etc/config.site
@@ -27,3 +27,4 @@
ac_cv_prog_lex_yytext_pointer=${ac_cv_prog_lex_yytext_pointer=yes}
  ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
  lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=131072}
  lt_cv_path_SED=${lt_cv_path_SED=/usr/bin/sed}
+with_wm=fvwm


Or one could read the FAQ and copy xinitrc to .xinitrc (or Xsession to 
.xsession) in their home directory and use vi to add their preferred window manager?




[patch] unify wm setting for xinit (xinitrc) and xenodm (Xsession), move to it config.site

2018-04-24 Thread IL Ka
Hello,

There are 2 separate places with fvwm hardcoded in Xenocara:
1) xinitrc (used by xinit/startx)
2) Xsession (used by xenodm)

xinit's configure.ac has separate setting for it, so I
added same setting for xenodm configure.ac, recreated configure script
and extracted setting to config.site.

One can now change fvwm to cwm in config.site, and rebuild X11.

I also have an idea (not implemented yet) to have soft link
(i.e. /etc/X11/wm) and use it in both scripts.

We can then add step to sys/distrib/miniroot/install.sub
that asks user if she wants to have {fvwm,cwm,twm} and create
approprite link.
So, one may choose window manager as part of installation process
and have it for xenodm and startx.

diff --git app/xenodm/config/Xsession.in app/xenodm/config/Xsession.in
index 1a1b6ab2..f840c888 100644
--- app/xenodm/config/Xsession.in
+++ app/xenodm/config/Xsession.in
@@ -71,6 +71,6 @@ else
@XRDB_PROGRAM@ -load "$resources"
fi
@bindir@/xterm &
-   @bindir@/fvwm
+   @bindir@/@WM@
 fi
 do_exit
diff --git app/xenodm/configure app/xenodm/configure
index 1686d7e2..04c0873a 100755
--- app/xenodm/configure
+++ app/xenodm/configure
@@ -672,6 +672,7 @@ XENODM_CFLAGS
 SHELL_CMD
 WTMP_FILE
 UTMP_FILE
+WM
 DEFAULTVT
 XENODMLOGDIR
 XENODMSCRIPTDIR
@@ -843,6 +844,7 @@ with_xenodmconfigdir
 with_xenodmscriptdir
 with_logdir
 with_default_vt
+with_wm
 with_utmp_file
 with_wtmp_file
 with_color_pixmap
@@ -1553,6 +1555,7 @@ Optional Packages:
   (default=/var/log)
   --with-default-vt=
   specify default vt to start xenodm on
(default=none)
+  --with-wm=WMPath to default window manager
   --with-utmp-file=
   specify file to pass to sessreg -u for current
   logins
@@ -18809,6 +18812,16 @@ fi



+
+# Check whether --with-wm was given.
+if test "${with_wm+set}" = set; then :
+  withval=$with_wm; WM="$withval"
+else
+  WM="fvwm"
+fi
+
+
+
 # Ideally we'd just pull out UTMP_FILE & WTMP_FILE from 
 # but that's not easy to do in autoconf

diff --git app/xenodm/configure.ac app/xenodm/configure.ac
index 76702564..45a0ff40 100644
--- app/xenodm/configure.ac
+++ app/xenodm/configure.ac
@@ -93,6 +93,12 @@ AC_ARG_WITH(default-vt,
[DEFAULTVT="$withval"], [[DEFAULTVT=""]])
 AC_SUBST(DEFAULTVT)

+AC_ARG_WITH(wm,
+AS_HELP_STRING([--with-wm=WM], [Path to default window manager]),
+[WM="$withval"],
+[WM="fvwm"])
+AC_SUBST(WM)
+
 # Ideally we'd just pull out UTMP_FILE & WTMP_FILE from 
 # but that's not easy to do in autoconf
 AC_ARG_WITH(utmp_file,
diff --git etc/config.site etc/config.site
index 2681f486..b3223582 100644
--- etc/config.site
+++ etc/config.site
@@ -27,3 +27,4 @@
ac_cv_prog_lex_yytext_pointer=${ac_cv_prog_lex_yytext_pointer=yes}
 ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}
 lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=131072}
 lt_cv_path_SED=${lt_cv_path_SED=/usr/bin/sed}
+with_wm=fvwm


sprinkle some const over libssl

2018-04-24 Thread Theo Buehler
OpenSSL started adding const to functions all over the place. The patch
below makes all our libssl functions match theirs wrt const, except for
BIO_f_ssl(3). I plan to do this one in a later step as a reacharound
into libcrypto would about double the size of the diff.

This diff was put through an i386 bulk build by sthen (thanks!) and only
had minimal fallout which I'll deal with when committing this diff.

Index: lib/libssl/ssl.h
===
RCS file: /var/cvs/src/lib/libssl/ssl.h,v
retrieving revision 1.155
diff -u -p -r1.155 ssl.h
--- lib/libssl/ssl.h11 Apr 2018 17:47:36 -  1.155
+++ lib/libssl/ssl.h20 Apr 2018 14:25:04 -
@@ -727,10 +727,10 @@ void SSL_CTX_sess_set_remove_cb(SSL_CTX 
 void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx,
 SSL_SESSION *sess);
 void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
-SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,
-int len, int *copy));
+SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
+const unsigned char *data, int len, int *copy));
 SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl,
-unsigned char *Data, int len, int *copy);
+const unsigned char *Data, int len, int *copy);
 void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,
 int type, int val));
 void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl, int type,
@@ -746,7 +746,7 @@ void SSL_CTX_set_cookie_generate_cb(SSL_
 int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
 unsigned int *cookie_len));
 void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,
-int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
+int (*app_verify_cookie_cb)(SSL *ssl, const unsigned char *cookie,
 unsigned int cookie_len));
 void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, int (*cb)(SSL *ssl,
 const unsigned char **out, unsigned int *outlen, void *arg), void *arg);
@@ -1247,7 +1247,7 @@ const SSL_CIPHER *SSL_get_current_cipher
 const SSL_CIPHER *SSL_CIPHER_get_by_id(unsigned int id);
 const SSL_CIPHER *SSL_CIPHER_get_by_value(uint16_t value);
 intSSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits);
-char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
+const char *   SSL_CIPHER_get_version(const SSL_CIPHER *c);
 const char *   SSL_CIPHER_get_name(const SSL_CIPHER *c);
 unsigned long  SSL_CIPHER_get_id(const SSL_CIPHER *c);
 uint16_t SSL_CIPHER_get_value(const SSL_CIPHER *c);
@@ -1279,7 +1279,7 @@ void  SSL_set_verify(SSL *s, int mode,
int (*callback)(int ok, X509_STORE_CTX *ctx));
 void   SSL_set_verify_depth(SSL *s, int depth);
 intSSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
-intSSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
+intSSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len);
 intSSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
 intSSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long 
len);
 intSSL_use_certificate(SSL *ssl, X509 *x);
@@ -1457,12 +1457,12 @@ long SSL_get_default_timeout(const SSL *
 int SSL_library_init(void );
 
 char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size);
-STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);
+STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk);
 
 SSL *SSL_dup(SSL *ssl);
 
 X509 *SSL_get_certificate(const SSL *ssl);
-/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl);
+/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl);
 
 void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode);
 int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);
Index: lib/libssl/ssl_cert.c
===
RCS file: /var/cvs/src/lib/libssl/ssl_cert.c,v
retrieving revision 1.66
diff -u -p -r1.66 ssl_cert.c
--- lib/libssl/ssl_cert.c   12 Aug 2017 02:55:22 -  1.66
+++ lib/libssl/ssl_cert.c   20 Apr 2018 14:25:04 -
@@ -454,7 +454,7 @@ set_client_CA_list(STACK_OF(X509_NAME) *
 }
 
 STACK_OF(X509_NAME) *
-SSL_dup_CA_list(STACK_OF(X509_NAME) *sk)
+SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk)
 {
int i;
STACK_OF(X509_NAME) *ret;
Index: lib/libssl/ssl_ciph.c
===
RCS file: /var/cvs/src/lib/libssl/ssl_ciph.c,v
retrieving revision 1.98
diff -u -p -r1.98 ssl_ciph.c
--- lib/libssl/ssl_ciph.c   17 Mar 2018 14:40:45 -  1.98
+++ lib/libssl/ssl_ciph.c   20 Apr 2018 14:25:04 -
@@ -1674,7 +1674,7 @@ SSL_CIPHER_description(const SSL_CIPHER 
return (ret);
 }
 
-char *
+const char *
 SSL_CIPHER_get_version(const SSL_CIPHER *c)
 {
if (c == NULL)
Index: lib/libssl/ssl_lib.c
===
RCS file: /var/cvs/src/lib/libssl/ssl_lib.c,v
retrieving revision 1.184
diff -u -p -r1.184 ssl_lib.c
--- lib/

Re: Make binutils not barf on binaries linked with lld

2018-04-24 Thread Mark Kettenis
> From: Philip Guenther 
> Date: Tue, 24 Apr 2018 21:09:32 +0200
> 
> On Tue, Apr 24, 2018 at 8:43 PM, Mark Kettenis 
> wrote:
> 
> > So lld generates .gnu.hash sections that our ancient binutils doesn't
> > grok.  With the diff below (taken from FreeBSD's binutils, so GPLv2)
> > fixes this.
> >
> > ok?
> >
> > --- gnu/usr.bin/binutils-2.17/bfd/elf.c 10 Aug 2016 20:46:08 -
> > 1.12
> > +++ gnu/usr.bin/binutils-2.17/bfd/elf.c 24 Apr 2018 18:41:12 -
> >
> ...
> 
> > @@ -2785,6 +2787,10 @@ elf_fake_sections (bfd *abfd, asection *
> >  case SHT_GROUP:
> >this_hdr->sh_entsize = 4;
> >break;
> > +
> > +case SHT_GNU_HASH:
> > +  this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4;
> > +  break;
> >
> 
> The entity size is _zero_ for 64bit archs?  (Or does that not really matter
> because you're not trying to make it dump the actual hash table itself?)

Yes.  The binaries produced by lld have it as 0 on amd64 and 4 on
armv7, which matches the code I copied from FreeBSD.

> Other than that possibly being wrong, ok guenther

Thanks



Re: Make binutils not barf on binaries linked with lld

2018-04-24 Thread Philip Guenther
On Tue, Apr 24, 2018 at 8:43 PM, Mark Kettenis 
wrote:

> So lld generates .gnu.hash sections that our ancient binutils doesn't
> grok.  With the diff below (taken from FreeBSD's binutils, so GPLv2)
> fixes this.
>
> ok?
>
> --- gnu/usr.bin/binutils-2.17/bfd/elf.c 10 Aug 2016 20:46:08 -
> 1.12
> +++ gnu/usr.bin/binutils-2.17/bfd/elf.c 24 Apr 2018 18:41:12 -
>
...

> @@ -2785,6 +2787,10 @@ elf_fake_sections (bfd *abfd, asection *
>  case SHT_GROUP:
>this_hdr->sh_entsize = 4;
>break;
> +
> +case SHT_GNU_HASH:
> +  this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4;
> +  break;
>

The entity size is _zero_ for 64bit archs?  (Or does that not really matter
because you're not trying to make it dump the actual hash table itself?)

Other than that possibly being wrong, ok guenther


Make binutils not barf on binaries linked with lld

2018-04-24 Thread Mark Kettenis
So lld generates .gnu.hash sections that our ancient binutils doesn't
grok.  With the diff below (taken from FreeBSD's binutils, so GPLv2)
fixes this.

ok?


Index: gnu/usr.bin/binutils-2.17/bfd/elf.c
===
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elf.c,v
retrieving revision 1.12
diff -u -p -r1.12 elf.c
--- gnu/usr.bin/binutils-2.17/bfd/elf.c 10 Aug 2016 20:46:08 -  1.12
+++ gnu/usr.bin/binutils-2.17/bfd/elf.c 24 Apr 2018 18:41:12 -
@@ -1825,6 +1825,7 @@ bfd_section_from_shdr (bfd *abfd, unsign
 case SHT_FINI_ARRAY:   /* .fini_array section.  */
 case SHT_PREINIT_ARRAY:/* .preinit_array section.  */
 case SHT_GNU_LIBLIST:  /* .gnu.liblist section.  */
+case SHT_GNU_HASH: /* .gnu.hash section.  */
   return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
 
 case SHT_DYNAMIC:  /* Dynamic linking information.  */
@@ -2264,6 +2265,7 @@ static const struct bfd_elf_special_sect
   { ".gnu.version_r", 14,  0, SHT_GNU_verneed, 0 },
   { ".gnu.liblist",   12,  0, SHT_GNU_LIBLIST, SHF_ALLOC },
   { ".gnu.conflict",  13,  0, SHT_RELA, SHF_ALLOC },
+  { ".gnu.hash",   9,  0, SHT_GNU_HASH, SHF_ALLOC },
   { NULL,  0,  0, 0,0 }
 };
 
@@ -2785,6 +2787,10 @@ elf_fake_sections (bfd *abfd, asection *
 case SHT_GROUP:
   this_hdr->sh_entsize = 4;
   break;
+
+case SHT_GNU_HASH:
+  this_hdr->sh_entsize = bed->s->arch_size == 64 ? 0 : 4;
+  break;
 }
 
   if ((asect->flags & SEC_ALLOC) != 0)
@@ -3230,6 +3236,7 @@ assign_section_numbers (bfd *abfd, struc
  break;
 
case SHT_HASH:
+   case SHT_GNU_HASH:
case SHT_GNU_versym:
  /* sh_link is the section header index of the symbol table
 this hash table or version table is for.  */
Index: gnu/usr.bin/binutils-2.17/include/elf/common.h
===
RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/include/elf/common.h,v
retrieving revision 1.7
diff -u -p -r1.7 common.h
--- gnu/usr.bin/binutils-2.17/include/elf/common.h  25 Jan 2017 08:56:08 
-  1.7
+++ gnu/usr.bin/binutils-2.17/include/elf/common.h  24 Apr 2018 18:41:12 
-
@@ -343,6 +343,7 @@
 #define SHT_LOOS   0x6000  /* First of OS specific semantics */
 #define SHT_HIOS   0x6fff  /* Last of OS specific semantics */
 
+#define SHT_GNU_HASH   0x6ff6  /* GNU style symbol hash table */
 #define SHT_GNU_LIBLIST0x6ff7  /* List of prelink dependencies 
*/
 
 /* The next three section types are defined by Solaris, and are named



Re: Error in adding system call in OpenBSD 6.3

2018-04-24 Thread Neeraj Pal
Yeah, It works.

I have just made two modifications:

1) make config
2) includes  for the printf and  for errors
that I pasted after doing "make config" file .

Now evrything works fine.

Sorry for asking some confusing non-clear kind of question.

 Thank you, everyone, for the support. And, from on next time I will
keep things clear. So, that it would be easy to answer for everyone.
And also I will try to solve the problem on my own and giving more
time for self research instead of just asking here.

On Tue, Apr 24, 2018 at 7:45 AM, Ted Unangst  wrote:
> Neeraj Pal wrote:
>>
>> In file included from /usr/src/sys/kern/sys_test.c:4:
>> /usr/src/sys/sys/syscallargs.h:153:13: error: unknown type name
>> 'socklen_t'; did you mean '__socklen_t'?
>
> Your includes are in the wrong or some are missing. I think you should start
> by adding code to a file that already compiles, that's much less trouble.
>



Re: fill device description with product name in uvideo(4)

2018-04-24 Thread Mark Kettenis
> Date: Tue, 24 Apr 2018 16:04:34 +0100
> From: Stuart Henderson 
> 
> On 2018/04/24 16:34, Landry Breuil wrote:
> > Hi,
> > 
> > here's a diff to reuse usbd_devinfo_vp() (exposed in usbdivar.h) in
> > VIDIOC_QUERYCAP ioctl callback, this way we can fill v4l2_capability
> > card struct member with the actual usb product name instead of a dummy
> > "Generic USB video class device".
> 
> Generally I think this is a good idea, but some devices have crap in
> v/p, is that likely to cause any problems?

Spaces are trimmed, but the strings are not otherwise sanitized.  The
mozilla code seems to interpret the string as UTF8 which opens up
additional ways to misinterpret the string.  Maybe some further
sanitization similar to what we do for scsi devices (scsi_strvis()) is
desirable.

An alternative would be to pass 0 instead of 1 for the last argument,
but then the string doesn't necessarily match what's printed in dmesg.

> > Firefox uses that ioctl to get the user-facing device name in
> > https://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc#313
> > so that's helpful when you have several devices
> > and the webrtc doorhanger asks you which camera you want to
> > share.. cf http://i.imgur.com/uLnWw6u.png
> > 
> > USB_MAX_STRING_LEN is 127 and card is 32 in v4l2_capability, so strlcpy
> > should take care of null-terminating/truncating.

I'm almost tempted to suggest putting the device name (uvideo0,
uvideo1, etc.) there to have something that is consistent.
> 
> > Index: usb_subr.c
> > ===
> > RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
> > retrieving revision 1.134
> > diff -u -r1.134 usb_subr.c
> > --- usb_subr.c  8 Apr 2017 02:57:25 -   1.134
> > +++ usb_subr.c  24 Apr 2018 14:20:00 -
> > @@ -61,8 +61,6 @@
> >  
> >  usbd_statususbd_set_config(struct usbd_device *, int);
> >  void   usbd_devinfo(struct usbd_device *, int, char *, size_t);
> > -void   usbd_devinfo_vp(struct usbd_device *, char *, size_t,
> > -   char *, size_t, int);
> >  char   *usbd_get_device_string(struct usbd_device *, uByte);
> >  char   *usbd_get_string(struct usbd_device *, int, char *, 
> > size_t);
> >  intusbd_getnewaddr(struct usbd_bus *);
> > Index: usbdivar.h
> > ===
> > RCS file: /cvs/src/sys/dev/usb/usbdivar.h,v
> > retrieving revision 1.73
> > diff -u -r1.73 usbdivar.h
> > --- usbdivar.h  3 Feb 2018 13:37:37 -   1.73
> > +++ usbdivar.h  24 Apr 2018 14:20:00 -
> > @@ -257,6 +257,8 @@
> >  usbd_statususb_insert_transfer(struct usbd_xfer *);
> >  void   usb_transfer_complete(struct usbd_xfer *);
> >  intusbd_detach(struct usbd_device *, struct device *);
> > +void   usbd_devinfo_vp(struct usbd_device *, char *, size_t,
> > +   char *, size_t, int);
> >  
> >  /* Routines from usb.c */
> >  void   usb_needs_explore(struct usbd_device *, int);
> > Index: uvideo.c
> > ===
> > RCS file: /cvs/src/sys/dev/usb/uvideo.c,v
> > retrieving revision 1.196
> > diff -u -r1.196 uvideo.c
> > --- uvideo.c30 Dec 2017 23:08:29 -  1.196
> > +++ uvideo.c24 Apr 2018 14:20:00 -
> > @@ -2781,11 +2781,14 @@
> >  uvideo_querycap(void *v, struct v4l2_capability *caps)
> >  {
> > struct uvideo_softc *sc = v;
> > +   char vendor[USB_MAX_STRING_LEN];
> > +   char product[USB_MAX_STRING_LEN];
> >  
> > bzero(caps, sizeof(*caps));
> > strlcpy(caps->driver, DEVNAME(sc), sizeof(caps->driver));
> > -   strlcpy(caps->card, "Generic USB video class device",
> > -   sizeof(caps->card));
> > +   usbd_devinfo_vp(sc->sc_udev, vendor, sizeof (vendor), product,
> > +   sizeof (product), 1);
> > +   strlcpy(caps->card, product, sizeof(caps->card));
> > strlcpy(caps->bus_info, "usb", sizeof(caps->bus_info));
> >  
> > caps->version = 1;
> 
> 



Re: on -current: "doas pkg_add evince" leads to "can't resolve libspectre-0.2.8p2".

2018-04-24 Thread Marc Espie
On Tue, Apr 24, 2018 at 05:01:40PM +0200, Felix Maschek wrote:
> Thank you for your help.
> 
> No resolution so far:
> 
> >
> e130$ doas pkg_check
> doas (fe...@e130.fritz.box) password:
> Packing-list sanity: ok
> Direct dependencies: ok
> --- ghostscript-9.07p7 ---
> dependency graphics/jbig2dec:jbig2dec-*:jbig2dec-0.11 does not match any
> installed package
> dependency 
> print/ghostscript/gnu-fonts:ghostscript-fonts->=8.11p3:ghostscript-fonts-8.11p3
> does not match any installed package
> dependency print/ijs:ijs-*:ijs-0.35p2 does not match any installed package
> ijs.0.0 not found
> jbig2dec.0.0 not found

So those packages are fucked, but you did not try to fix them ?

Like, by re-adding jbigdec ghostscript-fonts, ijs ?



Re: options(4) improvements

2018-04-24 Thread IL Ka
Hello  Jason,
here is new patch.



diff --git share/man/man4/options.4 share/man/man4/options.4
index 9ef493cf6..b0b0605c2 100644
--- share/man/man4/options.4
+++ share/man/man4/options.4
@@ -83,8 +83,7 @@ system call.
 .It Cd option DDB
 Compiles in a kernel debugger for diagnosing kernel problems.
 See
-.Xr ddb 4
-for details.
+.Xr ddb 4 .
 .It Cd option DDB_SAFE_CONSOLE
 Allows a break into the kernel debugger during boot.
 Useful when debugging problems that can cause
@@ -114,8 +113,7 @@ Adds code to the kernel for kernel profiling with
 Adds hooks for the system call tracing facility, which allows users to
 watch the system call invocation behavior of processes.
 See
-.Xr ktrace 1
-for details.
+.Xr ktrace 1 .
 .It Cd option NO_PROPOLICE
 Do not compile the kernel with the ProPolice stack protection.
 See
@@ -125,8 +123,7 @@ for more information about ProPolice.
 Adds hooks for the process tracing facility, allowing a process to
 control and observe another process.
 See
-.Xr ptrace 2
-for details.
+.Xr ptrace 2 .
 .It Cd option SMALL_KERNEL
 Removes some features and some optimizations from the kernel to reduce the
 size of the resulting kernel binary.
@@ -135,13 +132,11 @@ for general purpose kernels.
 .It Cd option VFSLCKDEBUG
 Turns on debugging for the Virtual File System interface.
 See
-.Xr vfs 9
-for details.
+.Xr vfs 9 .
 .It Cd option WITNESS
 Compiles in a lock checker for detecting lock order violations in the
kernel.
 See
-.Xr witness 4
-for details.
+.Xr witness 4 .
 .It Cd option WITNESS_COUNT= Ns Ar integer
 Maximum number of lock types that are tracked by
 .Xr witness 4 .
@@ -154,8 +149,7 @@ Includes code for the ISO 9660 + Rock Ridge file
system, which is the
 standard file system used on many CD-ROMs.
 It also supports Joliet extensions.
 See
-.Xr mount_cd9660 8
-for details.
+.Xr mount_cd9660 8 .
 .It Cd option EXT2FS
 Includes code implementing the Second Extended File System
 .Em ( EXT2FS ) ,
@@ -175,8 +169,7 @@ differing byte-orders.
 That is, a big-endian machine will not be able to read an
 ext2fs filesystem created on an i386 or other little-endian machine.
 See
-.Xr mount_ext2fs 8
-for details.
+.Xr mount_ext2fs 8 .
 .It Cd option FFS
 Includes code implementing the Berkeley Fast File System
 .Em ( FFS ) .
@@ -193,8 +186,7 @@ for
 .Pa /tmp
 or similar mount points.
 See
-.Xr mount_mfs 8
-for details.
+.Xr mount_mfs 8 .
 .It Cd option MSDOSFS
 Includes support for the MS-DOS FAT file system.
 The kernel also implements the Windows 95
@@ -202,8 +194,7 @@ extensions which permit the use of longer, mixed-case
file names.
 See
 .Xr mount_msdos 8
 and
-.Xr fsck_msdos 8
-for details.
+.Xr fsck_msdos 8 .
 .It Cd option NFSCLIENT
 Include the client side of the
 .Em NFS
@@ -217,18 +208,15 @@ for details on NFS.
 .It Cd option NTFS
 Includes support for reading NTFS file systems.
 See
-.Xr mount_ntfs 8
-for details.
+.Xr mount_ntfs 8 .
 .It Cd option UDF
 Includes code for the UDF file systems typically found on DVD discs.
 See
-.Xr mount_udf 8
-for details.
+.Xr mount_udf 8 .
 .It Cd option TMPFS
 Includes code for the TMPFS efficient memory file system.
 See
-.Xr mount_tmpfs 8
-for details.
+.Xr mount_tmpfs 8 .
 .El
 .Sh FILE SYSTEM OPTIONS
 .Bl -ohang
@@ -256,8 +244,7 @@ retaining the safety of synchronous metadata updates.
 .Pp
 Soft updates must be enabled on a per-filesystem basis.
 See
-.Xr mount 8
-for details.
+.Xr mount 8 .
 .Pp
 Processors with a small kernel address space, such as the sun4 and sun4c,
do
 not have enough kernel memory to support soft updates.
@@ -282,8 +269,7 @@ work.
 See
 .Xr mountd 8
 and
-.Xr nfsd 8
-for details.
+.Xr nfsd 8 .
 .It Cd option QUOTA
 Enables kernel support for file system quotas.
 See
@@ -291,8 +277,7 @@ See
 .Xr edquota 8 ,
 .Xr repquota 8 ,
 and
-.Xr quota 1
-for details.
+.Xr quota 1 .
 Note that quotas only work on
 .Dq ffs
 file systems, although
@@ -309,6 +294,8 @@ in large directories.
 Provide in-kernel support for controlling VGA framebuffer mapping
 and PCI configuration registers by user-processes
 (such as an X Window System server).
+See
+.Xr xf86 4 .
 This option is supported on the
 .Va alpha ,
 .Va amd64 ,
@@ -323,15 +310,18 @@ Adds support for the
 boot option (User Kernel Config).
 Allows modification of kernel settings (e.g., device parameters) before
 booting the system.
+See
+.Xr boot_config 8 .
 .It Cd option CRYPTO
 Enables support for the kernel cryptographic framework.
 See
-.Xr crypto 9
-for details.
+.Xr crypto 9 .
 While not IP specific, this option is usually used in conjunction with
option
 .Em IPSEC .
 .It Cd option EISAVERBOSE
 Makes the boot process more verbose for EISA peripherals.
+See
+.Xr eisa 4 .
 .It Cd option KMEMSTATS
 The kernel memory allocator,
 .Xr malloc 9 ,
@@ -341,8 +331,12 @@ On those architectures that have it, this enables
multiprocessor support.
 .It Cd option PCIVERBOSE
 Makes the boot process more verbose for PCI peripherals
 (vendor names and other information is printed, etc.).
+Se

Re: fill device description with product name in uvideo(4)

2018-04-24 Thread Martin Pieuchot
On 24/04/18(Tue) 17:15, Landry Breuil wrote:
> On Tue, Apr 24, 2018 at 04:04:34PM +0100, Stuart Henderson wrote:
> > On 2018/04/24 16:34, Landry Breuil wrote:
> > > Hi,
> > > 
> > > here's a diff to reuse usbd_devinfo_vp() (exposed in usbdivar.h) in
> > > VIDIOC_QUERYCAP ioctl callback, this way we can fill v4l2_capability
> > > card struct member with the actual usb product name instead of a dummy
> > > "Generic USB video class device".
> > 
> > Generally I think this is a good idea, but some devices have crap in
> > v/p, is that likely to cause any problems?
> 
> Well, the exact same function is called in usbd_devinfo() during boot to
> generate the dmesg lines for the devices.. so i dont really see how it makes
> things worse.

And by usbdevs(8) and the libusb. 

I'm ok with the diff if you change the last argument to be 0.  Setting
`usedev' to 1 makes the function generate I/O.  We want to avoid that
as much as possible.

I would be very happy if you could reduce the number of calls to
usbd_devinfo_vp() in the stack and used the cached the result instead.



Re: fill device description with product name in uvideo(4)

2018-04-24 Thread Stuart Henderson
On 2018/04/24 17:15, Landry Breuil wrote:
> On Tue, Apr 24, 2018 at 04:04:34PM +0100, Stuart Henderson wrote:
> > On 2018/04/24 16:34, Landry Breuil wrote:
> > > Hi,
> > > 
> > > here's a diff to reuse usbd_devinfo_vp() (exposed in usbdivar.h) in
> > > VIDIOC_QUERYCAP ioctl callback, this way we can fill v4l2_capability
> > > card struct member with the actual usb product name instead of a dummy
> > > "Generic USB video class device".
> > 
> > Generally I think this is a good idea, but some devices have crap in
> > v/p, is that likely to cause any problems?
> 
> Well, the exact same function is called in usbd_devinfo() during boot to
> generate the dmesg lines for the devices.. so i dont really see how it makes
> things worse.
> 
> uvideo0 at uhub1 port 1 configuration 1 interface 0 "Logitech QuickCam Orbit 
> AF" rev 2.00/0.08 addr 3
> uvideo1 at uhub1 port 8 configuration 1 interface 0 "Chicony Electronics 
> Co.,Ltd. Integrated Camera" rev 2.00/0.29 addr 5
> 
> Landry
> 

I've looked through dmesglog for strings in uvideo lines and they all look
pretty sane. I'm surprised, I've seen random-looking binary stuff on some
devices and was unsure how programs might handle that.



Re: fill device description with product name in uvideo(4)

2018-04-24 Thread Landry Breuil
On Tue, Apr 24, 2018 at 04:04:34PM +0100, Stuart Henderson wrote:
> On 2018/04/24 16:34, Landry Breuil wrote:
> > Hi,
> > 
> > here's a diff to reuse usbd_devinfo_vp() (exposed in usbdivar.h) in
> > VIDIOC_QUERYCAP ioctl callback, this way we can fill v4l2_capability
> > card struct member with the actual usb product name instead of a dummy
> > "Generic USB video class device".
> 
> Generally I think this is a good idea, but some devices have crap in
> v/p, is that likely to cause any problems?

Well, the exact same function is called in usbd_devinfo() during boot to
generate the dmesg lines for the devices.. so i dont really see how it makes
things worse.

uvideo0 at uhub1 port 1 configuration 1 interface 0 "Logitech QuickCam Orbit 
AF" rev 2.00/0.08 addr 3
uvideo1 at uhub1 port 8 configuration 1 interface 0 "Chicony Electronics 
Co.,Ltd. Integrated Camera" rev 2.00/0.29 addr 5

Landry



Re: fill device description with product name in uvideo(4)

2018-04-24 Thread Stuart Henderson
On 2018/04/24 16:34, Landry Breuil wrote:
> Hi,
> 
> here's a diff to reuse usbd_devinfo_vp() (exposed in usbdivar.h) in
> VIDIOC_QUERYCAP ioctl callback, this way we can fill v4l2_capability
> card struct member with the actual usb product name instead of a dummy
> "Generic USB video class device".

Generally I think this is a good idea, but some devices have crap in
v/p, is that likely to cause any problems?


> Firefox uses that ioctl to get the user-facing device name in
> https://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc#313
> so that's helpful when you have several devices
> and the webrtc doorhanger asks you which camera you want to
> share.. cf http://i.imgur.com/uLnWw6u.png
> 
> USB_MAX_STRING_LEN is 127 and card is 32 in v4l2_capability, so strlcpy
> should take care of null-terminating/truncating.
> 
> Thx mpi@ for the directions..
> 
> Landry

> Index: usb_subr.c
> ===
> RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
> retrieving revision 1.134
> diff -u -r1.134 usb_subr.c
> --- usb_subr.c8 Apr 2017 02:57:25 -   1.134
> +++ usb_subr.c24 Apr 2018 14:20:00 -
> @@ -61,8 +61,6 @@
>  
>  usbd_status  usbd_set_config(struct usbd_device *, int);
>  void usbd_devinfo(struct usbd_device *, int, char *, size_t);
> -void usbd_devinfo_vp(struct usbd_device *, char *, size_t,
> - char *, size_t, int);
>  char *usbd_get_device_string(struct usbd_device *, uByte);
>  char *usbd_get_string(struct usbd_device *, int, char *, size_t);
>  int  usbd_getnewaddr(struct usbd_bus *);
> Index: usbdivar.h
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdivar.h,v
> retrieving revision 1.73
> diff -u -r1.73 usbdivar.h
> --- usbdivar.h3 Feb 2018 13:37:37 -   1.73
> +++ usbdivar.h24 Apr 2018 14:20:00 -
> @@ -257,6 +257,8 @@
>  usbd_status  usb_insert_transfer(struct usbd_xfer *);
>  void usb_transfer_complete(struct usbd_xfer *);
>  int  usbd_detach(struct usbd_device *, struct device *);
> +void usbd_devinfo_vp(struct usbd_device *, char *, size_t,
> + char *, size_t, int);
>  
>  /* Routines from usb.c */
>  void usb_needs_explore(struct usbd_device *, int);
> Index: uvideo.c
> ===
> RCS file: /cvs/src/sys/dev/usb/uvideo.c,v
> retrieving revision 1.196
> diff -u -r1.196 uvideo.c
> --- uvideo.c  30 Dec 2017 23:08:29 -  1.196
> +++ uvideo.c  24 Apr 2018 14:20:00 -
> @@ -2781,11 +2781,14 @@
>  uvideo_querycap(void *v, struct v4l2_capability *caps)
>  {
>   struct uvideo_softc *sc = v;
> + char vendor[USB_MAX_STRING_LEN];
> + char product[USB_MAX_STRING_LEN];
>  
>   bzero(caps, sizeof(*caps));
>   strlcpy(caps->driver, DEVNAME(sc), sizeof(caps->driver));
> - strlcpy(caps->card, "Generic USB video class device",
> - sizeof(caps->card));
> + usbd_devinfo_vp(sc->sc_udev, vendor, sizeof (vendor), product,
> + sizeof (product), 1);
> + strlcpy(caps->card, product, sizeof(caps->card));
>   strlcpy(caps->bus_info, "usb", sizeof(caps->bus_info));
>  
>   caps->version = 1;



Re: on -current: "doas pkg_add evince" leads to "can't resolve libspectre-0.2.8p2".

2018-04-24 Thread Felix Maschek

Thank you for your help.

No resolution so far:




e130$ doas pkg_check
doas (fe...@e130.fritz.box) password:
Packing-list sanity: ok
Direct dependencies: ok
--- ghostscript-9.07p7 ---
dependency graphics/jbig2dec:jbig2dec-*:jbig2dec-0.11 does not match any 
installed package
dependency 
print/ghostscript/gnu-fonts:ghostscript-fonts->=8.11p3:ghostscript-fonts-8.11p3 
does not match any installed package
dependency print/ijs:ijs-*:ijs-0.35p2 does not match any installed 
package

ijs.0.0 not found
jbig2dec.0.0 not found
Reverse dependencies: ok
Files from packages: ok
e130$ doas pkg_add -u
quirks-2.426 signed on 2018-04-24T09:02:30Z
Couldn't find updates for xfdashboard-0.6.1p1 yelp-3.26.0p1 
yelp-xsl-3.20.1

e130$ doas pkg_add evince
quirks-2.426 signed on 2018-04-24T09:02:30Z
Ambiguous: choose package for evince
a   0: 
1: evince-3.26.0
2: evince-3.26.0-light
Your choice: 2
Can't install libspectre-0.2.8p2 because of libraries
|library ijs.0.0 not found
| not found anywhere
|library jbig2dec.0.0 not found
| not found anywhere
Direct dependencies for libspectre-0.2.8p2 resolve to ghostscript-9.07p7 
gettext-0.19.8.1p1
Full dependency tree is dbus-daemon-launch-helper-1.12.6 
ghostscript-9.07p7 jpeg-1.5.3v0 libunistring-0.9.7 lcms2-2.9 
libffi-3.2.1p4 cups-libs-2.2.7 gnutls-3.5.18 dbus-1.12.6v0 
python-2.7.14p1 glib2-2.56.1 p11-kit-0.23.2p0 tiff-4.0.9 avahi-0.7p1 
libtasn1-4.13p0 png-1.6.34 libdaemon-0.14p1 pcre-8.41 libnettle-3.4 
libidn2-2.0.0p0 bzip2-1.0.6p8 gettext-0.19.8.1p1 gmp-6.1.2p1 
libiconv-1.14p3 sqlite3-3.23.0 libelf-0.8.13p4 gdbm-1.14.1

Can't install evince-3.26.0-light: can't resolve libspectre-0.2.8p2
<

Any idea?
Felix

On 24.04.2018 15:39, Stuart Henderson wrote:

On 2018/04/24 15:28, Felix Maschek wrote:

Hi,

I want to install evince-light on my -current OpenBSD, which leads to
unresolved libs.

What can I do to fix this or to analyse the problem?


I would try "pkg_check" and then update all packages with "pkg_add -u",
then retry and post back if there are still problems.




Re: Despite the man, wsmouse(4) can't be shared between X(1) and wsmoused(8) (workaround included)

2018-04-24 Thread IL Ka
Hello Jason,
Thank you.

So, "wsmouse(4)"'s "/dev/wsmouse" multiplexer allows only exclusivie access
now, right?

Should not we also document it in wsmouse(4) like
"/dev/wsmouse is multiplexer for all mice,
and can only be accessed exclusively by eitherws(4)/synaptics(4) or
wsmoused(8)"


Ilya.


Re: semaphore: validate timespec and handle SA_RESTART

2018-04-24 Thread Philip Guenther
On Mon, 23 Apr 2018, Paul Irofti wrote:
> After discussing further with mpi@ and guenther@, we decided to first
> fix the existing semaphore implementation with regards to SA_RESTART
> and POSIX compliant returns in the case where we deal with restartable
> signals.
> 
> Currently we return EINTR everywhere which is mostly incorrect as the
> user can not know if she needs to recall the syscall or not. Philip
> suggested we use ECANCELED for that which is what my diff does.
> 
> Regression tests pass and so does the posixsuite. Timespec validation
> bits are needed to pass the later.

ok guenther@



fill device description with product name in uvideo(4)

2018-04-24 Thread Landry Breuil
Hi,

here's a diff to reuse usbd_devinfo_vp() (exposed in usbdivar.h) in
VIDIOC_QUERYCAP ioctl callback, this way we can fill v4l2_capability
card struct member with the actual usb product name instead of a dummy
"Generic USB video class device".

Firefox uses that ioctl to get the user-facing device name in
https://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc#313
so that's helpful when you have several devices
and the webrtc doorhanger asks you which camera you want to
share.. cf http://i.imgur.com/uLnWw6u.png

USB_MAX_STRING_LEN is 127 and card is 32 in v4l2_capability, so strlcpy
should take care of null-terminating/truncating.

Thx mpi@ for the directions..

Landry
Index: usb_subr.c
===
RCS file: /cvs/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.134
diff -u -r1.134 usb_subr.c
--- usb_subr.c  8 Apr 2017 02:57:25 -   1.134
+++ usb_subr.c  24 Apr 2018 14:20:00 -
@@ -61,8 +61,6 @@
 
 usbd_statususbd_set_config(struct usbd_device *, int);
 void   usbd_devinfo(struct usbd_device *, int, char *, size_t);
-void   usbd_devinfo_vp(struct usbd_device *, char *, size_t,
-   char *, size_t, int);
 char   *usbd_get_device_string(struct usbd_device *, uByte);
 char   *usbd_get_string(struct usbd_device *, int, char *, size_t);
 intusbd_getnewaddr(struct usbd_bus *);
Index: usbdivar.h
===
RCS file: /cvs/src/sys/dev/usb/usbdivar.h,v
retrieving revision 1.73
diff -u -r1.73 usbdivar.h
--- usbdivar.h  3 Feb 2018 13:37:37 -   1.73
+++ usbdivar.h  24 Apr 2018 14:20:00 -
@@ -257,6 +257,8 @@
 usbd_statususb_insert_transfer(struct usbd_xfer *);
 void   usb_transfer_complete(struct usbd_xfer *);
 intusbd_detach(struct usbd_device *, struct device *);
+void   usbd_devinfo_vp(struct usbd_device *, char *, size_t,
+   char *, size_t, int);
 
 /* Routines from usb.c */
 void   usb_needs_explore(struct usbd_device *, int);
Index: uvideo.c
===
RCS file: /cvs/src/sys/dev/usb/uvideo.c,v
retrieving revision 1.196
diff -u -r1.196 uvideo.c
--- uvideo.c30 Dec 2017 23:08:29 -  1.196
+++ uvideo.c24 Apr 2018 14:20:00 -
@@ -2781,11 +2781,14 @@
 uvideo_querycap(void *v, struct v4l2_capability *caps)
 {
struct uvideo_softc *sc = v;
+   char vendor[USB_MAX_STRING_LEN];
+   char product[USB_MAX_STRING_LEN];
 
bzero(caps, sizeof(*caps));
strlcpy(caps->driver, DEVNAME(sc), sizeof(caps->driver));
-   strlcpy(caps->card, "Generic USB video class device",
-   sizeof(caps->card));
+   usbd_devinfo_vp(sc->sc_udev, vendor, sizeof (vendor), product,
+   sizeof (product), 1);
+   strlcpy(caps->card, product, sizeof(caps->card));
strlcpy(caps->bus_info, "usb", sizeof(caps->bus_info));
 
caps->version = 1;


Re: Fix for "config(8) "kernel building" instructions lead to bad kernel name (which breaks relink)"

2018-04-24 Thread IL Ka
Hello,

> i'd be tempted to remove the instructions for building off a cd-rom, and
> leaving it as an exercise to the reader.
I am OK with it.
Lack of instructions is better than instruction that leads to
broken relink.

> the second (more common usage case) works fine, right?
Yes.


Re: on -current: "doas pkg_add evince" leads to "can't resolve libspectre-0.2.8p2".

2018-04-24 Thread Stuart Henderson
On 2018/04/24 15:28, Felix Maschek wrote:
> Hi,
> 
> I want to install evince-light on my -current OpenBSD, which leads to
> unresolved libs.
> 
> What can I do to fix this or to analyse the problem?

I would try "pkg_check" and then update all packages with "pkg_add -u",
then retry and post back if there are still problems.



on -current: "doas pkg_add evince" leads to "can't resolve libspectre-0.2.8p2".

2018-04-24 Thread Felix Maschek

Hi,

I want to install evince-light on my -current OpenBSD, which leads to 
unresolved libs.


What can I do to fix this or to analyse the problem?

Kind regards
Felix




e130$ cat /etc/installurl
https://fastly.cdn.openbsd.org/pub/OpenBSD
e130$ doas pkg_add evince
quirks-2.426 signed on 2018-04-24T09:02:30Z
Ambiguous: choose package for evince
a   0: 
1: evince-3.26.0
2: evince-3.26.0-light
Your choice: 2
evince-3.26.0-light:unrar-5.50v1: ok
Warning: couldn't read packing-list from installed package 
ghostscript-fonts-8.11p3

File /var/db/pkg/ghostscript-fonts-8.11p3/+CONTENTS does not exist
Warning: couldn't read packing-list from installed package ijs-0.35p2
File /var/db/pkg/ijs-0.35p2/+CONTENTS does not exist
Warning: couldn't read packing-list from installed package jbig2dec-0.11
File /var/db/pkg/jbig2dec-0.11/+CONTENTS does not exist
Warning: couldn't read packing-list from installed package 
cups-libs-2.2.6

File /var/db/pkg/cups-libs-2.2.6/+CONTENTS does not exist
Can't install libspectre-0.2.8p2 because of libraries
|library avahi-client.0.1 not found
| not found anywhere
|library avahi-common.0.1 not found
| not found anywhere
|library dbus-1.11.2 not found
| not found anywhere
|library ffi.1.2 not found
| not found anywhere
|library gmp.10.0 not found
| not found anywhere
|library gnutls.44.1 not found
| not found anywhere
|library hogweed.2.0 not found
| not found anywhere
|library idn2.1.0 not found
| not found anywhere
|library ijs.0.0 not found
| not found anywhere
|library jbig2dec.0.0 not found
| not found anywhere
|library nettle.3.0 not found
| not found anywhere
|library p11-kit.2.0 not found
| not found anywhere
|library tasn1.4.0 not found
| not found anywhere
|library unistring.0.1 not found
| not found anywhere
Direct dependencies for libspectre-0.2.8p2 resolve to gettext-0.19.8.1p1 
ghostscript-9.07p7
Full dependency tree is ghostscript-9.07p7 png-1.6.34 
ghostscript-fonts-8.11p3 tiff-4.0.9 jbig2dec-0.11 cups-libs-2.2.7 
libiconv-1.14p3 gettext-0.19.8.1p1 lcms2-2.9 cups-libs-2.2.6 ijs-0.35p2 
jpeg-1.5.3v0

Can't install evince-3.26.0-light: can't resolve libspectre-0.2.8p2
<



push NET_LOCK from ifioctl to in_control

2018-04-24 Thread Paul Irofti
Hi,

The following diff pushes NET_LOCK down from the default ifioctl case to
the in[6]_control and around the driver if_ioctl functions. OK?

Also available here

  https://github.com/bulibuta/openbsd-src/tree/ifioctl-default-netlock

Paul


diff --git sys/net/if.c sys/net/if.c
index 4905b757210..0457ab94579 100644
--- sys/net/if.c
+++ sys/net/if.c
@@ -2126,13 +2126,14 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, 
struct proc *p)
break;
/* FALLTHROUGH */
default:
-   NET_LOCK();
error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
(struct mbuf *) cmd, (struct mbuf *) data,
(struct mbuf *) ifp, p));
-   if (error == EOPNOTSUPP)
+   if (error == EOPNOTSUPP) {
+   NET_LOCK();
error = ((*ifp->if_ioctl)(ifp, cmd, data));
-   NET_UNLOCK();
+   NET_UNLOCK();
+   }
break;
}
 
diff --git sys/net/raw_usrreq.c sys/net/raw_usrreq.c
index 4b32be9ad24..9df4f828e28 100644
--- sys/net/raw_usrreq.c
+++ sys/net/raw_usrreq.c
@@ -54,10 +54,11 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *nam,
int error = 0;
int len;
 
-   soassertlocked(so);
-
if (req == PRU_CONTROL)
return (EOPNOTSUPP);
+
+   soassertlocked(so);
+
if (control && control->m_len) {
m_freem(m);
return (EOPNOTSUPP);
diff --git sys/netinet/in.c sys/netinet/in.c
index 60b02a4656c..15a8435b010 100644
--- sys/netinet/in.c
+++ sys/netinet/in.c
@@ -185,7 +185,9 @@ int
 in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp)
 {
int privileged;
+   int error;
 
+   NET_LOCK();
privileged = 0;
if ((so->so_state & SS_PRIV) != 0)
privileged++;
@@ -194,11 +196,16 @@ in_control(struct socket *so, u_long cmd, caddr_t data, 
struct ifnet *ifp)
switch (cmd) {
case SIOCGETVIFCNT:
case SIOCGETSGCNT:
-   return (mrt_ioctl(so, cmd, data));
+   error = mrt_ioctl(so, cmd, data);
+   goto out;
}
 #endif /* MROUTING */
 
-   return (in_ioctl(cmd, data, ifp, privileged));
+   error = in_ioctl(cmd, data, ifp, privileged);
+
+out:
+   NET_UNLOCK();
+   return error;
 }
 
 int
diff --git sys/netinet/ip_divert.c sys/netinet/ip_divert.c
index 1e1c2e200af..3e4a861368d 100644
--- sys/netinet/ip_divert.c
+++ sys/netinet/ip_divert.c
@@ -242,12 +242,13 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *addr,
struct inpcb *inp = sotoinpcb(so);
int error = 0;
 
-   soassertlocked(so);
-
if (req == PRU_CONTROL) {
return (in_control(so, (u_long)m, (caddr_t)addr,
(struct ifnet *)control));
}
+
+   soassertlocked(so);
+
if (inp == NULL) {
error = EINVAL;
goto release;
diff --git sys/netinet/raw_ip.c sys/netinet/raw_ip.c
index 79f2a0ca94a..03c13e631ed 100644
--- sys/netinet/raw_ip.c
+++ sys/netinet/raw_ip.c
@@ -368,12 +368,12 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *nam,
struct inpcb *inp = sotoinpcb(so);
int error = 0;
 
-   soassertlocked(so);
-
if (req == PRU_CONTROL)
return (in_control(so, (u_long)m, (caddr_t)nam,
(struct ifnet *)control));
 
+   soassertlocked(so);
+
if (inp == NULL) {
error = EINVAL;
goto release;
diff --git sys/netinet/tcp_usrreq.c sys/netinet/tcp_usrreq.c
index cd7f7e398dd..d1d7546938c 100644
--- sys/netinet/tcp_usrreq.c
+++ sys/netinet/tcp_usrreq.c
@@ -131,8 +131,6 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *nam,
int error = 0;
short ostate;
 
-   soassertlocked(so);
-
if (req == PRU_CONTROL) {
 #ifdef INET6
if (sotopf(so) == PF_INET6)
@@ -143,6 +141,9 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *nam,
return (in_control(so, (u_long)m, (caddr_t)nam,
(struct ifnet *)control));
}
+
+   soassertlocked(so);
+
if (control && control->m_len) {
m_freem(control);
m_freem(m);
diff --git sys/netinet/udp_usrreq.c sys/netinet/udp_usrreq.c
index 001a41a0810..9d62ad42137 100644
--- sys/netinet/udp_usrreq.c
+++ sys/netinet/udp_usrreq.c
@@ -1057,8 +1057,6 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *addr,
struct inpcb *inp;
int error = 0;
 
-   soassertlocked(so);
-
if (req == PRU_CONTROL) {
 #ifdef INET6
if (sotopf(so) == PF_INET6)
@@ -1070,6 +1068,8 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, 
struct mbuf *add

config -e vs ugen(4) fix

2018-04-24 Thread Martin Pieuchot
Instead of having to disable USB drivers to force some devices to attach
as ugen(4), we can whitelist them.  Diff below does that by adding a new
option to usbdevs(8):

# usbdevs -l 7047:04ca -l a001:1199 

The logic is currently limited to 16 devices.  usbdevs(8) output could
be improved but I'm not sure what people want.

This should remove the need for running config -e on GENERIC kernels to
disable ulpt(4).

Comments?

Index: usr.sbin/usbdevs/usbdevs.c
===
RCS file: /cvs/src/usr.sbin/usbdevs/usbdevs.c,v
retrieving revision 1.25
diff -u -p -r1.25 usbdevs.c
--- usr.sbin/usbdevs/usbdevs.c  22 Dec 2015 08:36:40 -  1.25
+++ usr.sbin/usbdevs/usbdevs.c  24 Apr 2018 11:54:57 -
@@ -30,15 +30,17 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
 
 #ifndef nitems
 #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
@@ -48,6 +50,10 @@
 
 int verbose = 0;
 int showdevs = 0;
+int adddevs = 0;
+int gotlist = 0;
+
+struct usb_device_list dl;
 
 void usage(void);
 void usbdev(int f, int a, int rec);
@@ -110,14 +116,13 @@ usbdev(int f, int a, int rec)
else
printf("unconfigured, ");
}
+   printf("%04x:%04x %s, %s", di.udi_productNo, di.udi_vendorNo,
+   di.udi_product, di.udi_vendor);
if (verbose) {
-   printf("%s(0x%04x), %s(0x%04x), rev %s",
-   di.udi_product, di.udi_productNo,
-   di.udi_vendor, di.udi_vendorNo, di.udi_release);
+   printf(", rev %s", di.udi_release);
if (strlen(di.udi_serial))
printf(", iSerialNumber %s", di.udi_serial);
-   } else
-   printf("%s, %s", di.udi_product, di.udi_vendor);
+   }
printf("\n");
if (showdevs) {
for (i = 0; i < USB_MAX_DEVNAMES; i++)
@@ -169,6 +174,13 @@ dumpone(char *name, int f, int addr)
 {
if (verbose)
printf("Controller %s:\n", name);
+
+   if (!gotlist) {
+   dl.udl_cmd = USB_DEVICE_LIST_GET;
+   if (ioctl(f, USB_DEVICE_LIST, &dl))
+   /* nothing */;
+   }
+
indent = 0;
memset(done, 0, sizeof done);
if (addr)
@@ -177,6 +189,44 @@ dumpone(char *name, int f, int addr)
usbdump(f);
 }
 
+void
+addlist(char *optarg)
+{
+   long vendorNo, productNo;
+   char *str, *ids, *endptr;
+   int i;
+
+   ids = strdup(optarg);
+
+   str = strtok(ids, ":");
+   if (str == NULL)
+   errx(1, "product");
+   productNo = strtol(str, &endptr, 16);
+   if (str[0] == '\0' || endptr[0] != '\0' || productNo > 0x)
+   errx(1, "product '%s'", str);
+
+   str = strtok(NULL, ":");
+   if (str == NULL)
+   errx(1, "vendor");
+   vendorNo = strtol(str, &endptr, 16);
+   if (str[0] == '\0' || endptr[0] != '\0' || vendorNo > 0x)
+   errx(1, "vendor '%s'", str);
+
+   free(ids);
+
+   for (i = 0; i < USB_DEVICE_LIST_MAX; i++) {
+   if (dl.udl_productNo[i] != 0 || dl.udl_vendorNo[i] != 0)
+   continue;
+
+   dl.udl_productNo[i] = productNo;
+   dl.udl_vendorNo[i] = vendorNo;
+   break;
+   }
+
+   if (i == USB_DEVICE_LIST_MAX)
+   errx(1, "too many listed devices");
+}
+
 int
 main(int argc, char **argv)
 {
@@ -187,7 +237,7 @@ main(int argc, char **argv)
int addr = 0;
int ncont;
 
-   while ((ch = getopt(argc, argv, "a:df:v?")) != -1) {
+   while ((ch = getopt(argc, argv, "a:cdf:l:v?")) != -1) {
switch (ch) {
case 'a':
addr = strtonum(optarg, 1, USB_MAX_DEVICES, &errstr);
@@ -200,6 +250,10 @@ main(int argc, char **argv)
case 'f':
dev = optarg;
break;
+   case 'l':
+   adddevs = 1;
+   addlist(optarg);
+   break;
case 'v':
verbose = 1;
break;
@@ -210,6 +264,21 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
 
+   if (argc != 0)
+   usage();
+
+   if (adddevs) {
+   snprintf(buf, sizeof buf, "%s0", USBDEV);
+   f = open(buf, O_RDWR);
+   if (f >= 0) {
+   dl.udl_cmd = USB_DEVICE_LIST_SET;
+   if (ioctl(f, USB_DEVICE_LIST, &dl))
+   err(1, "USB_DEVICE_LIST_SET");
+   } else
+   err(1, "%s", buf);
+   return 0;
+   }
+
if (dev == 0) {
for (ncont = 0, i = 0; i 

Re: arm64: GPIO "pin bus" drivers

2018-04-24 Thread Mark Kettenis
> Date: Tue, 24 Apr 2018 08:32:40 +0300
> From: Artturi Alm 
> 
> Hi,
> 
> pine64 still being my only arm64-sbc, i won't bother w/
> gpio* at rkgpio?
> etc., but i would like to have these enabled for arm64,
> as atleast pine64 is equipped w/plenty of headers/pins brought out, and
> gpio* at sxipio?
> is there already:)

Thanks.  The gpioiic(4) is probably not all that useful considering
that there pins for a real i2c controller available as well.

Anyway, I committed the diff.  Thanks.



Re: mfi(4): Make "bioctl -R" work after hot swapping

2018-04-24 Thread YASUOKA Masahiko
Hi,

On Thu, 29 Jun 2017 17:14:41 +0900 (JST)
FUKAUMI Naoki  wrote:
> Currently "bioctl -R" works only if disk state is "Offline" (set by
> "bioctl -O") and it doesn't work for "Failed" disk.
> 
> To make it work with hot swapped disk, report unused ("unconfigured" in
> MegaRAID) disk to userland, and handle it properly when rebuilding.

Let me update the diff.

ok? comments?


Make "bioctl -R" work agaist "failed" disks.
Diff from Fukaumi at soum.co.jp

Index: sys/dev/ic/mfi.c
===
RCS file: /var/cvs/openbsd/src/sys/dev/ic/mfi.c,v
retrieving revision 1.168
diff -u -p -r1.168 mfi.c
--- sys/dev/ic/mfi.c8 Sep 2017 05:36:52 -   1.168
+++ sys/dev/ic/mfi.c24 Apr 2018 10:34:54 -
@@ -1582,7 +1582,8 @@ mfi_ioctl(struct device *dev, u_long cmd
 int
 mfi_bio_getitall(struct mfi_softc *sc)
 {
-   int i, d, size, rv = EINVAL;
+   int i, d, rv = EINVAL;
+   size_t  size;
union mfi_mbox  mbox;
struct mfi_conf *cfg = NULL;
struct mfi_ld_details   *ld_det = NULL;
@@ -1790,11 +1791,12 @@ mfi_ioctl_disk(struct mfi_softc *sc, str
struct mfi_array*ar;
struct mfi_ld_cfg   *ld;
struct mfi_pd_details   *pd;
+   struct mfi_pd_list  *pl;
struct mfi_pd_progress  *mfp;
struct mfi_progress *mp;
struct scsi_inquiry_data *inqbuf;
charvend[8+16+4+1], *vendp;
-   int rv = EINVAL;
+   int i, rv = EINVAL;
int arr, vol, disk, span;
union mfi_mbox  mbox;
 
@@ -1810,6 +1812,7 @@ mfi_ioctl_disk(struct mfi_softc *sc, str
cfg = sc->sc_cfg;
 
pd = malloc(sizeof *pd, M_DEVBUF, M_WAITOK);
+   pl = malloc(sizeof *pl, M_DEVBUF, M_WAITOK);
 
ar = cfg->mfc_array;
vol = bd->bd_volid;
@@ -1833,13 +1836,53 @@ mfi_ioctl_disk(struct mfi_softc *sc, str
 
/* offset disk into pd list */
disk = bd->bd_diskid % ld[vol].mlc_parm.mpa_no_drv_per_span;
-   bd->bd_target = ar[arr].pd[disk].mar_enc_slot;
+
+   if (ar[arr].pd[disk].mar_pd.mfp_id == 0xU) {
+   /* disk is missing but succeed command */
+   bd->bd_status = BIOC_SDFAILED;
+   rv = 0;
+
+   /* try to find an unused disk for the target to rebuild */
+   if (mfi_mgmt(sc, MR_DCMD_PD_GET_LIST, MFI_DATA_IN,
+   sizeof *pl, pl, NULL))
+   goto freeme;
+
+   for (i = 0; i < pl->mpl_no_pd; i++) {
+   if (pl->mpl_address[i].mpa_scsi_type != 0)
+   continue;
+
+   memset(&mbox, 0, sizeof(mbox));
+   mbox.s[0] = pl->mpl_address[i].mpa_pd_id;
+   if (mfi_mgmt(sc, MR_DCMD_PD_GET_INFO, MFI_DATA_IN,
+   sizeof *pd, pd, &mbox))
+   continue;
+
+   if (pd->mpd_fw_state == MFI_PD_UNCONFIG_GOOD ||
+   pd->mpd_fw_state == MFI_PD_UNCONFIG_BAD)
+   break;
+   }
+
+   if (i == pl->mpl_no_pd)
+   goto freeme;
+   } else {
+   memset(&mbox, 0, sizeof(mbox));
+   mbox.s[0] = ar[arr].pd[disk].mar_pd.mfp_id;
+   if (mfi_mgmt(sc, MR_DCMD_PD_GET_INFO, MFI_DATA_IN,
+   sizeof *pd, pd, &mbox)) {
+   bd->bd_status = BIOC_SDINVALID;
+   goto freeme;
+   }
+   }
+
+   /* get the remaining fields */
+   bd->bd_channel = pd->mpd_enc_idx;
+   bd->bd_target = pd->mpd_enc_slot;
 
/* get status */
-   switch (ar[arr].pd[disk].mar_pd_state){
+   switch (pd->mpd_fw_state){
case MFI_PD_UNCONFIG_GOOD:
-   case MFI_PD_FAILED:
-   bd->bd_status = BIOC_SDFAILED;
+   case MFI_PD_UNCONFIG_BAD:
+   bd->bd_status = BIOC_SDUNUSED;
break;
 
case MFI_PD_HOTSPARE: /* XXX dedicated hotspare part of array? */
@@ -1850,6 +1893,10 @@ mfi_ioctl_disk(struct mfi_softc *sc, str
bd->bd_status = BIOC_SDOFFLINE;
break;
 
+   case MFI_PD_FAILED:
+   bd->bd_status = BIOC_SDFAILED;
+   break;
+
case MFI_PD_REBUILD:
bd->bd_status = BIOC_SDREBUILD;
break;
@@ -1858,27 +1905,15 @@ mfi_ioctl_disk(struct mfi_softc *sc, str
bd->bd_status = BIOC_SDONLINE;
break;
 
-   case MFI_PD_UNCONFIG_BAD: /* XXX define new state in bio */
+   case MFI_PD_COPYBACK:
+   case MFI_PD_SYSTEM:
default:
bd->bd_status = BIOC_SDINVALID;
break;
}
 
-   /* get the remaining fields */
-   memset(