Ticket #780: 0001-smartmontools-fix-panic-on-INVARIANTS-enabled-kernel.patch.txt

File 0001-smartmontools-fix-panic-on-INVARIANTS-enabled-kernel.patch.txt, 1.5 KB (added by op_hardenedbsd, 5 years ago)

patch generated against FreeBSD's ports tree

Line 
1From f14a14eea03ef4e500c8f6fb03cd695d41d4a542 Mon Sep 17 00:00:00 2001
2From: Oliver Pinter <oliver.pinter@hardenedbsd.org>
3Date: Sat, 17 Dec 2016 20:04:20 +0100
4Subject: [PATCH] smartmontools: fix panic on INVARIANTS enabled kernel after
5 r308351 in base
6
7After r308351 commit the INVARIANTS enabled kernel gets too "eager" when
8checking the cam ccb flags. But the real problem was not the previous, but
9the smartmontools does not zeroed out the ccb on stack, and pass this
10dirty ccb to kernel, which is catched by an ASSERT. So fix this by filling
11up with 0 this ccb. This commit is similar, what's happen in r307684
12in camcontrol. So this is the same followup patch in smartmontools.
13
14https://svnweb.freebsd.org/base?view=revision&revision=307684
15https://svnweb.freebsd.org/base?view=revision&revision=308351
16
17Sponsored-by: opBSD
18---
19 sysutils/smartmontools/files/patch-os__freebsd.cpp | 11 +++++++++++
20 1 file changed, 11 insertions(+)
21 create mode 100644 sysutils/smartmontools/files/patch-os__freebsd.cpp
22
23diff --git a/sysutils/smartmontools/files/patch-os__freebsd.cpp b/sysutils/smartmontools/files/patch-os__freebsd.cpp
24new file mode 100644
25index 0000000..8a11cb5
26--- /dev/null
27+++ b/sysutils/smartmontools/files/patch-os__freebsd.cpp
28@@ -0,0 +1,11 @@
29+--- os_freebsd.cpp.orig        2016-12-17 18:42:22 UTC
30++++ os_freebsd.cpp
31+@@ -1936,6 +1936,8 @@ smart_device * freebsd_smart_interface::
32+   int i;
33+   const char * test_name = name;
34+
35++  memset(&ccb, 0, sizeof(ccb));
36++
37+   // if dev_name null, or string length zero
38+   if (!name || !*name)
39+     return 0;
40--
412.10.2
42