Archive for April, 2020

Learning about Xen Server: why is virtualization disabled?

First looking at the architecture of Xen Server:

So dom0 is the frontend to the hypervisor, which is running as the kernel, and thus is headless.   Now before install Xen Orchestra, one of the requirements is the VMX or SVM must be detected in the /proc/cpuinfo CPU flags.

But checking /proc/cpuinfo in dom0 revealed it has VMX and SVM all disabled.

https://www.cyberciti.biz/faq/linux-xen-vmware-kvm-intel-vt-amd-v-support/

https://www.tecmint.com/check-linux-cpu-information/

https://xenbits.xen.org/docs/4.7-testing/misc/xen-command-line.html

https://wiki.xenproject.org/wiki/Xen_Common_Problems

This is the output when we do a “lscpu” in dom0:   “Virtualization type” is none, and “svm” and “vmx” are not shown in the CPU flags.   At first I thought “hypervisor” mode not enabled in BIOS, but it is not, it has been enabled.

https://discussions.citrix.com/topic/390487-virtualization-type-none/

And so it is a dom0 problem:   VMX/SVM has been explicitly disabled in dom0.   But the underlying host is still virtualization-enabled:

xe host-list params=capabilities
capabilities (SRO) : xen-3.0-x86_64; xen-3.0-x86_32p; hvm-3.0-x86_32; hvm-3.0-x86_32p; hvm-3.0-x86_64;

https://www.cyberciti.biz/faq/linux-xen-vmware-kvm-intel-vt-amd-v-support/

egrep -wo 'vmx|ept|vpid|npt|tpr_shadow|flexpriority|vnmi|lm|aes' /proc/cpuinfo | sort | uniq

aes
lm

cat /sys/hypervisor/properties/capabilities

xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64

Finally, as confirmed with “xl dmesg”, the Xen server indeed bootup with virtualization detected successfully:

(XEN) [    2.003723] ENABLING IO-APIC IRQs
(XEN) [    2.013342] -> Using new ACK method
(XEN) [    2.022265] ..TIMER: vector=0xF0 apic1=0 pin1=2 apic2=-1 pin2=-1
(XEN) [    2.422363] Defaulting to alternative key handling; send 'A' to switch to normal mode.
(XEN) [    2.432696] Allocated console ring of 128 KiB.
(XEN) [    2.441887] HVM: ASIDs enabled.
(XEN) [    2.450694] SVM: Supported advanced features:
(XEN) [    2.459927] - Nested Page Tables (NPT)
(XEN) [    2.468485] - Last Branch Record (LBR) Virtualisation
(XEN) [    2.477635] - Next-RIP Saved on #VMEXIT
(XEN) [    2.486049] - VMCB Clean Bits
(XEN) [    2.495104] - DecodeAssists
(XEN) [    2.503332] - Virtual VMLOAD/VMSAVE
(XEN) [    2.512256] - Virtual GIF
(XEN) [    2.520327] - Pause-Intercept Filter
(XEN) [    2.529088] - Pause-Intercept Filter Threshold
(XEN) [    2.537102] - TSC Rate MSR
(XEN) [    2.545735] HVM: SVM enabled
(XEN) [    2.553541] HVM: Hardware Assisted Paging (HAP) detected
(XEN) [    2.562176] HVM: HAP page sizes: 4kB, 2MB, 1GB
(XEN) [    2.570291] alt table ffff82d08044bed0 -> ffff82d080459d9c
(XEN) [    3.331164] Brought up 24 CPUs
(XEN) [    3.341236] Testing NMI watchdog on all CPUs: ok
(XEN) [    3.391432] mcheck_poll: Machine check polling timer started.
(XEN) [    3.401379] xenoprof: Initialization failed. AMD processor family 23 is not supported
(XEN) [    3.410792] Dom0 has maximum 1016 PIRQs
(XEN) [    3.420018] csched_alloc_domdata: setting dom 0 as the privileged domain
(XEN) [    3.429372] NX (Execute Disable) protection active
(XEN) [    3.438655] *** Building a PV Dom0 ***
(XEN) [    1.622367] AMD-Vi: IOMMU Extended Features:
(XEN) [    1.634936] - Peripheral Page Service Request
(XEN) [    1.646719] - x2APIC
(XEN) [    1.657599] - NX bit
(XEN) [    1.669069] - Invalidate All Command
(XEN) [    1.680503] - Guest APIC
(XEN) [    1.691099] - Performance Counters
(XEN) [    1.702436] - Host Address Translation Size: 0x2
(XEN) [    1.713747] - Guest Address Translation Size: 0
(XEN) [    1.724247] - Guest CR3 Root Table Level: 0x1
(XEN) [    1.735408] - Maximum PASID: 0xf
(XEN) [    1.746568] - SMI Filter Register: 0x1
(XEN) [    1.756882] - SMI Filter Register Count: 0x2
(XEN) [    1.767980] - Guest Virtual APIC Modes: 0x1
(XEN) [    1.778847] - Dual PPR Log: 0x2
(XEN) [    1.789039] - Dual Event Log: 0x2
(XEN) [    1.799796] - User / Supervisor Page Protection
(XEN) [    1.809834] - Device Table Segmentation: 0x3
(XEN) [    1.820567] - PPR Log Overflow Early Warning
(XEN) [    1.831308] - PPR Automatic Response
(XEN) [    1.841139] - Memory Access Routing and Control: 0x1
(XEN) [    1.851692] - Block StopMark Message
(XEN) [    1.862185] - Performance Optimization
(XEN) [    1.871928] - MSI Capability MMIO Access
(XEN) [    1.882845] - Guest I/O Protection
(XEN) [    1.892389] - Host Access
(XEN) [    1.902549] - Enhanced PPR Handling
(XEN) [    1.912846] - Attribute Forward
(XEN) [    1.922137] - Virtualized IOMMU
(XEN) [    1.932082] - VMGuard I/O Support
(XEN) [    1.941250] - VM Table Size: 0x2
(XEN) [    1.964466] AMD-Vi: IOMMU 0 Enabled.
(XEN) [    1.974743] I/O virtualisation enabled



