new and improved kernel build

This commit is contained in:
Bruce Leidl 2019-09-20 17:55:12 -04:00
parent 0f50387d1e
commit e69cb5ba1a
26 changed files with 8180 additions and 3148 deletions

3
kernel/.gitignore vendored
View File

@ -1,3 +1,4 @@
downloads/
build/
.work/
linux-*/
ph_linux*

View File

@ -1,126 +1,82 @@
LINUX_VERSION = 4.9.56
MINIPLI_TAG = 20171013093040
MINIPLI_VERSION = v$(LINUX_VERSION)-unofficial_grsec
MINIPLI_PATH = linux-unofficial_grsec/releases/download/$(MINIPLI_VERSION)
GRSEC_DIFF = $(MINIPLI_VERSION)-$(MINIPLI_TAG).diff
GRSEC_DOWNLOAD = https://github.com/minipli/$(MINIPLI_PATH)/$(GRSEC_DIFF)
LINUX_VERSION = 5.3
KERNEL_VERSION = linux-$(LINUX_VERSION)
KERNEL_DOWNLOAD = https://cdn.kernel.org/pub/linux/kernel/v4.x/$(KERNEL_VERSION)
WGET = wget
SHA256 = sha256sum
TAR = tar
PATCH = patch
LN = ln
CP = cp
MV = mv
RM = rm
RMDIR = rmdir
MKDIR = mkdir
TOUCH = touch
GPG = gpg
TOUCH = touch
UNXZ = unxz
KERNEL_DOWNLOAD = https://cdn.kernel.org/pub/linux/kernel/v5.x/$(KERNEL_VERSION)
PWD = $(shell pwd)
NPROC = $(shell nproc)
PATCH_FILES := $(shell find patches/ -name "00*.patch" | sort)
PATCH_SENTINEL = build/.patches_applied
GRSEC_DL_PATH = downloads/$(GRSEC_DIFF)
KERNEL_DL_PATH = downloads/$(KERNEL_VERSION).tar
KERNEL_BUILD_PATH = build/$(KERNEL_VERSION)
KERNEL_UNPACK_PATH = build/.unpack/$(KERNEL_VERSION)
KERNEL_BUILD_PATH = $(KERNEL_VERSION)
KERNEL_BUILD_OUTPUT = $(KERNEL_BUILD_PATH)/vmlinux
PH_LINUX = ph_linux
PH_LINUX_VER = $(PH_LINUX)-$(LINUX_VERSION)
GPGTMP = verify-tmp/
GPGOPTS = --homedir $(GPGTMP) --trust-model direct --no-autostart
GPG_IMPORT = $(GPG) $(GPGOPTS) --import
GPG_VERIFY = $(GPG) $(GPGOPTS) --verify
SHA256_FILE = v$(KERNEL_VERSION).sha256
SHA256_SENTINEL = build/.sha256-verififed
$(shell mkdir -p downloads)
$(shell mkdir -p build)
$(shell mkdir -p .work)
.NOTPARALLEL:
SHA256_SENTINEL = .work/.sha256-verififed
.PHONY: all gen-sha256
all: $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
$(GRSEC_DL_PATH):
cd downloads; $(WGET) $(GRSEC_DOWNLOAD)
cd downloads; $(WGET) $(GRSEC_DOWNLOAD).sig
$(KERNEL_DL_PATH):
cd downloads; $(WGET) $(KERNEL_DOWNLOAD).tar.xz
cd downloads; $(UNXZ) $(KERNEL_VERSION).tar.xz
cd downloads; $(WGET) $(KERNEL_DOWNLOAD).tar.sign
cd downloads; wget $(KERNEL_DOWNLOAD).tar.xz
cd downloads; unxz $(KERNEL_VERSION).tar.xz
cd downloads; wget $(KERNEL_DOWNLOAD).tar.sign
$(KERNEL_BUILD_PATH): $(KERNEL_DL_PATH) $(GRSEC_DL_PATH) $(SHA256_SENTINEL)
$(RM) -rf build/.unpack
$(MKDIR) -p build/.unpack
$(TAR) -C build/.unpack -xvf downloads/$(KERNEL_VERSION).tar
$(PATCH) -p1 -d $(KERNEL_UNPACK_PATH) < $(GRSEC_DL_PATH)
$(CP) config $(KERNEL_UNPACK_PATH)/.config
$(MV) $(KERNEL_UNPACK_PATH) build/
$(RM) -rf build/.unpack
$(PATCH_SENTINEL): | $(KERNEL_BUILD_PATH)
for p in $(PATCH_FILES); do $(PATCH) -p1 -d build/$(KERNEL_VERSION) < "$$p"; done
$(TOUCH) $@
$(KERNEL_BUILD_PATH): $(KERNEL_DL_PATH) $(SHA256_SENTINEL)
rm -rf .work/$(KERNEL_VERSION)
tar -C .work -xf downloads/$(KERNEL_VERSION).tar
for p in $(PATCH_FILES); do patch -p1 -d .work/$(KERNEL_VERSION) < "$$p"; done
cp config .work/$(KERNEL_VERSION)/.config
rm -rf ./$(KERNEL_VERSION)
mv .work/$(KERNEL_VERSION) .
#$(PATCH_SENTINEL): | $(KERNEL_BUILD_PATH)
# for p in $(PATCH_FILES); do patch -p1 -d $(KERNEL_VERSION) < "$$p"; done
# touch $@
$(PH_LINUX_VER): $(KERNEL_BUILD_OUTPUT)
$(RM) -f $(PH_LINUX)
$(CP) $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
$(LN) -s $(PWD)/$(PH_LINUX_VER) $(PH_LINUX)
rm -f $(PH_LINUX)
cp $(KERNEL_BUILD_OUTPUT) $(PH_LINUX_VER)
strip $(PH_LINUX_VER)
ln -s $(PWD)/$(PH_LINUX_VER) $(PH_LINUX)
$(KERNEL_BUILD_OUTPUT): $(PATCH_SENTINEL)
$(MAKE) -C build/$(KERNEL_VERSION)
$(KERNEL_BUILD_OUTPUT): $(KERNEL_BUILD_PATH)
cd $(KERNEL_VERSION); make -j$(NPROC)
clean:
$(RM) -rf $(KERNEL_BUILD_PATH) $(SHA256_SENTINEL) $(PATCH_SENTINEL) $(PH_LINUX_VER)
$(SHA256_SENTINEL): $(KERNEL_DL_PATH) $(GRSEC_DL_PATH)
$(SHA256) -c v$(LINUX_VERSION).sha256
$(TOUCH) $@
rm -rf $(KERNEL_BUILD_PATH) $(SHA256_SENTINEL) $(PH_LINUX_VER) $(PH_LINUX) .work
$(SHA256_SENTINEL): $(KERNEL_DL_PATH)
sha256sum -c v$(LINUX_VERSION).sha256
touch $@
gen-sha256: $(SHA256_FILE)
$(GRSEC_DL_PATH).verify: $(GRSEC_DL_PATH)
rm -rf $(GPGTMP)
$(MKDIR) -m 0700 $(GPGTMP)
$(GPG_IMPORT) < keys/minipli.key
$(GPG_VERIFY) downloads/$(GRSEC_DIFF).sig $(GRSEC_DL_PATH) 2> .out
mv .out $(GRSEC_DL_PATH).verify
rm -rf $(GPGTMP)
GPGTMP = verify-tmp/
GPGOPTS = --homedir $(GPGTMP) --trust-model direct --no-autostart
GPG_IMPORT = gpg $(GPGOPTS) --import
GPG_VERIFY = gpg $(GPGOPTS) --verify
$(KERNEL_DL_PATH).verify: $(KERNEL_DL_PATH)
rm -rf $(GPGTMP)
$(MKDIR) -m 0700 $(GPGTMP)
mkdir -m 0700 $(GPGTMP)
$(GPG_IMPORT) < keys/torvalds.key
$(GPG_IMPORT) < keys/gregkh.key
$(GPG_VERIFY) downloads/$(KERNEL_VERSION).tar.sign $(KERNEL_DL_PATH) 2> .out
mv .out $(KERNEL_DL_PATH).verify
rm -rf $(GPGTMP)
$(SHA256_FILE): $(KERNEL_DL_PATH).verify $(GRSEC_DL_PATH).verify
$(SHA256) $(KERNEL_DL_PATH) $(GRSEC_DL_PATH) > v$(LINUX_VERSION).sha256
$(SHA256_FILE): $(KERNEL_DL_PATH).verify
sha256sum $(KERNEL_DL_PATH) > v$(LINUX_VERSION).sha256

