android_kernel_xiaomi_sm8350/include/asm-m68k
Catherine Zhang 877ce7c1b3 [AF_UNIX]: Datagram getpeersec
This patch implements an API whereby an application can determine the
label of its peer's Unix datagram sockets via the auxiliary data mechanism of
recvmsg.

Patch purpose:

This patch enables a security-aware application to retrieve the
security context of the peer of a Unix datagram socket.  The application
can then use this security context to determine the security context for
processing on behalf of the peer who sent the packet.

Patch design and implementation:

The design and implementation is very similar to the UDP case for INET
sockets.  Basically we build upon the existing Unix domain socket API for
retrieving user credentials.  Linux offers the API for obtaining user
credentials via ancillary messages (i.e., out of band/control messages
that are bundled together with a normal message).  To retrieve the security
context, the application first indicates to the kernel such desire by
setting the SO_PASSSEC option via getsockopt.  Then the application
retrieves the security context using the auxiliary data mechanism.

An example server application for Unix datagram socket should look like this:

toggle = 1;
toggle_len = sizeof(toggle);

setsockopt(sockfd, SOL_SOCKET, SO_PASSSEC, &toggle, &toggle_len);
recvmsg(sockfd, &msg_hdr, 0);
if (msg_hdr.msg_controllen > sizeof(struct cmsghdr)) {
    cmsg_hdr = CMSG_FIRSTHDR(&msg_hdr);
    if (cmsg_hdr->cmsg_len <= CMSG_LEN(sizeof(scontext)) &&
        cmsg_hdr->cmsg_level == SOL_SOCKET &&
        cmsg_hdr->cmsg_type == SCM_SECURITY) {
        memcpy(&scontext, CMSG_DATA(cmsg_hdr), sizeof(scontext));
    }
}

sock_setsockopt is enhanced with a new socket option SOCK_PASSSEC to allow
a server socket to receive security context of the peer.

Testing:

We have tested the patch by setting up Unix datagram client and server
applications.  We verified that the server can retrieve the security context
using the auxiliary data mechanism of recvmsg.

