r268244 (stable/9) seems to break "sysctl hw.ncpu"

David Wolfskill david at catwhisker.org
Fri Jul 4 17:47:08 UTC 2014


On Fri, Jul 04, 2014 at 07:19:20PM +0200, Hans Petter Selasky wrote:
> On 07/04/14 14:39, David Wolfskill wrote:
> > After building & installing @r268208 (yesterday), "sysctl hw.ncpu"
> > reports a number (e.g., "2" for my laptop).
> >
> > After building & installing @r268244 (today)...
> >
> > freebeast(9.3-P)[5] sysctl hw.ncpu | hd
> > 00000000  68 77 2e 6e 63 70 75 3a  20 0a                    |hw.ncpu: .|
> > 0000000a
> > freebeast(9.3-P)[6]
> >
> > After reverting r268244, then "cd /usr/src/sbin/sysctl && make && make
> > install":
> >
> > g1-252(9.3-P)[8] sysctl hw.ncpu | hd
> > 00000000  68 77 2e 6e 63 70 75 3a  20 32 0a                 |hw.ncpu:
> > 2.|
> > 0000000b
> > g1-252(9.3-P)[9]
> >
> >
> > I note that I also track stable/10 and head (on different slices;
> > daily) on the machine; haven't seen similar behavior in either
> > environment.
> ...
> 
> I cannot reproduce this. Using the same kernel and running sysctl from. 
> My patch to 9-stable will not affect printing of integers. 9-stable and 
> 10-stable and current "sysctl" code all gives the same result over here 
> with 9-stable kernel:
> 
> sysctl -n hw.ncpu | hd
> 00000000  32 0a                                             |2.|
> 
> sysctl hw.ncpu | hd
> 00000000  68 77 2e 6e 63 70 75 3a  20 32 0a                 |hw.ncpu: 2.|
> 
> Can you tell me exactly what kernel version you are using, "uname -a" 
> and which version of "sysctl" with which version of the kernel is 
> failing, so that I can reproduce.
> 
> Thank you!
> ...

/usr/src is:

g1-252(9.3-P)[1] svn info /usr/src/
Path: /usr/src
Working Copy Root Path: /usr/src
URL: file:///svn/freebsd/src/base/stable/9
Relative URL: ^/stable/9
Repository Root: file:///svn/freebsd/src/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 268249
Node Kind: directory
Schedule: normal
Last Changed Author: hselasky
Last Changed Rev: 268244
Last Changed Date: 2014-07-03 23:05:39 -0700 (Thu, 03 Jul 2014)

g1-252(9.3-P)[2] uname -a
FreeBSD g1-252.catwhisker.org 9.3-PRERELEASE FreeBSD 9.3-PRERELEASE #46  r268244M/268249:903500: Fri Jul  4 04:52:48 PDT 2014     root at g1-252.catwhisker.org:/usr/obj/usr/src/sys/CANARY  i386
g1-252(9.3-P)[3] 


I was able to see the behavior without changing the kernel -- and
indeed, I was able to run the stable/10 version of /sbin/sysctl
under stable/9 without problems:

g1-252(9.3-P)[3] which sysctl
/sbin/sysctl
g1-252(9.3-P)[4] ls -lT `!!`
ls -lT `which sysctl`
-r-xr-xr-x  1 root  wheel  14500 Jul  4 10:35:55 2014 /sbin/sysctl
g1-252(9.3-P)[5] !$ hw.ncpu | hd
`which sysctl` hw.ncpu | hd
00000000  68 77 2e 6e 63 70 75 3a  20 0a                    |hw.ncpu: .|
0000000a
g1-252(9.3-P)[6] `which sysctl.OK` hw.ncpu | hd
00000000  68 77 2e 6e 63 70 75 3a  20 32 0a                 |hw.ncpu: 2.|
0000000b
g1-252(9.3-P)[7] /S3/sbin/sysctl hw.ncpu | hd
00000000  68 77 2e 6e 63 70 75 3a  20 32 0a                 |hw.ncpu: 2.|
0000000b
g1-252(9.3-P)[8] file /S3/sbin/sysctl
/S3/sbin/sysctl: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 10.0 (1000709), stripped
g1-252(9.3-P)[9] file /sbin/sysctl
/sbin/sysctl: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.2 (902512), stripped
g1-252(9.3-P)[10] 

(Note that my stable/10 is from sources:
g1-252(9.3-P)[10] svn info /S3/usr/src/
Path: /S3/usr/src
Working Copy Root Path: /S3/usr/src
URL: file:///svn/freebsd/src/base/stable/10
Relative URL: ^/stable/10
Repository Root: file:///svn/freebsd/src/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 268249
Node Kind: directory
Schedule: normal
Last Changed Author: hselasky
Last Changed Rev: 268243
Last Changed Date: 2014-07-03 23:03:54 -0700 (Thu, 03 Jul 2014)

g1-252(9.3-P)[11] 

FreeBSD g1-252.catwhisker.org 10.0-STABLE FreeBSD 10.0-STABLE #1267  r268206M/268208:1000710: Thu Jul  3 05:27:08 PDT 2014     root at g1-252.catwhisker.org:/common/S3/obj/usr/src/sys/CANARY  i386

in case that's useful.)

I tried restoring r268244, rebuilding sysctl with debugging & running
it under gdb to see what was going on, but I'm a couple decades out
of practice -- seems that some of the variables I wanted to print
had been optimized to registers or some such thing.

I'm sympathetic to the notion that the change *shouldn't* have this
effect... but I have empiricist tendencies. :-}

I'll be happy to experiment as time permits.  (Holiday over here,
so that means I work on house-maintenance.)

Peace,
david
-- 
David H. Wolfskill				david at catwhisker.org
Taliban: Evil cowards with guns afraid of truth from a 14-year old girl.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140704/78961551/attachment.sig>


More information about the freebsd-stable mailing list