(XEN) [    3.429372] NX (Execute Disable) protection active

(XEN) [    1.974743] I/O virtualisation enabled
(XEN) [    1.984439] - Dom0 mode: Relaxed
(XEN) [    1.993952] Interrupt remapping enabled
(XEN) [    2.003723] ENABLING IO-APIC IRQs
(XEN) [    2.013342] -> Using new ACK method
(XEN) [    2.022265] ..TIMER: vector=0xF0 apic1=0 pin1=2 apic2=-1 pin2=-1
(XEN) [    2.422363] Defaulting to alternative key handling; send 'A' to switch to normal mode.
(XEN) [    2.432696] Allocated console ring of 128 KiB.
(XEN) [    2.441887] HVM: ASIDs enabled.

(XEN) [    3.420018] csched_alloc_domdata: setting dom 0 as the privileged domain
(XEN) [    3.429372] NX (Execute Disable) protection active
(XEN) [    3.438655] *** Building a PV Dom0 ***
(XEN) [    3.598258] Xen kernel: 64-bit, lsb, compat32
(XEN) [    3.607564] Dom0 kernel: 64-bit, PAE, lsb, paddr 0x1000000 -> 0x302c000
(XEN) [    3.616031] PHYSICAL MEMORY ARRANGEMENT:
(XEN) [    3.624107] Dom0 alloc.: 0000000fe8000000->0000000fec000000 (1080651 pages to be allocated)
(XEN) [    3.632720] Init. ramdisk: 000000101df4b000->000000101f1ff7f1
(XEN) [    3.641122] VIRTUAL MEMORY ARRANGEMENT:
(XEN) [    3.649228] Loaded kernel: ffffffff81000000->ffffffff8302c000
(XEN) [    3.657668] Init. ramdisk: 0000000000000000->0000000000000000
(XEN) [    3.666057] Phys-Mach map: 0000008000000000->0000008000868000
(XEN) [    3.674731] Start info: ffffffff8302c000->ffffffff8302c4b8
(XEN) [    3.683416] Xenstore ring: 0000000000000000->0000000000000000
(XEN) [    3.692761] Console ring: 0000000000000000->0000000000000000
(XEN) [    3.701352] Page tables: ffffffff8302d000->ffffffff8304a000
(XEN) [    3.710315] Boot stack: ffffffff8304a000->ffffffff8304b000
(XEN) [    3.718818] TOTAL: ffffffff80000000->ffffffff83400000
(XEN) [    3.728002] ENTRY ADDRESS: ffffffff8242a180
(XEN) [    3.737824] Dom0 has maximum 16 VCPUs
(XEN) [    5.033103] Initial low memory virq threshold set at 0x4000 pages.
(XEN) [    5.043716] Scrubbing Free RAM in background
(XEN) [    5.054023] Std. Loglevel: Errors, warnings and info
(XEN) [    5.064475] Guest Loglevel: Nothing (Rate-limited: Errors and warnings)
(XEN) [    5.074753] Xen is relinquishing VGA console.
(XEN) [    5.206616] *** Serial input to DOM0 (type 'CTRL-a' three times to switch input)
(XEN) [    5.207461] Freed 600kB init memory

and other useful information from  “xl info“:

xl info|grep -i xen
xen_major : 4
xen_minor : 13
xen_extra : .0-8.3.xcpng8.1
xen_version : 4.13.0-8.3.xcpng8.1
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
xen_changeset : 85e1424de2dd, pq bcf9a0b5da2d
xen_commandline : dom0_mem=4304M,max:4304M watchdog ucode=scan dom0_max_vcpus=1-16 crashkernel=256M,below=4G console=vga vga=mode-0x0311
xend_config_format : 4


