android_kernel_xiaomi_sm8350/include/asm-powerpc
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
..
iseries [POWERPC] Clean up it_lp_queue.h 2006-06-28 15:18:55 +10:00
8253pit.h
a.out.h
abs_addr.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
agp.h
asm-compat.h
atomic.h
auxvec.h
backlight.h [PATCH] Rewritten backlight infrastructure for portable Apple computers 2006-06-25 10:00:59 -07:00
bitops.h [PATCH] remove powerpc bitops in favor of existing generic bitops 2006-05-24 16:08:58 +10:00
bootx.h
btext.h
bug.h
bugs.h
byteorder.h
cache.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
cacheflush.h
checksum.h
compat.h
cputable.h [POWERPC] Simplify the code defining the 64-bit CPU features 2006-06-28 15:19:03 +10:00
cputime.h
current.h
dbdma.h
delay.h [POWERPC] Fix mdelay badness on shared processor partitions 2006-06-21 15:01:33 +10:00
div64.h
dma-mapping.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
dma.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
eeh_event.h [PATCH] powerpc/pseries: clear PCI failure counter if no new failures 2006-04-22 18:46:13 +10:00
eeh.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
elf.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
emergency-restart.h
errno.h
fcntl.h
firmware.h
floppy.h [PATCH] random: remove SA_SAMPLE_RANDOM from floppy driver 2006-06-25 10:01:00 -07:00
futex.h
grackle.h
hardirq.h
heathrow.h
hvcall.h [POWERPC] check firmware state before suspending 2006-06-15 19:31:27 +10:00
hvconsole.h
hvcserver.h
hw_irq.h [PATCH] genirq: add ->retrigger() irq op to consolidate hw_irq_resend() 2006-06-29 10:26:23 -07:00
i8259.h
ibmebus.h
ide.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
immap_86xx.h [POWERPC] Add 8641 Register space and IRQ definitions. 2006-06-21 15:01:28 +10:00
io.h Merge branch 'merge' 2006-04-29 16:15:57 +10:00
ioctl.h
ioctls.h
iommu.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
ipc.h
ipcbuf.h
ipic.h
irq.h [PATCH] genirq: cleanup: turn ARCH_HAS_IRQ_PER_CPU into CONFIG_IRQ_PER_CPU 2006-06-29 10:26:23 -07:00
kdebug.h [PATCH] Notify page fault call chain for powerpc 2006-06-26 09:58:22 -07:00
kdump.h [POWERPC] kdump: Reserve the existing TCE mappings left by the first kernel 2006-06-28 11:59:46 +10:00
kexec.h [POWERPC] Add the use of the firmware soft-reset-nmi to kdump. 2006-06-28 15:18:52 +10:00
keylargo.h
kmap_types.h
kprobes.h [PATCH] Notify page fault call chain 2006-06-26 09:58:22 -07:00
linkage.h
lmb.h
local.h
lppaca.h
machdep.h [POWERPC] kdump: Reserve the existing TCE mappings left by the first kernel 2006-06-28 11:59:46 +10:00
macio.h
mc146818rtc.h
mediabay.h
mman.h
mmu_context.h [POWERPC] Correct the MAX_CONTEXT definition 2006-06-29 16:16:15 +10:00
mmu.h [POWERPC] powerpc: Initialise ppc_md htab pointers earlier 2006-06-28 11:59:47 +10:00
mmzone.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
module.h
mpc86xx.h Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc 2006-06-28 16:10:53 +10:00
mpic.h [POWERPC] mpic: add support for serial mode interrupts 2006-06-21 15:01:32 +10:00
msgbuf.h
mutex.h
namei.h
nvram.h
of_device.h
ohare.h
oprofile_impl.h [PATCH] powerpc: Remove oprofile spinlock backtrace code 2006-03-29 13:44:16 +11:00
paca.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
page_32.h
page_64.h [PATCH] powerpc: Fix pagetable bloat for hugepages 2006-04-28 15:02:51 +10:00
page.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
param.h
parport.h
pci-bridge.h [POWERPC] pcibus_to_node fixes 2006-06-15 19:31:26 +10:00
pci.h [PATCH] 64bit resource: change pci core and arch code to use resource_size_t 2006-06-27 09:24:00 -07:00
percpu.h [PATCH] Define __raw_get_cpu_var and use it 2006-06-25 10:01:01 -07:00
pgalloc.h [PATCH] powerpc: Fix pagetable bloat for hugepages 2006-04-28 15:02:51 +10:00
pgtable-4k.h powerpc: Use 64k pages without needing cache-inhibited large pages 2006-06-15 10:45:18 +10:00
pgtable-64k.h powerpc: Use 64k pages without needing cache-inhibited large pages 2006-06-15 10:45:18 +10:00
pgtable.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h
poll.h
posix_types.h
ppc_asm.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ppc-pci.h
processor.h [POWERPC] disable floating point exceptions for init 2006-06-21 15:01:33 +10:00
prom.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
pSeries_reconfig.h
ptrace.h [PATCH] powerpc: enable PPC_PTRACE_[GS]ETREGS on ppc32 2006-06-09 21:20:51 +10:00
reg_8xx.h
reg.h [POWERPC] cell: add RAS support 2006-06-21 15:01:29 +10:00
resource.h
rtas.h [POWERPC] Setup RTAS values earlier, to enable rtas_call() earlier 2006-06-28 11:59:48 +10:00
rtc.h
rwsem.h
scatterlist.h
seccomp.h
sections.h
semaphore.h
sembuf.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
smp.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
smu.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h
spu_csa.h [POWERPC] spufs: one more fix for 64k pages 2006-06-21 15:01:32 +10:00
spu_priv1.h [POWERPC] spufs: fix spu irq affinity setting 2006-06-21 15:01:31 +10:00
spu.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
sstep.h
stat.h
statfs.h
string.h
synch.h
syscalls.h
systbl.h [POWERPC] Unify ppc syscall tables 2006-06-21 15:01:32 +10:00
system.h [NET]: Allow skb headroom to be overridden 2006-03-31 02:27:06 -08:00
tce.h [PATCH] powerpc: kill union tce_entry 2006-04-29 18:07:54 +10:00
termbits.h [PATCH] Add CMSPAR to termbits.h for powerpc and alpha 2006-05-26 11:55:46 -07:00
termios.h
thread_info.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
time.h [POWERPC] update asm-powerpc/time.h 2006-06-28 15:18:56 +10:00
timex.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
tlb.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
tlbflush.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
todc.h [POWERPC] todc: add support for Time-Of-Day-Clock 2006-06-29 16:22:46 +10:00
topology.h [PATCH] sched: mc/smt power savings sched policy 2006-06-27 17:32:45 -07:00
tsi108.h [POWERPC] Add tsi108 pci and platform device data register function 2006-06-29 16:20:36 +10:00
types.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
uaccess.h powerpc: Fix incorrect might_sleep in __get_user/__put_user on kernel addresses 2006-05-03 23:06:46 +10:00
ucontext.h
udbg.h [POWERPC] Add udbg support for RTAS console 2006-06-28 11:59:48 +10:00
unaligned.h
uninorth.h
unistd.h Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-05-24 09:22:21 +01:00
user.h
vdso_datapage.h
vdso.h
vga.h [PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use 2006-06-22 15:05:58 -07:00
vio.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2006-06-22 22:11:30 -07:00
xmon.h
xor.h