]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rbd/huge-tickets.sh
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / qa / workunits / rbd / huge-tickets.sh
CommitLineData
11fdf7f2 1#!/usr/bin/env bash
7c673cae
FG
2
3# This is a test for http://tracker.ceph.com/issues/8979 and the fallout
4# from triaging it. #8979 itself was random crashes on corrupted memory
5# due to a buffer overflow (for tickets larger than 256 bytes), further
6# inspection showed that vmalloced tickets weren't handled correctly as
7# well.
8#
9# What we are doing here is generating three huge keyrings and feeding
10# them to libceph (through 'rbd map' on a scratch image). Bad kernels
11# will crash reliably either on corrupted memory somewhere or a bad page
12# fault in scatterwalk_pagedone().
13
14set -ex
15
16function generate_keyring() {
17 local user=$1
18 local n=$2
19
20 ceph-authtool -C -n client.$user --cap mon 'allow *' --gen-key /tmp/keyring-$user
21
22 set +x # don't pollute trace with echos
23 echo -en "\tcaps osd = \"allow rwx pool=rbd" >>/tmp/keyring-$user
24 for i in $(seq 1 $n); do
25 echo -n ", allow rwx pool=pool$i" >>/tmp/keyring-$user
26 done
27 echo "\"" >>/tmp/keyring-$user
28 set -x
29}
30
31generate_keyring foo 1000 # ~25K, kmalloc
32generate_keyring bar 20000 # ~500K, vmalloc
33generate_keyring baz 300000 # ~8M, vmalloc + sg chaining
34
35rbd create --size 1 test
36
37for user in {foo,bar,baz}; do
38 ceph auth import -i /tmp/keyring-$user
39 DEV=$(sudo rbd map -n client.$user --keyring /tmp/keyring-$user test)
40 sudo rbd unmap $DEV
41done