Re: svn commit: r239356 - head/sbin/dhclient

2012-08-21 Thread Andrey Chernov
On Tue, Aug 21, 2012 at 03:58:12PM +0900, Hajimu UMEMOTO wrote: ache I am network admin, but what router advertise is out my easy control ache (fixing configs in the Linux router's FS or even rebuilding router ache components is needed, I don't want to touch this hardware). You may want to

Re: svn commit: r239356 - head/sbin/dhclient

2012-08-21 Thread Andrey Chernov
On Tue, Aug 21, 2012 at 03:58:12PM +0900, Hajimu UMEMOTO wrote: Okay, thanks. I solve this riddle, thanks to your helpful tips. Relevant part of my setup are at the end of this messae for anybody who may have the same problem. BTW, I notice that link-local router address behavior is strange

Re: svn commit: r240822 - head/sys/geom

2012-09-26 Thread Andrey Chernov
On Tue, Sep 25, 2012 at 05:37:12PM -0600, Kenneth D. Merry wrote: Use the topology lock to protect list of providers while withering them. It is possible that provider is destroyed while we are iterating over the list. This breaks devices going away in CAM. When the da(4) driver

Re: svn commit: r241373 - head/lib/libc/stdlib

2012-10-09 Thread Andrey Chernov
Do you check assembler output for _both_ cases? In my testing clang and gcc xor's 'junk' properly in case it have 'volatile' keyword (as in srandomdev()) and elide it without 'volatile'. IMHO this change should be backed out for srandomdev() and adding 'volatile' for sranddev() instead. On

Re: svn commit: r241373 - head/lib/libc/stdlib

2012-10-09 Thread Andrey Chernov
On 09.10.2012 21:47, Eitan Adler wrote: On 9 October 2012 12:33, Andrey Chernov a...@freebsd.org wrote: Do you check assembler output for _both_ cases? Yes. ... http://blog.eitanadler.com/2012/10/reduced-entropy-in-rand-and-random.html At this URL I see only already known buggy assembler

Re: svn commit: r241373 - head/lib/libc/stdlib

2012-10-11 Thread Andrey Chernov
On 11.10.2012 19:23, Peter Wemm wrote: On Thu, Oct 11, 2012 at 6:14 AM, Andrey Chernov a...@freebsd.org wrote: On 11.10.2012 15:44, Pawel Jakub Dawidek wrote: On Tue, Oct 09, 2012 at 01:51:05PM -0400, Eitan Adler wrote: On 9 October 2012 13:27, m...@freebsd.org wrote: The original behavior

Re: svn commit: r242417 - head/sys/dev/sound/pci/hda

2012-11-01 Thread Andrey Chernov
On 01.11.2012 2:11, Alexander Motin wrote: Author: mav Date: Wed Oct 31 22:11:51 2012 New Revision: 242417 URL: http://svn.freebsd.org/changeset/base/242417 Log: ASUS EeePC 1001px has strange variant of ALC269 CODEC, that mutes speaker if unused in that configuration mixer at NID 15

Re: svn commit: r208868 - in head/usr.bin: bc dc

