1
0

Auto detect debug symbols for host kernels

This commit is contained in:
dump_stack() 2019-08-16 05:34:10 +00:00
parent fc50808893
commit 3064dc3a27
3 changed files with 12 additions and 2 deletions

View File

@ -170,6 +170,9 @@ type KernelInfo struct {
KernelPath string KernelPath string
InitrdPath string InitrdPath string
RootFS string RootFS string
// Debug symbols
VmlinuxPath string
} }
type KernelConfig struct { type KernelConfig struct {

View File

@ -114,7 +114,7 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
return aurora.BgGreen(aurora.Black(name)) return aurora.BgGreen(aurora.Black(name))
} }
return aurora.BgRed(aurora.Gray(aurora.Bold(name))) return aurora.BgRed(aurora.Gray(name))
} }
fmt.Printf("[*] %s %s %s\n", redgreen("KASLR", kaslr), fmt.Printf("[*] %s %s %s\n", redgreen("KASLR", kaslr),
@ -156,7 +156,7 @@ func debugHandler(kcfg config.KernelConfig, workPath, kernRegex, gdb string,
fmt.Printf("[*] build result copied to %s\n", coloredRemoteFile) fmt.Printf("[*] build result copied to %s\n", coloredRemoteFile)
fmt.Printf("\n%s\n", q.GetSshCommand()) fmt.Printf("\n%s\n", q.GetSshCommand())
fmt.Printf("gdb -ex 'target remote %s'\n\n", gdb) fmt.Printf("gdb %s -ex 'target remote %s'\n\n", ki.VmlinuxPath, gdb)
err = interactive(q) err = interactive(q)
return return

View File

@ -348,6 +348,13 @@ func genHostKernels() (kcfg config.KernelConfig, err error) {
InitrdPath: kernelsBase + genInitrdPath(files, k), InitrdPath: kernelsBase + genInitrdPath(files, k),
RootFS: genRootfsImage(dii), RootFS: genRootfsImage(dii),
} }
vmlinux := "/usr/lib/debug/boot/vmlinux-" + k
log.Println("vmlinux", vmlinux)
if exists(vmlinux) {
ki.VmlinuxPath = vmlinux
}
kcfg.Kernels = append(kcfg.Kernels, ki) kcfg.Kernels = append(kcfg.Kernels, ki)
} }