mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
Merge branch android-common-3.10
This commit is contained in:
commit
e82146650e
|
|
@ -3598,13 +3598,24 @@ static int binder_transactions_show(struct seq_file *m, void *unused)
|
|||
|
||||
static int binder_proc_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_proc *itr;
|
||||
struct binder_proc *proc = m->private;
|
||||
int do_lock = !binder_debug_no_lock;
|
||||
bool valid_proc = false;
|
||||
|
||||
if (do_lock)
|
||||
binder_lock(__func__);
|
||||
seq_puts(m, "binder proc state:\n");
|
||||
print_binder_proc(m, proc, 1);
|
||||
|
||||
hlist_for_each_entry(itr, &binder_procs, proc_node) {
|
||||
if (itr == proc) {
|
||||
valid_proc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valid_proc) {
|
||||
seq_puts(m, "binder proc state:\n");
|
||||
print_binder_proc(m, proc, 1);
|
||||
}
|
||||
if (do_lock)
|
||||
binder_unlock(__func__);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ static LIST_HEAD(wakeup_sources);
|
|||
|
||||
static DECLARE_WAIT_QUEUE_HEAD(wakeup_count_wait_queue);
|
||||
|
||||
static ktime_t last_read_time;
|
||||
|
||||
/**
|
||||
* wakeup_source_prepare - Prepare a new wakeup source for initialization.
|
||||
* @ws: Wakeup source to prepare.
|
||||
|
|
@ -343,6 +345,20 @@ int device_set_wakeup_enable(struct device *dev, bool enable)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(device_set_wakeup_enable);
|
||||
|
||||
/**
|
||||
* wakeup_source_not_registered - validate the given wakeup source.
|
||||
* @ws: Wakeup source to be validated.
|
||||
*/
|
||||
static bool wakeup_source_not_registered(struct wakeup_source *ws)
|
||||
{
|
||||
/*
|
||||
* Use timer struct to check if the given source is initialized
|
||||
* by wakeup_source_add.
|
||||
*/
|
||||
return ws->timer.function != pm_wakeup_timer_fn ||
|
||||
ws->timer.data != (unsigned long)ws;
|
||||
}
|
||||
|
||||
/*
|
||||
* The functions below use the observation that each wakeup event starts a
|
||||
* period in which the system should not be suspended. The moment this period
|
||||
|
|
@ -383,6 +399,10 @@ static void wakeup_source_activate(struct wakeup_source *ws)
|
|||
{
|
||||
unsigned int cec;
|
||||
|
||||
if (WARN(wakeup_source_not_registered(ws),
|
||||
"unregistered wakeup source\n"))
|
||||
return;
|
||||
|
||||
/*
|
||||
* active wakeup source should bring the system
|
||||
* out of PM_SUSPEND_FREEZE state
|
||||
|
|
@ -760,10 +780,15 @@ bool pm_wakeup_pending(void)
|
|||
bool pm_get_wakeup_count(unsigned int *count, bool block)
|
||||
{
|
||||
unsigned int cnt, inpr;
|
||||
unsigned long flags;
|
||||
|
||||
if (block) {
|
||||
DEFINE_WAIT(wait);
|
||||
|
||||
spin_lock_irqsave(&events_lock, flags);
|
||||
last_read_time = ktime_get();
|
||||
spin_unlock_irqrestore(&events_lock, flags);
|
||||
|
||||
for (;;) {
|
||||
prepare_to_wait(&wakeup_count_wait_queue, &wait,
|
||||
TASK_INTERRUPTIBLE);
|
||||
|
|
@ -795,6 +820,7 @@ bool pm_save_wakeup_count(unsigned int count)
|
|||
{
|
||||
unsigned int cnt, inpr;
|
||||
unsigned long flags;
|
||||
struct wakeup_source *ws;
|
||||
|
||||
events_check_enabled = false;
|
||||
spin_lock_irqsave(&events_lock, flags);
|
||||
|
|
@ -802,6 +828,15 @@ bool pm_save_wakeup_count(unsigned int count)
|
|||
if (cnt == count && inpr == 0) {
|
||||
saved_count = count;
|
||||
events_check_enabled = true;
|
||||
} else {
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
|
||||
if (ws->active ||
|
||||
ktime_compare(ws->last_time, last_read_time) > 0) {
|
||||
ws->wakeup_count++;
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
spin_unlock_irqrestore(&events_lock, flags);
|
||||
return events_check_enabled;
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ static int __init proc_uid_cputime_init(void)
|
|||
proc_create_data("remove_uid_range", S_IWUGO, parent, &uid_remove_fops,
|
||||
NULL);
|
||||
|
||||
proc_create_data("show_uid_stat", S_IWUGO, parent, &uid_stat_fops,
|
||||
proc_create_data("show_uid_stat", S_IRUGO, parent, &uid_stat_fops,
|
||||
NULL);
|
||||
|
||||
profile_event_register(PROFILE_TASK_EXIT, &process_notifier_block);
|
||||
|
|
|
|||
|
|
@ -305,6 +305,8 @@ static void __save_error_info(struct super_block *sb, const char *func,
|
|||
struct ext4_super_block *es = EXT4_SB(sb)->s_es;
|
||||
|
||||
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
|
||||
if (bdev_read_only(sb->s_bdev))
|
||||
return;
|
||||
es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
|
||||
es->s_last_error_time = cpu_to_le32(get_seconds());
|
||||
strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
|
||||
|
|
|
|||
|
|
@ -224,10 +224,11 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
|
|||
if (!(suspend_test(TEST_CORE) || *wakeup)) {
|
||||
error = suspend_ops->enter(state);
|
||||
events_check_enabled = false;
|
||||
} else {
|
||||
} else if (*wakeup) {
|
||||
pm_get_active_wakeup_sources(suspend_abort,
|
||||
MAX_SUSPEND_ABORT_LEN);
|
||||
log_suspend_abort_reason(suspend_abort);
|
||||
error = -EBUSY;
|
||||
}
|
||||
syscore_resume();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,6 +332,10 @@ static long caif_stream_data_wait(struct sock *sk, long timeo)
|
|||
release_sock(sk);
|
||||
timeo = schedule_timeout(timeo);
|
||||
lock_sock(sk);
|
||||
|
||||
if (sock_flag(sk, SOCK_DEAD))
|
||||
break;
|
||||
|
||||
clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
|
||||
}
|
||||
|
||||
|
|
@ -376,6 +380,10 @@ static int caif_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
|
|||
struct sk_buff *skb;
|
||||
|
||||
lock_sock(sk);
|
||||
if (sock_flag(sk, SOCK_DEAD)) {
|
||||
err = -ECONNRESET;
|
||||
goto unlock;
|
||||
}
|
||||
skb = skb_dequeue(&sk->sk_receive_queue);
|
||||
caif_check_flow_release(sk);
|
||||
|
||||
|
|
|
|||
|
|
@ -928,6 +928,7 @@ static void neigh_timer_handler(unsigned long arg)
|
|||
neigh->nud_state = NUD_PROBE;
|
||||
neigh->updated = jiffies;
|
||||
atomic_set(&neigh->probes, 0);
|
||||
notify = 1;
|
||||
next = now + neigh->parms->retrans_time;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1155,6 +1156,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
|
|||
|
||||
if (new != old) {
|
||||
neigh_del_timer(neigh);
|
||||
if (new & NUD_PROBE)
|
||||
atomic_set(&neigh->probes, 0);
|
||||
if (new & NUD_IN_TIMER)
|
||||
neigh_add_timer(neigh, (jiffies +
|
||||
((new & NUD_REACHABLE) ?
|
||||
|
|
|
|||
|
|
@ -1899,6 +1899,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo,
|
|||
unix_state_unlock(sk);
|
||||
timeo = freezable_schedule_timeout(timeo);
|
||||
unix_state_lock(sk);
|
||||
|
||||
if (sock_flag(sk, SOCK_DEAD))
|
||||
break;
|
||||
|
||||
clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
|
||||
}
|
||||
|
||||
|
|
@ -1958,6 +1962,10 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
|
|||
struct sk_buff *skb, *last;
|
||||
|
||||
unix_state_lock(sk);
|
||||
if (sock_flag(sk, SOCK_DEAD)) {
|
||||
err = -ECONNRESET;
|
||||
goto unlock;
|
||||
}
|
||||
last = skb = skb_peek(&sk->sk_receive_queue);
|
||||
again:
|
||||
if (skb == NULL) {
|
||||
|
|
|
|||
|
|
@ -699,7 +699,12 @@ static int selinux_set_mnt_opts(struct super_block *sb,
|
|||
}
|
||||
|
||||
if (strcmp(sb->s_type->name, "proc") == 0)
|
||||
sbsec->flags |= SE_SBPROC;
|
||||
sbsec->flags |= SE_SBPROC | SE_SBGENFS;
|
||||
|
||||
if (!strcmp(sb->s_type->name, "debugfs") ||
|
||||
!strcmp(sb->s_type->name, "sysfs") ||
|
||||
!strcmp(sb->s_type->name, "pstore"))
|
||||
sbsec->flags |= SE_SBGENFS;
|
||||
|
||||
/* Determine the labeling behavior to use for this filesystem type. */
|
||||
rc = security_fs_use((sbsec->flags & SE_SBPROC) ? "proc" : sb->s_type->name, &sbsec->behavior, &sbsec->sid);
|
||||
|
|
@ -1184,12 +1189,13 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
|
|||
return SECCLASS_SOCKET;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static int selinux_proc_get_sid(struct dentry *dentry,
|
||||
u16 tclass,
|
||||
u32 *sid)
|
||||
static int selinux_genfs_get_sid(struct dentry *dentry,
|
||||
u16 tclass,
|
||||
u16 flags,
|
||||
u32 *sid)
|
||||
{
|
||||
int rc;
|
||||
struct super_block *sb = dentry->d_inode->i_sb;
|
||||
char *buffer, *path;
|
||||
|
||||
buffer = (char *)__get_free_page(GFP_KERNEL);
|
||||
|
|
@ -1200,26 +1206,20 @@ static int selinux_proc_get_sid(struct dentry *dentry,
|
|||
if (IS_ERR(path))
|
||||
rc = PTR_ERR(path);
|
||||
else {
|
||||
/* each process gets a /proc/PID/ entry. Strip off the
|
||||
* PID part to get a valid selinux labeling.
|
||||
* e.g. /proc/1/net/rpc/nfs -> /net/rpc/nfs */
|
||||
while (path[1] >= '0' && path[1] <= '9') {
|
||||
path[1] = '/';
|
||||
path++;
|
||||
if (flags & SE_SBPROC) {
|
||||
/* each process gets a /proc/PID/ entry. Strip off the
|
||||
* PID part to get a valid selinux labeling.
|
||||
* e.g. /proc/1/net/rpc/nfs -> /net/rpc/nfs */
|
||||
while (path[1] >= '0' && path[1] <= '9') {
|
||||
path[1] = '/';
|
||||
path++;
|
||||
}
|
||||
}
|
||||
rc = security_genfs_sid("proc", path, tclass, sid);
|
||||
rc = security_genfs_sid(sb->s_type->name, path, tclass, sid);
|
||||
}
|
||||
free_page((unsigned long)buffer);
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
static int selinux_proc_get_sid(struct dentry *dentry,
|
||||
u16 tclass,
|
||||
u32 *sid)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The inode's security attributes must be initialized before first use. */
|
||||
static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry)
|
||||
|
|
@ -1374,7 +1374,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
|
|||
/* Default to the fs superblock SID. */
|
||||
isec->sid = sbsec->sid;
|
||||
|
||||
if ((sbsec->flags & SE_SBPROC) && !S_ISLNK(inode->i_mode)) {
|
||||
if ((sbsec->flags & SE_SBGENFS) && !S_ISLNK(inode->i_mode)) {
|
||||
/* We must have a dentry to determine the label on
|
||||
* procfs inodes */
|
||||
if (opt_dentry)
|
||||
|
|
@ -1397,7 +1397,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
|
|||
if (!dentry)
|
||||
goto out_unlock;
|
||||
isec->sclass = inode_mode_to_security_class(inode->i_mode);
|
||||
rc = selinux_proc_get_sid(dentry, isec->sclass, &sid);
|
||||
rc = selinux_genfs_get_sid(dentry, isec->sclass,
|
||||
sbsec->flags, &sid);
|
||||
dput(dentry);
|
||||
if (rc)
|
||||
goto out_unlock;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#define SE_SBINITIALIZED 0x10
|
||||
#define SE_SBPROC 0x20
|
||||
#define SE_SBLABELSUPP 0x40
|
||||
#define SE_SBGENFS 0x80
|
||||
|
||||
#define CONTEXT_STR "context="
|
||||
#define FSCONTEXT_STR "fscontext="
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user