2010-06-06 Thread Andrey Chernov
On Sun, Jun 06, 2010 at 03:00:04PM +0300, Kostik Belousov wrote: On Sun, Jun 06, 2010 at 11:36:09AM +, Gabor Kovesdan wrote: @@ -223,14 +222,11 @@ static const struct jump_entry jump_tabl (sizeof(jump_table_data)/sizeof(jump_table_data[0])) static void -sighandler(int

Re: svn commit: r209388 - in head/sbin/geom: class/part core misc

2010-06-21 Thread Andrey Chernov
On Mon, Jun 21, 2010 at 08:24:51AM +, Andrey V. Elsukov wrote: +done: + if (mult * unit mult || number * mult * unit number) + return (ERANGE); A general rule is: don't check for overflow when it already occurs, since result can be any, including valid ones. Redo it to

Re: svn commit: r210679 - head/bin/sleep

2010-07-31 Thread Andrey Chernov
On Sat, Jul 31, 2010 at 02:30:11PM +, Konstantin Belousov wrote: Author: kib Date: Sat Jul 31 14:30:11 2010 New Revision: 210679 URL: http://svn.freebsd.org/changeset/base/210679 Log: Report the time left for the sleep on SIGINFO. Be stricter in the checking of interval

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 10:08:09AM +0200, Dimitry Andric wrote: On 2012-06-04 23:34, Andrey A. Chernov wrote: Author: ache Date: Mon Jun 4 21:34:49 2012 New Revision: 236582 URL: http://svn.freebsd.org/changeset/base/236582 Log: 1) IEEE Std 1003.1-2008, errno section, is explicit

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 11:35:53AM +0300, Konstantin Belousov wrote: Not to mention that the patch was committed to _our_ implementation of libc, which uses _our_ free, and not some abstract free(3). Our free changing errno means that process state is so messed that worrying about realpath(3)

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 04:39:01PM +0400, Andrey Chernov wrote: Actually, it says the following: RETURN VALUE The free() function shall not return a value. ERRORS No errors are defined. How much clearer do you want it? ;) It is pretty clear

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 09:47:42AM +0200, Pawel Jakub Dawidek wrote: The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified. Very interesting. However free(3) is always successful.

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 02:55:20PM +0200, Joerg Sonnenberger wrote: On Tue, Jun 05, 2012 at 04:39:01PM +0400, Andrey Chernov wrote: Moreover, standard metion unsuccessful call case for free() where errno state is totally undefined. ...which would be a programming mistake in first place

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 03:10:06PM +0200, Dag-Erling Sm??rgrav wrote: Pawel Jakub Dawidek p...@freebsd.org writes: Very interesting. However free(3) is always successful. Maybe we need more context here, but the sentence above might talk about functions that can either succeed or fail and

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Mon, Jun 04, 2012 at 09:34:49PM +, Andrey A. Chernov wrote: 1) IEEE Std 1003.1-2008, errno section, is explicit that The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified.

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 04:25:10PM +0200, Joerg Sonnenberger wrote: Please see http://austingroupbugs.net/view.php?id=385 That is about explicitly recognizing how stupid the notion of free(3) not preserving errno is. Seriously, before you start to randomly bloat code all over the place,

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 08:23:20AM -0700, Marcel Moolenaar wrote: If we the resolution of the ID 385 indicates that a future version will have the suggested text, then one can definitely argue that it's not unreasonable to start changing our functions to match the new text (like free(3))

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 05:17:33PM +0200, Joerg Sonnenberger wrote: On Tue, Jun 05, 2012 at 06:31:14PM +0400, Andrey Chernov wrote: BTW, if general consensus will be to track unpublished standard, I will back out my change (in hope our malloc() maintainer will change free() to directly

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Wed, Jun 06, 2012 at 04:57:29AM +1000, Bruce Evans wrote: POSIX may require errno to not be clobbered, especially for its functions. It probably shouldn't do this for Standard C library functions like free(), since this would be an extension and any use of the extension would give

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Wed, Jun 06, 2012 at 06:11:01AM +1000, Bruce Evans wrote: This is essentially unusable (so a bad idea). Instead of unconditionally saving and restoring errno around calls to free(), portable POSIX code can soon use a messy ifdef to avoid doing this in some cases, but still has to do it in

Re: svn commit: r236582 - head/lib/libc/stdlib

2012-06-05 Thread Andrey Chernov
On Tue, Jun 05, 2012 at 11:30:34PM +0200, Joerg Sonnenberger wrote: On Wed, Jun 06, 2012 at 01:01:54AM +0400, Andrey Chernov wrote: On Wed, Jun 06, 2012 at 06:11:01AM +1000, Bruce Evans wrote: This is essentially unusable (so a bad idea). Instead of unconditionally saving and restoring

Re: svn commit: r238118 - head/lib/libc/gen

2012-07-04 Thread Andrey Chernov
On Wed, Jul 04, 2012 at 11:02:20PM +0300, Konstantin Belousov wrote: On Wed, Jul 04, 2012 at 07:51:25PM +, Pawel Jakub Dawidek wrote: Author: pjd Date: Wed Jul 4 19:51:25 2012 New Revision: 238118 URL: http://svn.freebsd.org/changeset/base/238118 Log: Prefer sysctl to

Re: svn commit: r238118 - head/lib/libc/gen

2012-07-04 Thread Andrey Chernov
On Wed, Jul 04, 2012 at 01:49:01PM -0700, Doug Barton wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 07/04/2012 13:32, Andrey Chernov wrote: 1) /dev/urandom may not exist in jails/sandboxes That would be a pretty serious configuration error. It may be true, but old POLA

Re: svn commit: r238118 - head/lib/libc/gen

2012-07-05 Thread Andrey Chernov
On Thu, Jul 05, 2012 at 11:39:02PM +0200, Pawel Jakub Dawidek wrote: sysctls are not all Giant locked. KERN_ARND is marked MPSAFE, so it does not use Giant: It doesn't really matter. Our in-kernel random generator has its own giant lock, so is basically single threaded. Compare

Re: svn commit: r238741 - head/lib/libelf

2012-07-26 Thread Andrey Chernov
On Wed, Jul 25, 2012 at 04:26:29PM -0700, Garrett Cooper wrote: A bunch of the sys/boot directories probably need this too.. Two of them (ficl and zfs) just fixed in r238795. If I miss some others, point me to. -- http://ache.vniz.net/ ___

Re: svn commit: r239100 - head/lib/libpam/modules/pam_unix

2012-08-06 Thread Andrey Chernov
On Mon, Aug 06, 2012 at 09:01:05PM +0200, Dimitry Andric wrote: On 2012-08-06 20:44, Dimitry Andric wrote: Author: dim Date: Mon Aug 6 18:44:59 2012 New Revision: 239100 URL: http://svn.freebsd.org/changeset/base/239100 Log: Fix an instance in pam_krb5(8), where the variable

Re: svn commit: r239356 - head/sbin/dhclient

