Re: exec_elf.c: mistake ?
Le 06/07/2013 17:42, Kenneth R Westerback a écrit : On Sat, Jul 06, 2013 at 05:21:31PM +0200, Maxime Villard wrote: Hi, - - - - sys/kern/exec_elf.c l.236 ~ 251252 Are my code scanner and me wrong, or 'bdiff' may not be initialized ? Codewise it does look possible that bdiff will be used uninitialized. Whether it can happen in reality depends on whether ph-p_align can ever be 1. Next question -- what would the correct value for bdiff be in that = 1 case? 0? i.e. should the line be 'diff = bdiff = 0;'. Ken Hum hum, after investigating a bit, and from what I understood - if I'm not mistaken, I think it would make sense if bdiff was set to bdiff = ph-p_vaddr - trunc_page(ph-p_vaddr); Since we are supposed to align only on 2^n boundaries, if we get 0 or 1 we do not align on p_align. But p_vaddr still has to be aligned on PAGE_MASK (with trunc_page()); I read somewhere that ELF loaders are smart enough to adjust the address when it does not exactly fit a page boundary. So bdiff should be the difference with the original p_vaddr. Actually, bdiff is already set to this value in the other conditions. There's another problem, 'base' should also be initialized here. I would say that is should be set to the truncated p_vaddr plus the address at which we want to load: base = *addr + trunc_page(ph-p_vaddr); but I'm not sure at all. Anyway, here is a patch. With these changes, 'uaddr' becomes useless, so I removed it. ...Ok? Index: exec_elf.c === RCS file: /cvs/src/sys/kern/exec_elf.c,v retrieving revision 1.93 diff -u -r1.93 exec_elf.c --- exec_elf.c 4 Jul 2013 17:37:05 - 1.93 +++ exec_elf.c 14 Aug 2013 18:31:37 - @@ -215,7 +215,7 @@ ELFNAME(load_psection)(struct exec_vmcmd_set *vcset, struct vnode *vp, Elf_Phdr *ph, Elf_Addr *addr, Elf_Addr *size, int *prot, int flags) { - u_long uaddr, msize, lsize, psize, rm, rf; + u_long msize, lsize, psize, rm, rf; long diff, offset, bdiff; Elf_Addr base; @@ -229,19 +229,16 @@ /* page align vaddr */ base = *addr + trunc_page(ph-p_vaddr) - ELF_TRUNC(ph-p_vaddr, ph-p_align); - - bdiff = ph-p_vaddr - trunc_page(ph-p_vaddr); - } else diff = 0; } else { - *addr = uaddr = ph-p_vaddr; + *addr = ph-p_vaddr; if (ph-p_align 1) - *addr = ELF_TRUNC(uaddr, ph-p_align); - base = trunc_page(uaddr); - bdiff = uaddr - base; - diff = uaddr - *addr; + *addr = ELF_TRUNC(*addr, ph-p_align); + base = trunc_page(ph-p_vaddr); + diff = ph-p_vaddr - *addr; } + bdiff = ph-p_vaddr - trunc_page(ph-p_vaddr); *prot |= (ph-p_flags PF_R) ? VM_PROT_READ : 0; *prot |= (ph-p_flags PF_W) ? VM_PROT_WRITE : 0;
Re: rtsold ioctl sysctl
On Thu, Aug 15, 2013 at 00:39 +0200, Alexander Bluhm wrote: Hi, I would like to replace the obsolete ioctl(SIOCGDRLST_IN6) interface with sysctl(net.inet6.icmp6.nd6_drlist) in rtsold. Code copied from ndp. ok? looks good to me. OK
Re: Advanced btcoex in iwn(4)
On 10/08/13(Sat) 18:12, Sylvestre Gallon wrote: Hi, Here is a patch for advanced btcoex support in iwn(4). I know that there is no particular reason to do it due to the lack of bluetooth enabled by default. But as we already do btcoex for the cards without IWN_FLAG_ADV_BT_COEX flag I was thinking that we could also do it on other cards. I take all these things in freebsd without the memset that overflow: memset(btprot, 0, sizeof btprio); I've also replaced some hardcoded values by defines and added few comments. It works on Intel Wifi Link 130 and jca@ have tried it on his Wifi Link 5300. It would be awesome if someone could try it on other chips. Any ok or this code this is really not needed ? I would argue that even if it's not really needed it reduces the diff against the freebsd version and makes the driver coherent between the different supported revisions. So you've my ok. Martin
remove obsolete nd6 ioctls
Hi, After converting the last user of ioctl(SIOCGDRLST_IN6) to sysctl, I would like to remove dead kernel ioctl code. Is it save to just delete this? ok? bluhm Index: netinet6/in6.c === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/in6.c,v retrieving revision 1.116 diff -u -p -u -p -r1.116 in6.c --- netinet6/in6.c 20 Jun 2013 12:03:40 - 1.116 +++ netinet6/in6.c 15 Aug 2013 15:06:06 - @@ -361,10 +361,7 @@ in6_control(struct socket *so, u_long cm if (!privileged) return (EPERM); /* FALLTHROUGH */ - case OSIOCGIFINFO_IN6: case SIOCGIFINFO_IN6: - case SIOCGDRLST_IN6: - case SIOCGPRLST_IN6: case SIOCGNBRINFO_IN6: return (nd6_ioctl(cmd, data, ifp)); } Index: netinet6/in6_var.h === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/in6_var.h,v retrieving revision 1.40 diff -u -p -u -p -r1.40 in6_var.h --- netinet6/in6_var.h 17 Jun 2013 18:02:24 - 1.40 +++ netinet6/in6_var.h 15 Aug 2013 15:03:46 - @@ -400,11 +400,6 @@ struct in6_rrenumreq { #define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) -#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist) -#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_prlist) -#ifdef _KERNEL -#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) -#endif #define SIOCGIFINFO_IN6_IOWR('i', 108, struct in6_ndireq) #define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq) #define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo) Index: netinet6/nd6.c === RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/nd6.c,v retrieving revision 1.99 diff -u -p -u -p -r1.99 nd6.c --- netinet6/nd6.c 31 May 2013 15:04:24 - 1.99 +++ netinet6/nd6.c 15 Aug 2013 15:04:50 - @@ -1238,111 +1238,13 @@ nd6_rtrequest(int req, struct rtentry *r int nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) { - struct in6_drlist *drl = (struct in6_drlist *)data; - struct in6_oprlist *oprl = (struct in6_oprlist *)data; struct in6_ndireq *ndi = (struct in6_ndireq *)data; struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data; - struct nd_defrouter *dr; - struct nd_prefix *pr; struct rtentry *rt; - int i = 0, error = 0; + int error = 0; int s; switch (cmd) { - case SIOCGDRLST_IN6: - /* -* obsolete API, use sysctl under net.inet6.icmp6 -*/ - bzero(drl, sizeof(*drl)); - s = splsoftnet(); - TAILQ_FOREACH(dr, nd_defrouter, dr_entry) { - if (i = DRLSTSIZ) - break; - drl-defrouter[i].rtaddr = dr-rtaddr; - if (IN6_IS_ADDR_LINKLOCAL(drl-defrouter[i].rtaddr)) { - /* XXX: need to this hack for KAME stack */ - drl-defrouter[i].rtaddr.s6_addr16[1] = 0; - } else - log(LOG_ERR, - default router list contains a - non-linklocal address(%s)\n, - ip6_sprintf(drl-defrouter[i].rtaddr)); - - drl-defrouter[i].flags = dr-flags; - drl-defrouter[i].rtlifetime = dr-rtlifetime; - drl-defrouter[i].expire = dr-expire; - drl-defrouter[i].if_index = dr-ifp-if_index; - i++; - } - splx(s); - break; - case SIOCGPRLST_IN6: - /* -* obsolete API, use sysctl under net.inet6.icmp6 -* -* XXX the structure in6_prlist was changed in backward- -* incompatible manner. in6_oprlist is used for SIOCGPRLST_IN6, -* in6_prlist is used for nd6_sysctl() - fill_prlist(). -*/ - /* -* XXX meaning of fields, especially raflags, is very -* different between RA prefix list and RR/static prefix list. -* how about separating ioctls into two? -*/ - bzero(oprl, sizeof(*oprl)); - s = splsoftnet(); - LIST_FOREACH(pr, nd_prefix, ndpr_entry) { - struct nd_pfxrouter *pfr; - int j; - - if (i = PRLSTSIZ) - break; - oprl-prefix[i].prefix = pr-ndpr_prefix.sin6_addr; - oprl-prefix[i].raflags = pr-ndpr_raf; -
Re: remove obsolete nd6 ioctls
On 15 August 2013 17:34, Alexander Bluhm alexander.bl...@gmx.net wrote: Hi, After converting the last user of ioctl(SIOCGDRLST_IN6) to sysctl, I would like to remove dead kernel ioctl code. Is it save to just delete this? ok? bluhm if ports are fine with it, i'm fine as well (:
Re: remove obsolete nd6 ioctls
* Mike Belopuhov m...@belopuhov.com [2013-08-15 17:38]: On 15 August 2013 17:34, Alexander Bluhm alexander.bl...@gmx.net wrote: After converting the last user of ioctl(SIOCGDRLST_IN6) to sysctl, I would like to remove dead kernel ioctl code. Is it save to just delete this? ok? if ports are fine with it, i'm fine as well (: what Sir Mike said. -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services GmbH, http://bsws.de, Full-Service ISP Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed Henning Brauer Consulting, http://henningbrauer.com/