summaryrefslogtreecommitdiff
path: root/sys/compat/common
AgeCommit message (Collapse)Author
2023-03-30atalk(4): Omit spurious satosat.riastradh
The input is already a struct sockaddr_at pointer.
2022-12-20Remove sys/compat/common/Makefile.*.msaitoh
These files are not used anymore. Files for compat code are listed in sys/comapt/common/files.common and sys/modules/compat_xxx/Makefile. OK'd by riastradh@ and pgoyette@.
2022-12-19Create compat_100 module infrastructure now that we have branchedpgoyette
for NetBSD-10
2022-09-28Simplify sys/compat/sys/sockio.h. No functional change intended.msaitoh
- Move some definitions from sys/compat/sockio.h to compat/net/if.h. struct oif_data in sockio.h and if_data50 are the same, so remove oif_data. Do the same thing to oifdatareq, too. - u_quad_t -> uint64_t. No functional change.
2022-09-21compat_50_quota: reject invalid quota id types.dholland
Reported-by: syzbot+ce8391eb74a16e1967ab@syzkaller.appspotmail.com
2022-09-03Remove <net/netisr.h>thorpej
2022-08-03sys/compat/common/if_media_80.c: Add kernel rcsid.riastradh
2022-07-10tty_43: Do unsigned arithmetic to avoid shift into sign bits.riastradh
Omit input validation -- it's not a great idea for compatibility with historical kernels, since they ignored the bits instead of rejecting them if set. With unsigned arithmetic, we get the same semantics as was previously assumed (discarding bits that get shifted into the sign bit or off into oblivion) without the formal undefined behaviour. Reported-by: syzbot+e408764cdd8c0c0ff535@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=8318f0039e68187cd8d27b2c520816fff3f7266a
2022-07-07ifioctl(9): Don't touch ifconf or ifreq until command is validated.riastradh
sys_ioctl validates the data pointer according to the command's size and direction. But userland may ioctl commands other than OSIOCGIFCONF or OOSIOCGIFCONF -- and if userland passes an IOC_VOID command, the argument is passed through verbatim and may be null. Reported-by: syzbot+19b1bf83e5481273eafc@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=f4c91a7dcd31901c80d91af6ed01456faf0a7286 Reported-by: syzbot+442c033feb784d055185@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=4a3a4b92dbe9695046ff17a5474cef52aed23e0b Reported-by: syzbot+4c87d0cdf7025741ea7a@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=3e5f42c998e43ad42da40dec3c7873e6aae187e4
2022-03-12compat_30: Fix thinko in previous.riastradh
Let's not go into an infinite loop of stack smashing!
2022-03-12compat_30: Avoid what might be technically undefined behaviour.riastradh
Not sure advancing a user pointer by one for the purpose of making an equality test fail later on is actually likely to be a problem, but let's just pacify the sanitizer. Reported-by: syzbot+758b18164c5c444f4249@syzkaller.appspotmail.com
2021-12-10s/occured/occurred/ in comments, log messages and man pages.andvar
2021-12-02don't call MODULE_HOOK_SET(), if exec_sigcode_alloc() fails.ryo
2021-11-26Fix anonymous memory object leak for sigcode.ryo
- Repeating "modload compat_linux && /emul/linux/bin/ls && modunload compat_linux" will reproduce this problem. - It cause in exec_sigcode_map(), anon-object for sigcode was created at first exec, but it remained even after exec_remove. - Fixed that the anon-object for sigcode is created at exec_add(), and the anon-object reference is removed at exec_remove(). - sigobject_lock is no longer needed since it is locked by exec_lock. - The compat_16 module rewrites the e_sigcode entry in emul_netbsd directly and does not use exec_add()/exec_remove(), so it needs to call sigcode_alloc()/sigcode_free() on its own.
2021-11-10s/compatability/compatibility/ in comment.msaitoh
2021-11-01Use "stack_t" instead of "struct sigaltstack", as the former is thethorpej
newer standardized name. NFC.
2021-09-07sys/compat: Memset zero before copyout.riastradh
Just in case of uninitialized padding which would lead to kernel stack disclosure. If the compiler can prove the memset redundant then it can optimize it away; otherwise better safe than sorry.
2021-08-15- memset struct stat to avoid kernel memory disclosure of padded fieldschristos
(thanks Trend Micro for the report) - use do_fhstat - consistency in argument order of compat functions
2021-08-09fix various typos in compatibility, mainly in comments.andvar
2021-07-21need <sys/param.h> for COHERENCY_UNITskrll
Minor KNF along the way.
2021-05-25PR port-xen/53130 was fixed and closed some time ago, so now we canpgoyette
belatedly re-enable inclusion of the compat_60 x86 microcode code in the loadable module. (It was already being included in the built-in version of the module.)
2021-04-03Centralise the setitimer() timer type validation in dosetitimer() as issimonb
done with dogetitimer().
2020-12-19malloc(9) -> kmem(9)thorpej
2020-10-10TIOCGSID is used by tcgetsid() so it is not really compat :-)christos
This should reduce loading the compat module.
2020-10-09tty_43: Check a bitset from userspace is valid before shifting itnia
Passing a negative value to these legacy compat ioctls results in left shift on a negative value which is undefined behaviour and results in the tty (at least, possibly other things) locking up. The argument to the ioctl should always be > 0. Return EINVAL otherwise. While here, adjustments to code style to match current guidelines. Found by UBSan. Reported-by: syzbot+39cd551a05298b222756@syzkaller.appspotmail.com
2020-09-05Round of uvm.h cleanup.riastradh
The poorly named uvm.h is generally supposed to be for uvm-internal users only. - Narrow it to files that actually need it -- mostly files that need to query whether curlwp is the pagedaemon, which should maybe be exposed by an external header. - Use uvm_extern.h where feasible and uvm_*.h for things not exposed by it. We should split up uvm_extern.h but this will serve for now to reduce the uvm.h dependencies. - Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use UVMHIST(ubchist), since ubchist is declared in uvm.h but the reference evaporates if UVMHIST is not defined, so we reduce header file dependencies. - Make uvm_device.h and uvm_swap.h independently includable while here. ok chs@
2020-08-08Fix the OTIOCGETD emulation. Line discipline 0 is NTTYDISC.christos
2020-07-16 Don't accept negative value.msaitoh
Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
2020-06-28Fix struct entry size (thanks kre@)christos
2020-06-24reduce stack usage in compat_60_ptmget_ioctl() - allocate struct ptmgetjdolecek
via kmem_alloc()
2020-06-24remove special handling for symbolic links for COMPAT_43 lstat, it'sjdolecek
not necessary; this removes the only places in kernel which did namei LOOKUP with LOCKPARENT fixes diagnostic KASSERT() in namei() code Reported-by: syzbot+628382ecf1438e53d08d@syzkaller.appspotmail.com
2020-06-12Remove in-kernel handling of Router Advertisementsroy
This is much better handled by a user-land tool. Proposed on tech-net here: https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl. Compat is fully provided where it makes sense, but trying to turn on RA handling will obviously throw an error as it no longer exists. Note that if you use IPv6 temporary addresses, this now needs to be turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).
2020-05-23Move proc_lock into the data segment. It was dynamically allocated becausead
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
2020-04-30Omit needless #include <sys/rnd.h>.riastradh
2020-03-26When using SYSCTL_SETUP there is no guarantee of the order in whichpgoyette
the set-up functions will be called, so it is perfectly acceptable for a compat code's routine to be called ahead of the code in other parts of the kernel. So make sure that the 2nd level sysctl node ``vfs.generic'' exists before trying to add the 3rd level entries. XXX Rather than creating the 2nd level node in two places, we could XXX add the shared ``vfs.generic'' node to sysctl_init_base.c but XXX this is left for another day.
2020-03-09The compat_50_quota code needs quota support from ufs. Add dependency.pgoyette
2020-02-27Include all of the vfs syscalls in the syscall_package, not just oquota.pgoyette
Should fix PR kern/55025 XXX pullup-9
2020-02-27Ooppss - SYSCTL_SETUP() functions return void.pgoyette
2020-02-27Remove explicit calls to the sysctl setup routines, since this is nowpgoyette
handled by the module infrastructure.
2020-02-23Don't bother with kernel_lock for kern_reboot().ad
2020-02-22pass the address of the field, instead of relying on it being the firstmaxv
field of the structure, no functional change
2020-01-31Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problemmaxv
since this syscall is privileged.
2020-01-30- make sure size is not used uninitializedchristos
- limit size range - fix type botch for "size" from maxv@
2020-01-29- Track LWPs in a per-process radixtree. It uses no extra memory in thead
single threaded case. Replace scans of p->p_lwps with lookups in the tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep queues for park/unpark with lookups in the tree under cover of a RW lock. - lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and return EINVAL if it's detached, not ESRCH. - Group the locks in struct proc at the end of the struct in their own cache line. - Add some comments.
2020-01-29Don't reference ifp->if_data directly; use if_export_if_data().thorpej
2020-01-27Split the module glue out from the rest of opencrypto/ocryptodev topgoyette
make rump happy. Rump doesn't have compat modules (the compat code is included in the relevant librump*.so), so there's no module compat_50 listed in link_set_modules, and thus ocryptodev's MODULE(...) can't "require" it. This fixes the problem of "built-in module compat_50 not found" when starting up rump_allserver (or rump_server with -l rumpdev_opencrypto). XXX This does not resolve the long-standing "crypto: unable to XXX register devsw, error 17" message noted at line 78 of XXX sys/rump/dev/lib/libopencrypto/opencrypto_component.c
2020-01-22Since this used to be part of the compat_50 module, make it depend onpgoyette
compat_50 rather than compat_60 module.
2020-01-21Split the compat_50 module into two, separating the QUOTA-relatedpgoyette
stuff from the rest of the module. This allows loading of the (main) compat_50 module on kernels that don't include ``options QUOTA''. Welcome to 9.99.40 ! Addresses PR kern/54875
2020-01-17VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, toad
allow us to get shared locks (or no lock) on the returned vnode. Matches FreeBSD.
2020-01-04Resurrect boottime, but only in the compat_90 module (whether built-inpgoyette
or separately loaded). This will enable running of old vmstat(1) images on newer kernels.