Skip to content

Commit 6c63feb

Browse files
committed
debuginfo: add support for UEK-next
While UEK-next is not an officially supported release, it's going to be quite useful as a (public) resource for keeping our helpers up-to-date with the latest kernel features. Add attributes to KernelVersion to detect when a kernel is UEK-next, and ensure that the debuginfo RPM name is properly determined. Then, use that to mark CTF as compatible with UEK-next, since there are no known issues. Of course, UEK-next is not _supported_ by any means, and in fact, I expect to encounter quite a few compatibility issues in Corelens modules that need to be addressed. Signed-off-by: Stephen Brennan <[email protected]>
1 parent 2c85424 commit 6c63feb

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

drgn_tools/debuginfo.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ class KernelVersion(NamedTuple):
452452
Note that depending on the package versioning scheme, the patchlevel number
453453
here may be useless, misleading, or otherwise unhelpful.
454454
"""
455+
version_tuple: Tuple[int, ...]
456+
"""
457+
The upstream version, split into integer groups for easy comparison.
458+
459+
This should be a three element tuple, but the code does not enforce it as a
460+
requirement, so you should treat it as a variable length tuple of integers.
461+
"""
455462
release: str
456463
"""The packaging release version (the stuff after the hyphen)."""
457464
release_tuple: Tuple[int, ...]
@@ -479,14 +486,22 @@ class KernelVersion(NamedTuple):
479486
"""Whether the kernel is a UEK kernel."""
480487
uek_version: Optional[int]
481488
"""The major version of the UEK release, if applicable."""
489+
is_ueknext: bool
490+
"""Whether the kernel is a UEK-next kernel (uek_version will be None)"""
482491

483492
@classmethod
484493
def parse(cls, original: str) -> "KernelVersion":
485494
"""
486495
Parse the given kernel release string and return a ``KernelVersion``:
487496
488-
>>> KernelVersion.parse(prog["UTS_RELEASE"].string_().decode("ascii"))
489-
KernelVersion(version='4.14.35', release='2047.516.2.4', ol_version=7, ol_update=None, arch='x86_64', original='4.14.35-2047.516.2.4.el7uek.x86_64', is_uek=True)
497+
>>> KernelVersion.parse('4.14.35-2047.516.2.4.el7uek.x86_64')
498+
KernelVersion(version='4.14.35', version_tuple=(4, 14, 35),
499+
release='2047.516.2.4',
500+
release_tuple=(2047, 516, 2, 4),
501+
ol_version=7, ol_update=None, arch='x86_64',
502+
original='4.14.35-2047.516.2.4.el7uek.x86_64',
503+
extraversion1='', extraversion2='', is_uek=True,
504+
uek_version=5, is_ueknext=False)
490505
491506
:param original: The kernel's release string
492507
:returns: A ``KernelVersion`` with fields parsed
@@ -503,17 +518,23 @@ def parse(cls, original: str) -> "KernelVersion":
503518
raise ValueError(
504519
"Could not understand kernel version string: " + original
505520
)
521+
version_tuple = tuple(
522+
int(g) for g in re.split("[.-]", match["version"])
523+
)
506524
release_tuple = tuple(
507525
int(g) for g in re.split("[.-]", match["release"])
508526
)
509527
update = None
510528
if match["update"]:
511529
update = int(match["update"])
530+
is_uek = match["extra"].startswith("uek")
512531
uek_ver = None
513-
if match["extra"].startswith("uek"):
532+
if is_uek:
514533
uek_ver = _UEK_VER.get(match["version"])
534+
is_uek_next = is_uek and uek_ver is None and version_tuple >= (6, 8, 0)
515535
return cls(
516536
match["version"],
537+
version_tuple,
517538
match["release"],
518539
release_tuple,
519540
int(match.group("ol_version")),
@@ -522,12 +543,15 @@ def parse(cls, original: str) -> "KernelVersion":
522543
original,
523544
match["extraversion1"] or "",
524545
match["extraversion2"] or "",
525-
match["extra"].startswith("uek"),
546+
is_uek,
526547
uek_ver,
548+
is_uek_next,
527549
)
528550

529551
def oraclelinux_debuginfo_rpm(self) -> str:
530-
if self.is_uek:
552+
if self.is_uek and self.is_ueknext:
553+
package_name = "kernel-ueknext"
554+
elif self.is_uek:
531555
package_name = "kernel-uek"
532556
else:
533557
package_name = "kernel"
@@ -635,7 +659,14 @@ def get(
635659
cls, kver: KernelVersion, host_ol: Optional[int]
636660
) -> "CtfCompatibility":
637661
# At this point, only UEK kernels have CTF debuginfo.
638-
if not kver.is_uek or kver.uek_version is None:
662+
if not kver.is_uek:
663+
return cls.NO
664+
# UEK-next kernels have no compatibility issues
665+
if kver.is_ueknext:
666+
return cls.YES
667+
elif kver.uek_version is None:
668+
# If it's UEK, but we can't identify a version or -next, that's a
669+
# bug!
639670
return cls.NO
640671

641672
# Prior to UEK4, it is untested and will not be tested.

0 commit comments

Comments
 (0)