Red Hat Code Browser

Updated -

Red Hat Code Browser is the new Source Browser for viewing Red Hat shipped kernel sources trees, patches, RPM spec files, and Changelogs. You can also search and filter your results for programming language or package and search for a specific symbol such as a function, class, struct and others.

Features

  • Searching for symbols and code snippets
  • Browse/View the source code, patches, spec file and changelog
  • Perform a diff operation for a file in the source code
  • View the corresponding patch file to the Changelog
  • Cross-referencing available in source code and patches
  • Filters for language and package available along with search

How to use Red Hat Code Browser

Red Hat Code Browser is available in Red Hat Customer Portal Labs space Red Hat Code Browser

The Code Browser home page displays a list of all kernels shipped by Red Hat, grouped according to Red Hat Enterprise Linux releases. Click on any kernel to view the kernel source tree and files. Source code files written in common programming language are automatically syntax highlighted and identifiers (functions, macros, variables) detected are automatically cross-referenced via the built-in search engine.


Drawing

The search box present at the top can be used to search for code snippets or specific symbols across the kernel sources. Search is context sensitive; if a code snippet is searched while browsing a particular kernel version, the snippet will be automatically searched inside that kernel version.

Usage

Perform a search operation

Search for a function named setShowDebug.

Drawing

Perform a search operation inside a particular kernel version

Search for a string tg3_tx_recover inside any particular kernel version, suppose kernel-3.10.0-123.4.2.el7. You can see the results which belong to the respective kernel.

Drawing

Use Filter facet to optimize search

Search for the string memcpy in files containing Makefile sources. The programming language filters can be applied by entering the parameter language: makefile in the search bar or by selecting the language from the displayed list of filters on the left.

Drawing

View Source Code

On selecting a kernel from the Red Hat Code Browser home page, the kernel source tree is displayed.

Drawing

View a List of Functions

Browse the kernel source and click on a file to view source code. A list of function, macro, struct and members definitions are displayed on the left. Click on a function to jump to its definition within the file.

Jump to function

View Patched Source

If a patch has been applied to the source code, a patch icon is displayed on the left. Click on the icon to see what changed.

Patch marker

Perform a Diff Operation

Look for changes in a file across various kernel versions. Use the Diff dropdown located on the far right to diff the current source across other kernel releases.

Drawing

View a List of Patches

The Patches tab lists all the patches applied to a particular version of kernel. A list of patches is displayed containing patch file name, size and the kernel version in which that patch was introduced.

Drawing

Search within Patches

Search for a string skb_headlen within Patches by clicking on the drop-down next to search box and selecting Patch.

Search within Patches

View Patches applied by a Bugzilla ID or CVE

Search for bugzilla: 1152755 to list patches applied via bugzilla #1152755.

Search patches by Bugzilla ID

Or search for cve: CVE-2014-3688 to list patches applied via to CVE-2014-3688.

Search lines modified by a Patch

Search for modified_lines: xfs_ail_min_lsn to list all patches that modify code containing the string xfs_ail_min_lsn.

Search for modified lines

Similarly, added_lines: set_thread_flag(TIF_NOTIFY_RESUME) searches for patches that add the string set_thread_flag(TIF_NOTIFY_RESUME) and removed_lines searches for patches that remove this string.

View Spec file

The Spec tab displays spec file used to build a particular version of kernel.

Drawing

View Changelog

The Changelog tab displays Changelog for a particular version of kernel along with links to patches applied to it. Wherever possible, Bugzilla IDs and CVE identifiers are linked to the appropriate pages.

Drawing

Red Hat Code Browser use cases

An important use case for using Red Hat Code Browser is analyzing vmcore files. With Code Browser's powerful searching and filtering capabilities, it's possible to narrow down a source code snippet inside a given kernel version and file path. See how Code Browser can help in working with kernel sources below.

Analyzing kernel vmcore

Looking at the vmcore, one may start with the summary and backtrace:

KERNEL:
/cores/retrace/repos/kernel/x86_64/usr/lib/debug/lib/modules/2.6.32-431.11.2.el6.x86_64/vmlinux
RELEASE: 2.6.32-431.11.2.el6.x86_64
PANIC: "kernel BUG at drivers/net/tg3.c:6409!"

[exception RIP: tg3_tx_recover+133]
RIP: ffffffffa03aeb85  RSP: ffff880002203cf0  RFLAGS: 00010286
RAX: 00000000000000af  RBX: ffff8800374566e0  RCX: 00000000ffffffff
RDX: 0000000000000000  RSI: 0000000061a37000  RDI: ffff8800374566e0
RBP: ffff880002203d10   R8: ffff880002214008   R9: ffffffff81a01ea8
R10: 0000000000000000  R11: 0000000000000001  R12: ffff8800374567e0
R13: ffff8800da5e1068  R14: 0000000000000002  R15: 0000000000000000
ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
...
...

The above vmcore indicates that the kernel in question is kernel-2.6.32-431.11.2.el6 and symbol is tg3_tx_recover. This gives enough parameters to locate the symbol tg3_tx_recover and see what the code is doing.

Suggested search query:
tg3_tx_recover version:kernel-2.6.32-431.11.2.el6


Drawing

Search for symbols

You can search for any identifier by using the special search keyword tag. Suppose you are looking for a symbol named MM_PAGEVEC_FREE

Suggested sample query:
tag: MM_PAGEVEC_FREE


Drawing

From the results you can find that the symbol you search for is a 'constant'.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.