File diff suppressed because it is too large Load Diff

View File

@ -1,88 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.6
Comment: Hostname: pgp.mit.edu
mQINBE7f0lwBEAC8xd/vF0Tkh5hPrUy55U98Pi4bJf93PFCovSis+qiInCrQ+WE3Ni32ZYun
pjOE/QpNZBw/RmiFROZXBw+H/u2LwYNotLzjGcNxZ9jlOr/w/RXTU5pR1WBjYmyvLssy+YZ0
lMXezfG2QjZIpiTJh9eEicl+QPIJFBNm13wZv+b54oG6xTPl4BX3ri01+OAuSTkro40qD2LG
gz8+SqQNKzApfOuk6FEzAsb2ySp+CNdmJVhRMGIQldeqYezkRDJB7u9bD+85bgmC+0f4y+4/
1CShXtbpdF1Z+cX9RQ9bULetheYHAHycyFGKyaN/KLhptnjEsCQzebRFjy9ZAxZS2KnZXqre
1oUGQ3vl+3wr9X//hfuD7zJCUusc8ptLgRyHSHwat7OqTL38tA+InwkNvFVwQNP4UNwLIrqw
FoEQOhRFjY7ahW9+0Skqvt7XtZz3uzI32o+3XdYXfxfiiXJZylUuZv8ZqYXFNri6Xu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bPiP
-----END PGP PUBLIC KEY BLOCK-----

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
From e86a8d2060f5551bc3bbb1621cce206954340cc1 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 11 Feb 2015 16:19:26 -0600
Subject: [PATCH 02/22] cpuidle: skip synchronize_rcu() on single CPU systems
synchronize_rcu() is pretty expensive, and on single CPU systems we don't need
it in this specific case, so skip it.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
drivers/cpuidle/cpuidle.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index c73207ab..224cefc0 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -307,8 +307,11 @@ void cpuidle_uninstall_idle_handler(void)
/*
* Make sure external observers (such as the scheduler)
* are done looking at pointed idle states.
+ * This is only relevant if there is more than one cpu,
+ * if there is only one CPU, that is us... and we're
+ * coherent to ourselves.
*/
- synchronize_rcu();
+
}
/**
--
2.11.0

View File

@ -1,38 +0,0 @@
From 7b5447090b8fbb80a85320c880934f35acbf68a7 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 11 Feb 2015 16:25:16 -0600
Subject: [PATCH 03/22] sysrq: skip synchronize_rcu() if there is no old op
synchronize_rcu() is expensive. Currently it is called as part of the sysrq
registration/unregistration, which happens during boot several times.
Now, the reason for the synchronize_rcu() is to allow an old registered
operation to expire properly... which is pointless if the old operation
is NULL...
So we can save the common case of the old operation being NULL a lot of time
by just checking for non-NULL prior to the synchronize_rcu()
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
drivers/tty/sysrq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 701c085b..c60c7ba5 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -1065,8 +1065,10 @@ static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p,
* A concurrent __handle_sysrq either got the old op or the new op.
* Wait for it to go away before returning, so the code for an old
* op is not freed (eg. on module unload) while it is in use.
+ * This is only relevant if the old op is not NULL of course.
*/
- synchronize_rcu();
+ if (remove_op_p)
+ synchronize_rcu();
return retval;
}
--
2.11.0