2012-08-17 Thread Andrey Chernov
On Fri, Aug 17, 2012 at 03:53:43PM +, John Baldwin wrote: Author: jhb Date: Fri Aug 17 15:53:43 2012 New Revision: 239356 URL: http://svn.freebsd.org/changeset/base/239356 Log: Fix dhclient to properly exit and teardown the configured lease when link is lost. devd will start a

Re: svn commit: r239356 - head/sbin/dhclient

2012-08-18 Thread Andrey Chernov
On Fri, Aug 17, 2012 at 03:07:07PM -0400, John Baldwin wrote: On Friday, August 17, 2012 2:25:12 pm Andrey Chernov wrote: On Fri, Aug 17, 2012 at 03:53:43PM +, John Baldwin wrote: Author: jhb Date: Fri Aug 17 15:53:43 2012 New Revision: 239356 URL: http://svn.freebsd.org

Re: svn commit: r239356 - head/sbin/dhclient

2012-08-20 Thread Andrey Chernov
On Tue, Aug 21, 2012 at 11:57:56AM +0900, Hajimu UMEMOTO wrote: FreeBSD 9 and above already have a feature to handle multiple source of DNS address,; resolvconf(8). Our dhclient(8) and rtsol(8) uses it to write /etc/resolv.conf. Thanks pointing to resolvconf(8) and rtsol(8), I'll try to look

Re: svn commit: r239356 - head/sbin/dhclient

2012-08-21 Thread Andrey Chernov
On Tue, Aug 21, 2012 at 03:16:26PM +0900, Hajimu UMEMOTO wrote: ache And I want to override IPv6 DNS address for the router's IPv6 tunnel ache with simple link-local IPv6 address of my router, i.e. fe80:... I think your network admin setup to advertise the address. Why do you want to use

Re: svn commit: r226889 - head/usr.bin/sed

2011-10-28 Thread Andrey Chernov
On Fri, Oct 28, 2011 at 05:40:35PM -0700, Doug Barton wrote: == --- head/usr.bin/sed/sed.1 Fri Oct 28 20:00:30 2011(r226888) +++ head/usr.bin/sed/sed.1 Fri Oct 28 20:28:13 2011(r226889) @@ -343,7

Re: svn commit: r227520 - head/lib/libc/gen

2011-11-14 Thread Andrey Chernov
On Tue, Nov 15, 2011 at 05:49:24AM +, David Schultz wrote: Author: das Date: Tue Nov 15 05:49:24 2011 New Revision: 227520 URL: http://svn.freebsd.org/changeset/base/227520 Log: Further reduce diffs with OpenBSD's arc4random. The main functional change here is to ensure that when

Re: svn commit: r228843 - head/contrib/telnet/libtelnet head/crypto/heimdal/appl/telnet/libtelnet head/include head/lib/libc/gen head/lib/libc/iconv head/lib/libc/include head/lib/libc/net head/libexe

2011-12-24 Thread Andrey Chernov
On Fri, Dec 23, 2011 at 07:51:43PM +0200, Kostik Belousov wrote: The __FreeBSD_libc_enter_restricted_mode() is, and its name is ugly exactly to note the ugly intent. I do not see how the symbol can go There must be no ugly intents and names. This whole idea just proves yet one our @secteam

Re: svn commit: r228843 - head/contrib/telnet/libtelnet head/crypto/heimdal/appl/telnet/libtelnet head/include head/lib/libc/gen head/lib/libc/iconv head/lib/libc/include head/lib/libc/net head/libexe

2011-12-24 Thread Andrey Chernov
On Sat, Dec 24, 2011 at 02:26:20AM -0800, Xin LI wrote: chroot(2) can create legitimate and secure environment where dlopen(2) is safe and necessary. Yes, so ischroot() check can be used only into that places where libc's libc_dlopen() currently used, i.e. placed into libc_dlopen() itself. --

Re: svn commit: r228843 - head/contrib/telnet/libtelnet head/crypto/heimdal/appl/telnet/libtelnet head/include head/lib/libc/gen head/lib/libc/iconv head/lib/libc/include head/lib/libc/net head/libexe

2011-12-24 Thread Andrey Chernov
On Sat, Dec 24, 2011 at 02:45:21AM -0800, Xin LI wrote: On Sat, Dec 24, 2011 at 2:39 AM, Andrey Chernov a...@freebsd.org wrote: On Sat, Dec 24, 2011 at 02:26:20AM -0800, Xin LI wrote: chroot(2) can create legitimate and secure environment where dlopen(2) is safe and necessary. Yes, so

Re: svn commit: r228843 - head/contrib/telnet/libtelnet head/crypto/heimdal/appl/telnet/libtelnet head/include head/lib/libc/gen head/lib/libc/iconv head/lib/libc/include head/lib/libc/net head/libexe

