Skip to content

Commit a1f03a0

Browse files
committed
xen: delete patching infrastructure
Overengineered for no good reason, especially since upstream Xen recommends downstreams to use the latest stable branch anyway (instead of the pinned release revision) Signed-off-by: Fernando Rodrigues <[email protected]>
1 parent ffd38a7 commit a1f03a0

File tree

2 files changed

+5
-276
lines changed

2 files changed

+5
-276
lines changed

pkgs/build-support/xen/default.nix

Lines changed: 5 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
testers,
88
which,
99
fetchgit,
10-
fetchpatch,
1110

1211
# Xen
1312
acpica-tools,
@@ -65,125 +64,33 @@
6564
withSeaBIOS ? true,
6665
withOVMF ? true,
6766
withIPXE ? true,
68-
useDefaultPatchList ? true,
6967
rev,
7068
hash,
7169
patches ? [ ],
7270
meta ? { },
7371
}:
7472

7573
let
76-
# Inherit helper functions from lib and builtins.
77-
inherit (builtins) elemAt isAttrs;
74+
inherit (lib.meta) getExe';
75+
inherit (lib.lists) optional optionals;
7876
inherit (lib.systems.inspect.patterns) isLinux isAarch64;
77+
inherit (lib) teams;
7978
inherit (lib.strings)
80-
concatLines
8179
enableFeature
8280
makeSearchPathOutput
8381
optionalString
84-
removeSuffix
8582
versionOlder
8683
;
87-
inherit (lib) teams;
8884
inherit (lib.licenses)
8985
cc-by-40
9086
gpl2Only
9187
lgpl21Only
9288
mit
9389
;
94-
inherit (lib.meta) getExe';
95-
inherit (lib.lists)
96-
count
97-
flatten
98-
optional
99-
optionals
100-
range
101-
remove
102-
zipListsWith
103-
;
104-
inherit (lib.attrsets) attrByPath;
10590

10691
# Mark versions older than minSupportedVersion as EOL.
10792
minSupportedVersion = "4.16";
10893

109-
## Generic Patch Handling ##
110-
111-
upstreamPatches = import ./patches.nix {
112-
inherit lib fetchpatch;
113-
};
114-
115-
upstreamPatchList = flatten (
116-
with upstreamPatches;
117-
[
118-
QUBES_REPRODUCIBLE_BUILDS
119-
XSA_460
120-
XSA_461
121-
XSA_462
122-
XSA_464
123-
]
124-
);
125-
126-
## XSA Patches Description Builder ##
127-
128-
# Simple counter for the number of attrsets (patches) in the patches list after normalisation.
129-
numberOfPatches = count (patch: isAttrs patch) upstreamPatchList;
130-
131-
# builtins.elemAt's index begins at 0, so we subtract 1 from the number of patches in order to
132-
# produce the range that will be used in the following builtin.map calls.
133-
availablePatchesToTry = range 0 (numberOfPatches - 1);
134-
135-
# Takes in an attrByPath input, and outputs the attribute value for each patch in a list.
136-
# If a patch does not have a given attribute, returns `null`. Use lib.lists.remove null
137-
# to remove these junk values, if necessary.
138-
retrievePatchAttributes =
139-
attributeName:
140-
map (x: attrByPath attributeName null (elemAt upstreamPatchList x)) availablePatchesToTry;
141-
142-
# Produces a list of newline-separated strings that lists the vulnerabilities this
143-
# Xen is NOT affected by, due to the applied Xen Security Advisory patches. This is
144-
# then used in meta.longDescription, to let users know their Xen is patched against
145-
# known vulnerabilities, as the package version isn't always the best indicator.
146-
#
147-
# Produces something like this: (one string for each XSA)
148-
# * [Xen Security Advisory #1](https://xenbits.xenproject.org/xsa/advisory-1.html): **Title for XSA.**
149-
# >Description of issue in XSA
150-
#Extra lines
151-
#are not indented,
152-
#but markdown should be
153-
#fine with it.
154-
# Fixes:
155-
# * [CVE-1999-00001](https://www.cve.org/CVERecord?id=CVE-1999-00001)
156-
# * [CVE-1999-00002](https://www.cve.org/CVERecord?id=CVE-1999-00002)
157-
# * [CVE-1999-00003](https://www.cve.org/CVERecord?id=CVE-1999-00003)
158-
writeAdvisoryDescription =
159-
if (remove null (retrievePatchAttributes [ "xsa" ]) != [ ]) then
160-
zipListsWith (a: b: a + b)
161-
(zipListsWith (a: b: a + "**" + b + ".**\n >")
162-
(zipListsWith (a: b: "* [Xen Security Advisory #" + a + "](" + b + "): ")
163-
(remove null (retrievePatchAttributes [ "xsa" ]))
164-
(
165-
remove null (retrievePatchAttributes [
166-
"meta"
167-
"homepage"
168-
])
169-
)
170-
)
171-
(
172-
remove null (retrievePatchAttributes [
173-
"meta"
174-
"description"
175-
])
176-
)
177-
)
178-
(
179-
remove null (retrievePatchAttributes [
180-
"meta"
181-
"longDescription"
182-
])
183-
)
184-
else
185-
[ ];
186-
18794
#TODO: fix paths instead.
18895
scriptEnvPath = makeSearchPathOutput "out" "bin" [
18996
bridge-utils
@@ -205,7 +112,7 @@ let
205112
in
206113

207114
stdenv.mkDerivation (finalAttrs: {
208-
inherit pname version;
115+
inherit pname version patches;
209116

210117
outputs = [
211118
"out"
@@ -220,8 +127,6 @@ stdenv.mkDerivation (finalAttrs: {
220127
inherit rev hash;
221128
};
222129

223-
patches = optionals useDefaultPatchList upstreamPatchList ++ patches;
224-
225130
nativeBuildInputs = [
226131
autoPatchelfHook
227132
bison
@@ -433,14 +338,7 @@ stdenv.mkDerivation (finalAttrs: {
433338
+ optionalString withFlask "\n* `xsm-flask`: The [FLASK Xen Security Module](https://wiki.xenproject.org/wiki/Xen_Security_Modules_:_XSM-FLASK). The `xenpolicy-${version}` file is available on the `boot` output of this package."
434339
+ optionalString withSeaBIOS "\n* `seabios`: Support for the SeaBIOS boot firmware on HVM domains."
435340
+ optionalString withOVMF "\n* `ovmf`: Support for the OVMF UEFI boot firmware on HVM domains."
436-
+ optionalString withIPXE "\n* `ipxe`: Support for the iPXE boot firmware on HVM domains."
437-
# Finally, we write a notice explaining which vulnerabilities this Xen is NOT vulnerable to.
438-
# This will hopefully give users the peace of mind that their Xen is secure, without needing
439-
# to search the source code for the XSA patches.
440-
+ optionalString (writeAdvisoryDescription != [ ]) (
441-
"\n\nThis Xen Project Hypervisor (${version}) has been patched against the following known security vulnerabilities:\n"
442-
+ removeSuffix "\n" (concatLines writeAdvisoryDescription)
443-
);
341+
+ optionalString withIPXE "\n* `ipxe`: Support for the iPXE boot firmware on HVM domains.";
444342

445343
homepage = "https://xenproject.org/";
446344
downloadPage = "https://downloads.xenproject.org/release/xen/${version}/";

pkgs/build-support/xen/patches.nix

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)