View File

@ -1,28 +0,0 @@
From 43e288fed0ccb8bf17cfea69d032425e6d224b96 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 11 Feb 2015 16:47:20 -0600
Subject: [PATCH 05/22] vmstats: wakeups
Author: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
mm/vmstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 604f26a4..bfbbcd76 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1549,7 +1549,7 @@ static const struct file_operations proc_vmstat_file_operations = {
#ifdef CONFIG_SMP
static struct workqueue_struct *vmstat_wq;
static DEFINE_PER_CPU(struct delayed_work, vmstat_work);
-int sysctl_stat_interval __read_mostly = HZ;
+int sysctl_stat_interval __read_mostly = 8 * HZ;
#ifdef CONFIG_PROC_FS
static void refresh_vm_stats(struct work_struct *work)
--
2.11.0

View File

@ -1,123 +0,0 @@
From 9c7e56e2621a12943055442a2b4b963ee1604e4a Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 11 Feb 2015 16:53:08 -0600
Subject: [PATCH 06/22] pci: probe
Author: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
drivers/pci/probe.c | 43 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index d266d800..73ebc222 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -182,6 +182,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
+ res->name = pci_name(dev);
+
+ printk("clr: Starting probe for %s\n", res->name);
+
/* No printks while decoding is disabled! */
if (!dev->mmio_always_on) {
pci_read_config_word(dev, PCI_COMMAND, &orig_cmd);
@@ -191,8 +195,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
}
}
- res->name = pci_name(dev);
-
pci_read_config_dword(dev, pos, &l);
pci_write_config_dword(dev, pos, l | mask);
pci_read_config_dword(dev, pos, &sz);
@@ -324,6 +326,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
if (dev->non_compliant_bars)
return;
+ printk("clr: pci_read_bases start\n");
+
for (pos = 0; pos < howmany; pos++) {
struct resource *res = &dev->resource[pos];
reg = PCI_BASE_ADDRESS_0 + (pos << 2);
@@ -332,11 +336,13 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
if (rom) {
struct resource *res = &dev->resource[PCI_ROM_RESOURCE];
+ printk("clr: rom path\n");
dev->rom_base_reg = rom;
res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH |
IORESOURCE_READONLY | IORESOURCE_SIZEALIGN;
__pci_read_base(dev, pci_bar_mem32, res, rom);
}
+ printk("clr: pci_read_bases end\n");
}
static void pci_read_bridge_io(struct pci_bus *child)
@@ -1193,6 +1199,28 @@ static void pci_msi_setup_pci_dev(struct pci_dev *dev)
pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
}
+static int guess_bar_count(int class)
+{
+ if (class == 0x068000)
+ return 0;
+ if (class == 0x020000)
+ return 2;
+ if (class == 0x010000)
+ return 2;
+ if (class == 0x00ff00)
+ return 1;
+ return 6;
+}
+
+static int has_rom(int class, int rom)
+{
+ if (class == 0x020000)
+ return 0;
+ if (class == 0x010000 || class == 0x00ff00)
+ return 0;
+ return rom;
+}
+
/**
* pci_setup_device - fill in class and map information of a device
* @dev: the device structure to fill
@@ -1211,6 +1239,9 @@ int pci_setup_device(struct pci_dev *dev)
int pos = 0;
struct pci_bus_region region;
struct resource *res;
+ int maxbar;
+
+ printk("clr: pci_setup_device start\n");
if (pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type))
return -EIO;
@@ -1265,7 +1296,11 @@ int pci_setup_device(struct pci_dev *dev)
if (class == PCI_CLASS_BRIDGE_PCI)
goto bad;
pci_read_irq(dev);
- pci_read_bases(dev, 6, PCI_ROM_ADDRESS);
+
+ maxbar = guess_bar_count(dev->class);
+
+ if (class != PCI_CLASS_STORAGE_IDE)
+ pci_read_bases(dev, maxbar, has_rom(dev->class, PCI_ROM_ADDRESS));
pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &dev->subsystem_vendor);
pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &dev->subsystem_device);
@@ -1350,6 +1385,8 @@ int pci_setup_device(struct pci_dev *dev)
dev->class = PCI_CLASS_NOT_DEFINED << 8;
}
+ printk("clr: pci_setup_device end\n");
+
/* We found a fine healthy device, go go go... */
return 0;
}
--
2.11.0

