Merge tag 'v5.2-rc3' into locking/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* audit.c -- Auditing support
|
||||
* Gateway between the kernel (e.g., selinux) and the user-space audit daemon.
|
||||
* System-call specific features have moved to auditsc.c
|
||||
@@ -5,20 +6,6 @@
|
||||
* Copyright 2003-2007 Red Hat Inc., Durham, North Carolina.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Written by Rickard E. (Rik) Faith <faith@redhat.com>
|
||||
*
|
||||
* Goals: 1) Integrate fully with Security Modules.
|
||||
|
@@ -1,22 +1,9 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/* audit -- definition of audit_context structure and supporting types
|
||||
*
|
||||
* Copyright 2003-2004 Red Hat, Inc.
|
||||
* Copyright 2005 Hewlett-Packard Development Company, L.P.
|
||||
* Copyright 2005 IBM Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
|
@@ -1,18 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* audit_fsnotify.c -- tracking inodes
|
||||
*
|
||||
* Copyright 2003-2009,2014-2015 Red Hat, Inc.
|
||||
* Copyright 2005 Hewlett-Packard Development Company, L.P.
|
||||
* Copyright 2005 IBM Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -1,22 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* audit_watch.c -- watching inodes
|
||||
*
|
||||
* Copyright 2003-2009 Red Hat, Inc.
|
||||
* Copyright 2005 Hewlett-Packard Development Company, L.P.
|
||||
* Copyright 2005 IBM Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/file.h>
|
||||
|
@@ -1,22 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* auditfilter.c -- filtering of audit events
|
||||
*
|
||||
* Copyright 2003-2004 Red Hat, Inc.
|
||||
* Copyright 2005 Hewlett-Packard Development Company, L.P.
|
||||
* Copyright 2005 IBM Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
@@ -1,8 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
@@ -1,8 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __BPF_LRU_LIST_H_
|
||||
#define __BPF_LRU_LIST_H_
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Linux Socket Filter - Kernel level socket filtering
|
||||
*
|
||||
@@ -12,11 +13,6 @@
|
||||
* Alexei Starovoitov <ast@plumgrid.com>
|
||||
* Daniel Borkmann <dborkman@redhat.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Andi Kleen - Fix a few bad bugs and races.
|
||||
* Kris Katterjohn - Added many additional checks in bpf_check_classic()
|
||||
*/
|
||||
|
@@ -1,8 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2017 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/slab.h>
|
||||
#include <linux/bpf.h>
|
||||
|
@@ -1,8 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2017 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __MAP_IN_MAP_H__
|
||||
#define __MAP_IN_MAP_H__
|
||||
|
@@ -1,8 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#include "percpu_freelist.h"
|
||||
|
||||
|
@@ -1,8 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __PERCPU_FREELIST_H__
|
||||
#define __PERCPU_FREELIST_H__
|
||||
|
@@ -1,8 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/jhash.h>
|
||||
|
@@ -1810,11 +1810,13 @@ int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node,
|
||||
|
||||
enum cgroup2_param {
|
||||
Opt_nsdelegate,
|
||||
Opt_memory_localevents,
|
||||
nr__cgroup2_params
|
||||
};
|
||||
|
||||
static const struct fs_parameter_spec cgroup2_param_specs[] = {
|
||||
fsparam_flag ("nsdelegate", Opt_nsdelegate),
|
||||
fsparam_flag("nsdelegate", Opt_nsdelegate),
|
||||
fsparam_flag("memory_localevents", Opt_memory_localevents),
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -1837,6 +1839,9 @@ static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param
|
||||
case Opt_nsdelegate:
|
||||
ctx->flags |= CGRP_ROOT_NS_DELEGATE;
|
||||
return 0;
|
||||
case Opt_memory_localevents:
|
||||
ctx->flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1848,6 +1853,11 @@ static void apply_cgroup_root_flags(unsigned int root_flags)
|
||||
cgrp_dfl_root.flags |= CGRP_ROOT_NS_DELEGATE;
|
||||
else
|
||||
cgrp_dfl_root.flags &= ~CGRP_ROOT_NS_DELEGATE;
|
||||
|
||||
if (root_flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS)
|
||||
cgrp_dfl_root.flags |= CGRP_ROOT_MEMORY_LOCAL_EVENTS;
|
||||
else
|
||||
cgrp_dfl_root.flags &= ~CGRP_ROOT_MEMORY_LOCAL_EVENTS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1855,6 +1865,8 @@ static int cgroup_show_options(struct seq_file *seq, struct kernfs_root *kf_root
|
||||
{
|
||||
if (cgrp_dfl_root.flags & CGRP_ROOT_NS_DELEGATE)
|
||||
seq_puts(seq, ",nsdelegate");
|
||||
if (cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_LOCAL_EVENTS)
|
||||
seq_puts(seq, ",memory_localevents");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6325,7 +6337,7 @@ static struct kobj_attribute cgroup_delegate_attr = __ATTR_RO(delegate);
|
||||
static ssize_t features_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "nsdelegate\n");
|
||||
return snprintf(buf, PAGE_SIZE, "nsdelegate\nmemory_localevents\n");
|
||||
}
|
||||
static struct kobj_attribute cgroup_features_attr = __ATTR_RO(features);
|
||||
|
||||
|
@@ -1,12 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* Task credentials management - see Documentation/security/credentials.rst
|
||||
*
|
||||
* Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the Licence, or (at your option) any later version.
|
||||
*/
|
||||
#include <linux/export.h>
|
||||
#include <linux/cred.h>
|
||||
|
@@ -24,7 +24,7 @@ struct ring_buffer {
|
||||
atomic_t poll; /* POLL_ for wakeups */
|
||||
|
||||
local_t head; /* write position */
|
||||
local_t nest; /* nested writers */
|
||||
unsigned int nest; /* nested writers */
|
||||
local_t events; /* event limit */
|
||||
local_t wakeup; /* wakeup stamp */
|
||||
local_t lost; /* nr records lost */
|
||||
@@ -41,7 +41,7 @@ struct ring_buffer {
|
||||
|
||||
/* AUX area */
|
||||
long aux_head;
|
||||
local_t aux_nest;
|
||||
unsigned int aux_nest;
|
||||
long aux_wakeup; /* last aux_watermark boundary crossed by aux_head */
|
||||
unsigned long aux_pgoff;
|
||||
int aux_nr_pages;
|
||||
|
@@ -38,7 +38,12 @@ static void perf_output_get_handle(struct perf_output_handle *handle)
|
||||
struct ring_buffer *rb = handle->rb;
|
||||
|
||||
preempt_disable();
|
||||
local_inc(&rb->nest);
|
||||
|
||||
/*
|
||||
* Avoid an explicit LOAD/STORE such that architectures with memops
|
||||
* can use them.
|
||||
*/
|
||||
(*(volatile unsigned int *)&rb->nest)++;
|
||||
handle->wakeup = local_read(&rb->wakeup);
|
||||
}
|
||||
|
||||
@@ -46,17 +51,35 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
|
||||
{
|
||||
struct ring_buffer *rb = handle->rb;
|
||||
unsigned long head;
|
||||
unsigned int nest;
|
||||
|
||||
/*
|
||||
* If this isn't the outermost nesting, we don't have to update
|
||||
* @rb->user_page->data_head.
|
||||
*/
|
||||
nest = READ_ONCE(rb->nest);
|
||||
if (nest > 1) {
|
||||
WRITE_ONCE(rb->nest, nest - 1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
again:
|
||||
/*
|
||||
* In order to avoid publishing a head value that goes backwards,
|
||||
* we must ensure the load of @rb->head happens after we've
|
||||
* incremented @rb->nest.
|
||||
*
|
||||
* Otherwise we can observe a @rb->head value before one published
|
||||
* by an IRQ/NMI happening between the load and the increment.
|
||||
*/
|
||||
barrier();
|
||||
head = local_read(&rb->head);
|
||||
|
||||
/*
|
||||
* IRQ/NMI can happen here, which means we can miss a head update.
|
||||
* IRQ/NMI can happen here and advance @rb->head, causing our
|
||||
* load above to be stale.
|
||||
*/
|
||||
|
||||
if (!local_dec_and_test(&rb->nest))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Since the mmap() consumer (userspace) can run on a different CPU:
|
||||
*
|
||||
@@ -84,14 +107,23 @@ again:
|
||||
* See perf_output_begin().
|
||||
*/
|
||||
smp_wmb(); /* B, matches C */
|
||||
rb->user_page->data_head = head;
|
||||
WRITE_ONCE(rb->user_page->data_head, head);
|
||||
|
||||
/*
|
||||
* Now check if we missed an update -- rely on previous implied
|
||||
* compiler barriers to force a re-read.
|
||||
* We must publish the head before decrementing the nest count,
|
||||
* otherwise an IRQ/NMI can publish a more recent head value and our
|
||||
* write will (temporarily) publish a stale value.
|
||||
*/
|
||||
barrier();
|
||||
WRITE_ONCE(rb->nest, 0);
|
||||
|
||||
/*
|
||||
* Ensure we decrement @rb->nest before we validate the @rb->head.
|
||||
* Otherwise we cannot be sure we caught the 'last' nested update.
|
||||
*/
|
||||
barrier();
|
||||
if (unlikely(head != local_read(&rb->head))) {
|
||||
local_inc(&rb->nest);
|
||||
WRITE_ONCE(rb->nest, 1);
|
||||
goto again;
|
||||
}
|
||||
|
||||
@@ -330,6 +362,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
|
||||
struct perf_event *output_event = event;
|
||||
unsigned long aux_head, aux_tail;
|
||||
struct ring_buffer *rb;
|
||||
unsigned int nest;
|
||||
|
||||
if (output_event->parent)
|
||||
output_event = output_event->parent;
|
||||
@@ -360,13 +393,16 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
|
||||
if (!refcount_inc_not_zero(&rb->aux_refcount))
|
||||
goto err;
|
||||
|
||||
nest = READ_ONCE(rb->aux_nest);
|
||||
/*
|
||||
* Nesting is not supported for AUX area, make sure nested
|
||||
* writers are caught early
|
||||
*/
|
||||
if (WARN_ON_ONCE(local_xchg(&rb->aux_nest, 1)))
|
||||
if (WARN_ON_ONCE(nest))
|
||||
goto err_put;
|
||||
|
||||
WRITE_ONCE(rb->aux_nest, nest + 1);
|
||||
|
||||
aux_head = rb->aux_head;
|
||||
|
||||
handle->rb = rb;
|
||||
@@ -394,7 +430,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle,
|
||||
if (!handle->size) { /* A, matches D */
|
||||
event->pending_disable = smp_processor_id();
|
||||
perf_output_wakeup(handle);
|
||||
local_set(&rb->aux_nest, 0);
|
||||
WRITE_ONCE(rb->aux_nest, 0);
|
||||
goto err_put;
|
||||
}
|
||||
}
|
||||
@@ -471,7 +507,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
|
||||
perf_event_aux_event(handle->event, aux_head, size,
|
||||
handle->aux_flags);
|
||||
|
||||
rb->user_page->aux_head = rb->aux_head;
|
||||
WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
|
||||
if (rb_need_aux_wakeup(rb))
|
||||
wakeup = true;
|
||||
|
||||
@@ -483,7 +519,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
|
||||
|
||||
handle->event = NULL;
|
||||
|
||||
local_set(&rb->aux_nest, 0);
|
||||
WRITE_ONCE(rb->aux_nest, 0);
|
||||
/* can't be last */
|
||||
rb_free_aux(rb);
|
||||
ring_buffer_put(rb);
|
||||
@@ -503,7 +539,7 @@ int perf_aux_output_skip(struct perf_output_handle *handle, unsigned long size)
|
||||
|
||||
rb->aux_head += size;
|
||||
|
||||
rb->user_page->aux_head = rb->aux_head;
|
||||
WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
|
||||
if (rb_need_aux_wakeup(rb)) {
|
||||
perf_output_wakeup(handle);
|
||||
handle->wakeup = rb->aux_wakeup + rb->aux_watermark;
|
||||
|
@@ -1,19 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* Rewritten by Rusty Russell, on the backs of many others...
|
||||
Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/memory.h>
|
||||
|
@@ -123,7 +123,7 @@
|
||||
unsigned long total_forks; /* Handle normal Linux uptimes. */
|
||||
int nr_threads; /* The idle threads do not count.. */
|
||||
|
||||
int max_threads; /* tunable limit on nr_threads */
|
||||
static int max_threads; /* tunable limit on nr_threads */
|
||||
|
||||
DEFINE_PER_CPU(unsigned long, process_counts) = 0;
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Fast Userspace Mutexes (which I call "Futexes!").
|
||||
* (C) Rusty Russell, IBM 2002
|
||||
@@ -29,20 +30,6 @@
|
||||
*
|
||||
* "The futexes are also cursed."
|
||||
* "But they come in a choice of three flavours!"
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <linux/compat.h>
|
||||
#include <linux/slab.h>
|
||||
|
@@ -1,21 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Kernel Probes (KProbes)
|
||||
* kernel/kprobes.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) IBM Corporation, 2002, 2004
|
||||
*
|
||||
* 2002-Oct Created by Vamsi Krishna S <vamsi_krishna@in.ibm.com> Kernel
|
||||
|
@@ -1,11 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* kernel/ksysfs.c - sysfs attributes in /sys/kernel, which
|
||||
* are not related to any other subsystem
|
||||
*
|
||||
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
|
||||
*
|
||||
* This file is release under the GPLv2
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kobject.h>
|
||||
|
@@ -30,13 +30,51 @@ enum lock_events {
|
||||
*/
|
||||
DECLARE_PER_CPU(unsigned long, lockevents[lockevent_num]);
|
||||
|
||||
/*
|
||||
* The purpose of the lock event counting subsystem is to provide a low
|
||||
* overhead way to record the number of specific locking events by using
|
||||
* percpu counters. It is the percpu sum that matters, not specifically
|
||||
* how many of them happens in each cpu.
|
||||
*
|
||||
* It is possible that the same percpu counter may be modified in both
|
||||
* the process and interrupt contexts. For architectures that perform
|
||||
* percpu operation with multiple instructions, it is possible to lose
|
||||
* count if a process context percpu update is interrupted in the middle
|
||||
* and the same counter is updated in the interrupt context. Therefore,
|
||||
* the generated percpu sum may not be precise. The error, if any, should
|
||||
* be small and insignificant.
|
||||
*
|
||||
* For those architectures that do multi-instruction percpu operation,
|
||||
* preemption in the middle and moving the task to another cpu may cause
|
||||
* a larger error in the count. Again, this will be few and far between.
|
||||
* Given the imprecise nature of the count and the possibility of resetting
|
||||
* the count and doing the measurement again, this is not really a big
|
||||
* problem.
|
||||
*
|
||||
* To get a better picture of what is happening under the hood, it is
|
||||
* suggested that a few measurements should be taken with the counts
|
||||
* reset in between to stamp out outliner because of these possible
|
||||
* error conditions.
|
||||
*
|
||||
* To minimize overhead, we use __this_cpu_*() in all cases except when
|
||||
* CONFIG_DEBUG_PREEMPT is defined. In this particular case, this_cpu_*()
|
||||
* will be used to avoid the appearance of unwanted BUG messages.
|
||||
*/
|
||||
#ifdef CONFIG_DEBUG_PREEMPT
|
||||
#define lockevent_percpu_inc(x) this_cpu_inc(x)
|
||||
#define lockevent_percpu_add(x, v) this_cpu_add(x, v)
|
||||
#else
|
||||
#define lockevent_percpu_inc(x) __this_cpu_inc(x)
|
||||
#define lockevent_percpu_add(x, v) __this_cpu_add(x, v)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Increment the PV qspinlock statistical counters
|
||||
*/
|
||||
static inline void __lockevent_inc(enum lock_events event, bool cond)
|
||||
{
|
||||
if (cond)
|
||||
__this_cpu_inc(lockevents[event]);
|
||||
lockevent_percpu_inc(lockevents[event]);
|
||||
}
|
||||
|
||||
#define lockevent_inc(ev) __lockevent_inc(LOCKEVENT_ ##ev, true)
|
||||
@@ -44,7 +82,7 @@ static inline void __lockevent_inc(enum lock_events event, bool cond)
|
||||
|
||||
static inline void __lockevent_add(enum lock_events event, int inc)
|
||||
{
|
||||
__this_cpu_add(lockevents[event], inc);
|
||||
lockevent_percpu_add(lockevents[event], inc);
|
||||
}
|
||||
|
||||
#define lockevent_add(ev, c) __lockevent_add(LOCKEVENT_ ##ev, c)
|
||||
|
@@ -1,16 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Queued read/write locks
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* Authors: Waiman Long <waiman.long@hp.com>
|
||||
|
@@ -1,16 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Queued spinlock
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
|
||||
* (C) Copyright 2013-2014,2018 Red Hat, Inc.
|
||||
* (C) Copyright 2015 Intel Corp.
|
||||
|
@@ -1,13 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Authors: Waiman Long <longman@redhat.com>
|
||||
*/
|
||||
|
@@ -1,12 +1,8 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/* Module internals
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the Licence, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/elf.h>
|
||||
|
@@ -1,20 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
Copyright (C) 2002 Richard Henderson
|
||||
Copyright (C) 2001 Rusty Russell, 2002, 2010 Rusty Russell IBM.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <linux/export.h>
|
||||
#include <linux/extable.h>
|
||||
|
@@ -1,12 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* Module signature checker
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the Licence, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -1,19 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/* Helpers for initial module or kernel cmdline parsing
|
||||
Copyright (C) 2001 Rusty Russell.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
|
@@ -129,7 +129,7 @@ static int hibernation_test(int level) { return 0; }
|
||||
static int platform_begin(int platform_mode)
|
||||
{
|
||||
return (platform_mode && hibernation_ops) ?
|
||||
hibernation_ops->begin() : 0;
|
||||
hibernation_ops->begin(PMSG_FREEZE) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,7 +542,7 @@ int hibernation_platform_enter(void)
|
||||
* hibernation_ops->finish() before saving the image, so we should let
|
||||
* the firmware know that we're going to enter the sleep state after all
|
||||
*/
|
||||
error = hibernation_ops->begin();
|
||||
error = hibernation_ops->begin(PMSG_HIBERNATE);
|
||||
if (error)
|
||||
goto Close;
|
||||
|
||||
|
@@ -1,17 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2010-2017 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
*
|
||||
* membarrier system call
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
#include "sched.h"
|
||||
|
||||
|
@@ -2485,6 +2485,8 @@ relock:
|
||||
if (signal_group_exit(signal)) {
|
||||
ksig->info.si_signo = signr = SIGKILL;
|
||||
sigdelset(¤t->pending.signal, SIGKILL);
|
||||
trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO,
|
||||
&sighand->action[SIGKILL - 1]);
|
||||
recalc_sigpending();
|
||||
goto fatal;
|
||||
}
|
||||
|
@@ -207,7 +207,7 @@ int stack_trace_save_tsk_reliable(struct task_struct *tsk, unsigned long *store,
|
||||
|
||||
ret = arch_stack_walk_reliable(consume_entry, &c, tsk);
|
||||
put_task_stack(tsk);
|
||||
return ret;
|
||||
return ret ? ret : c.len;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* kernel/stop_machine.c
|
||||
*
|
||||
@@ -5,8 +6,6 @@
|
||||
* Copyright (C) 2008, 2005 Rusty Russell rusty@rustcorp.com.au
|
||||
* Copyright (C) 2010 SUSE Linux Products GmbH
|
||||
* Copyright (C) 2010 Tejun Heo <tj@kernel.org>
|
||||
*
|
||||
* This file is released under the GPLv2 and any later version.
|
||||
*/
|
||||
#include <linux/completion.h>
|
||||
#include <linux/cpu.h>
|
||||
|
62
kernel/sys.c
62
kernel/sys.c
@@ -1882,13 +1882,14 @@ exit_err:
|
||||
}
|
||||
|
||||
/*
|
||||
* Check arithmetic relations of passed addresses.
|
||||
*
|
||||
* WARNING: we don't require any capability here so be very careful
|
||||
* in what is allowed for modification from userspace.
|
||||
*/
|
||||
static int validate_prctl_map(struct prctl_mm_map *prctl_map)
|
||||
static int validate_prctl_map_addr(struct prctl_mm_map *prctl_map)
|
||||
{
|
||||
unsigned long mmap_max_addr = TASK_SIZE;
|
||||
struct mm_struct *mm = current->mm;
|
||||
int error = -EINVAL, i;
|
||||
|
||||
static const unsigned char offsets[] = {
|
||||
@@ -1949,24 +1950,6 @@ static int validate_prctl_map(struct prctl_mm_map *prctl_map)
|
||||
prctl_map->start_data))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Someone is trying to cheat the auxv vector.
|
||||
*/
|
||||
if (prctl_map->auxv_size) {
|
||||
if (!prctl_map->auxv || prctl_map->auxv_size > sizeof(mm->saved_auxv))
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, make sure the caller has the rights to
|
||||
* change /proc/pid/exe link: only local sys admin should
|
||||
* be allowed to.
|
||||
*/
|
||||
if (prctl_map->exe_fd != (u32)-1) {
|
||||
if (!ns_capable(current_user_ns(), CAP_SYS_ADMIN))
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
out:
|
||||
return error;
|
||||
@@ -1993,11 +1976,18 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data
|
||||
if (copy_from_user(&prctl_map, addr, sizeof(prctl_map)))
|
||||
return -EFAULT;
|
||||
|
||||
error = validate_prctl_map(&prctl_map);
|
||||
error = validate_prctl_map_addr(&prctl_map);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (prctl_map.auxv_size) {
|
||||
/*
|
||||
* Someone is trying to cheat the auxv vector.
|
||||
*/
|
||||
if (!prctl_map.auxv ||
|
||||
prctl_map.auxv_size > sizeof(mm->saved_auxv))
|
||||
return -EINVAL;
|
||||
|
||||
memset(user_auxv, 0, sizeof(user_auxv));
|
||||
if (copy_from_user(user_auxv,
|
||||
(const void __user *)prctl_map.auxv,
|
||||
@@ -2010,6 +2000,14 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data
|
||||
}
|
||||
|
||||
if (prctl_map.exe_fd != (u32)-1) {
|
||||
/*
|
||||
* Make sure the caller has the rights to
|
||||
* change /proc/pid/exe link: only local sys admin should
|
||||
* be allowed to.
|
||||
*/
|
||||
if (!ns_capable(current_user_ns(), CAP_SYS_ADMIN))
|
||||
return -EINVAL;
|
||||
|
||||
error = prctl_set_mm_exe_file(mm, prctl_map.exe_fd);
|
||||
if (error)
|
||||
return error;
|
||||
@@ -2097,7 +2095,11 @@ static int prctl_set_mm(int opt, unsigned long addr,
|
||||
unsigned long arg4, unsigned long arg5)
|
||||
{
|
||||
struct mm_struct *mm = current->mm;
|
||||
struct prctl_mm_map prctl_map;
|
||||
struct prctl_mm_map prctl_map = {
|
||||
.auxv = NULL,
|
||||
.auxv_size = 0,
|
||||
.exe_fd = -1,
|
||||
};
|
||||
struct vm_area_struct *vma;
|
||||
int error;
|
||||
|
||||
@@ -2125,9 +2127,15 @@ static int prctl_set_mm(int opt, unsigned long addr,
|
||||
|
||||
error = -EINVAL;
|
||||
|
||||
down_write(&mm->mmap_sem);
|
||||
/*
|
||||
* arg_lock protects concurent updates of arg boundaries, we need
|
||||
* mmap_sem for a) concurrent sys_brk, b) finding VMA for addr
|
||||
* validation.
|
||||
*/
|
||||
down_read(&mm->mmap_sem);
|
||||
vma = find_vma(mm, addr);
|
||||
|
||||
spin_lock(&mm->arg_lock);
|
||||
prctl_map.start_code = mm->start_code;
|
||||
prctl_map.end_code = mm->end_code;
|
||||
prctl_map.start_data = mm->start_data;
|
||||
@@ -2139,9 +2147,6 @@ static int prctl_set_mm(int opt, unsigned long addr,
|
||||
prctl_map.arg_end = mm->arg_end;
|
||||
prctl_map.env_start = mm->env_start;
|
||||
prctl_map.env_end = mm->env_end;
|
||||
prctl_map.auxv = NULL;
|
||||
prctl_map.auxv_size = 0;
|
||||
prctl_map.exe_fd = -1;
|
||||
|
||||
switch (opt) {
|
||||
case PR_SET_MM_START_CODE:
|
||||
@@ -2181,7 +2186,7 @@ static int prctl_set_mm(int opt, unsigned long addr,
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = validate_prctl_map(&prctl_map);
|
||||
error = validate_prctl_map_addr(&prctl_map);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
@@ -2218,7 +2223,8 @@ static int prctl_set_mm(int opt, unsigned long addr,
|
||||
|
||||
error = 0;
|
||||
out:
|
||||
up_write(&mm->mmap_sem);
|
||||
spin_unlock(&mm->arg_lock);
|
||||
up_read(&mm->mmap_sem);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@@ -1,19 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* taskstats.c - Export per-task statistics to userland
|
||||
*
|
||||
* Copyright (C) Shailabh Nagar, IBM Corp. 2006
|
||||
* (C) Balbir Singh, IBM Corp. 2006
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -8910,12 +8910,8 @@ void ftrace_dump(enum ftrace_dump_mode oops_dump_mode)
|
||||
|
||||
cnt++;
|
||||
|
||||
/* reset all but tr, trace, and overruns */
|
||||
memset(&iter.seq, 0,
|
||||
sizeof(struct trace_iterator) -
|
||||
offsetof(struct trace_iterator, seq));
|
||||
trace_iterator_reset(&iter);
|
||||
iter.iter_flags |= TRACE_FILE_LAT_FMT;
|
||||
iter.pos = -1;
|
||||
|
||||
if (trace_find_next_entry_inc(&iter) != NULL) {
|
||||
int ret;
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include <linux/trace_seq.h>
|
||||
#include <linux/trace_events.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/trace_seq.h>
|
||||
#include <linux/glob.h>
|
||||
|
||||
#ifdef CONFIG_FTRACE_SYSCALLS
|
||||
@@ -1967,4 +1966,22 @@ static inline void tracer_hardirqs_off(unsigned long a0, unsigned long a1) { }
|
||||
|
||||
extern struct trace_iterator *tracepoint_print_iter;
|
||||
|
||||
/*
|
||||
* Reset the state of the trace_iterator so that it can read consumed data.
|
||||
* Normally, the trace_iterator is used for reading the data when it is not
|
||||
* consumed, and must retain state.
|
||||
*/
|
||||
static __always_inline void trace_iterator_reset(struct trace_iterator *iter)
|
||||
{
|
||||
const size_t offset = offsetof(struct trace_iterator, seq);
|
||||
|
||||
/*
|
||||
* Keep gcc from complaining about overwriting more than just one
|
||||
* member in the structure.
|
||||
*/
|
||||
memset((char *)iter + offset, 0, sizeof(struct trace_iterator) - offset);
|
||||
|
||||
iter->pos = -1;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_KERNEL_TRACE_H */
|
||||
|
@@ -428,7 +428,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
|
||||
op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL);
|
||||
if (!op_stack)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
prog_stack = kmalloc_array(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
|
||||
prog_stack = kcalloc(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
|
||||
if (!prog_stack) {
|
||||
parse_error(pe, -ENOMEM, 0);
|
||||
goto out_free;
|
||||
@@ -579,7 +579,11 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
|
||||
out_free:
|
||||
kfree(op_stack);
|
||||
kfree(inverts);
|
||||
kfree(prog_stack);
|
||||
if (prog_stack) {
|
||||
for (i = 0; prog_stack[i].pred; i++)
|
||||
kfree(prog_stack[i].pred);
|
||||
kfree(prog_stack);
|
||||
}
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@
|
||||
C(NO_CLOSING_PAREN, "No closing paren found"), \
|
||||
C(SUBSYS_NOT_FOUND, "Missing subsystem"), \
|
||||
C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"), \
|
||||
C(INVALID_REF_KEY, "Using variable references as keys not supported"), \
|
||||
C(INVALID_REF_KEY, "Using variable references in keys not supported"), \
|
||||
C(VAR_NOT_FOUND, "Couldn't find variable"), \
|
||||
C(FIELD_NOT_FOUND, "Couldn't find field"),
|
||||
|
||||
@@ -1854,6 +1854,9 @@ static u64 hist_field_var_ref(struct hist_field *hist_field,
|
||||
struct hist_elt_data *elt_data;
|
||||
u64 var_val = 0;
|
||||
|
||||
if (WARN_ON_ONCE(!elt))
|
||||
return var_val;
|
||||
|
||||
elt_data = elt->private_data;
|
||||
var_val = elt_data->var_ref_vals[hist_field->var_ref_idx];
|
||||
|
||||
@@ -3582,14 +3585,20 @@ static bool cond_snapshot_update(struct trace_array *tr, void *cond_data)
|
||||
struct track_data *track_data = tr->cond_snapshot->cond_data;
|
||||
struct hist_elt_data *elt_data, *track_elt_data;
|
||||
struct snapshot_context *context = cond_data;
|
||||
struct action_data *action;
|
||||
u64 track_val;
|
||||
|
||||
if (!track_data)
|
||||
return false;
|
||||
|
||||
action = track_data->action_data;
|
||||
|
||||
track_val = get_track_val(track_data->hist_data, context->elt,
|
||||
track_data->action_data);
|
||||
|
||||
if (!action->track_data.check_val(track_data->track_val, track_val))
|
||||
return false;
|
||||
|
||||
track_data->track_val = track_val;
|
||||
memcpy(track_data->key, context->key, track_data->key_len);
|
||||
|
||||
@@ -4503,7 +4512,7 @@ static int create_key_field(struct hist_trigger_data *hist_data,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (hist_field->flags & HIST_FIELD_FL_VAR_REF) {
|
||||
if (field_has_hist_vars(hist_field, 0)) {
|
||||
hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str));
|
||||
destroy_hist_field(hist_field, 0);
|
||||
ret = -EINVAL;
|
||||
|
@@ -37,12 +37,8 @@ static void ftrace_dump_buf(int skip_entries, long cpu_file)
|
||||
if (skip_entries)
|
||||
kdb_printf("(skipping %d entries)\n", skip_entries);
|
||||
|
||||
/* reset all but tr, trace, and overruns */
|
||||
memset(&iter.seq, 0,
|
||||
sizeof(struct trace_iterator) -
|
||||
offsetof(struct trace_iterator, seq));
|
||||
trace_iterator_reset(&iter);
|
||||
iter.iter_flags |= TRACE_FILE_LAT_FMT;
|
||||
iter.pos = -1;
|
||||
|
||||
if (cpu_file == RING_BUFFER_ALL_CPUS) {
|
||||
for_each_tracing_cpu(cpu) {
|
||||
|
@@ -1,19 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2008-2014 Mathieu Desnoyers
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
|
@@ -1,19 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* tsacct.c - System accounting over taskstats interface
|
||||
*
|
||||
* Copyright (C) Jay Lan, <jlan@sgi.com>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
Reference in New Issue
Block a user