dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/arch/alpha/include/asm
Pavel Emelyanov a8fc927780 sk-filter: Add ability to get socket filter program (v2)
The SO_ATTACH_FILTER option is set only. I propose to add the get
ability by using SO_ATTACH_FILTER in getsockopt. To be less
irritating to eyes the SO_GET_FILTER alias to it is declared. This
ability is required by checkpoint-restore project to be able to
save full state of a socket.

There are two issues with getting filter back.

First, kernel modifies the sock_filter->code on filter load, thus in
order to return the filter element back to user we have to decode it
into user-visible constants. Fortunately the modification in question
is interconvertible.

Second, the BPF_S_ALU_DIV_K code modifies the command argument k to
speed up the run-time division by doing kernel_k = reciprocal(user_k).
Bad news is that different user_k may result in same kernel_k, so we
can't get the original user_k back. Good news is that we don't have
to do it. What we need to is calculate a user2_k so, that

  reciprocal(user2_k) == reciprocal(user_k) == kernel_k

i.e. if it's re-loaded back the compiled again value will be exactly
the same as it was. That said, the user2_k can be calculated like this

  user2_k = reciprocal(kernel_k)

with an exception, that if kernel_k == 0, then user2_k == 1.

The optlen argument is treated like this -- when zero, kernel returns
the amount of sock_fprog elements in filter, otherwise it should be
large enough for the sock_fprog array.