View File

@ -1,107 +0,0 @@
From a672fb44791bab2e0b7cd519fbb55751fb2fbe16 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Fri, 28 Aug 2015 11:00:36 -0500
Subject: [PATCH 07/22] cgroup
Author: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Signed-off-by: Jose Carlos Venegas Munoz <jos.c.venegas.munoz@intel.com>
---
include/linux/cgroup-defs.h | 2 +-
kernel/cgroup.c | 24 ++++++++++++++----------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 6fb1c34c..f5ffee9d 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -137,7 +137,7 @@ struct cgroup_subsys_state {
/* percpu_ref killing and RCU release */
struct rcu_head rcu_head;
- struct work_struct destroy_work;
+ struct delayed_work destroy_work;
};
/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4c233437..27a71a9e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -73,7 +73,7 @@
* Expiring in the middle is a performance problem not a correctness one.
* 1 sec should be enough.
*/
-#define CGROUP_PIDLIST_DESTROY_DELAY HZ
+#define CGROUP_PIDLIST_DESTROY_DELAY round_jiffies_relative(HZ)
#define CGROUP_FILE_NAME_MAX (MAX_CGROUP_TYPE_NAMELEN + \
MAX_CFTYPE_NAME + 2)
@@ -4987,8 +4987,9 @@ static struct cftype cgroup_legacy_base_files[] = {
*/
static void css_free_work_fn(struct work_struct *work)
{
+ struct delayed_work *dwork = to_delayed_work(work);
struct cgroup_subsys_state *css =
- container_of(work, struct cgroup_subsys_state, destroy_work);
+ container_of(dwork, struct cgroup_subsys_state, destroy_work);
struct cgroup_subsys *ss = css->ss;
struct cgroup *cgrp = css->cgroup;
@@ -5037,14 +5038,15 @@ static void css_free_rcu_fn(struct rcu_head *rcu_head)
struct cgroup_subsys_state *css =
container_of(rcu_head, struct cgroup_subsys_state, rcu_head);
- INIT_WORK(&css->destroy_work, css_free_work_fn);
- queue_work(cgroup_destroy_wq, &css->destroy_work);
+ INIT_DELAYED_WORK(&css->destroy_work, css_free_work_fn);
+ queue_delayed_work(cgroup_destroy_wq, &css->destroy_work, CGROUP_PIDLIST_DESTROY_DELAY);
}
static void css_release_work_fn(struct work_struct *work)
{
+ struct delayed_work *dwork = to_delayed_work(work);
struct cgroup_subsys_state *css =
- container_of(work, struct cgroup_subsys_state, destroy_work);
+ container_of(dwork, struct cgroup_subsys_state, destroy_work);
struct cgroup_subsys *ss = css->ss;
struct cgroup *cgrp = css->cgroup;
@@ -5087,8 +5089,9 @@ static void css_release(struct percpu_ref *ref)
struct cgroup_subsys_state *css =
container_of(ref, struct cgroup_subsys_state, refcnt);
- INIT_WORK(&css->destroy_work, css_release_work_fn);
- queue_work(cgroup_destroy_wq, &css->destroy_work);
+ INIT_DELAYED_WORK(&css->destroy_work, css_release_work_fn);
+ queue_delayed_work(cgroup_destroy_wq, &css->destroy_work, CGROUP_PIDLIST_DESTROY_DELAY);
+
}
static void init_and_link_css(struct cgroup_subsys_state *css,
@@ -5367,8 +5370,9 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
*/
static void css_killed_work_fn(struct work_struct *work)
{
+ struct delayed_work *dwork = to_delayed_work(work);
struct cgroup_subsys_state *css =
- container_of(work, struct cgroup_subsys_state, destroy_work);
+ container_of(dwork, struct cgroup_subsys_state, destroy_work);
mutex_lock(&cgroup_mutex);
@@ -5389,8 +5393,8 @@ static void css_killed_ref_fn(struct percpu_ref *ref)
container_of(ref, struct cgroup_subsys_state, refcnt);
if (atomic_dec_and_test(&css->online_cnt)) {
- INIT_WORK(&css->destroy_work, css_killed_work_fn);
- queue_work(cgroup_destroy_wq, &css->destroy_work);
+ INIT_DELAYED_WORK(&css->destroy_work, css_killed_work_fn);
+ queue_delayed_work(cgroup_destroy_wq, &css->destroy_work, CGROUP_PIDLIST_DESTROY_DELAY);
}
}
--
2.11.0

View File

@ -1,45 +0,0 @@
From a312877651e18175726e33e4530307880d249aa5 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 11 Feb 2015 17:28:14 -0600
Subject: [PATCH 08/22] smpboot: reuse timer calibration
NO point recalibrating for known-constant tsc... saves 200ms+ of boot time.
Author: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
arch/x86/kernel/smpboot.c | 2 +-
arch/x86/kernel/tsc.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 36171bcd..7f4e9cdf 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -731,7 +731,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
pr_debug("Waiting for send to finish...\n");
send_status = safe_apic_wait_icr_idle();
- udelay(init_udelay);
+ udelay(100);
pr_debug("Deasserting INIT\n");
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 6e57edf3..94ab049f 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1390,6 +1390,9 @@ unsigned long calibrate_delay_is_known(void)
if (!mask)
return 0;
+ if (cpu !=0)
+ return cpu_data(0).loops_per_jiffy;
+
sibling = cpumask_any_but(mask, cpu);
if (sibling < nr_cpu_ids)
return cpu_data(sibling).loops_per_jiffy;
--
2.11.0

View File

@ -1,28 +0,0 @@
From f1af807278f9b52c68b32e604aa4c23f1456f5d5 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 4 Nov 2015 15:17:10 -0600
Subject: [PATCH 09/22] perf
Author: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
arch/x86/events/intel/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index f0f197f4..9d1f4060 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -4028,7 +4028,7 @@ __init int intel_pmu_init(void)
*/
if (x86_pmu.extra_regs) {
for (er = x86_pmu.extra_regs; er->msr; er++) {
- er->extra_msr_access = check_msr(er->msr, 0x11UL);
+ er->extra_msr_access = false;
/* Disable LBR select mapping */
if ((er->idx == EXTRA_REG_LBR) && !er->extra_msr_access)
x86_pmu.lbr_sel_map = NULL;
--
2.11.0

View File

@ -1,190 +0,0 @@
From 0f320ebfefc339814bc7efe46a83550cc6ee1453 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 14 Feb 2015 09:49:41 -0600
Subject: [PATCH 10/22] pci: probe: identify known devices
Author: Arjan van de Ven <arjan@linux.intel.com>
Modify-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
drivers/pci/probe.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 156 insertions(+)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 73ebc222..d693b6b8 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -163,6 +163,159 @@ static inline unsigned long decode_bar(struct pci_dev *dev, u32 bar)
#define PCI_COMMAND_DECODE_ENABLE (PCI_COMMAND_MEMORY | PCI_COMMAND_IO)
+/* shortcut version of __pci_read_base where we know the sizes already */
+int __pci_read_base_shortcut(struct pci_dev *dev, enum pci_bar_type type,
+ struct resource *res, unsigned int pos, u32 sz_in, u32 sz2_in)
+{
+ u32 l, sz;
+ u64 l64, sz64, mask64;
+ struct pci_bus_region region, inverted_region;
+
+ res->name = pci_name(dev);
+
+ pci_read_config_dword(dev, pos, &l);
+
+ sz = sz_in;
+
+ /*
+ * All bits set in sz means the device isn't working properly.
+ * If the BAR isn't implemented, all bits must be 0. If it's a
+ * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit
+ * 1 must be clear.
+ * Here we set the size and is not 0xffffffff
+ */
+
+ /*
+ * I don't know how l can have all bits set. Copied from old code.
+ * Maybe it fixes a bug on some ancient platform.
+ */
+ if (l == 0xffffffff)
+ l = 0;
+
+ if (type == pci_bar_unknown) {
+ res->flags = decode_bar(dev, l);
+ res->flags |= IORESOURCE_SIZEALIGN;
+ if (res->flags & IORESOURCE_IO) {
+ l64 = l & PCI_BASE_ADDRESS_IO_MASK;
+ sz64 = sz & PCI_BASE_ADDRESS_IO_MASK;
+ mask64 = PCI_BASE_ADDRESS_IO_MASK & (u32)IO_SPACE_LIMIT;
+ } else {
+ l64 = l & PCI_BASE_ADDRESS_MEM_MASK;
+ sz64 = sz & PCI_BASE_ADDRESS_MEM_MASK;
+ mask64 = (u32)PCI_BASE_ADDRESS_MEM_MASK;
+ }
+ } else {
+ res->flags |= (l & IORESOURCE_ROM_ENABLE);
+ l64 = l & PCI_ROM_ADDRESS_MASK;
+ sz64 = sz & PCI_ROM_ADDRESS_MASK;
+ mask64 = (u32)PCI_ROM_ADDRESS_MASK;
+ }
+
+ if (res->flags & IORESOURCE_MEM_64) {
+ pci_read_config_dword(dev, pos + 4, &l);
+ sz = sz2_in;
+
+ l64 |= ((u64)l << 32);
+ sz64 |= ((u64)sz << 32);
+ mask64 |= ((u64)~0 << 32);
+ }
+
+ if (!sz64)
+ goto fail;
+
+ sz64 = pci_size(l64, sz64, mask64);
+ if (!sz64) {
+ dev_info(&dev->dev, FW_BUG "reg 0x%x: invalid BAR (can't size)\n",
+ pos);
+ goto fail;
+ }
+
+ if (res->flags & IORESOURCE_MEM_64) {
+ if ((sizeof(dma_addr_t) < 8 || sizeof(resource_size_t) < 8) &&
+ sz64 > 0x100000000ULL) {
+ res->flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED;
+ res->start = 0;
+ res->end = 0;
+ dev_err(&dev->dev, "reg 0x%x: can't handle BAR larger than 4GB (size %#010llx)\n",
+ pos, (unsigned long long)sz64);
+ goto out;
+ }
+
+ if ((sizeof(dma_addr_t) < 8) && l) {
+ /* Above 32-bit boundary; try to reallocate */
+ res->flags |= IORESOURCE_UNSET;
+ res->start = 0;
+ res->end = sz64;
+ dev_info(&dev->dev, "reg 0x%x: can't handle BAR above 4GB (bus address %#010llx)\n",
+ pos, (unsigned long long)l64);
+ goto out;
+ }
+ }
+
+ region.start = l64;
+ region.end = l64 + sz64;
+
+ pcibios_bus_to_resource(dev->bus, res, &region);
+ pcibios_resource_to_bus(dev->bus, &inverted_region, res);
+
+ /*
+ * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is
+ * the corresponding resource address (the physical address used by
+ * the CPU. Converting that resource address back to a bus address
+ * should yield the original BAR value:
+ *
+ * resource_to_bus(bus_to_resource(A)) == A
+ *
+ * If it doesn't, CPU accesses to "bus_to_resource(A)" will not
+ * be claimed by the device.
+ */
+ if (inverted_region.start != region.start) {
+ res->flags |= IORESOURCE_UNSET;
+ res->start = 0;
+ res->end = region.end - region.start;
+ dev_info(&dev->dev, "reg 0x%x: initial BAR value %#010llx invalid\n",
+ pos, (unsigned long long)region.start);
+ }
+
+ goto out;
+
+
+fail:
+ res->flags = 0;
+out:
+ if (res->flags)
+ dev_printk(KERN_DEBUG, &dev->dev, "reg 0x%x: %pR\n", pos, res);
+
+ return (res->flags & IORESOURCE_MEM_64) ? 1 : 0;
+}
+
+static int is_known_device(struct pci_dev *dev, int pos, int *sz)
+{
+ /* Red Hat, Inc : Virtio network device */
+ if (dev->vendor == 0x1af4 && dev->device == 0x1000) {
+ if (pos == 0x10) {
+ *sz = 0xffffffe1;
+ return 1;
+ }
+ if (pos == 0x14) {
+ *sz = 0xfffff000;
+ return 1;
+ }
+ }
+ /* Red Hat, Inc : Virtio block device */
+ if (dev->vendor == 0x1af4 && dev->device == 0x1001) {
+ if (pos == 0x10) {
+ *sz = 0xffffffc1;
+ return 1;
+ }
+ if (pos == 0x14) {
+ *sz = 0xfffff000;
+ return 1;
+ }
+ }
+ return 0;
+}
+
/**
* pci_read_base - read a PCI BAR
* @dev: the PCI device
@@ -182,6 +335,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
+ if (is_known_device(dev, pos, &sz))
+ return __pci_read_base_shortcut(dev, type, res, pos, sz, 0);
+
res->name = pci_name(dev);
printk("clr: Starting probe for %s\n", res->name);
--
2.11.0

View File

@ -1,39 +0,0 @@
From 11a42057e43d77c04317eb3a3f40989b6f57864d Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Mon, 22 Jun 2015 09:33:33 -0500
Subject: [PATCH 11/22] init: no wait for the known devices
No wait for the known devices to complete their probing
Author: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
init/do_mounts.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index dea5de95..da840946 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -28,6 +28,7 @@
#include <linux/slab.h>
#include <linux/ramfs.h>
#include <linux/shmem_fs.h>
+#include <linux/async.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
@@ -563,7 +564,8 @@ void __init prepare_namespace(void)
* For example, it is not atypical to wait 5 seconds here
* for the touchpad of a laptop to initialize.
*/
- wait_for_device_probe();
+ //wait_for_device_probe();
+ async_synchronize_full();
md_run_setup();
--
2.11.0

View File

@ -1,32 +0,0 @@
From d8056696038fd33187ca41e25832ed3960c3ec7f Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Mon, 14 Mar 2016 11:06:46 -0600
Subject: [PATCH 12/22] ksm-wakeups
reduce wakeups in ksm
---
mm/ksm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index caa54a55..b043f871 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1724,8 +1724,12 @@ static int ksm_scan_thread(void *nothing)
try_to_freeze();
if (ksmd_should_run()) {
- schedule_timeout_interruptible(
- msecs_to_jiffies(ksm_thread_sleep_millisecs));
+ if (ksm_thread_sleep_millisecs >= 1000)
+ schedule_timeout_interruptible(
+ msecs_to_jiffies(round_jiffies_relative(ksm_thread_sleep_millisecs)));
+ else
+ schedule_timeout_interruptible(
+ msecs_to_jiffies(ksm_thread_sleep_millisecs));
} else {
wait_event_freezable(ksm_thread_wait,
ksmd_should_run() || kthread_should_stop());
--
2.11.0

View File

@ -1,56 +0,0 @@
From c03fac43a4294098b01d6a0eadd824e6c79e70e6 Mon Sep 17 00:00:00 2001
From: Alan Cox <alan@linux.intel.com>
Date: Thu, 10 Mar 2016 15:11:28 +0000
Subject: [PATCH 14/22] xattr: allow setting user.* attributes on symlinks by
owner
Kvmtool and clear containers supports using user attributes to label host
files with the virtual uid/guid of the file in the container. This allows an
end user to manage their files and a complete uid space without all the ugly
namespace stuff.
The one gap in the support is symlinks because an end user can change the
ownership of a symbolic link. We support attributes on these files as you
can already (as root) set security attributes on them.
The current rules seem slightly over-paranoid and as we have a use case this
patch enables updating the attributes on a symbolic link IFF you are the
owner of the synlink (as permissions are not usually meaningful on the link
itself).
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
fs/xattr.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/fs/xattr.c b/fs/xattr.c
index ed8c3745..f48d608e 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -118,15 +118,17 @@ xattr_permission(struct inode *inode, const char *name, int mask)
}
/*
- * In the user.* namespace, only regular files and directories can have
- * extended attributes. For sticky directories, only the owner and
- * privileged users can write attributes.
+ * In the user.* namespace, only regular files, symbolic links, and
+ * directories can have extended attributes. For symbolic links and
+ * sticky directories, only the owner and privileged users can write
+ * attributes.
*/
if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
- if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
+ if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) && !S_ISLNK(inode->i_mode))
return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
- if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
- (mask & MAY_WRITE) && !inode_owner_or_capable(inode))
+ if (((S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX))
+ || S_ISLNK(inode->i_mode)) && (mask & MAY_WRITE)
+ && !inode_owner_or_capable(inode))
return -EPERM;
}
--
2.11.0