My AMD Ryzen 9 3900X Built

This is my most recent built:

It consists of:

a. Ryzen 9 3900X CPU (comes default with the colourful LED-lighted fan)

b. Asus X570 motherboard: ROG Crosshair VIII HERO (WIFI)

c. Phanteks casing (which I regretted very much – it is so poorly designed. Once the ATX power goes inside, with all the wires jutting out from the powerbox, it eat into the space meant for the 3.5″ harddisk. So I can only have ONE 3.5″ HDD, which have spaces meant for TWO. And there are so many illogical wiring designs internally – endless defective design).

d. Corsair RM650 650W power.

e. GPU is from AMD RX Radeon 5600 XT

f. DDR4 Corsair Vengeance LPX 16GB x 4 (motherboard maxout at 4 slot for memory)

If you need comparisons there are tons of comparison out there:

https://www.digitaltrends.com/computing/amd-ryzen-9-3900x-vs-intel-core-i9-9900k/

https://www.anandtech.com/show/15422/the-amd-radeon-rx-5600-xt-review

From GPUCheck:

https://www.gpucheck.com/compare/amd-radeon-rx-5600-xt-vs-nvidia-geforce-rtx-2060/intel-core-i7-8700k-3-70ghz-vs-intel-core-i7-8700k-3-70ghz/

SAMBA setup on Ubuntu 18.04

NOTE: SAMBA was originally SMB Server – but the name had to be changed due to SMB Server being an actual product. So just terminology differences.

After encountering hiccups like this:

https://ubuntuforums.org/showthread.php?t=2375075

and like this blog being no long valid:

https://adrianmejia.com/how-to-set-up-samba-in-ubuntu-linux-and-access-it-in-mac-os-and-windows/

I decided to write down the latest status for creating Samba shares based on Ubuntu 18.04 as the host server.

First install Samba:

sudo apt-get install samba

Then cifs-utils, which deprecated smbfs:

sudo apt-get install cifs-utils

And this is for client-side connection to Samba server:

sudo apt-get install smbclient

Next is to update the Samba configuration file (/etc/samba/smb.conf):

[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
min protocol = SMB2
max protocol = SMB3

#======================= Share Definitions =======================
[petershare]
comment = ISO share
browseable = yes
path = /sdc2/share
read only = yes

The higher version is to ensure that the lower version will not be used, which used to default to version 1.0 whenever Samba start, and this is vulnerable to wannacry vulnerability.

The share name we have here is “petershare“, to be noted when mounting is concerned.

Next to note is the Samba has its own users and password database – it does not share these with the OS users and password file.

The current OS user is “tthtlc“, and so we will assign the Samba password for tthtlc:

sudo smbpasswd -a tthtlc

And enable the user for Samba:

sudo smbpasswd -e tthtlc

Now before mounting, we can do a final restart and status check of the Samba server:

sudo systemctl status smbd

sudo systemctl restart smbd

sudo systemctl status nmbd

sudo systemctl restart nmbd

Next is to enable Samba to be accessible via the firewall:

sudo ufw allow ‘Samba’

From now, all command are from the client machine.   So to mount the “petershare” directory:

Get the hostname first via “hostname” command, and in our case it is “mymamapapa“. And if you ping it it should be 127.0.1.1:

sudo mkdir -p /mnt/myshare

sudo chmod 0777 /mnt/myshare

sudo umount /mnt/myshare

sudo mount -t cifs -o username=tthtlc,password=mypassword,vers=3.0 //mymamapapa/petershare /mnt/myshare

And finally a status check:

Enter “mount” and you get:

Some references I followed:

https://askubuntu.com/questions/1098369/mount-cifs-problems-on-ubuntu-18-04

https://linuxize.com/post/how-to-install-and-configure-samba-on-ubuntu-18-04/

Vickblöm

Research scattered with thoughts, ideas, and dreams

Penetration Testing Lab

Offensive Techniques & Methodologies

Astr0baby's not so random thoughts _____ rand() % 100;

@astr0baby on Twitter for fresh randomness

The Data Explorer

playing around with open data to learn some cool stuff about data analysis and the world

Conorsblog

Data | ML | NLP | Python | R

quyv

Just a thought

IFT6266 - H2017 Deep Learning

A Graduate Course Offered at Université de Montréal

Deep Learning IFT6266-H2017 UdeM

Philippe Paradis - My solutions to the image inpainting problem

IFT6266 – H2017 DEEP LEARNING

Pulkit's thoughts on the course project

Thomas Dinsmore's Blog

No man but a blockhead ever wrote except for money -- Samuel Johnson

the morning paper

a random walk through Computer Science research, by Adrian Colyer

The Spectator

Shakir's Machine Learning Blog