android_kernel_xiaomi_sm8350/include/asm-ia64
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
..
sn [IA64-SGI] - Pass OS logical cpu number to the SN prom (bios) 2006-06-28 09:56:55 -07:00
a.out.h
acpi-ext.h [IA64] update HP CSR space discovery via ACPI 2006-04-06 14:42:38 -07:00
acpi.h [IA64] - Fix MAX_PXM_DOMAINS for systems with > 256 nodes 2006-04-20 10:16:11 -07:00
agp.h
asmmacro.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
atomic.h [PATCH] atomic: add_unless cmpxchg optimise 2006-03-23 07:38:17 -08:00
auxvec.h
bitops.h [IA64] remove asm-ia64/bitops.h self-inclusion 2006-05-05 11:37:15 -07:00
break.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 [PATCH] ia64: add ptr_to_compat() 2006-03-27 08:44:48 -08:00
cpu.h
cputime.h
current.h
cyclone.h
delay.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01: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
dmi.h [PATCH] ia64: use i386 dmi_scan.c 2006-03-26 08:56:54 -08: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
errno.h
fcntl.h
fpswa.h
fpu.h
futex.h
gcc_intrin.h
hardirq.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
hw_irq.h [PATCH] genirq: add ->retrigger() irq op to consolidate hw_irq_resend() 2006-06-29 10:26:23 -07:00
ia32.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ia64regs.h
ide.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
intel_intrin.h
intrinsics.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
io.h [IA64] rework memory attribute aliasing 2006-05-08 16:32:05 -07:00
ioctl.h
ioctls.h
iosapic.h
ipcbuf.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 ia64 2006-06-26 09:58:22 -07:00
kmap_types.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
kprobes.h [PATCH] Notify page fault call chain 2006-06-26 09:58:22 -07:00
kregs.h
linkage.h [PATCH] abstract type/size specification for assembly 2006-03-24 07:33:25 -08:00
local.h
machvec_dig.h [IA64] cleanup dig_irq_init 2006-03-24 13:12:46 -08:00
machvec_hpsim.h
machvec_hpzx1_swiotlb.h
machvec_hpzx1.h
machvec_init.h
machvec_sn2.h [PATCH] PCI: msi abstractions and support for altix 2006-06-21 11:59:58 -07:00
machvec.h [PATCH] PCI: msi abstractions and support for altix 2006-06-21 11:59:58 -07:00
mc146818rtc.h
mca_asm.h
mca.h [IA64] Sanitize assembler code for ia64_sal_os_state 2006-06-21 14:44:26 -07:00
meminit.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
mman.h
mmu_context.h
mmu.h
mmzone.h
module.h
msgbuf.h
msi.h [PATCH] PCI: msi abstractions and support for altix 2006-06-21 11:59:58 -07:00
mutex.h [IA64] fix bug in ia64 __mutex_fastpath_trylock 2006-04-07 22:39:49 -07:00
namei.h
nodedata.h [PATCH] pgdat allocation and update for ia64 of memory hotplug: update pgdat address array 2006-06-27 17:32:37 -07:00
numa.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
pal.h [IA64] Avoid "u64 foo : 32;" for gcc3 vs. gcc4 compatibility 2006-03-31 10:28:29 -08:00
param.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
parport.h
patch.h
pci.h
percpu.h [PATCH] Define __raw_get_cpu_var and use it 2006-06-25 10:01:01 -07:00
perfmon_default_smpl.h
perfmon.h
pgalloc.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
pgtable.h Pull rework-memory-attribute-aliasing into release branch 2006-06-21 14:50:10 -07: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 Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
ptrace_offsets.h
ptrace.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
resource.h
rse.h
rwsem.h
sal.h
scatterlist.h
sections.h
segment.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
socket.h [AF_UNIX]: Datagram getpeersec 2006-06-29 16:58:06 -07:00
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h
stat.h
statfs.h
string.h Don't include linux/config.h from anywhere else in include/ 2006-04-26 12:56:16 +01:00
suspend.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] i386/x86-64/ia64: Move polling flag into thread_info_status 2006-06-26 10:48:21 -07:00
timex.h
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
topology.h [PATCH] sched: mc/smt power savings sched policy 2006-06-27 17:32:45 -07:00
types.h
uaccess.h
ucontext.h
unaligned.h
uncached.h
unistd.h [PATCH] page migration: sys_move_pages(): support moving of individual pages 2006-06-23 07:42:53 -07:00
unwind.h
user.h
ustack.h
vga.h [PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use 2006-06-22 15:05:58 -07:00
xor.h