View File

@ -1,25 +0,0 @@
From ec4c5378faf4ab331d56706d58e112c14ec45396 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 7 Dec 2016 17:50:05 -0600
Subject: [PATCH 15/22] crypto: allow testmgr to be skipped
---
crypto/testmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 62dffa00..197e9c53 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -36,7 +36,7 @@
#include "internal.h"
-static bool notests;
+static bool notests = true;
module_param(notests, bool, 0644);
MODULE_PARM_DESC(notests, "disable crypto self-tests");
--
2.11.0

View File

@ -1,25 +0,0 @@
From 5b5f050eec3a244002b1a729627b7b610c86a4e5 Mon Sep 17 00:00:00 2001
From: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Date: Wed, 7 Dec 2016 17:53:45 -0600
Subject: [PATCH 16/22] silence "Power down" msg
---
kernel/reboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/reboot.c b/kernel/reboot.c
index bd30a973..eb6f8f6e 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -261,7 +261,7 @@ void kernel_power_off(void)
pm_power_off_prepare();
migrate_to_reboot_cpu();
syscore_shutdown();
- pr_emerg("Power down\n");
+ pr_info("Power down\n");
kmsg_dump(KMSG_DUMP_POWEROFF);
machine_power_off();
}
--
2.11.0

View File

