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
..
arch-aaec2000
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-at91rm9200
[ARM] 3660/1: Remove legacy defines
2006-06-28 17:54:55 +01:00
arch-cl7500
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
arch-clps711x
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-ebsa110
[ARM] ebsa110: Fix incorrect serial port address
2006-04-07 13:23:48 +01:00
arch-ebsa285
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-ep93xx
[ARM] 3634/1: ep93xx: initial implementation of the clk_* API
2006-06-24 10:33:02 +01:00
arch-h720x
[ARM] 3660/1: Remove legacy defines
2006-06-28 17:54:55 +01:00
arch-imx
[ARM] 3660/1: Remove legacy defines
2006-06-28 17:54:55 +01:00
arch-integrator
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-iop3xx
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-ixp4xx
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
2006-05-06 19:59:18 +01:00
arch-ixp23xx
[ARM] 3662/1: ixp23xx: don't include asm/hardware.h in uncompress.h
2006-06-28 17:54:56 +01:00
arch-ixp2000
[ARM] Fix decompressor serial IO to give CRLF not LFCR
2006-03-28 10:24:33 +01:00
arch-l7200
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-lh7a40x
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-netx
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-omap
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-pnx4008
[ARM] 3621/1: fix compilation breakage for pnx4008
2006-06-22 10:27:15 +01:00
arch-pxa
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-realview
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-rpc
[ARM] Move FLUSH_BASE macros to asm/arch/memory.h
2006-04-07 13:22:21 +01:00
arch-s3c2410
[ARM] 3661/1: S3C2412: Fix compilation if CPU_S3C2410 only
2006-06-28 17:54:54 +01:00
arch-sa1100
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
arch-shark
[ARM] Move FLUSH_BASE macros to asm/arch/memory.h
2006-04-07 13:22:21 +01:00
arch-versatile
[ARM] 3631/1: Remove legacy __mem_isa() definitions
2006-06-24 10:34:48 +01:00
hardware
[PATCH] backlight: LOCOMO Backlight Driver updates
2006-06-26 09:58:28 -07:00
mach
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
2006-06-29 10:49:17 -07:00
a.out.h
apm.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
assembler.h
[ARM] Remove MODE_(SVC|IRQ|FIQ|USR) and DEFAULT_FIQ
2006-06-25 12:01:48 +01:00
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] bitops: arm: use generic bitops
2006-03-26 08:57:12 -08:00
bug.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
2006-05-06 19:59:18 +01:00
bugs.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
byteorder.h
[ARM] Fix byte order macros for Thumb
2006-06-19 15:35:36 +01:00
cache.h
[PATCH] Kill L1_CACHE_SHIFT_MAX
2006-01-08 20:13:39 -08:00
cacheflush.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
checksum.h
[ARM] 3292/1: Fix memory corruption in asm-arm/checksum.h: ip_fast_csum()
2006-02-01 19:26:00 +00:00
cpu-multi32.h
[PATCH] qualifiers in return types - easy cases
2005-08-23 18:43:45 -07:00
cpu-single.h
[PATCH] qualifiers in return types - easy cases
2005-08-23 18:43:45 -07:00
cpu.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
cputime.h
current.h
delay.h
[ARM] 3346/1: Fix udelay() for HZ values different from 100
2006-03-21 22:06:07 +00: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
domain.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
ecard.h
elf.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
emergency-restart.h
[PATCH] Add emergency_restart()
2005-07-26 14:35:41 -07:00
errno.h
fcntl.h
[PATCH] Clean up struct flock64 definitions
2005-09-07 16:57:38 -07:00
fiq.h
floppy.h
[PATCH] random: remove SA_SAMPLE_RANDOM from floppy driver
2006-06-25 10:01:00 -07:00
fpstate.h
[ARM] 3370/2: ep93xx: add crunch support
2006-06-28 17:55:01 +01:00
futex.h
[PATCH] consolidate asm/futex.h
2006-01-08 20:13:39 -08:00
glue.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
hardirq.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
hardware.h
ide.h
[PATCH] ARM: 2758/1: Fix comment in file header to read "ARM" instead i386
2005-06-27 15:58:39 +01:00
io.h
[PATCH] remove ISA legacy functions: remove the helpers
2006-03-24 07:33:19 -08:00
ioctl.h
[PATCH] Generic ioctl.h
2006-01-10 08:01:34 -08:00
ioctls.h
ipc.h
ipcbuf.h
irq.h
[PATCH] adjust handle_IRR_event() return type
2006-06-23 07:43:08 -07:00
kmap_types.h
leds.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
limits.h
linkage.h
local.h
locks.h
[ARM] 3019/1: fix wrong comments
2005-10-18 07:51:34 +01:00
mc146818rtc.h
memory.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
mman.h
[PATCH] add asm-generic/mman.h
2006-02-15 15:32:22 -08:00
mmu.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
mmu_context.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
mmzone.h
module.h
msgbuf.h
mtd-xip.h
[MTD] XIP cleanup
2005-07-07 16:50:16 +02:00
mutex.h
[ARM] 3311/1: clean up include/asm-arm/mutex.h
2006-02-08 21:19:38 +00:00
namei.h
nwflash.h
page-nommu.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
page.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
param.h
[ARM] Move HZ definition into Kconfig
2006-03-21 22:05:45 +00:00
parport.h
pci.h
Don't include linux/config.h from anywhere else in include/
2006-04-26 12:56:16 +01:00
percpu.h
pgalloc.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
pgtable-hwdef.h
[ARM] 3439/2: xsc3: add I/O coherency support
2006-04-02 00:07:39 +01:00
pgtable-nommu.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
pgtable.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
poll.h
[PATCH] POLLRDHUP/EPOLLRDHUP handling for half-closed devices notifications
2006-03-25 08:22:56 -08:00
posix_types.h
proc-fns.h
[ARM] nommu: adjust headers for !MMU ARM systems
2006-06-28 17:59:45 +01:00
processor.h
[ARM] start_thread fixup for nommu mode
2006-01-13 21:04:17 +00:00
procinfo.h
[ARM] 3517/1: move definition of PROC_INFO_SZ from procinfo.h to asm-offsets.h
2006-05-16 11:39:30 +01:00
ptrace.h
[ARM] 3665/1: crunch: add ptrace support
2006-06-28 17:55:00 +01:00
resource.h
rtc.h
[PATCH] RTC subsystem: ARM cleanup
2006-03-27 08:44:50 -08:00
scatterlist.h
[ARM] Remove '__address' from scatterlist and convert to DMA API
2006-01-04 15:08:30 +00:00
sections.h
segment.h
semaphore-helper.h
semaphore.h
[ARM] sema_count() removal
2005-12-01 20:58:01 +00:00
sembuf.h
serial.h
setup.h
[ARM] 2925/3: earlyparam - postfix section with .init for make buildcheck
2005-09-20 16:25:12 +01:00
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h
[ARM] Remove SA_IRQNOMASK
2005-09-26 15:30:20 +01:00
sizes.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
spinlock.h
[ARM] 3533/1: Implement the __raw_(read|write)_can_lock functions on ARM
2006-05-19 21:55:35 +01:00
spinlock_types.h
[PATCH] spinlock consolidation
2005-09-10 10:06:21 -07:00
stat.h
[ARM] 3106/2: ARM EABI: some syscall adjustments
2006-01-14 16:32:12 +00:00
statfs.h
[ARM] 3108/2: old ABI compat: statfs64 and fstatfs64
2006-01-14 16:35:03 +00:00
string.h
suspend.h
system.h
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2006-06-20 17:52:36 -07:00
termbits.h
termios.h
therm.h
thread_info.h
[ARM] 3370/2: ep93xx: add crunch support
2006-06-28 17:55:01 +01:00
thread_notify.h
[ARM] Add thread_notify infrastructure
2006-06-22 10:24:18 +01:00
timex.h
tlb.h
[ARM] noMMU: removes TLB codes in nommu mode
2006-03-21 22:03:20 +00:00
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
types.h
[PATCH] sab: consolidate kmem_bufctl_t
2005-09-05 00:05:48 -07:00
uaccess.h
[ARM] nommu: uaccess tweaks
2006-06-28 17:59:46 +01:00
ucontext.h
[ARM] 3664/1: crunch: add signal frame save/restore
2006-06-28 17:54:59 +01:00
unaligned.h
unistd.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
2006-05-06 19:59:18 +01:00
user.h
vfp.h
vfpmacros.h
[ARM] 3472/1: Use the D variants of FLDMIA/FSTMIA on ARMv6
2006-04-10 21:32:42 +01:00
vga.h
[PATCH] vgacon: make VGA_MAP_MEM take size, remove extra use
2006-06-22 15:05:58 -07:00
xor.h