Signed-off-by: Catherine Zhang <cxzhang@watson.ibm.com>
Acked-by: Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-06-29 16:58:06 -07:00
..
a.out.h
adb_iop.h
adb.h
amigahw.h [PATCH] m68k: namespace pollution fix (custom->amiga_custom) 2006-01-12 09:09:00 -08:00
amigaints.h [PATCH] m68k: convert amiga irq code 2006-06-25 10:00:57 -07:00
amigayle.h
amipcmcia.h
apollodma.h
apollohw.h [PATCH] m68k: convert apollo irq code 2006-06-25 10:00:57 -07:00
atafd.h
atafdreg.h
atari_acsi.h
atari_joystick.h
atari_SLM.h
atari_stdma.h [PATCH] m68k: introduce irq controller 2006-06-25 10:00:57 -07:00
atari_stram.h
atarihw.h
atariints.h [PATCH] m68k: cleanup generic irq names 2006-06-25 10:00:57 -07:00
atarikb.h
atomic.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bitops.h [PATCH] m68k: fix undefined reference to generic_find_next_zero_le_bit 2006-03-26 08:57:13 -08:00
blinken.h
bootinfo.h
bug.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
bugs.h
bvme6000hw.h [PATCH] m68k: convert VME irq code 2006-06-25 10:00:58 -07:00
byteorder.h
cache.h [PATCH] Kill L1_CACHE_SHIFT_MAX 2006-01-08 20:13:39 -08:00
cachectl.h
cacheflush.h [PATCH] m68k: small flush_icache() cleanup 2006-06-25 10:00:56 -07:00
checksum.h [PATCH] m68k: checksum __user annotations 2006-01-12 09:09:03 -08:00
contregs.h
cputime.h
current.h
delay.h
div64.h
dma-mapping.h [PATCH] m68k: dma API addition 2006-06-25 10:00:56 -07:00
dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
dsp56k.h [PATCH] m68k: dsp56k __user annotations 2006-01-12 09:09:04 -08:00
dvma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
elf.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
emergency-restart.h
entry.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
errno.h
fbio.h
fcntl.h [PATCH] Clean up struct flock64 definitions 2005-09-07 16:57:38 -07:00
floppy.h [PATCH] m68k: NULL noise removal 2006-01-12 09:09:04 -08:00
fpu.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
futex.h [PATCH] consolidate asm/futex.h 2006-01-08 20:13:39 -08:00
hardirq.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
hp300hw.h
hw_irq.h
hwtest.h
ide.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
idprom.h
intersil.h
io.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ioctl.h [PATCH] Generic ioctl.h 2006-01-10 08:01:34 -08:00
ioctls.h
ipc.h
ipcbuf.h
irq.h [PATCH] m68k: convert generic irq code to irq controller 2006-06-25 10:00:57 -07:00
kmap_types.h
linkage.h
local.h
mac_asc.h
mac_baboon.h
mac_iop.h
mac_mouse.h
mac_oss.h [PATCH] m68k: convert mac irq code 2006-06-25 10:00:58 -07:00
mac_psc.h
mac_via.h
machdep.h [PATCH] m68k: convert generic irq code to irq controller 2006-06-25 10:00:57 -07:00
machines.h
machw.h
macintosh.h [PATCH] m68k: convert mac irq code 2006-06-25 10:00:58 -07:00
macints.h [PATCH] m68k: convert mac irq code 2006-06-25 10:00:58 -07:00
math-emu.h
mc146818rtc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
md.h
mman.h [PATCH] add asm-generic/mman.h 2006-02-15 15:32:22 -08:00
mmu_context.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mmu.h
module.h
motorola_pgalloc.h
motorola_pgtable.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
movs.h
msgbuf.h
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
mvme16xhw.h [PATCH] m68k: convert VME irq code 2006-06-25 10:00:58 -07:00
mvme147hw.h [PATCH] m68k: convert VME irq code 2006-06-25 10:00:58 -07:00
namei.h
nubus.h
openprom.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
oplib.h
page_offset.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
page.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
param.h
parport.h
pci.h
percpu.h
pgalloc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pgtable.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
poll.h [PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications 2006-03-25 08:22:56 -08:00
posix_types.h
processor.h [PATCH] m68k: use c99 initializer 2006-06-23 07:43:00 -07:00
ptrace.h
q40_master.h
q40ints.h
raw_io.h [PATCH] iomap_copy fallout (m68k) 2006-02-18 16:30:40 -05:00
resource.h
rtc.h
sbus.h
scatterlist.h [PATCH] m68k: Add the generic dma API functions 2006-06-25 10:00:56 -07:00
sections.h
segment.h
semaphore-helper.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
semaphore.h [PATCH] semaphore: Remove __MUTEX_INITIALIZER() 2005-10-30 17:37:27 -08:00
sembuf.h
serial.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
setup.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
shm.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [PATCH] m68k: fix constraints of the signal functions and some cleanup 2006-06-25 10:00:56 -07:00
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h
spinlock.h
stat.h [PATCH] 2TB files: st_blocks is invalid when calling stat64 2006-03-26 08:57:00 -08:00
statfs.h
string.h [PATCH] m68k: cleanup inline mem functions 2005-09-05 00:06:19 -07:00
sun3_pgalloc.h
sun3_pgtable.h [PATCH] m68k: bogus function argument types (sun3_pgtable.h) 2006-01-12 09:09:01 -08:00
sun3-head.h
sun3ints.h [PATCH] m68k: convert sun3 irq code 2006-06-25 10:00:58 -07:00
sun3mmu.h
sun3x.h
sun3xflop.h [PATCH] m68k: NULL noise removal 2006-01-12 09:09:04 -08:00
sun3xprom.h
suspend.h
swim_iop.h
system.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
termbits.h
termios.h
thread_info.h [PATCH] missing helper - task_stack_page() 2006-01-12 09:08:50 -08:00
timex.h
tlb.h
tlbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
topology.h
traps.h [PATCH] m68k: convert generic irq code to irq controller 2006-06-25 10:00:57 -07:00
types.h [PATCH] sab: consolidate kmem_bufctl_t 2005-09-05 00:05:48 -07:00
uaccess.h [PATCH] m68k: fix uaccess.h for gcc-3.x 2006-06-25 10:00:56 -07:00
ucontext.h
unaligned.h
unistd.h [PATCH] m68k: cleanup unistd.h 2006-06-23 07:43:00 -07:00
user.h
virtconvert.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
xor.h
zorro.h [PATCH] m68k: basic iomem annotations 2006-01-12 09:09:02 -08:00