Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/sysv_msg.c
RevisionDateAuthorComments
 1.76  04-Oct-2019  kamil Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX

This logic (found in Linux) avoids undefined behavior.

Reported-by: syzbot+8af00519a8688d9903ca@syzkaller.appspotmail.com
 1.75  07-Aug-2019  pgoyette Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables. This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data. So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed. We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded. (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.
 1.74  10-Apr-2019  pgoyette branches: 1.74.4;
Replace some "panic()" calls with simple "printf() ; return error"

There's no good reason for these build-time parameters to be allowed to
panic the kernel when it is easy to simply disable the module code and
fail gracefully.

While we're at it, similarly replace panic() when malloc fails to also
fail gracefully.
 1.73  21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.72  30-Mar-2018  maya branches: 1.72.2;
correct typo: and and -> and (comments only)

heads up on this being a common typo from chris28.
 1.71  05-Sep-2016  christos branches: 1.71.8; 1.71.14;
don't forget to destroy a cv
 1.70  06-Nov-2015  pgoyette In sysv_sem.c, defer establishment of exithook so we can initialize the
module code from module_init() rather than waiting until after calling
exec_init(). Use a RUN_ONCE routine at entry to each sys_sem* syscall
to establish the exithook, and no longer KASSERT that the hook has
been set before removing it. (A manually loaded module can be unloaded
before any syscalls have been invoked.)

Remove the conditional calls to the various xxx_init() routines from
init_main.c - we now rely on module_init() to handle initialization.

Let each sub-component's xxx_init() routine handle its own sysctl
sub-tree initialization; this removes another set of #ifdef ugliness.

Tested both built-in and loadable versions and verified that atf
test kernel/t_sysv passes.
 1.69  13-May-2015  pgoyette More prep: add a xxxfini() routine to each subcomponent so we can
clean up after ourselves. Mostly, this checks to make sure that
there are no active itmes, and then deallocates wired kernel virtual
memory. For SYSVSEM, we also disestablish the exithook() so we
won't try to call it after destroying its memory pool!
 1.68  13-May-2015  pgoyette More preparation for modularizing the SYSVxxx options. Here we
change the kern.ipc.sysvxxx sysctls into dynamic values, so each
sub-component of SYSVxxx can declare its own availability.
 1.67  12-May-2015  pgoyette In preparation for modularization of the SYSV* options, restore the
use of opt_sysv.h to get the -DSYSVxxx definitions.
 1.66  25-Feb-2014  pooka branches: 1.66.4; 1.66.6; 1.66.8; 1.66.12;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.65  07-Feb-2014  msaitoh s/mesage/message/
 1.64  23-Jul-2013  skrll Fix debug code to not use uninitialised variables.
 1.63  13-Mar-2012  elad branches: 1.63.2; 1.63.4; 1.63.10;
Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.62  30-Jul-2011  uebayasi branches: 1.62.2; 1.62.6;
Correct sizes to pass uvm_km_free(9) in error paths.
 1.61  28-Jan-2009  njoly Do not call put_type() but use copyout() when returning the message
segments to the user.

ok by rmind.
 1.60  26-Jan-2009  njoly Make msgsnd(2)/msgrcv(2) fail with EINVAL for messages larger than
SSIZE_MAX. Adjust man pages accordingly.

ok by christos.
 1.59  11-Jan-2009  christos merge christos-time_t
 1.58  19-Sep-2008  rmind branches: 1.58.2; 1.58.4;
Fix the aligning of memory blocks again, finally...
Tested by <martin> on his sparc64 box.
 1.57  22-May-2008  njoly branches: 1.57.4;
Make msgsnd return EINVAL instead of 0, when the value of mtype is
less than 1.
 1.56  28-Apr-2008  martin branches: 1.56.2;
Remove clause 3 and 4 from TNF licenses
 1.55  07-Jan-2008  ad branches: 1.55.6; 1.55.8; 1.55.10; 1.55.12;
Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.54  20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.53  25-Nov-2007  rmind branches: 1.53.2; 1.53.6;
- Retry the operations (instead of failing) in case of reallocation.
Suggested by <yamt>.
- Use predicts in checks for reallocation state.
 1.52  04-Nov-2007  yamt branches: 1.52.2;
fix deadlocks.
 1.51  04-Nov-2007  rmind Support for dynamic changing of SysV message queues and semaphores limits.
Also fixes the alignment problem, which was here forever. Thanks for <uwe>
for discussion and <martin> for testing.

Reviewed by: <tech-kern>, <gdt>
 1.50  09-Oct-2007  rmind branches: 1.50.2;
- Style, consistency;
- Replace most panic() checks with KASSERT();
- msgrcv1: Improve readability;
- Remove #ifdef ENOMSG;

No function changes of the interface are intented.
 1.49  13-Mar-2007  ad branches: 1.49.10; 1.49.12; 1.49.14;
msgctl1: fix a lock leak.
 1.48  09-Feb-2007  ad branches: 1.48.2; 1.48.6; 1.48.8;
Merge newlock2 to head.
 1.47  04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.46  01-Nov-2006  yamt remove some __unused from function parameters.
 1.45  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.44  23-Jul-2006  ad branches: 1.44.4; 1.44.6;
Use the LWP cached credentials where sane.
 1.43  07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.42  14-May-2006  elad branches: 1.42.2;
integrate kauth.
 1.41  06-Mar-2006  cube branches: 1.41.2; 1.41.4;
Introduce msgrcv1 and msgsnd1 which take special care of the msg_type
parameter that gets copied in or out, making sys_msg{rcv,snd} friendly to
COMPAT_NETBSD32.
 1.40  07-Dec-2005  thorpej branches: 1.40.4; 1.40.6; 1.40.8;
Use ANSI function delcs.
 1.39  01-Apr-2005  yamt branches: 1.39.2;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.38  26-Feb-2005  perry nuke trailing whitespace
 1.37  23-Mar-2004  junyoung branches: 1.37.8; 1.37.10;
Nuke __P().
 1.36  26-Oct-2003  jdolecek allocate virtual memory for SYSV shm, msg and semaphore structures
separately from the bufpages, so that it would be possible to eventually
make their limits changeable in runtime

make static all local variables which do not need to be exported to other
kernel parts
 1.35  18-Jan-2003  thorpej branches: 1.35.2;
Merge the nathanw_sa branch.
 1.34  05-Mar-2002  nathanw Make the debugging printfs compile:
- printf format checking doesn't like %x for pointers; use %p like we should.
- LP64 fixes.
 1.33  12-Nov-2001  lukem add RCSIDs
 1.32  22-Jul-2000  simonb branches: 1.32.2; 1.32.4; 1.32.8;
Delete a couple of <uvm/uvm_extern.h> includes that were for
<sys/sysctl.h> only.
 1.31  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.30  02-Jun-2000  simonb White space nit in previous.
 1.29  02-Jun-2000  simonb Add new sysctl node "KERN_SYSVIPC_INFO" with "KERN_SYSVIPC_MSG_INFO",
"KERN_SYSVIPC_SEM_INFO" and "KERN_SYSVIPC_SHM_INFO" to return the
info and data structures for the relevent SysV IPC types. The return
structures use fixed-size types and should be compat32 safe. All
user-visible changes are protected with
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

Make all variable declarations extern in msg.h, sem.h and shm.h and
add relevent variable declarations to sysv_*.c and remove unneeded
header files from those .c files.

Make compat14 SysV IPC conversion functions and sysctl_file() static.

Change the data pointer to "void *" in sysctl_clockrate(),
sysctl_ntptime(), sysctl_file() and sysctl_doeproc().
 1.28  12-Apr-2000  simonb branches: 1.28.2;
Remove bogus "#ifdef EIDRM" checks and warnings that BSD doesn't define
EIDRM - EIDRM was added over two years ago!
 1.27  30-Mar-2000  augustss Get rid of register declarations.
 1.26  25-Aug-1999  thorpej branches: 1.26.2;
Overhaul of the SVID IPC facilities, primarily to use the types specified
by the Single UNIX Specification version 2, rather than the SVR2-derived
types. While I was here, I did a namespace sweep to expose the constants
and strucutures, and structure members described by SUSv2; documentation
updates coming shortly.

Fixes kern/8158.
 1.25  21-Apr-1999  mrg properly test the msgsz as "msgsz - len". from PR#7386
 1.24  21-Oct-1998  tron branches: 1.24.8;
No need to get definition of "SYSV..." from "opt_sysv.h" because they
must be set if these files are compiled.
 1.23  19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.22  07-May-1998  kleink Various SysV IPC prototype changes.
 1.21  13-Oct-1996  christos backout previous kprintf change
 1.20  10-Oct-1996  christos - Use debugging printf - macros instead if #ifdef #endif everywhere
- printf -> kprintf, sprintf -> ksprintf
 1.19  09-Feb-1996  christos More proto fixes
 1.18  04-Feb-1996  christos First pass at prototyping
 1.17  07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.16  19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.15  24-Jun-1995  christos Extracted all of the compat_xxx routines, and created a library [libcompat]
for them. There are a few #ifdef COMPAT_XX remaining, but they are not easy
or worth eliminating (yet).
 1.14  05-Jun-1995  pk We need some compat_10 routines if COMPAT_SUNOS is on (PR #1008).
 1.13  19-Mar-1995  mycroft Use %p.
 1.12  05-Dec-1994  mycroft Minor style cleanup.
 1.11  23-Oct-1994  cgd fix for numerous cut & paste errors in the last changes, from Christos.
 1.10  20-Oct-1994  cgd update for new syscall args description mechanism
 1.9  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.8  25-May-1994  mycroft Fix typo.
 1.7  25-May-1994  mycroft Generalize ipcperm() a little.
 1.6  25-May-1994  hpeyerl sysv_shm.c from Adam.
sysv_ipc.c from me.
and various sundry changes to make sysv_ipc.c fit in.
(somewhat untested and not very pleasant reading material)
 1.5  15-Feb-1994  mycroft Some more cleanup.
 1.4  13-Feb-1994  mycroft Fix typo.
 1.3  13-Feb-1994  mycroft Format police.
 1.2  18-Dec-1993  mycroft Canonicalize all #includes.
 1.1  14-Nov-1993  cgd branches: 1.1.2;
Add the System V message queue and semaphore facilities. Implemented
by Daniel Boulet <danny@BouletFermat.ab.ca>
 1.1.2.3  27-Nov-1993  mycroft KNFify a bit.
 1.1.2.2  14-Nov-1993  cgd Update from trunk:
Add the System V message queue and semaphore facilities. Implemented
by Daniel Boulet <danny@BouletFermat.ab.ca>
 1.1.2.1  14-Nov-1993  cgd file sysv_msg.c was added on branch magnum on 1993-11-14 14:47:17 +0000
 1.24.8.1  21-Jun-1999  thorpej Sync w/ -current.
 1.26.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.28.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.32.8.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.32.4.2  16-Mar-2002  jdolecek Catch up with -current.
 1.32.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.32.2.4  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.32.2.3  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.32.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.32.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.35.2.6  11-Dec-2005  christos Sync with head.
 1.35.2.5  01-Apr-2005  skrll Sync with HEAD.
 1.35.2.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.35.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.35.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.35.2.1  03-Aug-2004  skrll Sync with HEAD
 1.37.10.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.37.10.1  25-Jan-2005  yamt convert to new apis.
 1.37.8.1  29-Apr-2005  kent sync with -current
 1.39.2.8  21-Jan-2008  yamt sync with head
 1.39.2.7  07-Dec-2007  yamt sync with head
 1.39.2.6  15-Nov-2007  yamt sync with head.
 1.39.2.5  27-Oct-2007  yamt sync with head.
 1.39.2.4  03-Sep-2007  yamt sync with head.
 1.39.2.3  26-Feb-2007  yamt sync with head.
 1.39.2.2  30-Dec-2006  yamt sync with head.
 1.39.2.1  21-Jun-2006  yamt sync with head.
 1.40.8.4  11-Aug-2006  yamt sync with head
 1.40.8.3  26-Jun-2006  yamt sync with head.
 1.40.8.2  24-May-2006  yamt sync with head.
 1.40.8.1  13-Mar-2006  yamt sync with head.
 1.40.6.3  01-Jun-2006  kardel Sync with head.
 1.40.6.2  22-Apr-2006  simonb Sync with head.
 1.40.6.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.40.4.1  09-Sep-2006  rpaulo sync with head
 1.41.4.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.41.2.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.41.2.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.42.2.1  19-Jun-2006  chap Sync with head.
 1.44.6.2  10-Dec-2006  yamt sync with head.
 1.44.6.1  22-Oct-2006  yamt sync with head
 1.44.4.5  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.44.4.4  28-Jan-2007  ad - Remove the last use of mtsleep()
- sched_pause() -> kpause()
 1.44.4.3  12-Jan-2007  ad Sync with head.
 1.44.4.2  09-Nov-2006  ad Fix locking botches.
 1.44.4.1  11-Sep-2006  ad Put a mutex around the SYSV message system. Provides a useful test of
sleep/wakeup when run unlocked.
 1.48.8.1  11-Jul-2007  mjf Sync with head.
 1.48.6.2  12-Oct-2007  ad Sync with head.
 1.48.6.1  13-Mar-2007  ad Sync with head.
 1.48.2.1  24-Mar-2007  yamt sync with head.
 1.49.14.1  14-Oct-2007  yamt sync with head.
 1.49.12.2  09-Jan-2008  matt sync with HEAD
 1.49.12.1  06-Nov-2007  matt sync with HEAD
 1.49.10.3  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.49.10.2  04-Nov-2007  jmcneill Sync with HEAD.
 1.49.10.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.50.2.1  13-Nov-2007  bouyer Sync with HEAD
 1.52.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.52.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.52.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.53.6.2  08-Jan-2008  bouyer Sync with HEAD
 1.53.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.53.2.1  26-Dec-2007  ad Sync with head.
 1.55.12.2  04-May-2009  yamt sync with head.
 1.55.12.1  16-May-2008  yamt sync with head.
 1.55.10.2  04-Jun-2008  yamt sync with head
 1.55.10.1  18-May-2008  yamt sync with head.
 1.55.8.2  01-Nov-2008  christos Sync with head.
 1.55.8.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.55.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.55.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.55.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.56.2.4  10-Oct-2008  skrll Sync with HEAD.
 1.56.2.3  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.56.2.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.56.2.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.57.4.1  19-Oct-2008  haad Sync with HEAD.
 1.58.4.1  02-Feb-2009  snj Pull up following revision(s) (requested by njoly in ticket #369):
sys/kern/sysv_msg.c: revision 1.61
Do not call put_type() but use copyout() when returning the message
segments to the user.
ok by rmind.
 1.58.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.58.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.62.6.1  05-Apr-2012  mrg sync to latest -current.
 1.62.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.62.2.1  17-Apr-2012  yamt sync with head
 1.63.10.1  23-Jul-2013  riastradh sync with HEAD
 1.63.4.2  18-May-2014  rmind sync with head
 1.63.4.1  28-Aug-2013  rmind sync with head
 1.63.2.2  03-Dec-2017  jdolecek update from HEAD
 1.63.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.66.12.1  23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.66.8.1  23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.66.6.3  05-Oct-2016  skrll Sync with HEAD
 1.66.6.2  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.66.6.1  06-Jun-2015  skrll Sync with HEAD
 1.66.4.1  23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.71.14.1  07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.71.8.1  23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.72.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.72.2.1  10-Jun-2019  christos Sync with HEAD
 1.74.4.1  15-Oct-2019  martin Pull up following revision(s) (requested by kamil in ticket #322):

sys/kern/sysv_msg.c: revision 1.76

Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX

This logic (found in Linux) avoids undefined behavior.

RSS XML Feed