1. 06 2月, 2008 40 次提交
    • M
      ACPI: battery: add sysfs serial number · 7c2670bb
      maximilian attems 提交于
      egrep serial /proc/acpi/battery/BAT0/info
      serial number:           32090
      
      serial number can tell you from the imminent danger
      of beeing set on fire.
      Signed-off-by: Nmaximilian attems <max@stro.at>
      Acked-by: NAlexey Starikovskiy <astarikovskiy@suse.de>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      7c2670bb
    • D
      uml: LDT mutex conversion · 01ac835f
      Daniel Walker 提交于
      The ldt.semaphore conforms to the new struct mutex requirments, so I converted
      it to use the new API and changed the name.
      Signed-off-by: NDaniel Walker <dwalker@mvista.com>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      01ac835f
    • J
      uml: add back CONFIG_HZ · 7281ff95
      Jeff Dike 提交于
      avoid-overflows-in-kernel-timec.patch makes CONFIG_HZ necessary for a
      successful build.  UML lacks a definition, so this patch adds one.  It also
      changes the hard-wired definition of HZ to CONFIG_HZ.
      
      Note: this patch is a good idea even in the absence of hpa's time fixes.
      
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7281ff95
    • J
      uml: get rid of syscall counters · a9b71b6c
      Jeff Dike 提交于
      Get rid of some syscall counters which haven't been useful in ages.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a9b71b6c
    • J
      uml: customize tlb.h · 0b4e273f
      Jeff Dike 提交于
      Customize the hooks in tlb.h to optimize TLB flushing some more.
      
      Add start and end fields to tlb_gather_mmu, which are used to limit
      the address space range scanned when a region is unmapped.
      
      The interfaces which just free page tables, without actually changing
      mappings, don't need to cause a TLB flush.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0b4e273f
    • J
      uml: 64-bit tlb fixes · 909e90d3
      Jeff Dike 提交于
      Some 64-bit tlb fixes -
      	moved pmd_page_vaddr to pgtable.h since it's the same for both
      2-level and 3-level page tables
      	fixed a bogus cast on pud_page_vaddr
      	made the address checking in update_*_range more careful
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      909e90d3
    • J
      uml: cover stubs with a VMA · 3963333f
      Jeff Dike 提交于
      Give the stubs a VMA.  This allows the removal of a truly nasty kludge to make
      sure that mm->nr_ptes was correct in exit_mmap.  The underlying problem was
      always that the stubs, which have ptes, and thus allocated a page table,
      weren't covered by a VMA.
      
      This patch fixes that by using install_special_mapping in arch_dup_mmap and
      activate_context to create the VMA.  The stubs have to be moved, since
      shift_arg_pages seems to assume that the stack is the only VMA present at that
      point during exec, and uses vma_adjust to fiddle its VMA.  However, that
      extends the stub VMA by the amount removed from the stack VMA.
      
      To avoid this problem, the stubs were moved to a different fixed location at
      the start of the address space.
      
      The init_stub_pte calls were moved from init_new_context to arch_dup_mmap
      because I was occasionally seeing arch_dup_mmap not being called, causing
      exit_mmap to die.  Rather than figure out what was really happening, I decided
      it was cleaner to just move the calls so that there's no doubt that both the
      pte and VMA creation happen, no matter what.  arch_exit_mmap is used to clear
      the stub ptes at exit time.
      
      The STUB_* constants in as-layout.h no longer depend on UM_TASK_SIZE, that
      that definition is removed, along with the comments complaining about gcc.
      
      Because the stubs are no longer at the top of the address space, some care is
      needed while flushing TLBs.  update_pte_range checks for addresses in the stub
      range and skips them.  flush_thread now issues two unmaps, one for the range
      before STUB_START and one for the range after STUB_END.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3963333f
    • J
      uml: clean up TASK_SIZE usage · 42a2b54c
      Jeff Dike 提交于
      Clean up the calculation and use of the usable address space size on the host.
      
      task_size is gone, replaced with TASK_SIZE, which is calculated from
      CONFIG_TOP_ADDR.  get_kmem_end and set_task_sizes_skas are also gone.
      
      host_task_size, which refers to the entire address space usable by the UML
      kernel and which may be larger than the address space usable by a UML process,
      since that has to end on a pgdir boundary, is replaced by CONFIG_TOP_ADDR.
      
      STACK_TOP is now TASK_SIZE minus the two stub pages.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      42a2b54c
    • J
      uml: add virt_to_pte · ca77b555
      Jeff Dike 提交于
      Turn um_virt_to_phys into virt_to_pte, cleaning up a horrid interface.
      
      It's also made non-static and declared in pgtable.h because it'll be
      needed when the stubs get a vma.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ca77b555
    • J
      uml: fix page table data sizes · 655e4ed0
      Jeff Dike 提交于
      Get the sizes of various pieces of data right when using three-level
      page tables.  pgd and pmd entries remain at 32 bits in a 32-bit
      compilation because page tables will remain in low memory.  So,
      PGDIR_SHIFT, the PTRS_PER_* values, set_pud, set_pmd are conditional
      on 64BIT.
      
      More use of phys_t is made when there are physical memory addresses
      floating around.
      
      ObCheckpatchViolationJustification - the new typedef is an alternate
      definition of pmd_t, which I can't really live without.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      655e4ed0
    • J
      uml: current.h cleanup · a5a678c8
      Jeff Dike 提交于
      Tidy current-related stuff.  There was a comment in current.h saying
      that current_thread was obsolete, so this patch turns all instances of
      current_thread into current_thread_info().  There's some simplifying
      of the result in arch/um/sys-i386/signal.c.
      
      current.h and thread_info also get style cleanups.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a5a678c8
    • J
      uml: style cleanup · 009ec2a9
      Jeff Dike 提交于
      Style fixes in elf-i386.h and arch/um/kernel/mem.c.
            update the copyright
            get rid of an emacs formatting comment
            some formatting fixes
            inclusion trimming
            whitespace fixes
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      009ec2a9
    • J
      uml: header untangling · 8192ab42
      Jeff Dike 提交于
      Untangle UML headers somewhat and add some includes where they were
      needed explicitly, but gotten accidentally via some other header.
      
      arch/um/include/um_uaccess.h loses asm/fixmap.h because it uses no
      fixmap stuff and gains elf.h, because it needs FIXADDR_USER_*, and
      archsetjmp.h, because it needs jmp_buf.
      
      pmd_alloc_one is uninlined because it needs mm_struct, and that's
      inconvenient to provide in asm-um/pgtable-3level.h.
      
      elf_core_copy_fpregs is also uninlined from elf-i386.h and
      elf-x86_64.h, which duplicated the code anyway, to
      arch/um/kernel/process.c, so that the reference to current_thread
      doesn't pull sched.h or anything related into asm/elf.h.
      
      arch/um/sys-i386/ldt.c, arch/um/kernel/tlb.c and
      arch/um/kernel/skas/uaccess.c got sched.h because they dereference
      task_structs.  Its includes of linux and asm headers got turned from
      "" to <>.
      
      arch/um/sys-i386/bug.c gets asm/errno.h because it needs errno
      constants.
      
      asm/elf-i386 gets asm/user.h because it needs user_regs_struct.
      
      asm/fixmap.h gets page.h because it needs PAGE_SIZE and PAGE_MASK and
      system.h for BUG_ON.
      
      asm/pgtable doesn't need sched.h.
      
      asm/processor-generic.h defined mm_segment_t, but didn't use it.  So,
      that definition is moved to uaccess.h, which defines a bunch of
      mm_segment_t-related stuff.  thread_info.h uses mm_segment_t, and
      includes uaccess.h, which causes a recursion.  So, the definition is
      placed above the include of thread_info. in uaccess.h.  thread_info.h
      also gets page.h because it needs PAGE_SIZE.
      
      ObCheckpatchViolationJustification - I'm not adding a typedef; I'm
      moving mm_segment_t from one place to another.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8192ab42
    • J
      uml: move um_virt_to_phys · 9157f90f
      Jeff Dike 提交于
      This patchset makes UML build and run with three-level page tables on
      32-bit hosts.  This is an uncommon use case, but the code here needed
      fixing and cleaning up, so 32-bit three-level pages tables were tested
      to make sure the changes are good.
      
      Patch 1 - code movement
      Patch 2 - header untangling
      Patch 3 - style fixups in files affected so far
      Patch 4 - clean up use of current.h
      Patch 5 - fix sizes of types that are different between 2 and 3-level
      	page tables - three-level page table support should build at
      	this point
      Patch 6 - tidy (i.e. eliminate much of) the code that figures out how
      	big the address space is
      Patch 7 - change um_virt_to_phys into virt_to_pte, clean its
      	interface, and clean its (so far) one caller
      Patch 8 - the stub pages are covered with a VMA, allowing some nasty
      	code to be thrown out - three-level page tables now work
      
      This patch:
      
      um_virt_to_phys only has one user, so it can be moved to the same file
      and made static.  Its declarations in pgtable.h and ksyms.c are also
      gone.
      
      current_cmd was another apparent user, but it itself isn't used, so it
      is deleted.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9157f90f
    • J
      UML - Fix build in 2.6.24-rc2-mm1 · 300ecf59
      Jeff Dike 提交于
      The earlier pgtable.h tidying patch made things a bit too tidy.  Add
      back a header which is needed in VMALLOC_START and friend.  Also add
      back a definition of pmd_page_vaddr, which is needed on x86_64.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      300ecf59
    • J
      uml: tidy pgtable.h · d83ecf08
      Jeff Dike 提交于
      Large pieces of include/asm/pgtable.h were unused cruft.
      
      This uncovered arch/um/kernel/trap.c needing skas.h in order to get
      ptrace_faultinfo.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d83ecf08
    • J
      uml: get rid of asmlinkage · b2cf7707
      Jeff Dike 提交于
      Get rid of asmlinkage and remove some old cruft from asm/linkage.h.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b2cf7707
    • J
      uml: implement get_wchan · c1127465
      Jeff Dike 提交于
      Implement get_wchan - the algorithm is similar to x86.  It starts with the
      stack pointer of the process in question and looks above that for addresses
      that are kernel text.  The second one which isn't in the scheduler is the one
      that's returned.  The first one is ignored because that will be UML's own
      context switching routine.
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c1127465
    • K
      uml: remove xmm checking on x86 · 4d18de45
      Karol Swietlicki 提交于
      This patch removes some code which ran at every boot, but does not seem to do
      anything anymore.  Please test.  It works for me but mistakes can happen.
      Signed-off-by: NKarol Swietlicki <magotari@gmail.com>
      Signed-off-by: NJeff Dike <jdike@linux.intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4d18de45
    • J
      cris: remove unused __dummy, CONST_ADDR and ADDR from bitops.h · 747646a4
      Jesper Nilsson 提交于
      This is very old code, it hasn't changed since 2001 and it is not used
      anywhere.  Noticed by Clemens Koller.
      Signed-off-by: NJesper Nilsson <jesper.nilsson@axis.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      747646a4
    • F
      mac68k: add nubus card definitions and a typo fix · 57dfee7c
      Finn Thain 提交于
      Add some new card definitions and fix a typo (from Eugen Paiuc).
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      57dfee7c
    • F
      mac68k: remove dead code · 00bf59ca
      Finn Thain 提交于
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      00bf59ca
    • R
      leds: add possibility to remove leds classdevs during suspend/resume · fa23f5cc
      Rafael J. Wysocki 提交于
      Make it possible to unregister a led classdev object in a safe way during a
      suspend/resume cycle.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: Michael Buesch <mb@bu3sch.de>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "John W. Linville" <linville@tuxdriver.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Greg KH <greg@kroah.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fa23f5cc
    • R
      HWRNG: add possibility to remove hwrng devices during suspend/resume · a41e3dc4
      Rafael J. Wysocki 提交于
      Make it possible to unregister a Hardware Random Number Generator
      device object in a safe way during a suspend/resume cycle.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMichael Buesch <mb@bu3sch.de>
      Cc: Michael Buesch <mb@bu3sch.de>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "John W. Linville" <linville@tuxdriver.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Greg KH <greg@kroah.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a41e3dc4
    • R
      Misc: Add possibility to remove misc devices during suspend/resume · 533354d4
      Rafael J. Wysocki 提交于
      Make it possible to unregister a misc device object in a safe way during a
      suspend/resume cycle.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: Michael Buesch <mb@bu3sch.de>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "John W. Linville" <linville@tuxdriver.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Greg KH <greg@kroah.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      533354d4
    • M
      latency.c: use QoS infrastructure · f011e2e2
      Mark Gross 提交于
      Replace latency.c use with pm_qos_params use.
      Signed-off-by: Nmark gross <mgross@linux.intel.com>
      Cc: "John W. Linville" <linville@tuxdriver.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Jaroslav Kysela <perex@suse.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Arjan van de Ven <arjan@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f011e2e2
    • M
      pm qos infrastructure and interface · d82b3518
      Mark Gross 提交于
      The following patch is a generalization of the latency.c implementation done
      by Arjan last year.  It provides infrastructure for more than one parameter,
      and exposes a user mode interface for processes to register pm_qos
      expectations of processes.
      
      This interface provides a kernel and user mode interface for registering
      performance expectations by drivers, subsystems and user space applications on
      one of the parameters.
      
      Currently we have {cpu_dma_latency, network_latency, network_throughput} as
      the initial set of pm_qos parameters.
      
      The infrastructure exposes multiple misc device nodes one per implemented
      parameter.  The set of parameters implement is defined by pm_qos_power_init()
      and pm_qos_params.h.  This is done because having the available parameters
      being runtime configurable or changeable from a driver was seen as too easy to
      abuse.
      
      For each parameter a list of performance requirements is maintained along with
      an aggregated target value.  The aggregated target value is updated with
      changes to the requirement list or elements of the list.  Typically the
      aggregated target value is simply the max or min of the requirement values
      held in the parameter list elements.
      
      >From kernel mode the use of this interface is simple:
      
      pm_qos_add_requirement(param_id, name, target_value):
      
        Will insert a named element in the list for that identified PM_QOS
        parameter with the target value.  Upon change to this list the new target is
        recomputed and any registered notifiers are called only if the target value
        is now different.
      
      pm_qos_update_requirement(param_id, name, new_target_value):
      
        Will search the list identified by the param_id for the named list element
        and then update its target value, calling the notification tree if the
        aggregated target is changed.  with that name is already registered.
      
      pm_qos_remove_requirement(param_id, name):
      
        Will search the identified list for the named element and remove it, after
        removal it will update the aggregate target and call the notification tree
        if the target was changed as a result of removing the named requirement.
      
      >From user mode:
      
        Only processes can register a pm_qos requirement.  To provide for
        automatic cleanup for process the interface requires the process to register
        its parameter requirements in the following way:
      
        To register the default pm_qos target for the specific parameter, the
        process must open one of /dev/[cpu_dma_latency, network_latency,
        network_throughput]
      
        As long as the device node is held open that process has a registered
        requirement on the parameter.  The name of the requirement is
        "process_<PID>" derived from the current->pid from within the open system
        call.
      
        To change the requested target value the process needs to write a s32
        value to the open device node.  This translates to a
        pm_qos_update_requirement call.
      
        To remove the user mode request for a target value simply close the device
        node.
      
      [akpm@linux-foundation.org: fix warnings]
      [akpm@linux-foundation.org: fix build]
      [akpm@linux-foundation.org: fix build again]
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: Nmark gross <mgross@linux.intel.com>
      Cc: "John W. Linville" <linville@tuxdriver.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Jaroslav Kysela <perex@suse.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Arjan van de Ven <arjan@infradead.org>
      Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
      Cc: Adam Belay <abelay@novell.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d82b3518
    • A
      make kernel_shutdown_prepare() static · 4ef7229f
      Adrian Bunk 提交于
      kernel_shutdown_prepare() can now become static.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4ef7229f
    • A
      alpha: fix warning by fixing flush_tlb_kernel_range() · cbed6c6e
      Andrew Morton 提交于
      mm/vmalloc.c: In function 'unmap_kernel_range':
      mm/vmalloc.c:75: warning: unused variable 'start'
      
      Macros are so horrid.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cbed6c6e
    • S
      Alpha doesn't use socketcall · 2f78dcfd
      Samuel Thibault 提交于
      Alpha doesn't use socketcall and doesn't provide __NR_socketcall.
      Signed-off-by: NSamuel Thibault <samuel.thibault@citrix.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2f78dcfd
    • A
      alpha: atomic_add_return() should return int · 26a6e661
      Andrew Morton 提交于
      Prevents stuff like
      
      drivers/crypto/hifn_795x.c:2443: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
      drivers/crypto/hifn_795x.c:2443: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
      
      (at least).
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      26a6e661
    • J
      m68knomu: remove dead config symbols from m68knomu code · c155f3f9
      Jiri Olsa 提交于
      remove dead config symbols from m68knommu code
      Signed-off-by: NJiri Olsa <olsajiri@gmail.com>
      Acked-by: NGreg Ungerer <gerg@snapgear.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c155f3f9
    • J
      frv: remove dead config symbol from FRV code · 8c5900b2
      Jiri Olsa 提交于
      Remove dead config symbol from FRV code.
      Signed-off-by: NJiri Olsa <olsajiri@gmail.com>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8c5900b2
    • R
      FRV: move DMA macros to scatterlist.h for consistency. · 82b12e23
      Robert P. J. Day 提交于
      To be consistent with other architectures, these two DMA macros should
      be defined in scatterlist.h as opposed to dma-mapping.h
      Signed-off-by: NRobert P. J. Day <rpjday@crashcourse.ca>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      82b12e23
    • C
      Smack: Simplified Mandatory Access Control Kernel · e114e473
      Casey Schaufler 提交于
      Smack is the Simplified Mandatory Access Control Kernel.
      
      Smack implements mandatory access control (MAC) using labels
      attached to tasks and data containers, including files, SVIPC,
      and other tasks. Smack is a kernel based scheme that requires
      an absolute minimum of application support and a very small
      amount of configuration data.
      
      Smack uses extended attributes and
      provides a set of general mount options, borrowing technics used
      elsewhere. Smack uses netlabel for CIPSO labeling. Smack provides
      a pseudo-filesystem smackfs that is used for manipulation of
      system Smack attributes.
      
      The patch, patches for ls and sshd, a README, a startup script,
      and x86 binaries for ls and sshd are also available on
      
          http://www.schaufler-ca.com
      
      Development has been done using Fedora Core 7 in a virtual machine
      environment and on an old Sony laptop.
      
      Smack provides mandatory access controls based on the label attached
      to a task and the label attached to the object it is attempting to
      access. Smack labels are deliberately short (1-23 characters) text
      strings. Single character labels using special characters are reserved
      for system use. The only operation applied to Smack labels is equality
      comparison. No wildcards or expressions, regular or otherwise, are
      used. Smack labels are composed of printable characters and may not
      include "/".
      
      A file always gets the Smack label of the task that created it.
      
      Smack defines and uses these labels:
      
          "*" - pronounced "star"
          "_" - pronounced "floor"
          "^" - pronounced "hat"
          "?" - pronounced "huh"
      
      The access rules enforced by Smack are, in order:
      
      1. Any access requested by a task labeled "*" is denied.
      2. A read or execute access requested by a task labeled "^"
         is permitted.
      3. A read or execute access requested on an object labeled "_"
         is permitted.
      4. Any access requested on an object labeled "*" is permitted.
      5. Any access requested by a task on an object with the same
         label is permitted.
      6. Any access requested that is explicitly defined in the loaded
         rule set is permitted.
      7. Any other access is denied.
      
      Rules may be explicitly defined by writing subject,object,access
      triples to /smack/load.
      
      Smack rule sets can be easily defined that describe Bell&LaPadula
      sensitivity, Biba integrity, and a variety of interesting
      configurations. Smack rule sets can be modified on the fly to
      accommodate changes in the operating environment or even the time
      of day.
      
      Some practical use cases:
      
      Hierarchical levels. The less common of the two usual uses
      for MLS systems is to define hierarchical levels, often
      unclassified, confidential, secret, and so on. To set up smack
      to support this, these rules could be defined:
      
         C        Unclass rx
         S        C       rx
         S        Unclass rx
         TS       S       rx
         TS       C       rx
         TS       Unclass rx
      
      A TS process can read S, C, and Unclass data, but cannot write it.
      An S process can read C and Unclass. Note that specifying that
      TS can read S and S can read C does not imply TS can read C, it
      has to be explicitly stated.
      
      Non-hierarchical categories. This is the more common of the
      usual uses for an MLS system. Since the default rule is that a
      subject cannot access an object with a different label no
      access rules are required to implement compartmentalization.
      
      A case that the Bell & LaPadula policy does not allow is demonstrated
      with this Smack access rule:
      
      A case that Bell&LaPadula does not allow that Smack does:
      
          ESPN    ABC   r
          ABC     ESPN  r
      
      On my portable video device I have two applications, one that
      shows ABC programming and the other ESPN programming. ESPN wants
      to show me sport stories that show up as news, and ABC will
      only provide minimal information about a sports story if ESPN
      is covering it. Each side can look at the other's info, neither
      can change the other. Neither can see what FOX is up to, which
      is just as well all things considered.
      
      Another case that I especially like:
      
          SatData Guard   w
          Guard   Publish w
      
      A program running with the Guard label opens a UDP socket and
      accepts messages sent by a program running with a SatData label.
      The Guard program inspects the message to ensure it is wholesome
      and if it is sends it to a program running with the Publish label.
      This program then puts the information passed in an appropriate
      place. Note that the Guard program cannot write to a Publish
      file system object because file system semanitic require read as
      well as write.
      
      The four cases (categories, levels, mutual read, guardbox) here
      are all quite real, and problems I've been asked to solve over
      the years. The first two are easy to do with traditonal MLS systems
      while the last two you can't without invoking privilege, at least
      for a while.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      Cc: Joshua Brindle <method@manicmethod.com>
      Cc: Paul Moore <paul.moore@hp.com>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: James Morris <jmorris@namei.org>
      Cc: "Ahmed S. Darwish" <darwish.07@gmail.com>
      Cc: Andrew G. Morgan <morgan@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e114e473
    • P
      NetLabel: introduce a new kernel configuration API for NetLabel · eda61d32
      Paul Moore 提交于
      Add a new set of configuration functions to the NetLabel/LSM API so that
      LSMs can perform their own configuration of the NetLabel subsystem without
      relying on assistance from userspace.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      Reviewed-by: NJames Morris <jmorris@namei.org>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: Casey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      eda61d32
    • S
      capabilities: introduce per-process capability bounding set · 3b7391de
      Serge E. Hallyn 提交于
      The capability bounding set is a set beyond which capabilities cannot grow.
       Currently cap_bset is per-system.  It can be manipulated through sysctl,
      but only init can add capabilities.  Root can remove capabilities.  By
      default it includes all caps except CAP_SETPCAP.
      
      This patch makes the bounding set per-process when file capabilities are
      enabled.  It is inherited at fork from parent.  Noone can add elements,
      CAP_SETPCAP is required to remove them.
      
      One example use of this is to start a safer container.  For instance, until
      device namespaces or per-container device whitelists are introduced, it is
      best to take CAP_MKNOD away from a container.
      
      The bounding set will not affect pP and pE immediately.  It will only
      affect pP' and pE' after subsequent exec()s.  It also does not affect pI,
      and exec() does not constrain pI'.  So to really start a shell with no way
      of regain CAP_MKNOD, you would do
      
      	prctl(PR_CAPBSET_DROP, CAP_MKNOD);
      	cap_t cap = cap_get_proc();
      	cap_value_t caparray[1];
      	caparray[0] = CAP_MKNOD;
      	cap_set_flag(cap, CAP_INHERITABLE, 1, caparray, CAP_DROP);
      	cap_set_proc(cap);
      	cap_free(cap);
      
      The following test program will get and set the bounding
      set (but not pI).  For instance
      
      	./bset get
      		(lists capabilities in bset)
      	./bset drop cap_net_raw
      		(starts shell with new bset)
      		(use capset, setuid binary, or binary with
      		file capabilities to try to increase caps)
      
      ************************************************************
      cap_bound.c
      ************************************************************
       #include <sys/prctl.h>
       #include <linux/capability.h>
       #include <sys/types.h>
       #include <unistd.h>
       #include <stdio.h>
       #include <stdlib.h>
       #include <string.h>
      
       #ifndef PR_CAPBSET_READ
       #define PR_CAPBSET_READ 23
       #endif
      
       #ifndef PR_CAPBSET_DROP
       #define PR_CAPBSET_DROP 24
       #endif
      
      int usage(char *me)
      {
      	printf("Usage: %s get\n", me);
      	printf("       %s drop <capability>\n", me);
      	return 1;
      }
      
       #define numcaps 32
      char *captable[numcaps] = {
      	"cap_chown",
      	"cap_dac_override",
      	"cap_dac_read_search",
      	"cap_fowner",
      	"cap_fsetid",
      	"cap_kill",
      	"cap_setgid",
      	"cap_setuid",
      	"cap_setpcap",
      	"cap_linux_immutable",
      	"cap_net_bind_service",
      	"cap_net_broadcast",
      	"cap_net_admin",
      	"cap_net_raw",
      	"cap_ipc_lock",
      	"cap_ipc_owner",
      	"cap_sys_module",
      	"cap_sys_rawio",
      	"cap_sys_chroot",
      	"cap_sys_ptrace",
      	"cap_sys_pacct",
      	"cap_sys_admin",
      	"cap_sys_boot",
      	"cap_sys_nice",
      	"cap_sys_resource",
      	"cap_sys_time",
      	"cap_sys_tty_config",
      	"cap_mknod",
      	"cap_lease",
      	"cap_audit_write",
      	"cap_audit_control",
      	"cap_setfcap"
      };
      
      int getbcap(void)
      {
      	int comma=0;
      	unsigned long i;
      	int ret;
      
      	printf("i know of %d capabilities\n", numcaps);
      	printf("capability bounding set:");
      	for (i=0; i<numcaps; i++) {
      		ret = prctl(PR_CAPBSET_READ, i);
      		if (ret < 0)
      			perror("prctl");
      		else if (ret==1)
      			printf("%s%s", (comma++) ? ", " : " ", captable[i]);
      	}
      	printf("\n");
      	return 0;
      }
      
      int capdrop(char *str)
      {
      	unsigned long i;
      
      	int found=0;
      	for (i=0; i<numcaps; i++) {
      		if (strcmp(captable[i], str) == 0) {
      			found=1;
      			break;
      		}
      	}
      	if (!found)
      		return 1;
      	if (prctl(PR_CAPBSET_DROP, i)) {
      		perror("prctl");
      		return 1;
      	}
      	return 0;
      }
      
      int main(int argc, char *argv[])
      {
      	if (argc<2)
      		return usage(argv[0]);
      	if (strcmp(argv[1], "get")==0)
      		return getbcap();
      	if (strcmp(argv[1], "drop")!=0 || argc<3)
      		return usage(argv[0]);
      	if (capdrop(argv[2])) {
      		printf("unknown capability\n");
      		return 1;
      	}
      	return execl("/bin/bash", "/bin/bash", NULL);
      }
      ************************************************************
      
      [serue@us.ibm.com: fix typo]
      Signed-off-by: NSerge E. Hallyn <serue@us.ibm.com>
      Signed-off-by: NAndrew G. Morgan <morgan@kernel.org>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: James Morris <jmorris@namei.org>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Casey Schaufler <casey@schaufler-ca.com>a
      Signed-off-by: N"Serge E. Hallyn" <serue@us.ibm.com>
      Tested-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3b7391de
    • A
      Remove unnecessary include from include/linux/capability.h · 46c383cc
      Andrew Morgan 提交于
      KaiGai Kohei observed that this line in the linux header is not needed.
      Signed-off-by: NAndrew G. Morgan <morgan@kernel.org>
      Cc: KaiGai Kohei <kaigai@kaigai.gr.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      46c383cc
    • A
      Add 64-bit capability support to the kernel · e338d263
      Andrew Morgan 提交于
      The patch supports legacy (32-bit) capability userspace, and where possible
      translates 32-bit capabilities to/from userspace and the VFS to 64-bit
      kernel space capabilities.  If a capability set cannot be compressed into
      32-bits for consumption by user space, the system call fails, with -ERANGE.
      
      FWIW libcap-2.00 supports this change (and earlier capability formats)
      
       http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
      
      [akpm@linux-foundation.org: coding-syle fixes]
      [akpm@linux-foundation.org: use get_task_comm()]
      [ezk@cs.sunysb.edu: build fix]
      [akpm@linux-foundation.org: do not initialise statics to 0 or NULL]
      [akpm@linux-foundation.org: unused var]
      [serue@us.ibm.com: export __cap_ symbols]
      Signed-off-by: NAndrew G. Morgan <morgan@kernel.org>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: James Morris <jmorris@namei.org>
      Cc: Casey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NErez Zadok <ezk@cs.sunysb.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e338d263
    • A
      revert "capabilities: clean up file capability reading" · 8f6936f4
      Andrew Morton 提交于
      Revert b68680e4 to make way for the next
      patch: "Add 64-bit capability support to the kernel".
      
      We want to keep the vfs_cap_data.data[] structure, using two 'data's for
      64-bit caps (and later three for 96-bit caps), whereas
      b68680e4 had gotten rid of the 'data' struct
      made its members inline.
      
      The 64-bit caps patch keeps the stack abuse fix at get_file_caps(), which was
      the more important part of that patch.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: Serge Hallyn <serue@us.ibm.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: James Morris <jmorris@namei.org>
      Cc: Casey Schaufler <casey@schaufler-ca.com>
      Cc: Andrew Morgan <morgan@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f6936f4