@ -1,131 +0,0 @@
From 3db64f7f26d077d4c05e413ac21269bc5a897c6a Mon Sep 17 00:00:00 2001
From: Eric Van Hensbergen <ericvh@gmail.com>
Date: Tue, 21 Apr 2015 12:46:29 -0700
Subject: [PATCH 17/22] fs/9p: fix create-unlink-getattr idiom
Fixes several outstanding bug reports of not being able to getattr from an
open file after an unlink. This patch cleans up transient fids on an unlink
and will search open fids on a client if it detects a dentry that appears to
have been unlinked. This search is necessary because fstat does not pass fd
information through the VFS API to the filesystem, only the dentry which for
9p has an imperfect match to fids.
Inherent in this patch is also a fix for the qid handling on create/open
which apparently wasn't being set correctly and was necessary for the search
to succeed.
A possible optimization over this fix is to include accounting of open fids
with the inode in the private data (in a similar fashion to the way we track
transient fids with dentries). This would allow a much quicker search for
a matching open fid.
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
---
fs/9p/fid.c | 30 ++++++++++++++++++++++++++++++
fs/9p/vfs_inode.c | 4 ++++
net/9p/client.c | 5 ++++-
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 60fb4746..e19c9cf7 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -54,6 +54,33 @@ void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
}
/**
+ * v9fs_fid_find_global - search for a fid off of the client list
+ * @inode: return a fid pointing to a specific inode
+ * @uid: return a fid belonging to the specified user
+ *
+ */
+
+static struct p9_fid *v9fs_fid_find_inode(struct inode *inode, kuid_t uid)
+{
+ struct p9_client *clnt = v9fs_inode2v9ses(inode)->clnt;
+ struct p9_fid *fid, *fidptr, *ret = NULL;
+ unsigned long flags;
+
+ p9_debug(P9_DEBUG_VFS, " inode: %p\n", inode);
+
+ spin_lock_irqsave(&clnt->lock, flags);
+ list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist) {
+ if (uid_eq(fid->uid, uid) &&
+ (inode->i_ino == v9fs_qid2ino(&fid->qid))) {
+ ret = fid;
+ break;
+ }
+ }
+ spin_unlock_irqrestore(&clnt->lock, flags);
+ return ret;
+}
+
+/**
* v9fs_fid_find - retrieve a fid that belongs to the specified uid
* @dentry: dentry to look for fid in
* @uid: return fid that belongs to the specified user
@@ -80,6 +107,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
}
}
spin_unlock(&dentry->d_lock);
+ } else {
+ if (dentry->d_inode)
+ ret = v9fs_fid_find_inode(dentry->d_inode, uid);
}
return ret;
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 30ca770c..c00487ea 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -624,6 +624,10 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
v9fs_invalidate_inode_attr(inode);
v9fs_invalidate_inode_attr(dir);
+
+ /* invalidate all fids associated with dentry */
+ /* NOTE: This will not include open fids */
+ dentry->d_op->d_release(dentry);
}
return retval;
}
diff --git a/net/9p/client.c b/net/9p/client.c
index cf129fec..8284ad03 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1208,7 +1208,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname,
if (nwname)
memmove(&fid->qid, &wqids[nwqids - 1], sizeof(struct p9_qid));
else
- fid->qid = oldfid->qid;
+ memmove(&fid->qid, &oldfid->qid, sizeof(struct p9_qid));
kfree(wqids);
return fid;
@@ -1261,6 +1261,7 @@ int p9_client_open(struct p9_fid *fid, int mode)
p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type,
(unsigned long long)qid.path, qid.version, iounit);
+ memmove(&fid->qid, &qid, sizeof(struct p9_qid));
fid->mode = mode;
fid->iounit = iounit;
@@ -1306,6 +1307,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
(unsigned long long)qid->path,
qid->version, iounit);
+ memmove(&ofid->qid, qid, sizeof(struct p9_qid));
ofid->mode = mode;
ofid->iounit = iounit;
@@ -1351,6 +1353,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
(unsigned long long)qid.path,
qid.version, iounit);
+ memmove(&fid->qid, &qid, sizeof(struct p9_qid));
fid->mode = mode;
fid->iounit = iounit;
--
2.11.0