2011-12-24 Thread Andrey Chernov
On Sat, Dec 24, 2011 at 02:50:45PM +0400, Andrey Chernov wrote: On Sat, Dec 24, 2011 at 02:45:21AM -0800, Xin LI wrote: On Sat, Dec 24, 2011 at 2:39 AM, Andrey Chernov a...@freebsd.org wrote: On Sat, Dec 24, 2011 at 02:26:20AM -0800, Xin LI wrote: chroot(2) can create legitimate

Re: svn commit: r223475 - head/sys/cam/ata

2011-06-23 Thread Andrey Chernov
On Thu, Jun 23, 2011 at 03:10:44PM +, Alexander Motin wrote: Author: mav Date: Thu Jun 23 15:10:44 2011 New Revision: 223475 URL: http://svn.freebsd.org/changeset/base/223475 Log: Fix ATAPI breakage introduced by r223443. It made SCSI commands to ATAPI device to never complete,

Re: svn commit: r223475 - head/sys/cam/ata

2011-06-23 Thread Andrey Chernov
On Thu, Jun 23, 2011 at 08:00:10PM +0400, Andrey Chernov wrote: On Thu, Jun 23, 2011 at 03:10:44PM +, Alexander Motin wrote: Author: mav Date: Thu Jun 23 15:10:44 2011 New Revision: 223475 URL: http://svn.freebsd.org/changeset/base/223475 Log: Fix ATAPI breakage introduced

Re: svn commit: r223475 - head/sys/cam/ata

2011-06-23 Thread Andrey Chernov
65534bytes) cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed On Thu, Jun 23, 2011 at 08:24:58PM +0400, Andrey Chernov wrote: On Thu, Jun 23, 2011 at 08:00:10PM +0400, Andrey Chernov wrote: On Thu, Jun 23, 2011 at 03:10:44PM +, Alexander Motin wrote

Re: svn commit: r223556 - head/sys/cam

2011-06-25 Thread Andrey Chernov
On Sun, Jun 26, 2011 at 01:14:54AM +, Justin T. Gibbs wrote: Author: gibbs Date: Sun Jun 26 01:14:54 2011 New Revision: 223556 URL: http://svn.freebsd.org/changeset/base/223556 Log: cam/cam_xpt.c: In camisr_runqueue(), we need to run the sims queue regardless of whether

Re: svn commit: r225800 - head/usr.bin/fetch

2011-09-27 Thread Andrey Chernov
On Tue, Sep 27, 2011 at 03:57:13PM +, Dag-Erling Smorgrav wrote: Author: des Date: Tue Sep 27 15:57:13 2011 New Revision: 225800 URL: http://svn.freebsd.org/changeset/base/225800 Log: Followup to r225599: the fseek() was a no-op since the file was opened in append mode. Open it

Re: svn commit: r226100 - head/sys/teken/stress

2011-10-07 Thread Andrey Chernov
On Fri, Oct 07, 2011 at 12:42:03PM +, Ed Schouten wrote: Author: ed Date: Fri Oct 7 12:42:03 2011 New Revision: 226100 URL: http://svn.freebsd.org/changeset/base/226100 Log: Simply let teken_stress use arc4random. This makes it run quite a bit faster, since it makes system

Re: svn commit: r226433 - head/sys/netinet

2011-10-16 Thread Andrey Chernov
On Sun, Oct 16, 2011 at 01:54:46PM +, Andre Oppermann wrote: Author: andre Date: Sun Oct 16 13:54:46 2011 New Revision: 226433 URL: http://svn.freebsd.org/changeset/base/226433 Log: Update the comment and description of tcp_sendspace and tcp_recvspace to better reflect their

Re: svn commit: r233684 - head/sys/x86/include

2012-03-30 Thread Andrey Chernov
On Thu, Mar 29, 2012 at 11:31:48PM +, Dimitry Andric wrote: However, the arguments are not properly masked, which results in the wrong value being calculated in some instances. For example, bswap32(0x12345678) returns 0x7c563412, and bswap64(0x123456789abcdef0) returns

Re: svn commit: r233684 - head/sys/x86/include

2012-03-30 Thread Andrey Chernov
On Fri, Mar 30, 2012 at 02:11:21PM +0200, Dimitry Andric wrote: In case of the __bswapXX() macros, you can see that the argument to __bswapXX_gen() is first explicitly cast to an unsigned type, for example with __bswap32(): #define __bswap32(x)\

Re: svn commit: r235266 - head/lib/libc/stdlib

