John Stultz [Fri, 4 Apr 2014 23:24:26 +0000 (16:24 -0700)]
Merge remote-tracking branch 'android/android-3.10' into linaro-fixes/android-3.10
Mark Brown [Fri, 4 Apr 2014 12:23:54 +0000 (13:23 +0100)]
net: ipv6: Add missing const to ipv6_chk_addr
The net_device used by ipv6_chk_addr is const in some users so add a
const here, fixing a warning following mainline commit
6bc19fb82d4c05
(Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net) from
David S. Miller.
Change-Id: Iebfae34fc9f10f958c41aad6ac4008d61668a870
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Sherman Yin <syin@broadcom.com>
[Folded in additional const fix to the dummy function from Sherman Yin]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Colin Cross [Thu, 3 Apr 2014 01:02:15 +0000 (18:02 -0700)]
ARM64: copy CONFIG_CMDLINE_EXTEND from ARM
Copy the config choice for CONFIG_CMDLINE_EXTEND from
arch/arm/Kconfig, including CONFIG_CMDLINE_FROM_BOOTLOADER
as the default. These will be used by drivers/of/fdt.c.
Change-Id: I8416038498ddf8fc1e99ab06109825eb1492aa7f
Signed-off-by: Colin Cross <ccross@android.com>
Doug Anderson [Fri, 3 Feb 2012 06:58:28 +0000 (22:58 -0800)]
of: Support CONFIG_CMDLINE_EXTEND config option
The old logic assumes CMDLINE_FROM_BOOTLOADER vs. CMDLINE_FORCE and
ignores CMDLINE_EXTEND. Here's the old logic:
- CONFIG_CMDLINE_FORCE=true
CONFIG_CMDLINE
- dt bootargs=non-empty:
dt bootargs
- dt bootargs=empty, @data is non-empty string
@data is left unchanged
- dt bootargs=empty, @data is empty string
CONFIG_CMDLINE (or "" if that's not defined)
The new logic is now documented in of_fdt.h and is copied here for
reference:
- CONFIG_CMDLINE_FORCE=true
CONFIG_CMDLINE
- CONFIG_CMDLINE_EXTEND=true, @data is non-empty string
@data + dt bootargs (even if dt bootargs are empty)
- CONFIG_CMDLINE_EXTEND=true, @data is empty string
CONFIG_CMDLINE + dt bootargs (even if dt bootargs are empty)
- CMDLINE_FROM_BOOTLOADER=true, dt bootargs=non-empty:
dt bootargs
- CMDLINE_FROM_BOOTLOADER=true, dt bootargs=empty, @data is non-empty string
@data is left unchanged
- CMDLINE_FROM_BOOTLOADER=true, dt bootargs=empty, @data is empty string
CONFIG_CMDLINE (or "" if that's not defined)
Signed-off-by: Doug Anderson <dianders@chromium.org>
CC: devicetree-discuss@lists.ozlabs.org
CC: Grant Likely <grant.likely@secretlab.ca>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Rob Herring <rob.herring@calxeda.com>
Change-Id: I40ace250847f813358125dfcaa8998fd32cf7ea3
Signed-off-by: Colin Cross <ccross@android.com>
Greg Hackmann [Wed, 26 Mar 2014 23:43:23 +0000 (16:43 -0700)]
video: adf: ensure consistent alignment on userspace facing structs
64-bit types in structs create alignment problems when a 32-bit x86
userspace talks to an x86_64 kernel. In most cases the 64-bit types can
be replaced with 32-bit ones, since they're being used for fds and
should have been __s32 in the first place. For adf_vsync_event,
alignment can be enforced by making the timestamp an __aligned_u64.
Change-Id: I87cf73d8f57730bd7bb43ffce6b7b411eb0ff198
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Tushar Behera [Wed, 26 Mar 2014 09:57:05 +0000 (15:27 +0530)]
tcp: Fix build error if IPV6 is not selected
If CONFIG_IPV6=m is selected, we are getting following build errors.
net/built-in.o: In function `tcp_is_local6':
net/ipv4/tcp.c:3261: undefined reference to `rt6_lookup'
Making the code conditional upon only CONFIG_IPV6=y fixes this issue.
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
CC: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Greg Hackmann [Mon, 24 Mar 2014 23:45:43 +0000 (16:45 -0700)]
video: adf: replace fbdev helper's open flag with refcount
A device's fb_info is shared between clients. fb_release() is called
when each client is released, not just the last one. Since the fbdev
helper needs to release its dma-buf when the last client goes away, it
must keep its own reference count.
fbmem and fbcon hold different locks while calling fb_release(), so
explicit locking is needed.
Change-Id: I42cd659f7633adba7c11f407d4b594bd43305d6a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Alex Ray [Mon, 17 Mar 2014 20:44:01 +0000 (13:44 -0700)]
ARM64: add option to build Image.gz/dtb combo
Allows a defconfig to set a list of dtbs to concatenate with an
Image.gz to create a Image.gz-dtb.
Change-Id: I0dc3935e57f01b517aa64eda0c27b0101e9ea3b2
Signed-off-by: Alex Ray <aray@google.com>
Masanari Iida [Sun, 23 Jun 2013 14:47:15 +0000 (23:47 +0900)]
staging: android: Fix typo in staging/android
Fix "with with" in debug message.
Issue: ABIT-21
Change-Id: Icd0b195524f4c77272276991a1e8a00aecef65c9
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Signed-off-by: Jun Tian <jun.j.tian@intel.com>
Alistair Strachan [Tue, 11 Mar 2014 00:00:25 +0000 (17:00 -0700)]
video: adf: export the adf_attachment_allow symbol to modules.
There are no in-tree users of adf_attachment_allow, but out-of-tree
modules want to use it. It looks like this function should be
EXPORT_SYMBOL.
Change-Id: Iad522dc5d32ac09fec6483bbc317db8ecae12e97
Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
Greg Hackmann [Mon, 10 Mar 2014 21:21:30 +0000 (14:21 -0700)]
power: wakeup_reason: rename irq_count to irqcount
On x86, irq_count conflicts with a declaration in
arch/x86/include/asm/processor.h
Change-Id: I3e4fde0ff64ef59ff5ed2adc0ea3a644641ee0b7
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Ruchi Kandoi [Fri, 7 Mar 2014 20:54:30 +0000 (12:54 -0800)]
Power: Add guard condition for maximum wakeup reasons
Ensure the array for the wakeup reason IRQs does not overflow.
Change-Id: Iddc57a3aeb1888f39d4e7b004164611803a4d37c
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry picked from commit
b5ea40cdfcf38296535f931a7e5e7bf47b6fad7f)
John Stultz [Mon, 3 Mar 2014 09:35:23 +0000 (01:35 -0800)]
staging: Fix build issues with new binder API
The new 64bit binder API causes build issues on 32bit ARM
due to the lack of 64bit __get_user_asm_* implementation.
Until that implementation is done, remove the choice for
32bit ARM, automatically enabling the old 32bit binder
protocol.
This can be reverted once a 64bit __get_user_asm_*
implementation is merged.
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Arnd Bergmann <arnd.bergmann@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Mon, 3 Mar 2014 09:00:52 +0000 (01:00 -0800)]
Merge branch 'upstream/android-3.10' into linaro-fixes/android-3.10
This reverts Serban's out-of-tree binder changes and moves to
the new binder protocol approach merged into AOSP.
Signed-off-by: John Stultz <john.stultz@linaro.org>
JP Abgrall [Fri, 28 Feb 2014 03:38:14 +0000 (19:38 -0800)]
android: base-cfg: enable DM_VERITY (used for secureboot)
Change-Id: I68d769f97ffa76bb45e65d34a96dd7f558c02d08
Signed-off-by: JP Abgrall <jpa@google.com>
Mark Hambleton [Tue, 3 Dec 2013 19:19:12 +0000 (19:19 +0000)]
arm64: cmpxchg: update macros to prevent warnings
Make sure the value we are going to return is referenced in order to
avoid warnings from newer GCCs such as:
arch/arm64/include/asm/cmpxchg.h:162:3: warning: value computed is not used [-Wunused-value]
((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \
^
net/netfilter/nf_conntrack_core.c:674:2: note: in expansion of macro ‘cmpxchg’
cmpxchg(&nf_conntrack_hash_rnd, 0, rand);
[Modified to use the current underlying implementation as current
mainline for both cmpxchg() and cmpxchg_local() does -- broonie]
Signed-off-by: Mark Hambleton <mahamble@broadcom.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Greg Hackmann [Mon, 24 Feb 2014 18:19:13 +0000 (10:19 -0800)]
drivers: usb: gadget: 64-bit related type fixes
Change-Id: I2f9b12e1e0cdfe64ffe20db78d319a6221821184
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Mon, 24 Feb 2014 17:39:46 +0000 (09:39 -0800)]
netfilter: xt_qtaguid: 64-bit warning fixes
Change-Id: I2adc517c0c51050ed601992fa0ea4de8f1449414
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Arve Hjønnevåg [Fri, 14 Feb 2014 04:25:06 +0000 (20:25 -0800)]
Staging: android: binder: More offset validation.
Make sure offsets don't point to overlapping flat_binder_object
structs.
Change-Id: I425ab0c46fbe2b00ed679c5becf9e8140395eb40
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Ruchi Kandoi [Fri, 21 Feb 2014 03:47:38 +0000 (19:47 -0800)]
POWER: fix compile warnings in log_wakeup_reason
Change I81addaf420f1338255c5d0638b0d244a99d777d1 introduced compile
warnings, fix these.
Change-Id: I05482a5335599ab96c0a088a7d175c8d4cf1cf69
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Ruchi Kandoi [Wed, 19 Feb 2014 23:30:47 +0000 (15:30 -0800)]
Power: add an API to log wakeup reasons
Add API log_wakeup_reason() and expose it to userspace via sysfs path
/sys/kernel/wakeup_reasons/last_resume_reason
Change-Id: I81addaf420f1338255c5d0638b0d244a99d777d1
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Rom Lemarchand [Thu, 20 Feb 2014 02:01:37 +0000 (18:01 -0800)]
android: configs: add systrace support to recommended configs
Change-Id: I4a6e88f47803e88b0ce2d913be4aeb299ca858b4
Signed-off-by: Rom Lemarchand <romlem@android.com>
Greg Hackmann [Fri, 14 Feb 2014 23:35:38 +0000 (15:35 -0800)]
video: adf: use %zu when printing size_t
Change-Id: I9cf7ebc368bad0a83db9e5aa370feadf117b21c0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Fri, 14 Feb 2014 23:38:49 +0000 (15:38 -0800)]
video: adf: fix compat ioctls calling ioctl with wrong cmd
Change-Id: Icdbac3edd123b3114103dc138a60e6955006cda4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Greg Hackmann [Fri, 14 Feb 2014 23:39:52 +0000 (15:39 -0800)]
video: adf: use ADF_IOCTL_TYPE in compat ioctl definitions
Change-Id: I7451a282d9d972c9957568b366c164b67b4b47e8
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Arve Hjønnevåg [Sat, 8 Feb 2014 01:46:21 +0000 (17:46 -0800)]
Staging: android: binder: Fix death notifications
The change (
008fa749e0fe5b2fffd20b7fe4891bb80d072c6a) that moved the
node release code to a separate function broke death notifications in
some cases. When it encountered a reference without a death
notification request, it would skip looking at the remaining
references, and therefore fail to send death notifications for them.
Change-Id: I12083a50709ccc30ba11a5f4d9eeb5f0ff4471c6
Signed-off-by: Arve Hjønnevåg <arve@android.com>
keunyoung [Wed, 29 Jan 2014 20:41:50 +0000 (12:41 -0800)]
fix false disconnect due to a signal sent to the reading process
- In the current implementation, when a signal is sent to the reading process,
read is cancelled by calling usb_ep_dequeue, which lead into calling
acc_complete_out with ECONNRESET, but the current logic treats it as
disconnection, which makes the device inaccessible until cable is actually
disconnected.
- The fix calls disconnect only when ESHUTDOWN error is passed.
- If data has already arrived while trying cancelling, the data is marked
as available, and it will be read out on the next read. This is necessary
as USB bulk is assumed to guarantee no data loss.
Signed-off-by: keunyoung <keunyoung@google.com>
Jacob Shin [Thu, 27 Jun 2013 20:02:12 +0000 (22:02 +0200)]
cpufreq: don't leave stale policy pointer in cdbs->cur_policy
Clear ->cur_policy when stopping a governor, or the ->cur_policy
pointer may be stale on systems with have_governor_per_policy when a
new policy is allocated due to CPU hotplug offline/online.
[rjw: Changelog]
Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Viresh Kumar [Thu, 16 May 2013 05:09:57 +0000 (05:09 +0000)]
cpufreq: governors: Move get_governor_parent_kobj() to cpufreq.c
get_governor_parent_kobj() can be used by any governor, generic
cpufreq governors or platform specific ones and so must be present in
cpufreq.c instead of cpufreq_governor.c.
This patch moves it to cpufreq.c. This also adds
EXPORT_SYMBOL_GPL(get_governor_parent_kobj) so that modules can use
this function too.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Viresh Kumar [Thu, 16 May 2013 05:09:56 +0000 (05:09 +0000)]
cpufreq: Add EXPORT_SYMBOL_GPL for have_governor_per_policy
This patch adds: EXPORT_SYMBOL_GPL(have_governor_per_policy), so that
this routine can be used by modules too.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
JP Abgrall [Sat, 8 Feb 2014 02:40:10 +0000 (18:40 -0800)]
tcp: add a sysctl to config the tcp_default_init_rwnd
The default initial rwnd is hardcoded to 10.
Now we allow it to be controlled via
/proc/sys/net/ipv4/tcp_default_init_rwnd
which limits the values from 3 to 100
This is somewhat needed because ipv6 routes are
autoconfigured by the kernel.
See "An Argument for Increasing TCP's Initial Congestion Window"
in https://developers.google.com/speed/articles/tcp_initcwnd_paper.pdf
Change-Id: I386b2a9d62de0ebe05c1ebe1b4bd91b314af5c54
Signed-off-by: JP Abgrall <jpa@google.com>
Conflicts:
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_input.c
Stephen Smalley [Thu, 30 Jan 2014 16:26:59 +0000 (11:26 -0500)]
SELinux: Fix kernel BUG on empty security contexts.
Setting an empty security context (length=0) on a file will
lead to incorrectly dereferencing the type and other fields
of the security context structure, yielding a kernel BUG.
As a zero-length security context is never valid, just reject
all such security contexts whether coming from userspace
via setxattr or coming from the filesystem upon a getxattr
request by SELinux.
Setting a security context value (empty or otherwise) unknown to
SELinux in the first place is only possible for a root process
(CAP_MAC_ADMIN), and, if running SELinux in enforcing mode, only
if the corresponding SELinux mac_admin permission is also granted
to the domain by policy. In Fedora policies, this is only allowed for
specific domains such as livecd for setting down security contexts
that are not defined in the build host policy.
[On Android, this can only be set by root/CAP_MAC_ADMIN processes,
and if running SELinux in enforcing mode, only if mac_admin permission
is granted in policy. In Android 4.4, this would only be allowed for
root/CAP_MAC_ADMIN processes that are also in unconfined domains. In current
AOSP master, mac_admin is not allowed for any domains except the recovery
console which has a legitimate need for it. The other potential vector
is mounting a maliciously crafted filesystem for which SELinux fetches
xattrs (e.g. an ext4 filesystem on a SDcard). However, the end result is
only a local denial-of-service (DOS) due to kernel BUG. This fix is
queued for 3.14.]
Reproducer:
su
setenforce 0
touch foo
setfattr -n security.selinux foo
Caveat:
Relabeling or removing foo after doing the above may not be possible
without booting with SELinux disabled. Any subsequent access to foo
after doing the above will also trigger the BUG.
BUG output from Matthew Thode:
[ 473.893141] ------------[ cut here ]------------
[ 473.962110] kernel BUG at security/selinux/ss/services.c:654!
[ 473.995314] invalid opcode: 0000 [#6] SMP
[ 474.027196] Modules linked in:
[ 474.058118] CPU: 0 PID: 8138 Comm: ls Tainted: G D I
3.13.0-grsec #1
[ 474.116637] Hardware name: Supermicro X8ST3/X8ST3, BIOS 2.0
07/29/10
[ 474.149768] task:
ffff8805f50cd010 ti:
ffff8805f50cd488 task.ti:
ffff8805f50cd488
[ 474.183707] RIP: 0010:[<
ffffffff814681c7>] [<
ffffffff814681c7>]
context_struct_compute_av+0xce/0x308
[ 474.219954] RSP: 0018:
ffff8805c0ac3c38 EFLAGS:
00010246
[ 474.252253] RAX:
0000000000000000 RBX:
ffff8805c0ac3d94 RCX:
0000000000000100
[ 474.287018] RDX:
ffff8805e8aac000 RSI:
00000000ffffffff RDI:
ffff8805e8aaa000
[ 474.321199] RBP:
ffff8805c0ac3cb8 R08:
0000000000000010 R09:
0000000000000006
[ 474.357446] R10:
0000000000000000 R11:
ffff8805c567a000 R12:
0000000000000006
[ 474.419191] R13:
ffff8805c2b74e88 R14:
00000000000001da R15:
0000000000000000
[ 474.453816] FS:
00007f2e75220800(0000) GS:
ffff88061fc00000(0000)
knlGS:
0000000000000000
[ 474.489254] CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
[ 474.522215] CR2:
00007f2e74716090 CR3:
00000005c085e000 CR4:
00000000000207f0
[ 474.556058] Stack:
[ 474.584325]
ffff8805c0ac3c98 ffffffff811b549b ffff8805c0ac3c98
ffff8805f1190a40
[ 474.618913]
ffff8805a6202f08 ffff8805c2b74e88 00068800d0464990
ffff8805e8aac860
[ 474.653955]
ffff8805c0ac3cb8 000700068113833a ffff880606c75060
ffff8805c0ac3d94
[ 474.690461] Call Trace:
[ 474.723779] [<
ffffffff811b549b>] ? lookup_fast+0x1cd/0x22a
[ 474.778049] [<
ffffffff81468824>] security_compute_av+0xf4/0x20b
[ 474.811398] [<
ffffffff8196f419>] avc_compute_av+0x2a/0x179
[ 474.843813] [<
ffffffff8145727b>] avc_has_perm+0x45/0xf4
[ 474.875694] [<
ffffffff81457d0e>] inode_has_perm+0x2a/0x31
[ 474.907370] [<
ffffffff81457e76>] selinux_inode_getattr+0x3c/0x3e
[ 474.938726] [<
ffffffff81455cf6>] security_inode_getattr+0x1b/0x22
[ 474.970036] [<
ffffffff811b057d>] vfs_getattr+0x19/0x2d
[ 475.000618] [<
ffffffff811b05e5>] vfs_fstatat+0x54/0x91
[ 475.030402] [<
ffffffff811b063b>] vfs_lstat+0x19/0x1b
[ 475.061097] [<
ffffffff811b077e>] SyS_newlstat+0x15/0x30
[ 475.094595] [<
ffffffff8113c5c1>] ? __audit_syscall_entry+0xa1/0xc3
[ 475.148405] [<
ffffffff8197791e>] system_call_fastpath+0x16/0x1b
[ 475.179201] Code: 00 48 85 c0 48 89 45 b8 75 02 0f 0b 48 8b 45 a0 48
8b 3d 45 d0 b6 00 8b 40 08 89 c6 ff ce e8 d1 b0 06 00 48 85 c0 49 89 c7
75 02 <0f> 0b 48 8b 45 b8 4c 8b 28 eb 1e 49 8d 7d 08 be 80 01 00 00 e8
[ 475.255884] RIP [<
ffffffff814681c7>]
context_struct_compute_av+0xce/0x308
[ 475.296120] RSP <
ffff8805c0ac3c38>
[ 475.328734] ---[ end trace
f076482e9d754adc ]---
[sds: commit message edited to note Android implications and
to generate a unique Change-Id for gerrit]
Change-Id: I4d5389f0cfa72b5f59dada45081fa47e03805413
Reported-by: Matthew Thode <mthode@mthode.org>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Cc: stable@vger.kernel.org
Signed-off-by: Paul Moore <pmoore@redhat.com>
JP Abgrall [Wed, 5 Feb 2014 20:29:34 +0000 (12:29 -0800)]
ARM: tegra: flounder: stick to 32bit binder for now.
Signed-off-by: JP Abgrall <jpa@google.com>
Ashish Sharma [Wed, 5 Feb 2014 01:50:50 +0000 (01:50 +0000)]
netfilter: xt_IDLETIMER: Revert to retain the kernel API format.
Reverted Change-Id: Iaeca5dd2d7878c0733923ae03309a2a7b86979ca
Change-Id: I0e0a4f60ec14330d8d8d1c5a508fa058d9919e07
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
(cherry picked from commit
e0a4e5b0e808d718dd9af500c5754118fc3935db)
Steven Rostedt [Fri, 10 Jan 2014 02:46:34 +0000 (21:46 -0500)]
SELinux: Fix possible NULL pointer dereference in selinux_inode_permission()
commit
3dc91d4338d698ce77832985f9cb183d8eeaf6be upstream.
While running stress tests on adding and deleting ftrace instances I hit
this bug:
BUG: unable to handle kernel NULL pointer dereference at
0000000000000020
IP: selinux_inode_permission+0x85/0x160
PGD
63681067 PUD
7ddbe067 PMD 0
Oops: 0000 [#1] PREEMPT
CPU: 0 PID: 5634 Comm: ftrace-test-mki Not tainted
3.13.0-rc4-test-00033-gd2a6dde-dirty #20
Hardware name: /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006
task:
ffff880078375800 ti:
ffff88007ddb0000 task.ti:
ffff88007ddb0000
RIP: 0010:[<
ffffffff812d8bc5>] [<
ffffffff812d8bc5>] selinux_inode_permission+0x85/0x160
RSP: 0018:
ffff88007ddb1c48 EFLAGS:
00010246
RAX:
0000000000000000 RBX:
0000000000800000 RCX:
ffff88006dd43840
RDX:
0000000000000001 RSI:
0000000000000081 RDI:
ffff88006ee46000
RBP:
ffff88007ddb1c88 R08:
0000000000000000 R09:
ffff88007ddb1c54
R10:
6e6576652f6f6f66 R11:
0000000000000003 R12:
0000000000000000
R13:
0000000000000081 R14:
ffff88006ee46000 R15:
0000000000000000
FS:
00007f217b5b6700(0000) GS:
ffffffff81e21000(0000) knlGS:
0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033^M
CR2:
0000000000000020 CR3:
000000006a0fe000 CR4:
00000000000007f0
Call Trace:
security_inode_permission+0x1c/0x30
__inode_permission+0x41/0xa0
inode_permission+0x18/0x50
link_path_walk+0x66/0x920
path_openat+0xa6/0x6c0
do_filp_open+0x43/0xa0
do_sys_open+0x146/0x240
SyS_open+0x1e/0x20
system_call_fastpath+0x16/0x1b
Code: 84 a1 00 00 00 81 e3 00 20 00 00 89 d8 83 c8 02 40 f6 c6 04 0f 45 d8 40 f6 c6 08 74 71 80 cf 02 49 8b 46 38 4c 8d 4d cc 45 31 c0 <0f> b7 50 20 8b 70 1c 48 8b 41 70 89 d9 8b 78 04 e8 36 cf ff ff
RIP selinux_inode_permission+0x85/0x160
CR2:
0000000000000020
Investigating, I found that the inode->i_security was NULL, and the
dereference of it caused the oops.
in selinux_inode_permission():
isec = inode->i_security;
rc = avc_has_perm_noaudit(sid, isec->sid, isec->sclass, perms, 0, &avd);
Note, the crash came from stressing the deletion and reading of debugfs
files. I was not able to recreate this via normal files. But I'm not
sure they are safe. It may just be that the race window is much harder
to hit.
What seems to have happened (and what I have traced), is the file is
being opened at the same time the file or directory is being deleted.
As the dentry and inode locks are not held during the path walk, nor is
the inodes ref counts being incremented, there is nothing saving these
structures from being discarded except for an rcu_read_lock().
The rcu_read_lock() protects against freeing of the inode, but it does
not protect freeing of the inode_security_struct. Now if the freeing of
the i_security happens with a call_rcu(), and the i_security field of
the inode is not changed (it gets freed as the inode gets freed) then
there will be no issue here. (Linus Torvalds suggested not setting the
field to NULL such that we do not need to check if it is NULL in the
permission check).
Note, this is a hack, but it fixes the problem at hand. A real fix is
to restructure the destroy_inode() to call all the destructor handlers
from the RCU callback. But that is a major job to do, and requires a
lot of work. For now, we just band-aid this bug with this fix (it
works), and work on a more maintainable solution in the future.
Link: http://lkml.kernel.org/r/20140109101932.0508dec7@gandalf.local.home
Link: http://lkml.kernel.org/r/20140109182756.17abaaa8@gandalf.local.home
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arve Hjønnevåg [Tue, 28 Jan 2014 03:18:47 +0000 (19:18 -0800)]
Staging: android: binder: Support concurrent 32 bit and 64 bit processes.
Add binder_size_t and binder_uintptr_t that is used instead of size_t and
void __user * in the user-space interface.
Use 64 bit pointers on all systems unless CONFIG_ANDROID_BINDER_IPC_32BIT
is set (which enables the old protocol on 32 bit systems).
Change BINDER_CURRENT_PROTOCOL_VERSION to 8 if
CONFIG_ANDROID_BINDER_IPC_32BIT is not set.
Add compat ioctl.
Change-Id: Ifbbde0209da0050011bcab34c547a4c30d6e8c49
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Serban Constantinescu [Wed, 15 Jan 2014 11:28:36 +0000 (11:28 +0000)]
staging: android: binder: fix ABI for 64bit Android
This patch fixes the ABI for 64bit Android userspace.
BC_REQUEST_DEATH_NOTIFICATION and BC_CLEAR_DEATH_NOTIFICATION claim
to be using struct binder_ptr_cookie, but they are using a 32bit handle
and a pointer.
On 32bit systems the payload size is the same as the size of struct
binder_ptr_cookie, however for 64bit systems this will differ. This
patch adds struct binder_handle_cookie that fixes this issue for 64bit
Android.
Since there are no 64bit users of this interface that we know of this
change should not affect any existing systems.
Change-Id: I8909cbc50aad48ccf371270bad6f69ff242a8c22
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:48 +0000 (10:54 +0100)]
staging: android: binder: fix binder interface for 64bit compat layer
The changes in this patch will fix the binder interface for use on 64bit
machines and stand as the base of the 64bit compat support. The changes
apply to the structures that are passed between the kernel and
userspace.
Most of the changes applied mirror the change to struct binder_version
where there is no need for a 64bit wide protocol_version(on 64bit
machines). The change inlines with the existing 32bit userspace(the
structure has the same size) and simplifies the compat layer such that
the same handler can service the BINDER_VERSION ioctl.
Other changes make use of kernel types as well as user-exportable ones
and fix format specifier issues.
The changes do not affect existing 32bit ABI.
Change-Id: Icccc8d47c302930cc61cddc5749b4cc74dc84117
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:47 +0000 (10:54 +0100)]
staging: android: binder: replace types with portable ones
Since this driver is meant to be used on different types of processors
and a portable driver should specify the size a variable expects to be
this patch changes the types used throughout the binder interface.
We use "userspace" types since this header will be exported and used by
the Android filesystem.
The patch does not change in any way the functionality of the binder driver.
Change-Id: Ib26daab8bc44b92d4a09badc8ecb64d37ee8773b
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:46 +0000 (10:54 +0100)]
staging: android: binder: fix alignment issues
The Android userspace aligns the data written to the binder buffers to
4bytes. Thus for 32bit platforms or 64bit platforms running an 32bit
Android userspace we can have a buffer looking like this:
platform buffer(binder_cmd pointer) size
32/32 32b 32b 8B
64/32 32b 64b 12B
64/64 32b 64b 12B
Thus the kernel needs to check that the buffer size is aligned to 4bytes
not to (void *) that will be 8bytes on 64bit machines.
The change does not affect existing 32bit ABI.
Change-Id: I7535f07301519623ea6334f525d312d687407ed4
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:45 +0000 (10:54 +0100)]
staging: android: binder: fix BC_FREE_BUFFER ioctl declaration
BinderDriverCommands mirror the ioctl usage. Thus the size of the
structure passed through the interface should be used to generate the
ioctl No.
The change reflects the type being passed from the user space-a pointer
to a binder_buffer. This change should not affect the existing 32bit
user space since BC_FREE_BUFFER is computed as:
#define _IOW(type,nr,size) \
((type) << _IOC_TYPESHIFT) | \
((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT))
and for a 32bit compiler BC_FREE_BUFFER will have the same computed
value. This change will also ease our work in differentiating
BC_FREE_BUFFER from COMPAT_BC_FREE_BUFFER.
The change does not affect existing 32bit ABI.
Change-Id: I2e0ae87bc4e913225a8eb2912913f7e3617cb575
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:44 +0000 (10:54 +0100)]
staging: android: binder: fix BINDER_SET_MAX_THREADS declaration
This change will fix the BINDER_SET_MAX_THREADS ioctl to use __u32
instead of size_t for setting the max threads. Thus using the same
handler for 32 and 64bit kernels.
This value is stored internally in struct binder_proc and set to 15
on open_binder() in the libbinder API(thus no need for a 64bit size_t
on 64bit platforms).
The change does not affect existing 32bit ABI.
Change-Id: Ibdfe10a70d475a91c247dc36e9cfd74a259d50e4
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:43 +0000 (10:54 +0100)]
staging: android: binder: modify struct binder_write_read to use size_t
This change mirrors the userspace operation where struct binder_write_read
members that specify the buffer size and consumed size are size_t elements.
The patch also fixes the binder_thread_write() and binder_thread_read()
functions prototypes to conform with the definition of binder_write_read.
The changes do not affect existing 32bit ABI.
Change-Id: I987246d507b9c5e4627c62a1da971d11869ac5a0
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Fri, 31 Jan 2014 19:22:18 +0000 (11:22 -0800)]
Fix aarch64 build issue with ION
In trying to build ION for aarch64, I came across the following build error:
In file included from /home/jstultz/projects/linux/linaro.android/arch/arm64/include/asm/page.h:39:0,
from drivers/staging/android/ion/ion_system_heap.c:17:
/home/jstultz/projects/linux/linaro.android/arch/arm64/include/asm/pgtable-3level-types.h:19:1: error: unknown type name u64
typedef u64 pteval_t;
^
/home/jstultz/projects/linux/linaro.android/arch/arm64/include/asm/pgtable-3level-types.h:20:1: error: unknown type name u64
typedef u64 pmdval_t;
^
...
The problem is asm/page.h doesn't include anything that defines u64, so
add an asm/types.h include to the pgtable-3level-types.h to match upstream
and avoid the issue.
Change-Id: I3f098bf666761ac6b316389a46d37cc449c342d6
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 31 Jan 2014 19:22:18 +0000 (11:22 -0800)]
Fix aarch64 build issue with ION
In trying to build ION for aarch64, I came across the following build error:
In file included from /home/jstultz/projects/linux/linaro.android/arch/arm64/include/asm/page.h:39:0,
from drivers/staging/android/ion/ion_system_heap.c:17:
/home/jstultz/projects/linux/linaro.android/arch/arm64/include/asm/pgtable-3level-types.h:19:1: error: unknown type name u64
typedef u64 pteval_t;
^
/home/jstultz/projects/linux/linaro.android/arch/arm64/include/asm/pgtable-3level-types.h:20:1: error: unknown type name u64
typedef u64 pmdval_t;
^
...
The problem is asm/page.h doesn't include anything that defines u64, so
add an asm/types.h include to the pgtable-3level-types.h to match upstream
and avoid the issue.
Change-Id: I23f6d2e909cb4de1f9b4f21eb20f9200367faddd
Signed-off-by: John Stultz <john.stultz@linaro.org>
Hannes Frederic Sowa [Mon, 18 Nov 2013 06:07:45 +0000 (07:07 +0100)]
ping: prevent NULL pointer dereference on write to msg_name
A plain read() on a socket does set msg->msg_name to NULL. So check for
NULL pointer first.
[Backport of net-next
cf970c002d270c36202bd5b9c2804d3097a52da0]
Bug:
12780426
Change-Id: I3df76aca2fa56478b9a33c404f7b1f0940475ef7
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Lorenzo Colitti [Wed, 3 Jul 2013 15:52:49 +0000 (00:52 +0900)]
net: ipv6: add missing lock in ping_v6_sendmsg
[net-next commit
a1bdc45580fc19e968b32ad27cd7e476a4aa58f6]
Bug:
12800827
Change-Id: I93d897e5043dc89bc99f111c89ef4f8b1fa1885d
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Colitti [Wed, 3 Jul 2013 15:12:40 +0000 (00:12 +0900)]
net: ipv6: fix wrong ping_v6_sendmsg return value
[net-next commit
fbfe80c890a1dc521d0b629b870e32fcffff0da5]
ping_v6_sendmsg currently returns 0 on success. It should return
the number of bytes written instead.
Bug:
12800827
Change-Id: I7ed17dc61afbb68a84908e67e44db976ec812bad
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cong Wang [Sun, 2 Jun 2013 22:43:52 +0000 (22:43 +0000)]
ping: always initialize ->sin6_scope_id and ->sin6_flowinfo
[net-next commit
c26d6b46da3ee86fa8a864347331e5513ca84c2b]
If we don't need scope id, we should initialize it to zero.
Same for ->sin6_flowinfo.
Bug:
12800827
Change-Id: Ic19792cee3f5dc30237562cf48e6bdf49817c96e
Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Acked-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Lorenzo Colitti [Wed, 22 May 2013 20:17:31 +0000 (20:17 +0000)]
net: ipv6: Add IPv6 support to the ping socket.
[net-next commit
6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67]
This adds the ability to send ICMPv6 echo requests without a
raw socket. The equivalent ability for ICMPv4 was added in
2011.
Instead of having separate code paths for IPv4 and IPv6, make
most of the code in net/ipv4/ping.c dual-stack and only add a
few IPv6-specific bits (like the protocol definition) to a new
net/ipv6/ping.c. Hopefully this will reduce divergence and/or
duplication of bugs in the future.
Caveats:
- Setting options via ancillary data (e.g., using IPV6_PKTINFO
to specify the outgoing interface) is not yet supported.
- There are no separate security settings for IPv4 and IPv6;
everything is controlled by /proc/net/ipv4/ping_group_range.
- The proc interface does not yet display IPv6 ping sockets
properly.
Tested with a patched copy of ping6 and using raw socket calls.
Compiles and works with all of CONFIG_IPV6={n,m,y}.
Bug:
12800827
Change-Id: I718cd9931823873ab44df22e8a66e12d6a0a6eb1
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
John Stultz [Thu, 30 Jan 2014 19:09:50 +0000 (11:09 -0800)]
Merge branch 'upstream/android-3.10' into linaro-fixes/android-3.10
John Stultz [Wed, 29 Jan 2014 21:00:51 +0000 (13:00 -0800)]
staging: ion: Build fix for compat_ion.c
compat_get_ion_handle_data is missing a declaration for
the return value.
This patch simply adds it, so things build.
Change-Id: I1a72a3c56975dc614322a63852f2a6554f2be107
Signed-off-by: John Stultz <john.stultz@linaro.org>
Laura Abbott [Tue, 28 Jan 2014 23:39:48 +0000 (15:39 -0800)]
ion: Fix ION_IOC_FREE compat ioctl
The compat ioctl for ION_IOC_FREE currently passes allocation data
instead of the free data. Correct this.
Change-Id: I5108a1937104b8368426f7695b4a2df416036a87
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Rom Lemarchand [Tue, 28 Jan 2014 18:23:19 +0000 (10:23 -0800)]
android: configs: update 3.10 options
Change-Id: Ifbda55e570a22ace98d7d74b057ba21a597e0826
Ashish Sharma [Thu, 16 Jan 2014 00:47:16 +0000 (16:47 -0800)]
android: configs: Add CONFIG_NETFILTER_XT_TARGET_IDLETIMER
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
(cherry picked from commit
5621df1091c7e103bca6cdd1dbecf4333efad4e7)
Change-Id: I3104266fa648fc024fee45f1ce9800142898baf7
Serban Constantinescu [Wed, 4 Dec 2013 18:09:41 +0000 (18:09 +0000)]
staging: android: binder: Add binder compat layer
This patch adds support for 32bit userspace running on 64bit kernels.
All the changes done in this patch have been tested on 32bit and 64bit
systems.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Minsung Kim [Sun, 19 Jan 2014 05:32:42 +0000 (14:32 +0900)]
cpufreq: interactive: fix NULL pointer dereference at sysfs ops
sysfs ops for target_loads and above_hispeed_delay can be called before
initializing tunables at CPUFREQ_GOV_POLICY_INIT. Create sysfs entries after
initialization.
Change-Id: I50356198d7629731c0d32a3066d61fe8354e0001
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
Greg Hackmann [Mon, 13 Jan 2014 23:24:24 +0000 (15:24 -0800)]
video: adf: define constants for device-custom ioctls
Device-custom ADF ioctls can use type ADF_IOCTL_TYPE and
nr >= ADF_IOCTL_NR_CUSTOM
Change-Id: Ia8270973df5100e996ca0e021ede60e54b9af72a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Will Deacon [Tue, 17 Sep 2013 10:46:23 +0000 (11:46 +0100)]
arm64: documentation: tighten up tagged pointer documentation
Commit
d50240a5f6ce ("arm64: mm: permit use of tagged pointers at EL0")
added support for tagged pointers in userspace, but the corresponding
update to Documentation/ contained some imprecise statements.
This patch fixes up some minor ambiguities in the text, hopefully making
it more clear about exactly what the kernel expects from user virtual
addresses.
Change-Id: I7df342e01d5253ccacb3847449940892768d7e07
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Will Deacon [Wed, 12 Jun 2013 15:28:04 +0000 (16:28 +0100)]
arm64: mm: permit use of tagged pointers at EL0
TCR.TBI0 can be used to cause hardware address translation to ignore the
top byte of userspace virtual addresses. Whilst not especially useful in
standard C programs, this can be used by JITs to `tag' pointers with
various pieces of metadata.
This patch enables this bit for AArch64 Linux, and adds a new file to
Documentation/arm64/ which describes some potential caveats when using
tagged virtual addresses.
Change-Id: I4c025d026144c69a2259b6562e46176f95b4e110
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:40 +0000 (18:09 +0000)]
staging: android: binder: Add binder compat handling to binder.h
This patch adds all the needed compat structures to binder.h. All the
structures defined in this patch mirror the structure and size of 32bit
ones.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:39 +0000 (18:09 +0000)]
staging: android: binder: Add copy_flat_binder_object()
This patch adds copy_flat_binder_object macro() that will help
dereference struct flat_binder_object on 64bit systems where the
structure differs between 32bit and 64bit userspace.
This patch is a temporary patch that will be extended with 32bit compat
handling.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:38 +0000 (18:09 +0000)]
staging: android: binder: Add size_helper() macro
This patch adds size_helper() macro that will be used for indexing into
different buffers on 64bit systems where the size of particular
structures will differ depending on the userspace used (32bit /64bit).
This patch is a temporary patch that will be extended with 32bit compat
handling.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:37 +0000 (18:09 +0000)]
staging: android: binder: Add deref_helper() macro
This patch adds a deref_helper() macro that will be used to dereference
the binder offsets on 64bit systems where the offset is either a 32bit
or a 64bit value, depending on the userpace used (32bit /64bit)
This patch is a temporary patch that will be extended with 32bit compat
handling.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:36 +0000 (18:09 +0000)]
staging: android: binder: Add align_helper() macro
This patch adds align_helper() macro that will be used for enforcing
the desired alignment on 64bit systems where the alignment will differ
depending on the userspace used (32bit /64bit).
This patch is a temporary patch that will be extended with 32bit compat
handling.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:35 +0000 (18:09 +0000)]
staging: android: binder: Add cmd == CMD_NAME handling
This patch modifies the functions that need to be passed the explicit
command to use a boolean flag. This way we can reuse the code for 64bit
compat commands.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:34 +0000 (18:09 +0000)]
staging: android: binder: Add binder_copy_to_user()
This patch adds binder_copy_to_user() to be used for copying binder
commands to user address space. This way we can abstract away the
copy_to_user() calls and add separate handling for the compat layer.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 4 Dec 2013 18:09:33 +0000 (18:09 +0000)]
staging: android: binder: Move some of the logic into subfunction
This patch moves some of the logic for binder_thread_write() into
subfunctions. This way we can share more code with the binder compat
layer.
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Thu, 16 Jan 2014 20:30:20 +0000 (12:30 -0800)]
Merge commit 'refs/changes/28/79228/1' of https://android.googlesource.com/kernel/common into linaro-fixes/android-3.10-binder-compat
Pull in Serban's syncing android-3.10 w/ upstream binder cleanups
Signed-off-by: John Stultz <john.stultz@linaro.org>
Serban Constantinescu [Wed, 15 Jan 2014 11:28:36 +0000 (11:28 +0000)]
staging: android: binder: fix ABI for 64bit Android
This patch fixes the ABI for 64bit Android userspace.
BC_REQUEST_DEATH_NOTIFICATION and BC_CLEAR_DEATH_NOTIFICATION claim
to be using struct binder_ptr_cookie, but they are using a 32bit handle
and a pointer.
On 32bit systems the payload size is the same as the size of struct
binder_ptr_cookie, however for 64bit systems this will differ. This
patch adds struct binder_handle_cookie that fixes this issue for 64bit
Android.
Since there are no 64bit users of this interface that we know of this
change should not affect any existing systems.
Change-Id: I8909cbc50aad48ccf371270bad6f69ff242a8c22
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:48 +0000 (10:54 +0100)]
staging: android: binder: fix binder interface for 64bit compat layer
The changes in this patch will fix the binder interface for use on 64bit
machines and stand as the base of the 64bit compat support. The changes
apply to the structures that are passed between the kernel and
userspace.
Most of the changes applied mirror the change to struct binder_version
where there is no need for a 64bit wide protocol_version(on 64bit
machines). The change inlines with the existing 32bit userspace(the
structure has the same size) and simplifies the compat layer such that
the same handler can service the BINDER_VERSION ioctl.
Other changes make use of kernel types as well as user-exportable ones
and fix format specifier issues.
The changes do not affect existing 32bit ABI.
Change-Id: Icccc8d47c302930cc61cddc5749b4cc74dc84117
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:47 +0000 (10:54 +0100)]
staging: android: binder: replace types with portable ones
Since this driver is meant to be used on different types of processors
and a portable driver should specify the size a variable expects to be
this patch changes the types used throughout the binder interface.
We use "userspace" types since this header will be exported and used by
the Android filesystem.
The patch does not change in any way the functionality of the binder driver.
Change-Id: Ib26daab8bc44b92d4a09badc8ecb64d37ee8773b
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:46 +0000 (10:54 +0100)]
staging: android: binder: fix alignment issues
The Android userspace aligns the data written to the binder buffers to
4bytes. Thus for 32bit platforms or 64bit platforms running an 32bit
Android userspace we can have a buffer looking like this:
platform buffer(binder_cmd pointer) size
32/32 32b 32b 8B
64/32 32b 64b 12B
64/64 32b 64b 12B
Thus the kernel needs to check that the buffer size is aligned to 4bytes
not to (void *) that will be 8bytes on 64bit machines.
The change does not affect existing 32bit ABI.
Change-Id: I7535f07301519623ea6334f525d312d687407ed4
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:45 +0000 (10:54 +0100)]
staging: android: binder: fix BC_FREE_BUFFER ioctl declaration
BinderDriverCommands mirror the ioctl usage. Thus the size of the
structure passed through the interface should be used to generate the
ioctl No.
The change reflects the type being passed from the user space-a pointer
to a binder_buffer. This change should not affect the existing 32bit
user space since BC_FREE_BUFFER is computed as:
#define _IOW(type,nr,size) \
((type) << _IOC_TYPESHIFT) | \
((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT))
and for a 32bit compiler BC_FREE_BUFFER will have the same computed
value. This change will also ease our work in differentiating
BC_FREE_BUFFER from COMPAT_BC_FREE_BUFFER.
The change does not affect existing 32bit ABI.
Change-Id: I2e0ae87bc4e913225a8eb2912913f7e3617cb575
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:44 +0000 (10:54 +0100)]
staging: android: binder: fix BINDER_SET_MAX_THREADS declaration
This change will fix the BINDER_SET_MAX_THREADS ioctl to use __u32
instead of size_t for setting the max threads. Thus using the same
handler for 32 and 64bit kernels.
This value is stored internally in struct binder_proc and set to 15
on open_binder() in the libbinder API(thus no need for a 64bit size_t
on 64bit platforms).
The change does not affect existing 32bit ABI.
Change-Id: Ibdfe10a70d475a91c247dc36e9cfd74a259d50e4
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Serban Constantinescu [Thu, 4 Jul 2013 09:54:43 +0000 (10:54 +0100)]
staging: android: binder: modify struct binder_write_read to use size_t
This change mirrors the userspace operation where struct binder_write_read
members that specify the buffer size and consumed size are size_t elements.
The patch also fixes the binder_thread_write() and binder_thread_read()
functions prototypes to conform with the definition of binder_write_read.
The changes do not affect existing 32bit ABI.
Change-Id: I987246d507b9c5e4627c62a1da971d11869ac5a0
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
Acked-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Sat, 23 Nov 2013 03:45:31 +0000 (19:45 -0800)]
ion: Add carveout and chunk heaps to dummy driver
Add support to the dummy driver for basic carveout and chunk heaps.
Since we're generating these heaps at module_init, and we want
this driver to be generic enough to be tested on any arch, we
don't have the ability to alloc bootmem, so both of these heaps
are conventionally allocated using alloc_pages(), which limits us
to 4M in size.
Should look into using CMA for heap allocation eventually, but
this provides enough to test the basic functionality of the
heaps.
Cc: Colin Cross <ccross@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Jesse Barker <jesse.barker@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Fri, 8 Nov 2013 00:08:52 +0000 (16:08 -0800)]
ion: Add dummy driver for testing
Provide a basic dummy driver to register the ion device
and to install basic SYSTEM and SYSTEM_CONTIG heaps.
This allows for basic testing with ION without having
access to drivers or systems that have been enabled to use
ION.
Cc: Colin Cross <ccross@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Jesse Barker <jesse.barker@arm.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Ajay Nandakumar [Thu, 25 Apr 2013 08:42:29 +0000 (14:12 +0530)]
Revert "PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock"
This reverts commit
11388c87d2abca1f01975ced28ce9eacea239104.
The issue is that no wake lock is held at the user space i.e by Power
Manager service.This is because the PowerManagerService fails to
acquire the Wakelock.In 3.8 the wakelock module in the kernel expects
the user process to have the capability of CAP_BLOCK_SUSPEND.Which the
powermangersevice does not have.
Bug
1274297
Bug
1384311
Change-Id: I3b696108d47278cf40abce8d5a9bd012f98f2925
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
(cherry picked from commit
e8464e785027a15279a13e6e32cd1aecd22d5a00)
Reviewed-on: http://git-master/r/282698
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
JP Abgrall [Tue, 7 Jan 2014 22:25:28 +0000 (14:25 -0800)]
android: configs: add IPV6 ROUTE INFO
Change-Id: I54cba86bce703647c4be8eee5592d55374ad02ef
Signed-off-by: JP Abgrall <jpa@google.com>
(cherry picked from commit
5e35d662616142d308ce24c9d552e469f60d8695)
John Stultz [Fri, 3 Jan 2014 04:11:06 +0000 (20:11 -0800)]
Merge branch 'upstream/android-3.10' into linaro-fixes/android-3.10
Chih-Wei Huang [Tue, 24 Dec 2013 09:51:55 +0000 (17:51 +0800)]
cpufreq: interactive: fix compiling warnings
The gcc warns like:
cpufreq_interactive.c:745:6: warning: operation on 'ret' may be undefined [-Wsequence-point]
It was introduced by commit
cf0fad49d17cb8273ce555dd5b7afab67d7923bf.
Since sprintf(...) just return 1 (one character) in this case, ret should not changed.
Just discarding the result of sprintf(...) leads to the result that
the committer of
cf0fad49d17cb8273ce555dd5b7afab67d7923bf wants.
Change-Id: Ifed1cef6d6a31c3ed23dad03a567b3b9eddf3a57
Signed-off-by: Chih-Wei Huang <cwhuang@android-x86.org>
JP Abgrall [Fri, 27 Dec 2013 23:20:32 +0000 (15:20 -0800)]
android: configs: add TIMER_STATS back, helps with sysrq t.
Change-Id: I8fe033090e38523152225dcfb7a1828f530a0757
Signed-off-by: JP Abgrall <jpa@google.com>
(cherry picked from commit
7aee29d6482954ac9fecae3ce8a90b6759158107)
Colin Cross [Fri, 20 Dec 2013 02:37:49 +0000 (18:37 -0800)]
ion: fix overflow and list bugs in system heap
Fix a few bugs in ion_system_heap:
Initialize the list node in the info block.
Don't store size_remaining in a signed long, allocating >2GB
could overflow, resulting in a call to sg_alloc_table with
nents=0 which panics. alloc_largest_available will never
return a block larger than size_remanining, so it can never
go negative.
Limit a single allocation to half of all memory. Prevents a
large allocation from taking down the whole system.
Change-Id: I7fcbd7e1d5b4d482d7612d80b6c9e8e24466f1d8
Signed-off-by: Colin Cross <ccross@android.com>
Mitchel Humpherys [Tue, 6 Aug 2013 22:08:23 +0000 (15:08 -0700)]
ion: Add private buffer flag to skip page pooling on free
Currently, when we free a buffer it might actually just go back into a
heap-specific page pool rather than going back to the system. This poses
a problem because sometimes (like when we're running a shrinker in low
memory conditions) we need to force the memory associated with the
buffer to truly be relinquished to the system rather than just going
back into a page pool.
There isn't a use case for this flag by Ion clients, so make it a
private flag. The main use case right now is to provide a mechanism for
the deferred free code to force stale buffers to bypass page pooling.
Change-Id: I724f89cc037083fe8576784363caa18a34e8705a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Mitchel Humpherys [Mon, 7 Oct 2013 16:24:29 +0000 (09:24 -0700)]
gpu: ion: make sure all clients are exposed in debugfs
Currently, if multiple Ion clients are created with the same name, only
the first one shows up in debugfs. Rectify this by adding a
monotonically-increasing serial number to the debug names of Ion
clients.
Change-Id: I000e45055d5029c7bccd88c36b238736929da3a5
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Mitchel Humpherys [Thu, 19 Dec 2013 06:10:07 +0000 (22:10 -0800)]
ion: store a copy of the client name on client creation
Currently, we copy the pointer passed in to ion_client_create without
making a copy of the string itself. This approach is problematic since
it relies on the client keeping the name string in working order.
Change-Id: I62d79c7539b2c857a5a625339d49c9c892e8622d
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Laura Abbott [Mon, 5 Dec 2011 23:32:36 +0000 (15:32 -0800)]
gpu: ion: Fix debugfs handling of multiple kernel clients
Currently, Ion registers all debugfs entries for clients
via pid. If there are multiple kernel clients, this means
the debugfs entry only gets created for the first one. Fix
this by creating debugfs entries by name always. When
creating user clients, specify the name via the pid.
Change-Id: I00cbb284d1c53b3362bb7be9c0275620a9fac167
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Mitchel Humpherys [Thu, 29 Aug 2013 22:28:58 +0000 (15:28 -0700)]
gpu: ion: create separate heap and client debugfs directories
It can be slightly annoying to figure out which files under the ion
debugfs directory are heap debug files and which ones are client debug
files. Create separate subdirectories under ion to hold the different
types of debug files.
Change-Id: Ic773ab619ef94b9b4d0f3794def9d37645c7c212
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Colin Cross [Fri, 13 Dec 2013 01:50:35 +0000 (17:50 -0800)]
ion: move shrinker out of heaps
Every heap that uses deferred frees is going to need a shrinker
to shrink the freelist under memory pressure. Rather than
requiring each heap to implement a shrinker, automatically
register a shrinker if the deferred free flag is set.
The system heap also needs to shrink its page pools, so add
a shrink function to the heap ops that will be called after
shrinking the freelists.
Change-Id: Icda722d683426fadb8ddd1c8e9499264ab682c57
Signed-off-by: Colin Cross <ccross@android.com>
John Stultz [Thu, 19 Dec 2013 23:56:23 +0000 (15:56 -0800)]
ion_test: Add compat_ioctl support (v2)
Prior to subitting this, Colin reworked the compat_ioctl support
for the ion_test driver, moving the structure to be the same size
on both 32 and 64 bit architectures.
Two small things were left out. The compat_ioctl ptr assignment,
and the fact that despite having uniform sized types in the
structure, the structure pads out to different sizes on different
arches.
This patch resolves this issue by adding a padding entry after
the write flag, and adding the compat_ioctl ptr.
Changes in v2:
- Add a padding int rather then making write a u64
Cc: Colin Cross <ccross@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
John Stultz [Wed, 18 Dec 2013 01:04:29 +0000 (17:04 -0800)]
staging: ion: Avoid using rt_mutexes directly
RT_MUTEXES can be configured out of the kernel, causing compile
problems with ION.
To quote Colin:
"rt_mutexes were added with the deferred freeing feature. Heaps need
to return zeroed memory to userspace, but zeroing the memory on every
allocation was causing performance issues. We added a SCHED_IDLE
thread to zero memory in the background after freeing, but locking the
heap from the SCHED_IDLE thread might block a high priority allocation
thread for a long time.
The lock is only used to protect the heap's free_list and
free_list_size members, and is not held for any long or sleeping
operations. Converting to a spinlock should prevent priority
inversion without using the rt_mutex. I'd also rename it to free_lock
to so it doesn't get used as a general heap lock."
Thus this patch converts the rt_mutex usage to a spinlock and
renames the lock free_lock to be more clear as to its use.
I also had to change a bit of logic in ion_heap_freelist_drain()
to safely avoid list corruption.
Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Tue, 17 Dec 2013 05:07:52 +0000 (21:07 -0800)]
staging: ion: Fix possible null pointer dereference
The kbuild test robot reported:
drivers/staging/android/ion/ion_system_heap.c:122 alloc_largest_available() error: potential null dereference 'info'. (kmalloc returns null)
Where the pointer returned from kmalloc goes unchecked for failure.
This patch checks the return for NULL, and reworks the logic, as
suggested by Colin, so we allocate the page_info structure first.
Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Tue, 17 Dec 2013 05:07:51 +0000 (21:07 -0800)]
staging: ion: Add HAVE_MEMBLOCK config dependency
The kbuild test robot reported a build issue w/ ION on m68k:
drivers/staging/android/ion/ion.c: In function 'ion_reserve':
drivers/staging/android/ion/ion.c:1526:4: error: implicit declaration of function 'memblock_alloc_base' [-Werror=implicit-function-declaration]
drivers/staging/android/ion/ion.c:1528:11: error: 'MEMBLOCK_ALLOC_ANYWHERE' undeclared (first use in this function)
drivers/staging/android/ion/ion.c:1528:11: note: each undeclared identifier is reported only once for each function it appears in
drivers/staging/android/ion/ion.c:1537:4: error: implicit declaration of function 'memblock_reserve' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
This is caused by ION using memblock functionality which m68k doesn't support.
This patch adds a HAVE_MEMBLOCK dependency to the ION config.
Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Tue, 17 Dec 2013 03:20:22 +0000 (11:20 +0800)]
gpu: ion: fix sparse non static symbol warnings
Fixes the following sparse warnings:
drivers/staging/android/ion/tegra/tegra_ion.c:23:19: warning:
symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:24:19: warning:
symbol 'tegra_user_mapper' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:25:5: warning:
symbol 'num_heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:26:17: warning:
symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:28:5: warning:
symbol 'tegra_ion_probe' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:66:5: warning:
symbol 'tegra_ion_remove' was not declared. Should it be static?
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Tue, 17 Dec 2013 03:16:41 +0000 (11:16 +0800)]
gpu: ion: use module_platform_driver to simplify the code
module_platform_driver() makes the code simpler by eliminating
boilerplate code.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Zhangfei Gao [Sun, 9 Jun 2013 03:08:32 +0000 (11:08 +0800)]
gpiolib: remove warnning of allocations with IRQs disabled
Move of_gpiochip_add outof spin_lock, since kzalloc inside
of_gpiochip_add -> of_gpiochip_add_pin_range -> gpiochip_add_pin_range -> kzalloc
WARNING: at kernel/lockdep.c:2740 lockdep_trace_alloc+0xf8/0xfc()
DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Michael Wright [Wed, 4 Dec 2013 23:23:41 +0000 (15:23 -0800)]
android: configs: Add HIDRAW to recommended set
The Logitech unifying driver depends on hidraw being available.
Recommending one without the other will cause the Logitech driver to
silently fail when connecting Logitech devices.
Change-Id: I92ed2b6803537d9da6eed7fcada8f329cb4469a2
Signed-off-by: Michael Wright <michaelwr@google.com>
Alexandre Courbot [Fri, 4 Oct 2013 17:59:57 +0000 (10:59 -0700)]
gpiolib: safer implementation of desc_to_gpio()
The current implementation of desc_to_gpio() relies on the chip pointer
to be set to a valid value in order to compute the GPIO number. This
was done in the hope that we can get rid of the gpio_desc global array,
but this is not happening anytime soon.
This patch reimplements desc_to_gpio() in a fashion similar to that of
gpio_to_desc(). As a result, desc_to_gpio(gpio_to_desc(gpio)) == gpio is
now always true. This allows to call desc_to_gpio() on non-initialized
descriptors as some error-handling code currently does.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reported-by: Dr. H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
John Stultz [Fri, 13 Dec 2013 03:09:47 +0000 (19:09 -0800)]
ion: Fix build warning
Add #include <linux/device.h> to fix the following warning seen
with gcc 4.7.3:
In file included from drivers/staging/android/ion/ion_heap.c:26:0:
drivers/staging/android/ion/ion_priv.h:358:21: warning: ‘struct device’ declared inside parameter list [enabled by default]
drivers/staging/android/ion/ion_priv.h:358:21: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
Change-Id: Icc249b32d877a5b76b1669c99bef2b05d9e322da
Signed-off-by: John Stultz <john.stultz@linaro.org>