Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Sat, 4 Aug 2018 04:24:01 +0200 From:Kamil Rytarowski Message-ID: <568544f4-36d5-853e-cdf8-248f84fad...@gmx.com> | I haven't changed any optimization or similar flags for the builds. Then why did the ssh example start giving "perhaps used uninit" warnings when it had not before?Something changed. | Freshly crashed pmax kernel due to integer overflow is a kernel (or | virtualization) bug, but it's also a definition of UB, that it can crash | the computer. I don't know the circumstances of that one, but sure, overflow can cause all kinds of problems, and if it actually occurs, almost anything is possible, depending upon just what the code is doing. I'm not sure what your point is here, no-one is suggesting that real bugs not get fixed. | The dhcpcd one was fixed first in upstream dhcpcd before landing it to src/. "fixed" is the wrong word, as there neither is, nor ever was, any bug there to "fix". You apparently silenced a bogus sanitiser induced warning. That is not a "fix". kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 04.08.2018 03:23, Robert Elz wrote: > Date:Sat, 4 Aug 2018 02:15:15 +0200 > From:Kamil Rytarowski > Message-ID: > > > | In general there shall not be a relation between -O level and > | sanitizers. Sanitizers do not need -O0 or -g for operation. > > That's fine. But are you doing compiles that way? (necessary or not) > I haven't changed any optimization or similar flags for the builds. > | GCC also enables more warnings for UBSan that have to be addressed in > | order to compile the source, as the code would be UB anyway (like > | changing the signedness bit with a shift operation). > > Sure, some of those, even though they're not really problems, are easy > to fix in a totally harmless way. That's fine. The UB is a technical C > issue, not really anything that ever fails in those cases though. > Freshly crashed pmax kernel due to integer overflow is a kernel (or virtualization) bug, but it's also a definition of UB, that it can crash the computer. > | And regarding utility of the Undefined Behavior Sanitizer and coverage > | of new tests.. we have just caught a bug on pmax that an integer > | overflow crashed the kernel: > > Sure, no-one is saying that the extra work is not worth while. Just that > you are sometimes fixing non-problems (and causing code churn to do > it - particularly when the code being changed comes from upstream ... in > the dhcpcd case that is not such an issue, as if needed, Roy will fix that > as well, but why would anyone expect the openbsd people to alter ssh > to fix a non problem ?) > Some Undefined Behavior fixes were pulled by FreeBSD (at least one of them merged McKusick!). Regarding the OpenSSH case, I'm in touch with some of their developers and concluded to push it to one of their mailinglist. One of the UB patches was already merged by the OpenBSD project (in tmux). I will go the same way with other patches and submit them upstream, even if some are cautious. The dhcpcd one was fixed first in upstream dhcpcd before landing it to src/. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Sat, 4 Aug 2018 02:15:15 +0200 From:Kamil Rytarowski Message-ID: | In general there shall not be a relation between -O level and | sanitizers. Sanitizers do not need -O0 or -g for operation. That's fine. But are you doing compiles that way? (necessary or not) | GCC is known for reporting uninitialized variables and I wouldn't blame | sanitizers for it. I wasn't. The one (which isn't) in the ssh code has been there for ages, and has compiled successfully, for ages There has to be a reason why it only needed action yesterday. | We just initialize them to tune it down and this is the current practice. Yes, I know - some of them are real potential problems, even if the circumstances that lead to the problem are so unlikely that we never see them in real life - others take knowledge about the environment the compiler does not have, or just require flow analysis more complex than it is reasonable to expect of the compiler, in order to know that there is not actually a problem.The real bugs we fix, obviously. The ones the compiler cannot detect are not bugs we deal with as you said. But when the compiler is able to detect there is no problem, but we are simply preventing it doing so, we fix the way we use the compiler. | GCC also enables more warnings for UBSan that have to be addressed in | order to compile the source, as the code would be UB anyway (like | changing the signedness bit with a shift operation). Sure, some of those, even though they're not really problems, are easy to fix in a totally harmless way. That's fine. The UB is a technical C issue, not really anything that ever fails in those cases though. There has (is currently) an issue with posix, where a current bug resulution requires abs(INT_MIN) to be INT_MIN (ie: abs(n) can end up < 0). In C that's undefined. POSIX requires 2's complement however (unlike C) and can rely upon what happens with 0 - INT_MAX even if C says that is undefined.Some people like it, others do not... (what the end result will be I have no idea.) | I don't agree with strong opinions against cautious warnings/errors from | a compiler. Sure, but when the warning goes off, we need to analyse the issue and see what the actual problem is, not just blindly do whatever makes the compiler stop issuing the warning. |They are there for purpose and dhcpcd could be really broken | with the same code, but with a different context. No, it could not. The only possible issue was if the packet was invalid (too short a len) but that was not what the warning was about (and could not have been, as there was nothing undefined if that happened, just an unwanted result). | And regarding utility of the Undefined Behavior Sanitizer and coverage | of new tests.. we have just caught a bug on pmax that an integer | overflow crashed the kernel: Sure, no-one is saying that the extra work is not worth while. Just that you are sometimes fixing non-problems (and causing code churn to do it - particularly when the code being changed comes from upstream ... in the dhcpcd case that is not such an issue, as if needed, Roy will fix that as well, but why would anyone expect the openbsd people to alter ssh to fix a non problem ?) Once again, please do not change code to fix gcc warnings unless you get the same warning with the code compiled with -O2 (or more). kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 04.08.2018 01:31, Robert Elz wrote: > Kamil: assuming you agree that this is a reasonable analysis, I'd suggest > no more code changes based upon gcc warnings issued this way. In general there shall not be a relation between -O level and sanitizers. Sanitizers do not need -O0 or -g for operation. UBSan does not need disabled optimization for reporting issues in exact location in the code. It also does not need debug information (DWARF or similar)... however a runtime might make use of the additional data to print more verbose messages or stacktraces. GCC is known for reporting uninitialized variables and I wouldn't blame sanitizers for it. We just initialize them to tune it down and this is the current practice. GCC also enables more warnings for UBSan that have to be addressed in order to compile the source, as the code would be UB anyway (like changing the signedness bit with a shift operation). I don't agree with strong opinions against cautious warnings/errors from a compiler. They are there for purpose and dhcpcd could be really broken with the same code, but with a different context. And regarding utility of the Undefined Behavior Sanitizer and coverage of new tests.. we have just caught a bug on pmax that an integer overflow crashed the kernel: UB caused to crash pmax.. divrem_overflow_signed_div: pexpect reported EOF - VMM exited unexpectedly signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 18:08:24 +0300, Valery Ushakov wrote: > On Fri, Aug 03, 2018 at 15:54:24 +0200, Martin Husemann wrote: > > > On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote: > > > Where is the signed arithmetic that was supposedly a probem? > > > > Ah, stupid C integer promotion rules. uint16_t is promoted to int > > here, not unsigned int or size_t. > > Hmm, i don't think that's true. Nah, you are right. "THEN" is the important word here. But as it transpired in another branch of this thread the problem was something entirely different... > 6.3.1.8 Usual arithmetic conversions > > ... > Otherwise, the integer promotions are performed on both > operands. Then the following rules are applied to the > promoted operands: -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 07:46:01PM +0100, Roy Marples wrote: > We could split the term, but merely storing the result of htons in it's own > variable creates a larger binary for no good reason as i see it. > I suspect that the compiler will generate the same code anyway when using a local variable for intermediate results, feel free to write the cost as you find most legible :-)
CVS commit: [phil-wifi] src/sys
Module Name:src Committed By: phil Date: Fri Aug 3 19:47:25 UTC 2018 Modified Files: src/sys/arch/amd64/conf [phil-wifi]: TESTWIFI src/sys/dev/usb [phil-wifi]: if_urtwn.c src/sys/net80211 [phil-wifi]: ieee80211_ioctl.c ieee80211_netbsd.c ieee80211_netbsd.h ieee80211_node.c ieee80211_proto.c ieee80211_ratectl.h ieee80211_scan_sta.c ieee80211_scan_sw.c ieee80211_sta.c Log Message: State Save: Scanning works, can see the broadcasts and stations. Association appears to work. (open networks only, no encryption yet.) IP traffic doesn't flow yet, not sure where the error is. Added back more NetBSD ioctls not in the FreeBSD code. Still have more to go. Updated my TESTWIFI kernel config. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/amd64/conf/TESTWIFI cvs rdiff -u -r1.59.2.4 -r1.59.2.5 src/sys/dev/usb/if_urtwn.c cvs rdiff -u -r1.60.18.5 -r1.60.18.6 src/sys/net80211/ieee80211_ioctl.c cvs rdiff -u -r1.31.2.5 -r1.31.2.6 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.21.2.6 -r1.21.2.7 src/sys/net80211/ieee80211_netbsd.h cvs rdiff -u -r1.75.4.3 -r1.75.4.4 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.34.14.5 -r1.34.14.6 src/sys/net80211/ieee80211_proto.c cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/net80211/ieee80211_ratectl.h cvs rdiff -u -r1.1.56.5 -r1.1.56.6 src/sys/net80211/ieee80211_scan_sta.c cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/net80211/ieee80211_scan_sw.c \ src/sys/net80211/ieee80211_sta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/conf/TESTWIFI diff -u src/sys/arch/amd64/conf/TESTWIFI:1.1.2.1 src/sys/arch/amd64/conf/TESTWIFI:1.1.2.2 --- src/sys/arch/amd64/conf/TESTWIFI:1.1.2.1 Thu Jul 12 16:35:33 2018 +++ src/sys/arch/amd64/conf/TESTWIFI Fri Aug 3 19:47:25 2018 @@ -1,4 +1,4 @@ -# $NetBSD: TESTWIFI,v 1.1.2.1 2018/07/12 16:35:33 phil Exp $ +# $NetBSD: TESTWIFI,v 1.1.2.2 2018/08/03 19:47:25 phil Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1.2.1 $" +#ident "GENERIC-$Revision: 1.1.2.2 $" maxusers 64 # estimated number of users @@ -100,6 +100,8 @@ options DIAGNOSTIC # inexpensive kernel # XXX to be commented out on release branch options DEBUG # expensive debugging checks/support options LOCKDEBUG # expensive locking checks/support +options URTWN_DEBUG # debug the urtwn driver +options IEEE80211_DEBUG # debug 802.11 code # # Because gcc omits the frame pointer for any -O level, the line below @@ -108,9 +110,9 @@ options LOCKDEBUG # expensive locking c makeoptions COPTS="-O2 -fno-omit-frame-pointer" options DDB # in-kernel debugger #options DDB_COMMANDONENTER="bt" # execute command when ddb is entered -#options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic' +options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic' options DDB_HISTORY_SIZE=512 # enable history editing in DDB -#options KGDB # remote debugger +options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 makeoptions DEBUG="-g" # compile full symbol table for CTF #options SYSCALL_STATS # per syscall counts Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.4 src/sys/dev/usb/if_urtwn.c:1.59.2.5 --- src/sys/dev/usb/if_urtwn.c:1.59.2.4 Sat Jul 28 00:49:43 2018 +++ src/sys/dev/usb/if_urtwn.c Fri Aug 3 19:47:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.59.2.4 2018/07/28 00:49:43 phil Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.59.2.5 2018/08/03 19:47:25 phil Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.4 2018/07/28 00:49:43 phil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.5 2018/08/03 19:47:25 phil Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -111,7 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v #define DBG_REG __BIT(6) #define DBG_ALL 0xU /* NNN Reset urtwn_debug to 0 when done debugging. */ -u_int urtwn_debug = DBG_ALL & ~DBG_REG; +u_int urtwn_debug = DBG_FN; #define DPRINTFN(n, s) \ do { if (urtwn_debug & (n)) printf s; } while (/*CONSTCOND*/0) #else @@ -284,7 +284,7 @@ static void urtwn_calib_to_cb(struct urt static void urtwn_next_scan(void *); static int urtwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); -// static void urtwn_newstate_cb(struct urtwn_softc *, void *); +//static void urtwn_newstate_cb(struct urtwn_softc *, void *); static int urtwn_wme_update(struct ieee80211com *); static void urtwn_wme_update_cb(struct urtwn_softc *, void *); static void urtwn_update_avgrssi(struct urtwn_softc *, int, int8_t); @@ -346,6
CVS commit: [phil-wifi] src/sys
Module Name:src Committed By: phil Date: Fri Aug 3 19:47:25 UTC 2018 Modified Files: src/sys/arch/amd64/conf [phil-wifi]: TESTWIFI src/sys/dev/usb [phil-wifi]: if_urtwn.c src/sys/net80211 [phil-wifi]: ieee80211_ioctl.c ieee80211_netbsd.c ieee80211_netbsd.h ieee80211_node.c ieee80211_proto.c ieee80211_ratectl.h ieee80211_scan_sta.c ieee80211_scan_sw.c ieee80211_sta.c Log Message: State Save: Scanning works, can see the broadcasts and stations. Association appears to work. (open networks only, no encryption yet.) IP traffic doesn't flow yet, not sure where the error is. Added back more NetBSD ioctls not in the FreeBSD code. Still have more to go. Updated my TESTWIFI kernel config. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/amd64/conf/TESTWIFI cvs rdiff -u -r1.59.2.4 -r1.59.2.5 src/sys/dev/usb/if_urtwn.c cvs rdiff -u -r1.60.18.5 -r1.60.18.6 src/sys/net80211/ieee80211_ioctl.c cvs rdiff -u -r1.31.2.5 -r1.31.2.6 src/sys/net80211/ieee80211_netbsd.c cvs rdiff -u -r1.21.2.6 -r1.21.2.7 src/sys/net80211/ieee80211_netbsd.h cvs rdiff -u -r1.75.4.3 -r1.75.4.4 src/sys/net80211/ieee80211_node.c cvs rdiff -u -r1.34.14.5 -r1.34.14.6 src/sys/net80211/ieee80211_proto.c cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/net80211/ieee80211_ratectl.h cvs rdiff -u -r1.1.56.5 -r1.1.56.6 src/sys/net80211/ieee80211_scan_sta.c cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/net80211/ieee80211_scan_sw.c \ src/sys/net80211/ieee80211_sta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 19:46:01 +0100 From:Roy Marples Message-ID: | Considering both methods work and the result of htons is a uint16_t (but | is this always guaranteed?) ntohs() (not that it matters) and "always" is a big word, but that is how it is defined by POSIX, so it should be something that we can rely upon. | is this just an over-zealous compiler warning? Not so much over zealous, as just plain lazy... (given Kamil's most recent message): | conversion to 'long unsigned int' from 'int' may change the sign of the | result [-Werror=sign-conversion] | *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); | ^ That's not the overflow on subtract that you said before, and for this one I can see how the cast can help ... but that's just sheer laziness on the part of the compiler. The "int" which is there was created by the compiler, it knows (or should know) that the underlying value is in the rangs [0..65535] and cannot possibly have its sign changed when it is converted to long unsigned int. It would be more understandable if the int appeared somewhere earlier, but here this is all in this one expression, one type promotion on top of another. Get the idiot compiler fixed, and then remove the cast. In the meantime, at least mark it with a comment indicating that the cast should not be needed, and is there purely to appease gcc. kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 20:49, Roy Marples wrote: > On 03/08/2018 15:22, Robert Elz wrote: >> Whether there need to be any attention to the possibility >> of a malformed packet I will leave for Roy to decide (I am >> assuming probably not) but that added cast just looks to be >> a bandaid for a broken compiler (sanitiser). > > The contents are verified further up the stack. > I'm inclined to agree it's a dodgy compiler warning, but I'm not really > an expert here. > > Roy I've repeated the compiler error as I forgot the exact error message (it was fixed in a local branch a while ago): /public/src.git/external/bsd/dhcpcd/dist/src/dhcp.c: In function 'get_udp_data': /public/src.git/external/bsd/dhcpcd/dist/src/dhcp.c:3270:29: error: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Werror=sign-conversion] *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); ^ http://netbsd.org/~kamil/patch-00068-dhcpcd-get_udp_data.txt signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03/08/2018 15:22, Robert Elz wrote: Whether there need to be any attention to the possibility of a malformed packet I will leave for Roy to decide (I am assuming probably not) but that added cast just looks to be a bandaid for a broken compiler (sanitiser). The contents are verified further up the stack. I'm inclined to agree it's a dodgy compiler warning, but I'm not really an expert here. Roy
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03/08/2018 14:02, Martin Husemann wrote: On Fri, Aug 03, 2018 at 02:47:53PM +0200, Kamil Rytarowski wrote: Further if there ever was a potential problem from this line ... *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); then *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); It was a build time error generated by GCC. The compiler detected that both sizeof() could be large enough to overflow the result returned from ntohs(3). And overflowing a signed integer is Undefined Behavior. But we do not do this here. This change points to the compiler that the code is safe. What exactly makes the code safe now? If ntohs(p->ip.ip_len) < (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious trouble. Does splitting the term help? uint16_t hdr_size = sizeof(p->ip) - sizeof(p->udp); uint16_t pkt_size = ntohs(p->ip.ip_len); KASSERT(pkt_size > hdr_size); *len = pkt_size > hdr_size ? pkt_size-hdr_size : 0; or something like that? We could split the term, but merely storing the result of htons in it's own variable creates a larger binary for no good reason as i see it. Considering both methods work and the result of htons is a uint16_t (but is this always guaranteed?) is this just an over-zealous compiler warning? Roy
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Fri Aug 3 17:04:30 UTC 2018 Modified Files: src/sys/arch/aarch64/aarch64: cpu_machdep.c Log Message: don't set lwp->l_private if no _UC_TLSBASE flag. atf lib/libc/sys/t_swapcontext Passed. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/cpu_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Fri Aug 3 17:04:30 UTC 2018 Modified Files: src/sys/arch/aarch64/aarch64: cpu_machdep.c Log Message: don't set lwp->l_private if no _UC_TLSBASE flag. atf lib/libc/sys/t_swapcontext Passed. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/cpu_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/cpu_machdep.c diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.5 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.6 --- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.5 Tue Jul 17 00:30:11 2018 +++ src/sys/arch/aarch64/aarch64/cpu_machdep.c Fri Aug 3 17:04:30 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_machdep.c,v 1.5 2018/07/17 00:30:11 christos Exp $ */ +/* $NetBSD: cpu_machdep.c,v 1.6 2018/08/03 17:04:30 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.5 2018/07/17 00:30:11 christos Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.6 2018/08/03 17:04:30 ryo Exp $"); #include "opt_multiprocessor.h" @@ -204,9 +204,11 @@ cpu_setmcontext(struct lwp *l, const mco return error; memcpy(>tf_regs, mcp->__gregs, sizeof(tf->tf_regs)); - l->l_private = (void *)mcp->__gregs[_REG_TPIDR]; } + if (flags & _UC_TLSBASE) + l->l_private = (void *)mcp->__gregs[_REG_TPIDR]; + if (flags & _UC_FPU) { struct pcb * const pcb = lwp_getpcb(l); fpu_discard(l, true);
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Fri Aug 3 16:32:55 UTC 2018 Modified Files: src/sys/arch/aarch64/aarch64: genassym.cf locore.S src/sys/arch/aarch64/conf: kern.ldscript Log Message: set kernel text/rodata readonly when not defined DDB. set readonly segment on 2Mbytes aligned. (kernel image is mapped with 2Mbytes L2 block) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/genassym.cf cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/conf/kern.ldscript Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/genassym.cf diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.5 src/sys/arch/aarch64/aarch64/genassym.cf:1.6 --- src/sys/arch/aarch64/aarch64/genassym.cf:1.5 Tue Jul 17 10:01:59 2018 +++ src/sys/arch/aarch64/aarch64/genassym.cf Fri Aug 3 16:32:55 2018 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.5 2018/07/17 10:01:59 ryo Exp $ +# $NetBSD: genassym.cf,v 1.6 2018/08/03 16:32:55 ryo Exp $ #- # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -120,6 +120,8 @@ define L2_SIZE L2_SIZE define LX_BLKPAG_UXN LX_BLKPAG_UXN define LX_BLKPAG_PXN LX_BLKPAG_PXN define LX_BLKPAG_AF LX_BLKPAG_AF +define LX_BLKPAG_AP LX_BLKPAG_AP +define LX_BLKPAG_AP_RO LX_BLKPAG_AP_RO define LX_BLKPAG_AP_RW LX_BLKPAG_AP_RW define LX_BLKPAG_SH_IS LX_BLKPAG_SH_IS define LX_BLKPAG_ATTR_INDX_0 LX_BLKPAG_ATTR_INDX_0 Index: src/sys/arch/aarch64/aarch64/locore.S diff -u src/sys/arch/aarch64/aarch64/locore.S:1.13 src/sys/arch/aarch64/aarch64/locore.S:1.14 --- src/sys/arch/aarch64/aarch64/locore.S:1.13 Tue Jul 17 18:08:36 2018 +++ src/sys/arch/aarch64/aarch64/locore.S Fri Aug 3 16:32:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.13 2018/07/17 18:08:36 christos Exp $ */ +/* $NetBSD: locore.S,v 1.14 2018/08/03 16:32:55 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -35,7 +35,7 @@ #include #include "assym.h" -RCSID("$NetBSD: locore.S,v 1.13 2018/07/17 18:08:36 christos Exp $") +RCSID("$NetBSD: locore.S,v 1.14 2018/08/03 16:32:55 ryo Exp $") /* #define DEBUG_LOCORE */ /* #define DEBUG_MMU */ @@ -650,9 +650,44 @@ arm_boot_l0pt_init: lsr x4, x4, #L2_SHIFT bl l2_setblocks +#ifndef DDB + /* map READONLY from VM_MIN_KERNEL_ADDRESS to __data_start */ + VERBOSE("Set kernel text/rodata READONLY\r\n") + ldr x3, =__data_start + ands x0, x3, #(L2_SIZE - 1) + beq 1f + ldr x1, =_erodata + and x1, x1, #L2_ADDR_BITS /* _erodata & L2_ADDR_BIT */ + and x0, x3, #L2_ADDR_BITS /* __data_start & L2_ADDR_BIT */ + cmp x0, x1 + bne 1f + /* __data_start and _erodata are in same L2 block */ + PRINT("Warning: data section not aligned on size of L2 block\r\n") +1: + /* x3 = l2pde_index(__data_start) */ + and x3, x3, #L2_ADDR_BITS + lsr x3, x3, #L2_SHIFT + + /* x2 = l2pde_inex(VM_MIN_KERNEL_ADDRESS) */ + mov x2, #VM_MIN_KERNEL_ADDRESS + and x2, x2, #L2_ADDR_BITS + lsr x2, x2, #L2_SHIFT + + ADDR x1, ttbr1_l2table_kva + b 9f +1: + ldr x0, [x1, x2, lsl #3] /* x0 = l2table[x2] */ + and x0, x0, #~LX_BLKPAG_AP + orr x0, x0, #LX_BLKPAG_AP_RO + str x0, [x1, x2, lsl #3] /* l2table[x2] = x0 */ + add x2, x2, #1 +9: + cmp x2, x3 + blo 1b +#endif + VERBOSE("Creating devmap tables\r\n") /* devmap=PA table for L1 */ -nop ADDR x0, ttbr1_l1table_kva ldr x1, .L_devmap_addr ADDR x2, ttbr1_l2table_devmap Index: src/sys/arch/aarch64/conf/kern.ldscript diff -u src/sys/arch/aarch64/conf/kern.ldscript:1.5 src/sys/arch/aarch64/conf/kern.ldscript:1.6 --- src/sys/arch/aarch64/conf/kern.ldscript:1.5 Sun Apr 1 04:35:03 2018 +++ src/sys/arch/aarch64/conf/kern.ldscript Fri Aug 3 16:32:55 2018 @@ -1,3 +1,5 @@ +#include "assym.h" + /* Default linker script, for normal executables */ OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64") @@ -30,9 +32,11 @@ SECTIONS PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); + /* Adjust the address for the data segment. Move .data to the next L2 block, + and .text and .rodata will be set readonly if needed. */ + PROVIDE (_erodata = .); + . = ALIGN (L2_SIZE); + . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); /* Exception handling */ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Fri Aug 3 16:32:55 UTC 2018 Modified Files: src/sys/arch/aarch64/aarch64: genassym.cf locore.S src/sys/arch/aarch64/conf: kern.ldscript Log Message: set kernel text/rodata readonly when not defined DDB. set readonly segment on 2Mbytes aligned. (kernel image is mapped with 2Mbytes L2 block) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/genassym.cf cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/conf/kern.ldscript Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/common/lib/libc/misc
Module Name:src Committed By: kamil Date: Fri Aug 3 16:31:04 UTC 2018 Modified Files: src/common/lib/libc/misc: ubsan.c Log Message: Try to fix the evbppc-powerpc64 build Avoid "comparison between signed and unsigned integer expressions" on Big-Endian hosts. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/misc/ubsan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/misc/ubsan.c diff -u src/common/lib/libc/misc/ubsan.c:1.2 src/common/lib/libc/misc/ubsan.c:1.3 --- src/common/lib/libc/misc/ubsan.c:1.2 Fri Aug 3 03:12:32 2018 +++ src/common/lib/libc/misc/ubsan.c Fri Aug 3 16:31:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ubsan.c,v 1.2 2018/08/03 03:12:32 kamil Exp $ */ +/* $NetBSD: ubsan.c,v 1.3 2018/08/03 16:31:04 kamil Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,9 +38,9 @@ #include #if defined(_KERNEL) -__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.2 2018/08/03 03:12:32 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.3 2018/08/03 16:31:04 kamil Exp $"); #else -__RCSID("$NetBSD: ubsan.c,v 1.2 2018/08/03 03:12:32 kamil Exp $"); +__RCSID("$NetBSD: ubsan.c,v 1.3 2018/08/03 16:31:04 kamil Exp $"); #endif #if defined(_KERNEL) @@ -1269,7 +1269,7 @@ DeserializeUINT128(char *pBuffer, size_t #if BYTE_ORDER == LITTLE_ENDIAN for (zI = sizeof(ulongest) - 1; zI >= 0; zI--) { #else - for (zI = 0; zI < sizeof(ulongest); zI++) { + for (zI = 0; zI < (ssize_t)sizeof(ulongest); zI++) { #endif snprintf(szBuf, sizeof(szBuf), "%02" PRIx8, rgNumber[zI]); strlcat(pBuffer, szBuf, zBUfferLength);
CVS commit: src/common/lib/libc/misc
Module Name:src Committed By: kamil Date: Fri Aug 3 16:31:04 UTC 2018 Modified Files: src/common/lib/libc/misc: ubsan.c Log Message: Try to fix the evbppc-powerpc64 build Avoid "comparison between signed and unsigned integer expressions" on Big-Endian hosts. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/misc/ubsan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Fri Aug 3 15:46:41 UTC 2018 Modified Files: src/sys/arch/arm/arm32: arm32_kvminit.c src/sys/arch/arm/broadcom: bcm283x_platform.c src/sys/arch/arm/include/arm32: machdep.h src/sys/arch/evbarm/rpi: rpi2_start.S rpi_start.S Log Message: Provide and use kern_vtopdiff in KERN_{VTOPHYS,PHYSTOV}. A step towards generic arm. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/arm32/arm32_kvminit.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm283x_platform.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/include/arm32/machdep.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/rpi2_start.S cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/rpi/rpi_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Fri Aug 3 15:46:41 UTC 2018 Modified Files: src/sys/arch/arm/arm32: arm32_kvminit.c src/sys/arch/arm/broadcom: bcm283x_platform.c src/sys/arch/arm/include/arm32: machdep.h src/sys/arch/evbarm/rpi: rpi2_start.S rpi_start.S Log Message: Provide and use kern_vtopdiff in KERN_{VTOPHYS,PHYSTOV}. A step towards generic arm. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/arm32/arm32_kvminit.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/broadcom/bcm283x_platform.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/include/arm32/machdep.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/rpi2_start.S cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/rpi/rpi_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/arm32_kvminit.c diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.43 src/sys/arch/arm/arm32/arm32_kvminit.c:1.44 --- src/sys/arch/arm/arm32/arm32_kvminit.c:1.43 Tue Jul 31 10:31:02 2018 +++ src/sys/arch/arm/arm32/arm32_kvminit.c Fri Aug 3 15:46:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_kvminit.c,v 1.43 2018/07/31 10:31:02 martin Exp $ */ +/* $NetBSD: arm32_kvminit.c,v 1.44 2018/08/03 15:46:41 skrll Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -126,7 +126,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.43 2018/07/31 10:31:02 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.44 2018/08/03 15:46:41 skrll Exp $"); #include #include @@ -175,21 +175,7 @@ extern char _end[]; /* Page tables for mapping kernel VM */ #define KERNEL_L2PT_VMDATA_NUM 8 /* start with 32MB of KVM */ -/* - * Macros to translate between physical and virtual for a subset of the - * kernel address space. *Not* for general use. - */ -#if defined(KERNEL_BASE_VOFFSET) -#define KERN_VTOPHYS(bmi, va) \ - ((paddr_t)((vaddr_t)(va) - KERNEL_BASE_VOFFSET)) -#define KERN_PHYSTOV(bmi, pa) \ - ((vaddr_t)((paddr_t)(pa) + KERNEL_BASE_VOFFSET)) -#else -#define KERN_VTOPHYS(bmi, va) \ - ((paddr_t)((vaddr_t)(va) - KERNEL_BASE + (bmi)->bmi_start)) -#define KERN_PHYSTOV(bmi, pa) \ - ((vaddr_t)((paddr_t)(pa) - (bmi)->bmi_start + KERNEL_BASE)) -#endif +u_long kern_vtopdiff __attribute__((__section__(".data"))); void arm32_bootmem_init(paddr_t memstart, psize_t memsize, vsize_t kernelstart) @@ -197,6 +183,16 @@ arm32_bootmem_init(paddr_t memstart, psi struct bootmem_info * const bmi = _info; pv_addr_t *pv = bmi->bmi_freeblocks; + /* + * FDT/generic boot fills in kern_vtopdiff early + */ +#if defined(KERNEL_BASE_VOFFSET) + kern_vtopdiff = KERNEL_BASE_VOFFSET; +#else + KASSERT(memstart == kernelstart); + kern_vtopdiff = KERNEL_BASE + memstart; +#endif + VPRINTF("%s: memstart=%#lx, memsize=%#lx, kernelstart=%#lx\n", __func__, memstart, memsize, kernelstart); @@ -217,7 +213,7 @@ arm32_bootmem_init(paddr_t memstart, psi * Let's record where the kernel lives. */ bmi->bmi_kernelstart = kernelstart; - bmi->bmi_kernelend = KERN_VTOPHYS(bmi, round_page((vaddr_t)_end)); + bmi->bmi_kernelend = KERN_VTOPHYS(round_page((vaddr_t)_end)); #if defined(FDT) fdt_add_reserved_memory_range(bmi->bmi_kernelstart, @@ -230,7 +226,7 @@ arm32_bootmem_init(paddr_t memstart, psi * Now the rest of the free memory must be after the kernel. */ pv->pv_pa = bmi->bmi_kernelend; - pv->pv_va = KERN_PHYSTOV(bmi, pv->pv_pa); + pv->pv_va = KERN_PHYSTOV(pv->pv_pa); pv->pv_size = bmi->bmi_end - bmi->bmi_kernelend; bmi->bmi_freepages += pv->pv_size / PAGE_SIZE; VPRINTF("%s: adding %lu free pages: [%#lx..%#lx] (VA %#lx)\n", @@ -244,7 +240,7 @@ arm32_bootmem_init(paddr_t memstart, psi */ if (bmi->bmi_start < bmi->bmi_kernelstart) { pv->pv_pa = bmi->bmi_start; - pv->pv_va = KERN_PHYSTOV(bmi, pv->pv_pa); + pv->pv_va = KERN_PHYSTOV(pv->pv_pa); pv->pv_size = bmi->bmi_kernelstart - pv->pv_pa; bmi->bmi_freepages += pv->pv_size / PAGE_SIZE; VPRINTF("%s: adding %lu free pages: [%#lx..%#lx] (VA %#lx)\n", @@ -627,7 +623,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b } const vaddr_t kernel_base = - KERN_PHYSTOV(bmi, bmi->bmi_kernelstart & -L2_S_SEGSIZE); + KERN_PHYSTOV(bmi->bmi_kernelstart & -L2_S_SEGSIZE); for (size_t idx = 0; idx < KERNEL_L2PT_KERNEL_NUM; idx++) { pmap_link_l2pt(l1pt_va, kernel_base + idx * L2_S_SEGSIZE, _l2pt[idx]); @@ -656,16 +652,16 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b VPRINTF("Mapping kernel\n"); - extern char etext[], _end[]; + extern char etext[]; size_t totalsize = bmi->bmi_kernelend - bmi->bmi_kernelstart; - size_t textsize = KERN_VTOPHYS(bmi, (uintptr_t)etext) - bmi->bmi_kernelstart; + size_t textsize = KERN_VTOPHYS((uintptr_t)etext) - bmi->bmi_kernelstart; textsize = (textsize + PGOFSET) & ~PGOFSET; /* start at offset of
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Aug 3 15:38:16 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Subtract KERNEL_BASE_VOFFSET from all VAs to get PA. How did this work before? To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/rpi/rpi_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/rpi/rpi_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.18 src/sys/arch/evbarm/rpi/rpi_start.S:1.19 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.18 Wed Jun 27 11:12:15 2018 +++ src/sys/arch/evbarm/rpi/rpi_start.S Fri Aug 3 15:38:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.18 2018/06/27 11:12:15 ryo Exp $ */ +/* $NetBSD: rpi_start.S,v 1.19 2018/08/03 15:38:16 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.18 2018/06/27 11:12:15 ryo Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.19 2018/08/03 15:38:16 skrll Exp $") #if defined(VERBOSE_INIT_ARM) @@ -141,16 +141,16 @@ _C_LABEL(rpi_start): #if defined(VERBOSE_INIT_ARM) /* stack for calling bcm2835_platform_early_putchar() */ ldr sp, Lbootstk -#if !defined(KERNEL_BASES_EQUAL) sub sp, sp, #KERNEL_BASE_VOFFSET -#endif #endif /* VERBOSE_INIT_ARM */ ldr r8, Luboot_args + sub r8, r8, #KERNEL_BASE_VOFFSET stmia r8!, {r0-r3} #ifdef FDT ldr r8, Lfdt_addr_r + sub r8, r8, #KERNEL_BASE_VOFFSET str r2, [r8] #endif mrs r0, cpsr
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Aug 3 15:38:16 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Subtract KERNEL_BASE_VOFFSET from all VAs to get PA. How did this work before? To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/rpi/rpi_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 15:54:24 +0200, Martin Husemann wrote: > On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote: > > Where is the signed arithmetic that was supposedly a probem? > > Ah, stupid C integer promotion rules. uint16_t is promoted to int > here, not unsigned int or size_t. Hmm, i don't think that's true. 6.3.1.8 Usual arithmetic conversions ... Otherwise, the integer promotions are performed on both operands. Then the following rules are applied to the promoted operands: If both operands have the same type, then no further conversion is needed. Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank. ntohs returns unsigned uint16_t, sizeof returns unsigned size_t, so uint16_t, that has "lesser integer convertion rank" (i.e. it's smaller) should be converted to size_t automagically. -uwe
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 15:54:24 +0200 From:Martin Husemann Message-ID: <20180803135424.gc23...@mail.duskware.de> | Ah, stupid C integer promotion rules. uint16_t is promoted to int | here, not unsigned int or size_t. Even with that, there should be no problem, in signed - unsigned the '-' should be an unsigned - and the result should be unsigned. There is no signed arithmetic being done here to cause an undefined result. That's the same rule that makes strlen(s) + 1 be a size_t rather than a ssize_t or whatever. Otherwise we'd need to be adding casts to every operation like that, just in case strlen(s) == MAX_INT and the " +1 " would cause overflow, and undefined operation.No thanks. Whether there need to be any attention to the possibility of a malformed packet I will leave for Roy to decide (I am assuming probably not) but that added cast just looks to be a bandaid for a broken compiler (sanitiser). kre
CVS commit: src/lib/libc
Module Name:src Committed By: kamil Date: Fri Aug 3 14:01:21 UTC 2018 Modified Files: src/lib/libc: Makefile Log Message: Restrict -fno-sanitize=function to Clang/LLVM only The base GCC version 6,x does not support this option. To generate a diff of this commit: cvs rdiff -u -r1.171 -r1.172 src/lib/libc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/Makefile diff -u src/lib/libc/Makefile:1.171 src/lib/libc/Makefile:1.172 --- src/lib/libc/Makefile:1.171 Fri Aug 3 02:29:35 2018 +++ src/lib/libc/Makefile Fri Aug 3 14:01:21 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.171 2018/08/03 02:29:35 kamil Exp $ +# $NetBSD: Makefile,v 1.172 2018/08/03 14:01:21 kamil Exp $ # @(#)Makefile 8.2 (Berkeley) 2/3/94 # # All library objects contain sccsid strings by default; they may be @@ -17,7 +17,9 @@ # The Hesiod functions are always in libc. To choose that getpwent() and friends # actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below. -LIBCSANITIZERFLAGS+= -fno-sanitize=function # generated code depends on RTTI + +# generated code depends on RTTI +LIBCSANITIZERFLAGS+= ${${ACTIVE_CC} == "clang":? -fno-sanitize=function :} .include "Makefile.inc"
CVS commit: src/lib/libc
Module Name:src Committed By: kamil Date: Fri Aug 3 14:01:21 UTC 2018 Modified Files: src/lib/libc: Makefile Log Message: Restrict -fno-sanitize=function to Clang/LLVM only The base GCC version 6,x does not support this option. To generate a diff of this commit: cvs rdiff -u -r1.171 -r1.172 src/lib/libc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 08:28:55PM +0700, Robert Elz wrote: > Where is the signed arithmetic that was supposedly a probem? Ah, stupid C integer promotion rules. uint16_t is promoted to int here, not unsigned int or size_t. The cast makes all operands the same type and no promotion happens. Martin
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Fri Aug 3 13:48:24 UTC 2018 Modified Files: src/sys/arch/arm/broadcom: bcm283x_platform.c src/sys/arch/evbarm/fdt: fdt_machdep.c Added Files: src/sys/arch/evbarm/fdt: machdep.h Log Message: Provide and use a evbarm/fdt/machdep.h To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm283x_platform.c cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbarm/fdt/fdt_machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/fdt/machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Fri Aug 3 13:48:24 UTC 2018 Modified Files: src/sys/arch/arm/broadcom: bcm283x_platform.c src/sys/arch/evbarm/fdt: fdt_machdep.c Added Files: src/sys/arch/evbarm/fdt: machdep.h Log Message: Provide and use a evbarm/fdt/machdep.h To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm283x_platform.c cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbarm/fdt/fdt_machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/fdt/machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/broadcom/bcm283x_platform.c diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.8 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.9 --- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.8 Mon Jul 16 23:11:47 2018 +++ src/sys/arch/arm/broadcom/bcm283x_platform.c Fri Aug 3 13:48:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm283x_platform.c,v 1.8 2018/07/16 23:11:47 christos Exp $ */ +/* $NetBSD: bcm283x_platform.c,v 1.9 2018/08/03 13:48:24 skrll Exp $ */ /*- * Copyright (c) 2017 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.8 2018/07/16 23:11:47 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.9 2018/08/03 13:48:24 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -64,9 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: bcm283x_plat #include #include -#ifdef __aarch64__ -#include -#endif + #include #include @@ -81,6 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: bcm283x_plat #include #include +#include #include #include Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.29 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.30 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.29 Fri Aug 3 12:48:33 2018 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Fri Aug 3 13:48:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.29 2018/08/03 12:48:33 skrll Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.30 2018/08/03 13:48:24 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.29 2018/08/03 12:48:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.30 2018/08/03 13:48:24 skrll Exp $"); #include "opt_machdep.h" #include "opt_bootconfig.h" @@ -68,14 +68,9 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_machdep. #include #include -#ifdef __aarch64__ -#include -#else -#include -#endif - #include +#include #include #include Added files: Index: src/sys/arch/evbarm/fdt/machdep.h diff -u /dev/null src/sys/arch/evbarm/fdt/machdep.h:1.1 --- /dev/null Fri Aug 3 13:48:24 2018 +++ src/sys/arch/evbarm/fdt/machdep.h Fri Aug 3 13:48:24 2018 @@ -0,0 +1,43 @@ +/* $NetBSD: machdep.h,v 1.1 2018/08/03 13:48:24 skrll Exp $ */ + +/*- + * Copyright (c) 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _EVBARM_FDT_MACHDEP_H +#define _EVBARM_FDT_MACHDEP_H + +#ifdef __aarch64__ +#include +#endif + +#ifdef __arm__ +#include +#endif + +#endif /* _EVBARM_FDT_MACHDEP_H */
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 15:02:28 +0200 From:Martin Husemann Message-ID: <20180803130227.ga23...@mail.duskware.de> | What exactly makes the code safe now? If ntohs(p->ip.ip_len) < | (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious | trouble. Actually, not more serious, the same serious as before. If adding that cast change anything at all, the compiler isn't working as it should. If the values haven't been verieied, they should be. If they have been verified, there is no problem and nothing needs fixing (except possibly the santiizer). In a later message ... | Overflow (underflow) of an unsigned value is defined and GCC stops | deducing whether there might be a problem. But it always was unsigned, ntohs() returns an unsigned result. Further even if it was signed, doesn't combining a signed value and an unsigned one with an arithmetic op result in an unsigned operation? Where is the signed arithmetic that was supposedly a probem? kre
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 15:20, Martin Husemann wrote: > On Fri, Aug 03, 2018 at 03:18:18PM +0200, Kamil Rytarowski wrote: >> The change was indicating to the compiler that code is safe, without >> changing the algorithm. > > I don't get why. > > Martin > Overflow (underflow) of an unsigned value is defined and GCC stops deducing whether there might be a problem. signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 03:18:18PM +0200, Kamil Rytarowski wrote: > The change was indicating to the compiler that code is safe, without > changing the algorithm. I don't get why. Martin
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Fri Aug 3 13:19:33 UTC 2018 Modified Files: src/sys/dev/usb: umcs.c Log Message: Fix build To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/umcs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/umcs.c diff -u src/sys/dev/usb/umcs.c:1.11 src/sys/dev/usb/umcs.c:1.12 --- src/sys/dev/usb/umcs.c:1.11 Sun Jul 29 02:07:56 2018 +++ src/sys/dev/usb/umcs.c Fri Aug 3 13:19:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: umcs.c,v 1.11 2018/07/29 02:07:56 riastradh Exp $ */ +/* $NetBSD: umcs.c,v 1.12 2018/08/03 13:19:33 skrll Exp $ */ /* $FreeBSD: head/sys/dev/usb/serial/umcs.c 260559 2014-01-12 11:44:28Z hselasky $ */ /*- @@ -41,7 +41,7 @@ * */ #include -__KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.11 2018/07/29 02:07:56 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.12 2018/08/03 13:19:33 skrll Exp $"); #include #include @@ -517,7 +517,8 @@ umcs7840_detach(device_t self, int flags kmem_free(sc->sc_intr_buf, sc->sc_intr_buflen); sc->sc_intr_pipe = NULL; } - usb_rem_task_wait(sc->sc_udev, >sc_change_task, USB_TASKQ_DRIVER); + usb_rem_task_wait(sc->sc_udev, >sc_change_task, USB_TASKQ_DRIVER, + NULL); /* detach children */ for (i = 0; i < sc->sc_numports; i++) {
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Fri Aug 3 13:19:33 UTC 2018 Modified Files: src/sys/dev/usb: umcs.c Log Message: Fix build To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/umcs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 15:02, Martin Husemann wrote: > On Fri, Aug 03, 2018 at 02:47:53PM +0200, Kamil Rytarowski wrote: >>> Further if there ever was a potential problem from this line ... >>> >>> *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); >>> then >>> *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > >> It was a build time error generated by GCC. The compiler detected that >> both sizeof() could be large enough to overflow the result returned from >> ntohs(3). And overflowing a signed integer is Undefined Behavior. > > But we do not do this here. > >> This change points to the compiler that the code is safe. > > What exactly makes the code safe now? If ntohs(p->ip.ip_len) < > (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious > trouble. > The change was indicating to the compiler that code is safe, without changing the algorithm. > Does splitting the term help? > > uint16_t hdr_size = sizeof(p->ip) - sizeof(p->udp); + > uint16_t pkt_size = ntohs(p->ip.ip_len); > KASSERT(pkt_size > hdr_size); > *len = pkt_size > hdr_size ? pkt_size-hdr_size : 0; > > or something like that? > This looks like a safer approach, but I will defer it to Roy to decide what to do. Previously we have agreed with the (size_t) case. > Martin > signature.asc Description: OpenPGP digital signature
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On Fri, Aug 03, 2018 at 02:47:53PM +0200, Kamil Rytarowski wrote: > > Further if there ever was a potential problem from this line ... > > > > *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > > then > > *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > It was a build time error generated by GCC. The compiler detected that > both sizeof() could be large enough to overflow the result returned from > ntohs(3). And overflowing a signed integer is Undefined Behavior. But we do not do this here. > This change points to the compiler that the code is safe. What exactly makes the code safe now? If ntohs(p->ip.ip_len) < (sizeof(p->ip) + sizeof(p->udp)) then we are now in even more serious trouble. Does splitting the term help? uint16_t hdr_size = sizeof(p->ip) - sizeof(p->udp); uint16_t pkt_size = ntohs(p->ip.ip_len); KASSERT(pkt_size > hdr_size); *len = pkt_size > hdr_size ? pkt_size-hdr_size : 0; or something like that? Martin
CVS commit: src/crypto/external/bsd/openssh/dist
Module Name:src Committed By: kre Date: Fri Aug 3 12:49:41 UTC 2018 Modified Files: src/crypto/external/bsd/openssh/dist: sshkey.c Log Message: Add a "gcc is stupid" comment to the previous change, as even the most cursory analysis shows that the var ("eg") is not (cannot be) used unitialialised, just gcc is too dumb to work it out. In this case, the code could be rewritten easily enough to appease even gcc, but that would cause unnecessary code churn, and some minor duplication, so just put up with the nonsense init... To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/crypto/external/bsd/openssh/dist/sshkey.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/openssh/dist/sshkey.c diff -u src/crypto/external/bsd/openssh/dist/sshkey.c:1.15 src/crypto/external/bsd/openssh/dist/sshkey.c:1.16 --- src/crypto/external/bsd/openssh/dist/sshkey.c:1.15 Fri Aug 3 04:32:12 2018 +++ src/crypto/external/bsd/openssh/dist/sshkey.c Fri Aug 3 12:49:41 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: sshkey.c,v 1.15 2018/08/03 04:32:12 kamil Exp $ */ +/* $NetBSD: sshkey.c,v 1.16 2018/08/03 12:49:41 kre Exp $ */ /* $OpenBSD: sshkey.c,v 1.64 2018/03/22 07:05:48 markus Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "includes.h" -__RCSID("$NetBSD: sshkey.c,v 1.15 2018/08/03 04:32:12 kamil Exp $"); +__RCSID("$NetBSD: sshkey.c,v 1.16 2018/08/03 12:49:41 kre Exp $"); #include #include @@ -1641,7 +1641,7 @@ dsa_generate_private_key(u_int bits, DSA int sshkey_ecdsa_key_to_nid(EC_KEY *k) { - EC_GROUP *eg = NULL; + EC_GROUP *eg = NULL; /* XXXGCC: unneeded init */ int nids[] = { NID_X9_62_prime256v1, NID_secp384r1,
CVS commit: src/crypto/external/bsd/openssh/dist
Module Name:src Committed By: kre Date: Fri Aug 3 12:49:41 UTC 2018 Modified Files: src/crypto/external/bsd/openssh/dist: sshkey.c Log Message: Add a "gcc is stupid" comment to the previous change, as even the most cursory analysis shows that the var ("eg") is not (cannot be) used unitialialised, just gcc is too dumb to work it out. In this case, the code could be rewritten easily enough to appease even gcc, but that would cause unnecessary code churn, and some minor duplication, so just put up with the nonsense init... To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/crypto/external/bsd/openssh/dist/sshkey.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Aug 3 12:48:33 UTC 2018 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: s/DPRINTF/VPRINTF/ for consistency To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbarm/fdt/fdt_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Aug 3 12:48:33 UTC 2018 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: s/DPRINTF/VPRINTF/ for consistency To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbarm/fdt/fdt_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.28 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.29 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.28 Fri Aug 3 07:44:31 2018 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Fri Aug 3 12:48:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.28 2018/08/03 07:44:31 skrll Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.29 2018/08/03 12:48:33 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.28 2018/08/03 07:44:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.29 2018/08/03 12:48:33 skrll Exp $"); #include "opt_machdep.h" #include "opt_bootconfig.h" @@ -156,9 +156,9 @@ earlyconsgetc(dev_t dev) } #ifdef VERBOSE_INIT_ARM -#define DPRINTF(...) printf(__VA_ARGS__) +#define VPRINTF(...) printf(__VA_ARGS__) #else -#define DPRINTF(...) +#define VPRINTF(...) #endif /* @@ -179,13 +179,13 @@ fdt_get_memory(uint64_t *pstart, uint64_ *pstart = cur_addr; *pend = cur_addr + cur_size; - DPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", + VPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", 0, *pstart, *pend - *pstart); for (index = 1; fdtbus_get_reg64(memory, index, _addr, _size) == 0; index++) { - DPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", + VPRINTF("FDT /memory [%d] @ 0x%" PRIx64 " size 0x%" PRIx64 "\n", index, cur_addr, cur_size); #ifdef __aarch64__ @@ -211,7 +211,7 @@ fdt_add_reserved_memory_range(uint64_t a printf("MEM ERROR: res %" PRIx64 "-%" PRIx64 " failed: %d\n", start, end, error); else - DPRINTF("MEM: res %" PRIx64 "-%" PRIx64 "\n", start, end); + VPRINTF("MEM: res %" PRIx64 "-%" PRIx64 "\n", start, end); } /* @@ -265,7 +265,7 @@ fdt_build_bootconfig(uint64_t mem_start, if (error != 0) printf("MEM ERROR: add %" PRIx64 "-%" PRIx64 " failed: %d\n", addr, addr + size, error); - DPRINTF("MEM: add %" PRIx64 "-%" PRIx64 "\n", addr, addr + size); + VPRINTF("MEM: add %" PRIx64 "-%" PRIx64 "\n", addr, addr + size); } fdt_add_reserved_memory(mem_end); @@ -274,10 +274,10 @@ fdt_build_bootconfig(uint64_t mem_start, if (initrd_size > 0) fdt_add_reserved_memory_range(initrd_start, initrd_size); - DPRINTF("Usable memory:\n"); + VPRINTF("Usable memory:\n"); bc->dramblocks = 0; LIST_FOREACH(er, _memory_ext->ex_regions, er_link) { - DPRINTF(" %lx - %lx\n", er->er_start, er->er_end); + VPRINTF(" %lx - %lx\n", er->er_start, er->er_end); bc->dram[bc->dramblocks].address = er->er_start; bc->dram[bc->dramblocks].pages = (er->er_end - er->er_start) / PAGE_SIZE; @@ -378,25 +378,25 @@ initarm(void *arg) panic("Kernel does not support this device"); /* Early console may be available, announce ourselves. */ - DPRINTF("FDT<%p>\n", fdt_addr_r); + VPRINTF("FDT<%p>\n", fdt_addr_r); const int chosen = OF_finddevice("/chosen"); if (chosen >= 0) OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs)); boot_args = bootargs; - DPRINTF("devmap\n"); + VPRINTF("devmap\n"); pmap_devmap_register(plat->devmap()); #ifdef __aarch64__ pmap_devmap_bootstrap(plat->devmap()); #endif /* Heads up ... Setup the CPU / MMU / TLB functions. */ - DPRINTF("cpufunc\n"); + VPRINTF("cpufunc\n"); if (set_cpufuncs()) panic("cpu not recognized!"); - DPRINTF("bootstrap\n"); + VPRINTF("bootstrap\n"); plat->bootstrap(); /* @@ -405,11 +405,11 @@ initarm(void *arg) */ fdt_update_stdout_path(); - DPRINTF("consinit "); + VPRINTF("consinit "); consinit(); - DPRINTF("ok\n"); + VPRINTF("ok\n"); - DPRINTF("uboot: args %#lx, %#lx, %#lx, %#lx\n", + VPRINTF("uboot: args %#lx, %#lx, %#lx, %#lx\n", uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); cpu_reset_address = fdt_reset; @@ -417,7 +417,7 @@ initarm(void *arg) evbarm_device_register = fdt_device_register; /* Talk to the user */ - DPRINTF("\nNetBSD/evbarm (fdt) booting ...\n"); + VPRINTF("\nNetBSD/evbarm (fdt) booting ...\n"); #ifdef BOOT_ARGS char mi_bootargs[] = BOOT_ARGS; @@ -425,7 +425,7 @@ initarm(void *arg) #endif #ifndef __aarch64__ - DPRINTF("KERNEL_BASE=0x%x, " + VPRINTF("KERNEL_BASE=0x%x, " "KERNEL_VM_BASE=0x%x, " "KERNEL_VM_BASE - KERNEL_BASE=0x%x, " "KERNEL_BASE_VOFFSET=0x%x\n", @@ -450,7 +450,7 @@ initarm(void *arg) const bool mapallmem_p = true; #ifndef PMAP_NEED_ALLOC_POOLPAGE if (memory_size > KERNEL_VM_BASE - KERNEL_BASE) { -
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
On 03.08.2018 12:26, Robert Elz wrote: > Date:Fri, 3 Aug 2018 02:17:33 + > From:"Kamil Rytarowski" > Message-ID: <20180803021733.b2002f...@cvs.netbsd.org> > > | GCC with -fsanitize=undefiend detects a potential overflow in the code. > | Cast the return value of ntohs(3) to size_t. > > I don't understand the point of this change, and I believe it to > be wrong and misguided. > > Further if there ever was a potential problem from this line ... > > *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > then > *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); > > will not fix it. The possible problem being if ip_len < 28 (the sum of the > two sizeof's).While I didn't check this code, that possibility is usually > verified elsewhere, and even if not, adding the cast changes nothing, the > result is still bogus (that is, at best, the change could be masking a real > bug, though that's unlikely.) > > This looks to be (somehow) determining that the result of ntohs(ip_len) > might somehow be negative (or something, I'm not really sure what is > being believed is happening) but the ntohs() result is (in all cases here) > a uint16_t (either because the result is literally the arg, which is that > type, > or because it is the result of bswap16() which is declared that way.) > > The sizeof() ops make the expression at least a size_t - so unless size_t > and uint16_t are the same (which might happen on a pdp-11 or similar, > though even there it is unlikely I suspect) the narrower one needs to be > promoted - whether the ntohs() result is implicitly promoted to size_t, or > explicitly cast cannot make any difference, can it? > > So what exactly is being fixed here? Which behaviour is supposedly undefined? > It was a build time error generated by GCC. The compiler detected that both sizeof() could be large enough to overflow the result returned from ntohs(3). And overflowing a signed integer is Undefined Behavior. This change points to the compiler that the code is safe. > kre > signature.asc Description: OpenPGP digital signature
CVS commit: src/sys/net
Module Name:src Committed By: jmcneill Date: Fri Aug 3 11:24:19 UTC 2018 Modified Files: src/sys/net: if_vlan.c Log Message: Use a different psz for a different lock. Patch from riastradh, reviewed by ozaki-r. To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_vlan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/net
Module Name:src Committed By: jmcneill Date: Fri Aug 3 11:24:19 UTC 2018 Modified Files: src/sys/net: if_vlan.c Log Message: Use a different psz for a different lock. Patch from riastradh, reviewed by ozaki-r. To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_vlan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_vlan.c diff -u src/sys/net/if_vlan.c:1.130 src/sys/net/if_vlan.c:1.131 --- src/sys/net/if_vlan.c:1.130 Tue Jun 26 06:48:02 2018 +++ src/sys/net/if_vlan.c Fri Aug 3 11:24:19 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vlan.c,v 1.130 2018/06/26 06:48:02 msaitoh Exp $ */ +/* $NetBSD: if_vlan.c,v 1.131 2018/08/03 11:24:19 jmcneill Exp $ */ /* * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.130 2018/06/26 06:48:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.131 2018/08/03 11:24:19 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -161,6 +161,7 @@ struct ifvlan { * instead of direct dereference */ kmutex_t ifv_lock; /* writer lock for ifv_mib */ + pserialize_t ifv_psz; LIST_HEAD(__vlan_mchead, vlan_mc_entry) ifv_mc_listhead; LIST_ENTRY(ifvlan) ifv_list; @@ -355,6 +356,7 @@ vlan_clone_create(struct if_clone *ifc, psref_target_init(>ifvm_psref, ifvm_psref_class); mutex_init(>ifv_lock, MUTEX_DEFAULT, IPL_NONE); + ifv->ifv_psz = pserialize_create(); ifv->ifv_mib = mib; mutex_enter(_list.lock); @@ -792,7 +794,7 @@ vlan_linkmib_update(struct ifvlan *ifv, membar_producer(); ifv->ifv_mib = nmib; - pserialize_perform(vlan_psz); + pserialize_perform(ifv->ifv_psz); psref_target_destroy(>ifvm_psref, ifvm_psref_class); }
CVS commit: src/sys/arch/usermode
Module Name:src Committed By: reinoud Date: Fri Aug 3 11:18:22 UTC 2018 Modified Files: src/sys/arch/usermode/include: vmparam.h src/sys/arch/usermode/usermode: db_memrw.c pmap.c Log Message: Allow for setting kernel breakpoints in our remote kgdb To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/usermode/include/vmparam.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/db_memrw.c cvs rdiff -u -r1.111 -r1.112 src/sys/arch/usermode/usermode/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode
Module Name:src Committed By: reinoud Date: Fri Aug 3 11:18:22 UTC 2018 Modified Files: src/sys/arch/usermode/include: vmparam.h src/sys/arch/usermode/usermode: db_memrw.c pmap.c Log Message: Allow for setting kernel breakpoints in our remote kgdb To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/usermode/include/vmparam.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/db_memrw.c cvs rdiff -u -r1.111 -r1.112 src/sys/arch/usermode/usermode/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/include/vmparam.h diff -u src/sys/arch/usermode/include/vmparam.h:1.19 src/sys/arch/usermode/include/vmparam.h:1.20 --- src/sys/arch/usermode/include/vmparam.h:1.19 Wed Aug 1 12:09:02 2018 +++ src/sys/arch/usermode/include/vmparam.h Fri Aug 3 11:18:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.19 2018/08/01 12:09:02 reinoud Exp $ */ +/* $NetBSD: vmparam.h,v 1.20 2018/08/03 11:18:22 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -43,7 +43,7 @@ extern paddr_t kmem_user_start, kmem_use #define VM_MAX_ADDRESS kmem_user_end #define VM_MAXUSER_ADDRESS kmem_user_end #define VM_MIN_KERNEL_ADDRESS kmem_kvm_start -#define VM_MAX_KERNEL_ADDRESS kmem_kvm_end +#define VM_MAX_KERNEL_ADDRESS kmem_k_end #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST #define VM_PHYSSEG_MAX 1 Index: src/sys/arch/usermode/usermode/db_memrw.c diff -u src/sys/arch/usermode/usermode/db_memrw.c:1.2 src/sys/arch/usermode/usermode/db_memrw.c:1.3 --- src/sys/arch/usermode/usermode/db_memrw.c:1.2 Wed Aug 1 10:27:28 2018 +++ src/sys/arch/usermode/usermode/db_memrw.c Fri Aug 3 11:18:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: db_memrw.c,v 1.2 2018/08/01 10:27:28 reinoud Exp $ */ +/* $NetBSD: db_memrw.c,v 1.3 2018/08/03 11:18:22 reinoud Exp $ */ /*- * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc. @@ -53,11 +53,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.2 2018/08/01 10:27:28 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.3 2018/08/03 11:18:22 reinoud Exp $"); #include #include #include +#include #include #include @@ -211,29 +212,30 @@ db_write_text(vaddr_t addr, size_t size, void db_write_bytes(vaddr_t addr, size_t size, const char *data) { -// extern struct bootspace bootspace; char *dst; -// size_t i; + int ret; dst = (char *)addr; thunk_printf_debug("\n%s : %p + %d\n", __func__, dst, (int) size); -#if 0 - // TODO: check if we in kernel range and if so, do the mmap dance - // ourselves? - /* If any part is in kernel text or rodata, use db_write_text() */ - for (i = 0; i < BTSPACE_NSEGS; i++) { - if (bootspace.segs[i].type != BTSEG_TEXT && - bootspace.segs[i].type != BTSEG_RODATA) { - continue; - } - if (addr >= bootspace.segs[i].va && - addr < (bootspace.segs[i].va + bootspace.segs[i].sz)) { - db_write_text(addr, size, data); - return; - } + if (db_validate_address((vaddr_t)addr)) { + printf("address %p is invalid\n", (void *) addr); + return; + } + + /* + * if we are in the kernel range, just allow writing by using + * mprotect(); Note that this needs an unprotected binary, set with + * `paxctl -agm netbsd` + */ + if (addr > kmem_k_start) { + ret = thunk_mprotect((void *) trunc_page(addr), PAGE_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC); + if (ret != 0) + panic("please unprotect kernel binary with " + "`paxctl -agm netbsd`"); + assert(ret == 0); } -#endif dst = (char *)addr; Index: src/sys/arch/usermode/usermode/pmap.c diff -u src/sys/arch/usermode/usermode/pmap.c:1.111 src/sys/arch/usermode/usermode/pmap.c:1.112 --- src/sys/arch/usermode/usermode/pmap.c:1.111 Fri Aug 3 06:52:50 2018 +++ src/sys/arch/usermode/usermode/pmap.c Fri Aug 3 11:18:22 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.111 2018/08/03 06:52:50 reinoud Exp $ */ +/* $NetBSD: pmap.c,v 1.112 2018/08/03 11:18:22 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2018/08/03 06:52:50 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.112 2018/08/03 11:18:22 reinoud Exp $"); #include "opt_memsize.h" #include "opt_kmempages.h" @@ -139,7 +139,7 @@ pmap_bootstrap(void) struct pmap *pmap; paddr_t DRAM_cfg; paddr_t fpos, file_len; - paddr_t pv_fpos, tlb_fpos, pm_l1_fpos, pm_fpos; + paddr_t kernel_fpos, pv_fpos, tlb_fpos, pm_l1_fpos, pm_fpos; paddr_t wlen; paddr_t barrier_len; paddr_t pv_table_size; @@ -281,9 +281,11 @@ pmap_bootstrap(void) assert(err == 0); /* map the kernel at the start of the 'memory' file */ - written = thunk_pwrite(mem_fh, (void *) kmem_k_start, kmem_k_length, 0); + kernel_fpos = 0; + written = thunk_pwrite(mem_fh, (void *) kmem_k_start, kmem_k_length, + kernel_fpos); assert(written == kmem_k_length); - fpos =
Re: CVS commit: src/external/bsd/dhcpcd/dist/src
Date:Fri, 3 Aug 2018 02:17:33 + From:"Kamil Rytarowski" Message-ID: <20180803021733.b2002f...@cvs.netbsd.org> | GCC with -fsanitize=undefiend detects a potential overflow in the code. | Cast the return value of ntohs(3) to size_t. I don't understand the point of this change, and I believe it to be wrong and misguided. Further if there ever was a potential problem from this line ... *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); then *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp); will not fix it. The possible problem being if ip_len < 28 (the sum of the two sizeof's).While I didn't check this code, that possibility is usually verified elsewhere, and even if not, adding the cast changes nothing, the result is still bogus (that is, at best, the change could be masking a real bug, though that's unlikely.) This looks to be (somehow) determining that the result of ntohs(ip_len) might somehow be negative (or something, I'm not really sure what is being believed is happening) but the ntohs() result is (in all cases here) a uint16_t (either because the result is literally the arg, which is that type, or because it is the result of bswap16() which is declared that way.) The sizeof() ops make the expression at least a size_t - so unless size_t and uint16_t are the same (which might happen on a pdp-11 or similar, though even there it is unlikely I suspect) the narrower one needs to be promoted - whether the ntohs() result is implicitly promoted to size_t, or explicitly cast cannot make any difference, can it? So what exactly is being fixed here? Which behaviour is supposedly undefined? kre
CVS commit: src/sys/net
Module Name:src Committed By: ozaki-r Date: Fri Aug 3 09:54:40 UTC 2018 Modified Files: src/sys/net: if_tun.c Log Message: tun: fix locking against myself filt_tunread is called with tun_lock held from tun_output (via tun_output => selnotify => knote), so we must not take tun_lock in filt_tunread. The bug is triggered only if a tun is used through kqueue. Found by k-goda@IIJ To generate a diff of this commit: cvs rdiff -u -r1.144 -r1.145 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_tun.c diff -u src/sys/net/if_tun.c:1.144 src/sys/net/if_tun.c:1.145 --- src/sys/net/if_tun.c:1.144 Tue Jun 26 06:48:02 2018 +++ src/sys/net/if_tun.c Fri Aug 3 09:54:40 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.144 2018/06/26 06:48:02 msaitoh Exp $ */ +/* $NetBSD: if_tun.c,v 1.145 2018/08/03 09:54:40 ozaki-r Exp $ */ /* * Copyright (c) 1988, Julian Onions @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.144 2018/06/26 06:48:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.145 2018/08/03 09:54:40 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1058,18 +1058,15 @@ filt_tunread(struct knote *kn, long hint struct ifnet *ifp = >tun_if; struct mbuf *m; - mutex_enter(>tun_lock); + KASSERT(mutex_owned(>tun_lock)); + IF_POLL(>if_snd, m); - if (m == NULL) { - mutex_exit(>tun_lock); + if (m == NULL) return 0; - } for (kn->kn_data = 0; m != NULL; m = m->m_next) kn->kn_data += m->m_len; - mutex_exit(>tun_lock); - return 1; }
CVS commit: src/sys/net
Module Name:src Committed By: ozaki-r Date: Fri Aug 3 09:54:40 UTC 2018 Modified Files: src/sys/net: if_tun.c Log Message: tun: fix locking against myself filt_tunread is called with tun_lock held from tun_output (via tun_output => selnotify => knote), so we must not take tun_lock in filt_tunread. The bug is triggered only if a tun is used through kqueue. Found by k-goda@IIJ To generate a diff of this commit: cvs rdiff -u -r1.144 -r1.145 src/sys/net/if_tun.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Aug 3 07:44:31 UTC 2018 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: Mark fdt_addr_r __attribute__((__section__(".data"))) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/fdt/fdt_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.27 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.28 --- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.27 Tue Jul 17 19:12:55 2018 +++ src/sys/arch/evbarm/fdt/fdt_machdep.c Fri Aug 3 07:44:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_machdep.c,v 1.27 2018/07/17 19:12:55 christos Exp $ */ +/* $NetBSD: fdt_machdep.c,v 1.28 2018/08/03 07:44:31 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.27 2018/07/17 19:12:55 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.28 2018/08/03 07:44:31 skrll Exp $"); #include "opt_machdep.h" #include "opt_bootconfig.h" @@ -98,8 +98,7 @@ char *boot_args = NULL; /* filled in before cleaning bss. keep in .data */ u_long uboot_args[4] __attribute__((__section__(".data"))); - -const uint8_t *fdt_addr_r = (const uint8_t *)0xdeadc0de; +const uint8_t *fdt_addr_r __attribute__((__section__(".data"))); static char fdt_memory_ext_storage[EXTENT_FIXED_STORAGE_SIZE(DRAM_BLOCKS)]; static struct extent *fdt_memory_ext;
CVS commit: src/sys/arch/evbarm/fdt
Module Name:src Committed By: skrll Date: Fri Aug 3 07:44:31 UTC 2018 Modified Files: src/sys/arch/evbarm/fdt: fdt_machdep.c Log Message: Mark fdt_addr_r __attribute__((__section__(".data"))) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/fdt/fdt_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Fri Aug 3 06:52:50 UTC 2018 Modified Files: src/sys/arch/usermode/usermode: pmap.c Log Message: Fix physical memory size issue. It will now happily run on more than one gb. To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/arch/usermode/usermode/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/usermode
Module Name:src Committed By: reinoud Date: Fri Aug 3 06:52:50 UTC 2018 Modified Files: src/sys/arch/usermode/usermode: pmap.c Log Message: Fix physical memory size issue. It will now happily run on more than one gb. To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/sys/arch/usermode/usermode/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/usermode/usermode/pmap.c diff -u src/sys/arch/usermode/usermode/pmap.c:1.110 src/sys/arch/usermode/usermode/pmap.c:1.111 --- src/sys/arch/usermode/usermode/pmap.c:1.110 Wed Aug 1 12:09:01 2018 +++ src/sys/arch/usermode/usermode/pmap.c Fri Aug 3 06:52:50 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.110 2018/08/01 12:09:01 reinoud Exp $ */ +/* $NetBSD: pmap.c,v 1.111 2018/08/03 06:52:50 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2018/08/01 12:09:01 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2018/08/03 06:52:50 reinoud Exp $"); #include "opt_memsize.h" #include "opt_kmempages.h" @@ -76,6 +76,14 @@ struct pmap { struct pmap_l2 **pm_l1; }; +/* + * pv_table is list of pv_entry structs completely spanning the total memory. + * It is indexed on physical page number. Each entry will be daisy chained + * with pv_entry records for each usage in all the pmaps. + * + * kernel_pm_entries contains all kernel L2 pages for its complete map. + * + */ static struct pv_entry **kernel_pm_entries; static struct pv_entry *pv_table; /* physical pages info (direct mapped) */ @@ -95,7 +103,6 @@ static int pm_l1_size = 0; static uint64_t pm_entries_size = 0; static struct pool pmap_pool; -static struct pool pmap_l1_pool; static struct pool pmap_pventry_pool; /* forwards */ @@ -139,6 +146,7 @@ pmap_bootstrap(void) vaddr_t free_start, free_end; paddr_t pa; vaddr_t va; + size_t kmem_k_length, written; uintptr_t pg, l1; void *addr; int err; @@ -165,6 +173,7 @@ pmap_bootstrap(void) /* calculate kernel section (R-X) */ kmem_k_start = (vaddr_t) PAGE_SIZE * (atop(_start)); kmem_k_end = (vaddr_t) PAGE_SIZE * (atop() + 1); + kmem_k_length = kmem_k_end - kmem_k_start; /* calculate total available memory space & available pages */ DRAM_cfg = (vaddr_t) TEXTADDR; @@ -260,7 +269,7 @@ pmap_bootstrap(void) #endif /* protect the current kernel section */ - err = thunk_mprotect((void *) kmem_k_start, kmem_k_end - kmem_k_start, + err = thunk_mprotect((void *) kmem_k_start, kmem_k_length, THUNK_PROT_READ | THUNK_PROT_EXEC); assert(err == 0); @@ -271,14 +280,18 @@ pmap_bootstrap(void) THUNK_MADV_WILLNEED | THUNK_MADV_RANDOM); assert(err == 0); + /* map the kernel at the start of the 'memory' file */ + written = thunk_pwrite(mem_fh, (void *) kmem_k_start, kmem_k_length, 0); + assert(written == kmem_k_length); + fpos = kmem_k_length; + /* initialize counters */ - fpos = 0; free_start = fpos; /* in physical space ! */ free_end = file_len; /* in physical space ! */ kmem_kvm_cur_start = kmem_kvm_start; /* calculate pv table size */ - phys_npages = (free_end - free_start) / PAGE_SIZE; + phys_npages = file_len / PAGE_SIZE; pv_table_size = round_page(phys_npages * sizeof(struct pv_entry)); thunk_printf_debug("claiming %"PRIu64" KB of pv_table for " "%"PRIdPTR" pages of physical memory\n", @@ -292,7 +305,7 @@ pmap_bootstrap(void) /* calculate how big the l1 tables are going to be */ pm_nl1 = pm_nentries / PMAP_L2_NENTRY; - pm_l1_size = pm_nl1 * sizeof(struct pmap_l1 *); + pm_l1_size = round_page(pm_nl1 * sizeof(struct pmap_l1 *)); /* claim pv table */ pv_fpos = fpos; @@ -449,8 +462,6 @@ pmap_deferred_init(void) /* create pmap pool */ pool_init(_pool, sizeof(struct pmap), 0, 0, 0, "pmappool", NULL, IPL_NONE); - pool_init(_l1_pool, pm_l1_size, 0, 0, 0, - "pmapl1pool", NULL, IPL_NONE); pool_init(_pventry_pool, sizeof(struct pv_entry), 0, 0, 0, "pventry", NULL, IPL_HIGH); } @@ -484,8 +495,8 @@ pmap_create(void) pmap->pm_flags = 0; /* claim l1 table */ - pmap->pm_l1 = pool_get(_l1_pool, PR_WAITOK); - memset(pmap->pm_l1, 0, pm_l1_size); + pmap->pm_l1 = kmem_zalloc(pm_l1_size, KM_SLEEP); + assert(pmap->pm_l1); thunk_printf_debug("\tpmap %p\n", pmap); @@ -527,7 +538,7 @@ pmap_destroy(pmap_t pmap) continue; kmem_free(l2tbl, PMAP_L2_SIZE); } - pool_put(_l1_pool, pmap->pm_l1); + kmem_free(pmap->pm_l1, pm_l1_size); pool_put(_pool, pmap); }
CVS commit: src/distrib/sets/lists
Module Name:src Committed By: kamil Date: Fri Aug 3 06:07:02 UTC 2018 Modified Files: src/distrib/sets/lists/comp: mi src/distrib/sets/lists/man: mi Log Message: Fix distribution lists with MKCATPAGES=yes Add SCTP documentation. To generate a diff of this commit: cvs rdiff -u -r1.2215 -r1.2216 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.1604 -r1.1605 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2215 src/distrib/sets/lists/comp/mi:1.2216 --- src/distrib/sets/lists/comp/mi:1.2215 Thu Aug 2 08:40:47 2018 +++ src/distrib/sets/lists/comp/mi Fri Aug 3 06:07:02 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2215 2018/08/02 08:40:47 rjs Exp $ +# $NetBSD: mi,v 1.2216 2018/08/03 06:07:02 kamil Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.compcomp-sys-root @@ -9205,6 +9205,17 @@ ./usr/share/man/cat3/sched_setparam.0 comp-c-catman .cat ./usr/share/man/cat3/sched_setscheduler.0 comp-c-catman .cat ./usr/share/man/cat3/sched_yield.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_bindx.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_connectx.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_freepaddrs.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_getaddrlen.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_getassocid.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_getpaddrs.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_opt_info.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_peeloff.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_recvmsg.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_send.0 comp-c-catman .cat +./usr/share/man/cat3/sctp_sendmsg.0 comp-c-catman .cat ./usr/share/man/cat3/scrl.0 comp-c-catman .cat ./usr/share/man/cat3/scroll.0 comp-c-catman .cat ./usr/share/man/cat3/scrollok.0 comp-c-catman .cat Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1604 src/distrib/sets/lists/man/mi:1.1605 --- src/distrib/sets/lists/man/mi:1.1604 Tue Jul 31 19:30:18 2018 +++ src/distrib/sets/lists/man/mi Fri Aug 3 06:07:02 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1604 2018/07/31 19:30:18 rjs Exp $ +# $NetBSD: mi,v 1.1605 2018/08/03 06:07:02 kamil Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1642,6 +1642,7 @@ ./usr/share/man/cat4/schide.0 man-sys-catman .cat ./usr/share/man/cat4/scsi.0 man-sys-catman .cat ./usr/share/man/cat4/scsibus.0 man-sys-catman .cat +./usr/share/man/cat4/sctp.0 man-sys-catman .cat ./usr/share/man/cat4/sd.0 man-sys-catman .cat ./usr/share/man/cat4/sdhc.0 man-sys-catman .cat ./usr/share/man/cat4/sdmmc.0 man-sys-catman .cat
CVS commit: src/distrib/sets/lists
Module Name:src Committed By: kamil Date: Fri Aug 3 06:07:02 UTC 2018 Modified Files: src/distrib/sets/lists/comp: mi src/distrib/sets/lists/man: mi Log Message: Fix distribution lists with MKCATPAGES=yes Add SCTP documentation. To generate a diff of this commit: cvs rdiff -u -r1.2215 -r1.2216 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.1604 -r1.1605 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.