2012-05-11 Thread Andrey Chernov
Thanks, but in this two places old errno value should be saved across free() because free() may damage it: On Fri, May 11, 2012 at 11:29:08AM +, Konstantin Belousov wrote: ... + if (lstat(resolved, sb) != 0) { + if (m) +

Re: svn commit: r235266 - head/lib/libc/stdlib

2012-05-11 Thread Andrey Chernov
On Fri, May 11, 2012 at 08:04:12PM +0300, Konstantin Belousov wrote: On Fri, May 11, 2012 at 06:54:32PM +0400, Andrey Chernov wrote: Thanks, but in this two places old errno value should be saved across free() because free() may damage it: I do not agree. free() cannot change errno. Perhaps

Additionally (was Re: svn commit: r204803 - head/usr.bin/uniq)

2010-03-07 Thread Andrey Chernov
On Sun, Mar 07, 2010 at 02:52:11PM +0300, Andrey Chernov wrote: On Sun, Mar 07, 2010 at 12:46:27PM +0200, Jaakko Heinonen wrote: On 2010-03-06, Andrey A. Chernov wrote: 3) Enforce the implied LINE_MAX limit (from POSIX definition of text file and POSIX uniq(1) description

Re: svn commit: r204803 - head/usr.bin/uniq

2010-03-07 Thread Andrey Chernov
On Mon, Mar 08, 2010 at 02:17:41AM +1100, Bruce Evans wrote: 3) Enforce the implied LINE_MAX limit (from POSIX definition of text file and POSIX uniq(1) description). This seems to enforce a limit of LINE_MAX - 1, since space for the NUL terminator is no longer provided. Hopfully

Re: svn commit: r204803 - head/usr.bin/uniq

2010-03-07 Thread Andrey Chernov
On Sun, Mar 07, 2010 at 09:31:39PM +0300, Andrey Chernov wrote: It is right idea. I'll use sysconf(__SC_LINE_MAX) there. But currently it does the same (sysconf.c): case _SC_LINE_MAX: return (LINE_MAX); ... To add more: NetBSD uniq grows (contrary, NetBSD comm

Re: svn commit: r204803 - head/usr.bin/uniq

2010-03-09 Thread Andrey Chernov
On Tue, Mar 09, 2010 at 12:55:44PM -0500, David Schultz wrote: Actually, a question...why doesn't it suffice to simply call strcoll() instead of mbstowcs() followed by wcscoll()? I would expect that in the absence of the -i flag, none of this would be necessary. strcoll() is only for

Re: svn commit: r220983 - head

2011-04-24 Thread Andrey Chernov
On Sun, Apr 24, 2011 at 09:23:08AM +, Alexander Motin wrote: ATA device names in /etc/fstab or other places, make sure to update them respectively (adX - adaY, acdX - cdY, afdX - daY, astX - saY, - where 'Y's are the sequential numbers for each type in order of -

Re: svn commit: r228843 - head/contrib/telnet/libtelnet head/crypto/heimdal/appl/telnet/libtelnet head/include head/lib/libc/gen head/lib/libc/iconv head/lib/libc/include head/lib/libc/net head/libexe

2012-01-14 Thread Andrey Chernov
On Sat, Dec 24, 2011 at 02:26:20AM -0800, Xin LI wrote: chroot(2) can create legitimate and secure environment where dlopen(2) is safe and necessary. It seems it is internal contradiction in your argumentation: 1) You state that chroot(2) can create legitimate environment. 2) For ftpd's you

Re: svn commit: r228843 - head/contrib/telnet/libtelnet head/crypto/heimdal/appl/telnet/libtelnet head/include head/lib/libc/gen head/lib/libc/iconv head/lib/libc/include head/lib/libc/net head/libexe

2012-01-15 Thread Andrey Chernov
On Sun, Jan 15, 2012 at 02:44:35AM -0800, Xin LI wrote: Why you need anything if the program needs to run something inside the chroot, which means one already have set up a full chroot environment? 1) ftpds usually not allows to run any program by default. Max default set usualy is: ls, tar,

Re: svn commit: r230230 - head/sys/dev/random

2012-01-17 Thread Andrey Chernov
On Mon, Jan 16, 2012 at 08:18:10PM +, David Schultz wrote: Author: das Date: Mon Jan 16 20:18:10 2012 New Revision: 230230 URL: http://svn.freebsd.org/changeset/base/230230 Log: Generate a warning if the kernel's arc4random() is seeded with bogus entropy. While you are here, could

Re: svn commit: r230230 - head/sys/dev/random

2012-01-18 Thread Andrey Chernov
On Wed, Jan 18, 2012 at 12:54:40PM -0500, David Schultz wrote: It appears to reseed arc4random's state exactly once, at whatever unpredictable time devrandom decides to reseed itself. Are you As fast as possible, immediatelly when we have enough good entropy. trying to fix the problems that

Re: svn commit: r230230 - head/sys/dev/random

2012-01-19 Thread Andrey Chernov
On Thu, Jan 19, 2012 at 07:52:30PM +, Mark Murray wrote: Andrey Chernov writes: On Mon, Jan 16, 2012 at 08:18:10PM +, David Schultz wrote: Author: das Date: Mon Jan 16 20:18:10 2012 New Revision: 230230 URL: http://svn.freebsd.org/changeset/base/230230 Log

Re: svn commit: r230230 - head/sys/dev/random

2012-01-20 Thread Andrey Chernov
On Fri, Jan 20, 2012 at 03:12:53PM +, Mark Murray wrote: Andrey Chernov writes: Look at the function random_yarrow_unblock(). Thats where yopu want to be doing this. This function is where the random device is unblocked once safely seeded. Thanx for your hint, but I fear one

Re: svn commit: r230230 - head/sys/dev/random