View File

@ -1,24 +0,0 @@
From 9ac45f2a4f0de76365e7b12414500f3a12bf028e Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Tue, 29 Mar 2016 14:29:24 -0600
Subject: [PATCH 18/22] rdrand
---
arch/x86/kernel/cpu/rdrand.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/kernel/cpu/rdrand.c b/arch/x86/kernel/cpu/rdrand.c
index cfa97ff6..cd7aa166 100644
--- a/arch/x86/kernel/cpu/rdrand.c
+++ b/arch/x86/kernel/cpu/rdrand.c
@@ -48,6 +48,7 @@ void x86_init_rdrand(struct cpuinfo_x86 *c)
if (!cpu_has(c, X86_FEATURE_RDRAND))
return;
+ return;
for (i = 0; i < SANITY_CHECK_LOOPS; i++) {
if (!rdrand_long(&tmp)) {
clear_cpu_cap(c, X86_FEATURE_RDRAND);
--
2.11.0

View File

@ -1,34 +0,0 @@
From 1629faac6cc01351c26608c3ea8c669c8b87459b Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Thu, 11 Feb 2016 11:06:26 -0600
Subject: [PATCH 19/22] reboot
---
kernel/reboot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/reboot.c b/kernel/reboot.c
index eb6f8f6e..b367c1e0 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -309,7 +309,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
* halt when pm_power_off is not set do it the easy way.
*/
if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
- cmd = LINUX_REBOOT_CMD_HALT;
+ cmd = LINUX_REBOOT_CMD_RESTART;
mutex_lock(&reboot_mutex);
switch (cmd) {
@@ -326,7 +326,7 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
break;
case LINUX_REBOOT_CMD_HALT:
- kernel_halt();
+ kernel_restart(NULL);
do_exit(0);
panic("cannot halt");
--
2.11.0

View File

@ -1,25 +0,0 @@
From 9424467a5d1fb1f971076187c07c78a81e9cf661 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Thu, 11 Feb 2016 11:07:54 -0600
Subject: [PATCH 20/22] no early modprobe
---
kernel/kmod.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 0277d121..20b5777f 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -557,7 +557,7 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
DECLARE_COMPLETION_ONSTACK(done);
int retval = 0;
- if (!sub_info->path) {
+ if (!sub_info->path || system_state == SYSTEM_BOOTING) {
call_usermodehelper_freeinfo(sub_info);
return -EINVAL;
}
--
2.11.0

View File

@ -1,28 +0,0 @@
From f209324e2d027b432870b64847122e55ba805ee9 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
Date: Thu, 11 Feb 2016 13:14:53 -0600
Subject: [PATCH 22/22] Show restart information using info log
---
kernel/reboot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/reboot.c b/kernel/reboot.c
index b367c1e0..cfd60137 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -217,9 +217,9 @@ void kernel_restart(char *cmd)
migrate_to_reboot_cpu();
syscore_shutdown();
if (!cmd)
- pr_emerg("Restarting system\n");
+ pr_info("Restarting system\n");
else
- pr_emerg("Restarting system with command '%s'\n", cmd);
+ pr_info("Restarting system with command '%s'\n", cmd);
kmsg_dump(KMSG_DUMP_RESTART);
machine_restart(cmd);
}
--
2.11.0

View File

@ -1,2 +0,0 @@
66df3d3c25d3627da87b612db9f0158b652d949b5e8b27ac38c6c5957fa2bf72 downloads/linux-4.9.56.tar
5b0d7ac640b6c1f20524cf6042ad39bb5d8f2184ca5ef7a9cd309e5b8a5c9b60 downloads/v4.9.56-unofficial_grsec-20171013093040.diff

1
kernel/v5.3.sha256 Normal file
View File

@ -0,0 +1 @@
d6434bf06da20d6954efdf7639d9fc105ca3b1fb01338ab5d9b6deae4bf72e15 downloads/linux-5.3.tar