changes since v1:
* Declared SO_GET_FILTER in all arch headers
* Added decode of vlan-tag codes

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2012-11-01 11:17:15 -04:00
..
Kbuild Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal 2012-10-10 12:02:25 +09:00
a.out-core.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
a.out.h alpha: introduce field 'taso' into struct linux_binprm 2008-10-16 11:21:38 -07:00
agp.h agp: kill phys_to_gart() and gart_to_phys() 2009-08-03 09:05:00 +01:00
agp_backend.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
atomic.h Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts 2012-08-19 08:41:19 -07:00
auxvec.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
barrier.h alpha: futex implementation 2009-05-02 15:36:10 -07:00
bitops.h asm-generic: add another generic ext2 atomic bitops 2011-07-26 16:49:46 -07:00
bitsperlong.h asm-generic: introduce asm/bitsperlong.h 2009-06-11 21:02:14 +02:00
bug.h alpha: Convert BUG() to use unreachable() 2009-12-18 01:14:52 -05:00
bugs.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
byteorder.h byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
cache.h alpha: remove homegrown L1_CACHE_ALIGN macro 2010-08-31 22:45:31 -04:00
cacheflush.h mm: Fix out-of-date comments which refers non-existent functions 2011-02-17 16:54:39 +01:00
checksum.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
cmpxchg.h alpha: fix build failures from system.h dismemberment 2012-04-13 13:15:16 -04:00
compiler.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
console.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
core_apecs.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
core_cia.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
core_irongate.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
core_lca.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
core_marvel.h alpha: fix compile errors in dma-mapping-common.h 2010-03-18 22:35:28 -04:00
core_mcpcia.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
core_polaris.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
core_t2.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
core_titan.h alpha: fix compile errors in dma-mapping-common.h 2010-03-18 22:35:28 -04:00
core_tsunami.h alpha: fix compile errors in dma-mapping-common.h 2010-03-18 22:35:28 -04:00
core_wildfire.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
cputime.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
current.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
delay.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
device.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
div64.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
dma-mapping.h Alpha: adapt for dma_map_ops changes 2012-03-28 16:36:36 +02:00
dma.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
elf.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
emergency-restart.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
err_common.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
err_ev6.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
err_ev7.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
errno.h mm: make __get_user_pages return -EHWPOISON for HWPOISON page optionally 2011-03-17 13:08:27 -03:00
fb.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
fcntl.h locks: move F_INPROGRESS from fl_type to fl_flags field 2011-08-19 13:25:34 -04:00
floppy.h treewide: fix potentially dangerous trailing ';' in #defined values/expressions 2011-07-21 14:10:00 +02:00
fpu.h alpha: fix fpu.h usage in userspace 2012-08-19 08:41:19 -07:00
ftrace.h tracing: make CALLER_ADDRx overwriteable 2009-03-02 16:49:37 -05:00
futex.h alpha: fix 32/64-bit bug in futex support 2012-03-05 15:49:43 -08:00
gct.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
gentrap.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
gpio.h gpiolib/arches: Centralise bolierplate asm/gpio.h 2012-05-11 18:00:14 -06:00
hardirq.h alpha: convert to asm-generic/hardirq.h 2009-09-22 07:17:43 -07:00
hw_irq.h alpha: add performance monitor interrupt counter 2010-08-09 20:45:03 -07:00
hwrpb.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
io.h alpha: add io{read,write}{16,32}be functions 2012-05-24 14:27:59 -04:00
io_trivial.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
ioctl.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
ioctls.h tty: add TIOCVHANGUP to allow clean tty shutdown of all ttys 2011-02-17 14:16:30 -08:00
ipcbuf.h consolidate a bunch of ipcbuf.h instances 2012-01-03 22:55:18 -05:00
irq.h alpha: kill off alpha_do_IRQ 2011-01-17 05:42:13 +01:00
irq_regs.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
irqflags.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
jensen.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
kdebug.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
kmap_types.h kmap_types: make most arches use generic header file 2009-06-16 19:47:51 -07:00
kvm_para.h kvmclock: Add functions to check if the host has stopped the vm 2012-04-08 12:48:59 +03:00
linkage.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
local.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
local64.h arch: Implement local64_t 2010-06-09 11:12:36 +02:00
machvec.h constify struct pci_dev * in obvious cases 2012-03-20 00:20:37 +01:00
mc146818rtc.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
mce.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
mman.h coredump: add VM_NODUMP, MADV_NODUMP, MADV_CLEAR_NODUMP 2012-03-23 16:58:42 -07:00
mmu.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
mmu_context.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
mmzone.h Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
module.h Make most arch asm/module.h files use asm-generic/module.h 2012-09-28 14:31:03 +09:30
msgbuf.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
mutex.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
page.h asm-generic: rename page.h and uaccess.h 2009-06-11 21:02:17 +02:00
pal.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
param.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
parport.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
pci.h PCI: collapse pcibios_resource_to_bus 2012-02-23 20:19:04 -07:00
percpu.h alpha: fix percpu build breakage 2009-06-30 18:55:59 -07:00
perf_event.h perf, arch: Cleanup perf-pmu init vs lockup-detector 2010-11-26 15:14:56 +01:00
pgalloc.h alpha: make pte_alloc_one_kernel() inline 2009-01-15 16:39:40 -08:00
pgtable.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
poll.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
posix_types.h bury __kernel_nlink_t, make internal nlink_t consistent 2012-05-30 21:04:50 -04:00
processor.h alpha: switch to generic kernel_thread() 2012-09-30 22:53:18 -04:00
ptrace.h alpha: take a bunch of syscalls into osf_sys.c 2012-08-19 08:41:19 -07:00
reg.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
regdef.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
resource.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
rtc.h alpha: properly define get/set_rtc_time on Marvel/SMP 2012-05-02 15:54:05 -04:00
rwsem.h rwsem: Move duplicate function prototypes to linux/rwsem.h 2011-01-27 12:30:39 +01:00
scatterlist.h remove needless ISA_DMA_THRESHOLD 2010-08-07 18:15:50 +02:00
sections.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
segment.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
sembuf.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
serial.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
setup.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
sfp-machine.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
shmbuf.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
shmparam.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
sigcontext.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
siginfo.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
signal.h asm-generic: rename termios.h, signal.h and mman.h 2009-06-11 21:01:52 +02:00
smp.h Remove unused PROC_CHANGE_PENALTY constant 2011-05-25 08:39:43 -07:00
socket.h sk-filter: Add ability to get socket filter program (v2) 2012-11-01 11:17:15 -04:00
sockios.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
special_insns.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
spinlock.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
spinlock_types.h locking: Convert raw_rwlock to arch_rwlock 2009-12-14 23:55:32 +01:00
stat.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
statfs.h headers_check fix: alpha, statfs.h 2009-02-01 11:01:22 +05:30
string.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
swab.h headers_check fix: alpha, swab.h 2009-02-01 11:01:22 +05:30
switch_to.h Disintegrate asm/system.h for Alpha 2012-03-28 18:11:12 +01:00
sysinfo.h alpha: implement setsysinfo(SSI_LMF) as a no-op 2012-05-24 14:27:55 -04:00
termbits.h tty: Add EXTPROC support for LINEMODE 2010-08-10 13:47:39 -07:00
termios.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
thread_info.h sanitize tsk_is_polling() 2012-10-01 09:58:13 -04:00
timex.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
tlb.h mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
tlbflush.h alpha: switch to dynamic percpu allocator 2009-06-24 15:13:52 +09:00
topology.h alpha: cpumask_of_node() should handle -1 as a node 2010-01-14 13:21:35 -05:00
types.h consolidate umode_t declarations 2012-01-03 22:55:17 -05:00
uaccess.h alpha: Use new generic strncpy_from_user() and strnlen_user() 2012-08-19 08:41:18 -07:00
ucontext.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
unaligned.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
unistd.h alpha: switch to saner kernel_execve() semantics 2012-10-12 13:35:23 -04:00
user.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
vga.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00
word-at-a-time.h alpha: Use new generic strncpy_from_user() and strnlen_user() 2012-08-19 08:41:18 -07:00
wrperfmon.h alpha: add wrperfmon.h header file to aid use of wrperfmon PALcall 2010-08-09 20:45:04 -07:00
xchg.h alpha: fix build failures from system.h dismemberment 2012-04-13 13:15:16 -04:00
xor.h alpha: move include/asm-alpha to arch/alpha/include/asm 2008-08-15 09:19:40 -07:00