2012-01-22 Thread Andrey Chernov
On Sun, Jan 22, 2012 at 04:59:55PM +, Mark Murray wrote: Andrey Chernov writes: The usual way round this is with a flag. Set a static, volatile flag, defaulting off, and set it to on when the seeding has happened. Then arc4random() can do the right thing, depending on this flag

Re: svn commit: r230230 - head/sys/dev/random

2012-01-25 Thread Andrey Chernov
On Sun, Jan 22, 2012 at 09:43:02PM +, Mark Murray wrote: Thanx for review! I'll send final version to this thread a bit later when I'll find more free time. Final, unless something else noticed. --- sys/libkern.h.bak 2012-01-16 07:15:12.0 +0400 +++ sys/libkern.h

Re: svn commit: r230230 - head/sys/dev/random

2012-01-25 Thread Andrey Chernov
On Wed, Jan 25, 2012 at 07:16:41PM +, Mark Murray wrote: I thought you were going to do this as a function? It would be slightly neater to do it that way. Looks good! Are you sure this needs no locking or volatile variables? Now with function, volatile, atomic and even enum: ---

Re: svn commit: r230230 - head/sys/dev/random

2012-01-25 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 07:03:05AM +0400, Andrey Chernov wrote: On Wed, Jan 25, 2012 at 07:16:41PM +, Mark Murray wrote: I thought you were going to do this as a function? It would be slightly neater to do it that way. Looks good! Are you sure this needs no locking or volatile

Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote: What is the purpose of the atomics? Doing atomic_load/atomic_store is just as racy as if you had not used atomics at all. Thanx for a hint. Protecting comparison itself isn't essential as protecting variable consitency because

Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote: atomic_cmpset_int(iniseed_state, ARC4_ENTER_NONE, ARC4_ENTER_HAVE); break; Updated version (I hope, final): --- sys/libkern.h.old 2012-01-16 07:15:12.0 +0400 +++ sys/libkern.h 2012-01-26

Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 11:32:38AM -0500, John Baldwin wrote: On Thursday, January 26, 2012 10:56:27 am Andrey Chernov wrote: On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote: atomic_cmpset_int(iniseed_state, ARC4_ENTER_NONE, ARC4_ENTER_HAVE

Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 11:32:38AM -0500, John Baldwin wrote: Atomics don't operate on enums. You'll need to make it an int and just use #define's for the 3 states. --- sys/libkern.h.old 2012-01-16 07:15:12.0 +0400 +++ sys/libkern.h 2012-01-26 21:40:21.0 +0400 @@

Re: svn commit: r230230 - head/sys/dev/random

2012-01-26 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 12:52:43PM -0500, David Schultz wrote: Why complicate things with atomics at all? A race might result in arc4random(9) being seeded multiple times, but that's harmless. Multiply seeding in line is harmless, just waste of time and resources. Other case is one missing

Re: svn commit: r230230 - head/sys/dev/random

2012-01-27 Thread Andrey Chernov
On Fri, Jan 27, 2012 at 08:34:35PM +1100, Bruce Evans wrote: On Thu, 26 Jan 2012, Andrey Chernov wrote: On Thu, Jan 26, 2012 at 11:32:38AM -0500, John Baldwin wrote: Atomics don't operate on enums. You'll need to make it an int and just use #define's for the 3 states. This restores

Re: svn commit: r230230 - head/sys/dev/random

2012-01-27 Thread Andrey Chernov
New verson addressed bde's style things: --- sys/libkern.h.old 2012-01-16 07:15:12.0 +0400 +++ sys/libkern.h 2012-01-28 08:49:19.0 +0400 @@ -70,6 +70,11 @@ static __inline int abs(int a) { return static __inline long labs(long a) { return (a 0 ? -a : a); } static

Re: svn commit: r230230 - head/sys/dev/random

2012-01-28 Thread Andrey Chernov
On Sat, Jan 28, 2012 at 06:47:50PM +1100, Bruce Evans wrote: --- sys/libkern.h.old 2012-01-16 07:15:12.0 +0400 +++ sys/libkern.h 2012-01-28 08:49:19.0 +0400 @@ -70,6 +70,11 @@ static __inline int abs(int a) { return static __inline long labs(long a) { return (a 0 ?

Re: svn commit: r230230 - head/sys/dev/random

2012-01-29 Thread Andrey Chernov
On Thu, Jan 26, 2012 at 10:13:41PM +0400, Andrey Chernov wrote: On Thu, Jan 26, 2012 at 12:52:43PM -0500, David Schultz wrote: Why complicate things with atomics at all? A race might result in arc4random(9) being seeded multiple times, but that's harmless. Multiply seeding in line

Re: svn commit: r230230 - head/sys/dev/random

2012-01-30 Thread Andrey Chernov
On Mon, Jan 30, 2012 at 11:30:15AM +, Mark Murray wrote: Well, I almost forget about my special case: I have personal prohibition from @secteam (5 years old already) to commit anything to all RNG areas. So, the question is: could anyone of you commit some version from this thread,

Re: svn commit: r231300 - head/usr.sbin/pkg_install/create

2012-02-09 Thread Andrey Chernov
On Thu, Feb 09, 2012 at 08:51:03PM +, Eitan Adler wrote: /* Prefix should add an @cwd to the packing list */ -if (Prefix) - add_plist_top(plist, PLIST_CWD, Prefix); +if (Prefix) { +char resolved_prefix[PATH_MAX]; +if (realpath(Prefix, resolved_prefix) !=

Re: svn commit: r232521 - in head/sys: amd64/conf i386/conf

2012-03-04 Thread Andrey Chernov
On Sun, Mar 04, 2012 at 09:31:13PM +, Robert Millan wrote: Author: rmh Date: Sun Mar 4 21:31:13 2012 New Revision: 232521 URL: http://svn.freebsd.org/changeset/base/232521 Log: Exclude USB drivers (except umass and ukbd) from main kernel image on i386 and amd64. IMHO, generic

Re: svn commit: r249849 - in head/sys/dev: hptmv mpt

2013-04-25 Thread Andrey Chernov
On 25.04.2013 12:26, Ronald Klop wrote: Hi, Maybe I need more coffee, but I don't see a difference between the if and the else statements in the hptmv file. shutdown_kproc vs. kproc_shutdown Regards, Ronald. On Wed, 24 Apr 2013 21:00:45 +0200, Alexander Motin m...@freebsd.org wrote:

Re: svn commit: r250245 - head/lib/libc/locale

2013-05-05 Thread Andrey Chernov
On 04.05.2013 21:21, Sergey Kandaurov wrote: Log: Document that the return type is different from 1003.1-2008. It is better to fix this function return type to match POSIX standard rather than to document its non-standard behavior. We try to follow POSIX when possible and this is the

Re: svn commit: r250245 - head/lib/libc/locale

2013-05-06 Thread Andrey Chernov
On 06.05.2013 1:03, David Chisnall wrote: On 5 May 2013, at 19:31, Andrey Chernov a...@freebsd.org wrote: It is better to fix this function return type to match POSIX standard rather than to document its non-standard behavior. We try to follow POSIX when possible and this is the case. We

Re: svn commit: r250577 - head/sys/vm

2013-05-12 Thread Andrey Chernov
On 12.05.2013 20:50, Alan Cox wrote: GNU cc errors related to part of diff below: cc1: warnings being treated as errors ../../../vm/vm_page.c: In function 'vm_page_alloc': ../../../vm/vm_page.c:1209: warning: 'mpred' may be used uninitialized in this function *** [vm_page.o] Error code 1 Formally

Re: svn commit: r250883 - in head: include include/xlocale lib/libc/locale sys/sys tools/regression/lib/libc/locale

2013-05-21 Thread Andrey Chernov
On 22.05.2013 2:20, Ed Schouten wrote: 2013/5/22 Jilles Tjoelker jil...@stack.nl: Our wchar_t is only ISO 10646 for UTF-8 and possibly US-ASCII and ISO8859-1 (subset) locales. Oh, the horror! I thought on FreeBSD, we used the LC_CTYPE files to do a mapping to ISO 10646. Unfortunately, it

Re: svn commit: r263091 - in head/sys: netinet netinet6

2014-03-12 Thread Andrey Chernov
On 12.03.2014 18:29, Gleb Smirnoff wrote: --- head/sys/netinet/ip_input.c Wed Mar 12 12:27:13 2014 (r263090) +++ head/sys/netinet/ip_input.c Wed Mar 12 14:29:08 2014 (r263091) @@ -794,6 +795,8 @@ SYSCTL_PROC(_net_inet_ip, OID_AUTO, maxf NULL, 0,

Re: svn commit: r263953 - in head: . share/mk

2014-03-30 Thread Andrey Chernov
On 31.03.2014 3:43, Warner Losh wrote: Author: imp Date: Sun Mar 30 23:43:30 2014 New Revision: 263953 URL: http://svnweb.freebsd.org/changeset/base/263953 Somewhere after your mk changes (I think, previous files) typing 'make' in /usr/src/lib produce that: make: /usr/share/mk/bsd.subdir.mk

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 05.05.2014 20:41, Pedro F. Giffuni wrote: Log: regex: Use calloc instead of malloc. Mostly to reduce differences with OpenBSD. Please don't commit OpenBSD errors. Now you mix calloc() with the realloc() for the same variable later which makes calloc() zeroing pointless and waste of

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 05.05.2014 22:28, David Chisnall wrote: On 5 May 2014, at 18:42, Andrey Chernov a...@freebsd.org wrote: Please don't commit OpenBSD errors. Now you mix calloc() with the realloc() for the same variable later which makes calloc() zeroing pointless and waste of CPU. The purpose of calloc

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 06.05.2014 1:43, David Chisnall wrote: While reallocf() is nice, it doesn't address the problem of overflow. It takes a single size, forcing the caller to do the number-of-elements * element-size multiplication, which is the problematic one. If an attacker can control the number of

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 06.05.2014 1:52, David Chisnall wrote: This is not relying on undocumented intrinsic knowledge, this is relying on the standard library doing what is required of it. There is a reason why secure coding standards have, for over a decade, said to prefer calloc() over malloc() unless

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 06.05.2014 2:12, David Chisnall wrote: On 5 May 2014, at 22:51, Andrey Chernov a...@freebsd.org wrote: For standard malloc/realloc interface it is up to the caller to check n*size not overflows. You must trust caller already does such check. Do a search of the CVE database sometime

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 06.05.2014 2:52, Andrey Chernov wrote: As I mention initially, literal enough checks is what we need to make logic clear. In the case we discuss realloc() can be changed by reallocf() which does n*size and NULL checks and literal if should be added before malloc() to check overflow. Sorry

Re: svn commit: r265367 - head/lib/libc/regex

2014-05-05 Thread Andrey Chernov
On 06.05.2014 2:59, Warner Losh wrote: Stupid is as stupid does. malloc and realloc both have this same issue. While an interesting theoretical attack, the size doesn’t necessarily come from multiplication. Careful coding is still required, not matter what spin you put on this. reallocf()

Re: svn commit: r267758 - head

2014-06-24 Thread Andrey Chernov
On 24.06.2014 20:07, Warner Losh wrote: Log: Change suggestion how to set MAKESYSPATH as broken incremental build workaround. Magic .../share/mk (search directories up to /) does not work for f.e. /usr/src/gnu/lib/libgcc because the path inside is starting from /usr/obj hierarchy and ends

Re: svn commit: r267758 - head

2014-06-24 Thread Andrey Chernov
On 24.06.2014 21:25, Andrey Chernov wrote: On 24.06.2014 20:07, Warner Losh wrote: Log: Change suggestion how to set MAKESYSPATH as broken incremental build workaround. Magic .../share/mk (search directories up to /) does not work for f.e. /usr/src/gnu/lib/libgcc because the path inside

Re: RAND_MAX broken

2013-07-02 Thread Andrey Chernov
On 02.07.2013 11:39, Bruce Evans wrote: The bugs are a little different than I said above. There is no overflow problem and no problem with invalid values being produces, since the algorithm from ACM is careful to do everything with 32 bit signed integers without causing overflow. The

Re: RAND_MAX broken

2013-07-02 Thread Andrey Chernov
On 02.07.2013 20:33, Bruce Evans wrote: I checked the values returned by rand(). The ACM part works as intended, so it never returns RAND_MAX. It also never returns 0. So the distribution of values in the documented range [0, RAND_MAX] is very non-uniform. It is uniform in [1, RAND_MAX -

Re: svn commit: r252608 - in head: include lib/libc/stdlib

2013-07-03 Thread Andrey Chernov
On 04.07.2013 6:47, Bruce Evans wrote: Er, I think it is too dangerous to change either RAND_MAX or the offset without more preparation: - increasing the range returned (and increasing RAND_MAX to match) would obviously be binary-incompatible. Old binaries may have the old RAND_MAX built

Re: svn commit: r252608 - in head: include lib/libc/stdlib

2013-07-04 Thread Andrey Chernov
On 04.07.2013 11:01, Bruce Evans wrote: We already pass that moment in the past, changing oldbad formula with new one which cause the same effect: non-repeating sequence in the very global scope. We already agree that repeating depends on something like OS release numbers. I can't find that

Re: svn commit: r252608 - in head: include lib/libc/stdlib

2013-07-04 Thread Andrey Chernov
On 04.07.2013 16:30, Dmitry Morozovsky wrote: On Thu, 4 Jul 2013, Andrey Chernov wrote: We already pass that moment in the past, changing oldbad formula with new one which cause the same effect: non-repeating sequence in the very global scope. We already agree that repeating depends

Re: svn commit: r253380 - head/lib/libc/stdlib

2013-07-16 Thread Andrey Chernov
On 16.07.2013 11:26, Andriy Gapon wrote: Modified: head/lib/libc/stdlib/getenv.c == --- head/lib/libc/stdlib/getenv.c Tue Jul 16 06:50:22 2013 (r253379) +++ head/lib/libc/stdlib/getenv.c Tue Jul 16

Re: svn commit: r253380 - head/lib/libc/stdlib

2013-07-16 Thread Andrey Chernov
On 17.07.2013 8:48, Andrey Chernov wrote: On 17.07.2013 8:10, Andrey Chernov wrote: On 16.07.2013 11:26, Andriy Gapon wrote: Modified: head/lib/libc/stdlib/getenv.c == --- head/lib/libc/stdlib/getenv.c Tue Jul 16 06

Re: svn commit: r253380 - head/lib/libc/stdlib

2013-07-16 Thread Andrey Chernov
On 17.07.2013 8:10, Andrey Chernov wrote: On 16.07.2013 11:26, Andriy Gapon wrote: Modified: head/lib/libc/stdlib/getenv.c == --- head/lib/libc/stdlib/getenv.cTue Jul 16 06:50:22 2013 (r253379) +++ head

  1   2   3   >