From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Ricardo Marin Matinata <rmm@br.ibm.com>,
Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
Jens Axboe <axboe@fb.com>
Subject: [PATCH 3.14 72/73] blk-throttle: check stats_cpu before reading it from sysfs
Date: Tue, 3 Mar 2015 22:13:40 -0800 [thread overview]
Message-ID: <20150304055344.391996114@linuxfoundation.org> (raw)
In-Reply-To: <20150304055332.344462103@linuxfoundation.org>
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
commit 045c47ca306acf30c740c285a77a4b4bda6be7c5 upstream.
When reading blkio.throttle.io_serviced in a recently created blkio
cgroup, it's possible to race against the creation of a throttle policy,
which delays the allocation of stats_cpu.
Like other functions in the throttle code, just checking for a NULL
stats_cpu prevents the following oops caused by that race.
[ 1117.285199] Unable to handle kernel paging request for data at address 0x7fb4d0020
[ 1117.285252] Faulting instruction address: 0xc0000000003efa2c
[ 1137.733921] Oops: Kernel access of bad area, sig: 11 [#1]
[ 1137.733945] SMP NR_CPUS=2048 NUMA PowerNV
[ 1137.734025] Modules linked in: bridge stp llc kvm_hv kvm binfmt_misc autofs4
[ 1137.734102] CPU: 3 PID: 5302 Comm: blkcgroup Not tainted 3.19.0 #5
[ 1137.734132] task: c000000f1d188b00 ti: c000000f1d210000 task.ti: c000000f1d210000
[ 1137.734167] NIP: c0000000003efa2c LR: c0000000003ef9f0 CTR: c0000000003ef980
[ 1137.734202] REGS: c000000f1d213500 TRAP: 0300 Not tainted (3.19.0)
[ 1137.734230] MSR: 9000000000009032 <SF,HV,EE,ME,IR,DR,RI> CR: 42008884 XER: 20000000
[ 1137.734325] CFAR: 0000000000008458 DAR: 00000007fb4d0020 DSISR: 40000000 SOFTE: 0
GPR00: c0000000003ed3a0 c000000f1d213780 c000000000c59538 0000000000000000
GPR04: 0000000000000800 0000000000000000 0000000000000000 0000000000000000
GPR08: ffffffffffffffff 00000007fb4d0020 00000007fb4d0000 c000000000780808
GPR12: 0000000022000888 c00000000fdc0d80 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 000001003e120200 c000000f1d5b0cc0 0000000000000200 0000000000000000
GPR24: 0000000000000001 c000000000c269e0 0000000000000020 c000000f1d5b0c80
GPR28: c000000000ca3a08 c000000000ca3dec c000000f1c667e00 c000000f1d213850
[ 1137.734886] NIP [c0000000003efa2c] .tg_prfill_cpu_rwstat+0xac/0x180
[ 1137.734915] LR [c0000000003ef9f0] .tg_prfill_cpu_rwstat+0x70/0x180
[ 1137.734943] Call Trace:
[ 1137.734952] [c000000f1d213780] [d000000005560520] 0xd000000005560520 (unreliable)
[ 1137.734996] [c000000f1d2138a0] [c0000000003ed3a0] .blkcg_print_blkgs+0xe0/0x1a0
[ 1137.735039] [c000000f1d213960] [c0000000003efb50] .tg_print_cpu_rwstat+0x50/0x70
[ 1137.735082] [c000000f1d2139e0] [c000000000104b48] .cgroup_seqfile_show+0x58/0x150
[ 1137.735125] [c000000f1d213a70] [c0000000002749dc] .kernfs_seq_show+0x3c/0x50
[ 1137.735161] [c000000f1d213ae0] [c000000000218630] .seq_read+0xe0/0x510
[ 1137.735197] [c000000f1d213bd0] [c000000000275b04] .kernfs_fop_read+0x164/0x200
[ 1137.735240] [c000000f1d213c80] [c0000000001eb8e0] .__vfs_read+0x30/0x80
[ 1137.735276] [c000000f1d213cf0] [c0000000001eb9c4] .vfs_read+0x94/0x1b0
[ 1137.735312] [c000000f1d213d90] [c0000000001ebb38] .SyS_read+0x58/0x100
[ 1137.735349] [c000000f1d213e30] [c000000000009218] syscall_exit+0x0/0x98
[ 1137.735383] Instruction dump:
[ 1137.735405] 7c6307b4 7f891800 409d00b8 60000000 60420000 3d420004 392a63b0 786a1f24
[ 1137.735471] 7d49502a e93e01c8 7d495214 7d2ad214 <7cead02a> e9090008 e9490010 e9290018
And here is one code that allows to easily reproduce this, although this
has first been found by running docker.
void run(pid_t pid)
{
int n;
int status;
int fd;
char *buffer;
buffer = memalign(BUFFER_ALIGN, BUFFER_SIZE);
n = snprintf(buffer, BUFFER_SIZE, "%d\n", pid);
fd = open(CGPATH "/test/tasks", O_WRONLY);
write(fd, buffer, n);
close(fd);
if (fork() > 0) {
fd = open("/dev/sda", O_RDONLY | O_DIRECT);
read(fd, buffer, 512);
close(fd);
wait(&status);
} else {
fd = open(CGPATH "/test/blkio.throttle.io_serviced", O_RDONLY);
n = read(fd, buffer, BUFFER_SIZE);
close(fd);
}
free(buffer);
exit(0);
}
void test(void)
{
int status;
mkdir(CGPATH "/test", 0666);
if (fork() > 0)
wait(&status);
else
run(getpid());
rmdir(CGPATH "/test");
}
int main(int argc, char **argv)
{
int i;
for (i = 0; i < NR_TESTS; i++)
test();
return 0;
}
Reported-by: Ricardo Marin Matinata <rmm@br.ibm.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
block/blk-throttle.c | 3 +++
1 file changed, 3 insertions(+)
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1292,6 +1292,9 @@ static u64 tg_prfill_cpu_rwstat(struct s
struct blkg_rwstat rwstat = { }, tmp;
int i, cpu;
+ if (tg->stats_cpu == NULL)
+ return 0;
+
for_each_possible_cpu(cpu) {
struct tg_stats_cpu *sc = per_cpu_ptr(tg->stats_cpu, cpu);
next prev parent reply other threads:[~2015-03-04 7:58 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 6:12 [PATCH 3.14 00/73] 3.14.35-stable review Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 01/73] Bluetooth: ath3k: workaround the compatibility issue with xHCI controller Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 02/73] xfs: ensure buffer types are set correctly Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 03/73] xfs: inode unlink does not set AGI buffer type Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 04/73] xfs: set superblock buffer type correctly Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 05/73] fsnotify: fix handling of renames in audit Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 06/73] iwlwifi: pcie: disable the SCD_BASE_ADDR when we resume from WoWLAN Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 07/73] iwlwifi: mvm: validate tid and sta_id in ba_notif Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 08/73] iwlwifi: mvm: fix failure path when power_update fails in add_interface Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 09/73] iwlwifi: mvm: always use mac color zero Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 10/73] HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 11/73] PCI: Generate uppercase hex for modalias var in uevent Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 13/73] cpufreq: Set cpufreq_cpu_data to NULL before putting kobject Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 15/73] cpufreq: s3c: remove incorrect __init annotations Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 16/73] xen/manage: Fix USB interaction issues when resuming Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 17/73] [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 18/73] ALSA: off by one bug in snd_riptide_joystick_probe() Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 19/73] ALSA: hdspm - Constrain periods to 2 on older cards Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 20/73] power_supply: 88pm860x: Fix leaked power supply on probe fail Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 21/73] power: bq24190: Fix ignored supplicants Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 22/73] power: gpio-charger: balance enable/disable_irq_wake calls Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 23/73] megaraid_sas: disable interrupt_mask before enabling hardware interrupts Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 26/73] mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 27/73] nfs: dont call blocking operations while !TASK_RUNNING Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 28/73] MIPS: KVM: Deliver guest interrupts after local_irq_disable() Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 29/73] mm/hugetlb: pmd_huge() returns true for non-present hugepage Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 30/73] tracing: Fix unmapping loop in tracing_mark_write Greg Kroah-Hartman
2015-03-04 6:12 ` [PATCH 3.14 31/73] ARM: 8284/1: sa1100: clear RCSR_SMR on resume Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 32/73] ARM: DRA7: hwmod: Fix boot crash with DEBUG_LL enabled on UART3 Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 33/73] ARM: dts: tegra20: fix GR3D, DSI unit and reg base addresses Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 34/73] ARM: dts: am335x-bone*: usb0 is hardwired for peripheral Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 35/73] tpm_tis: verify interrupt during init Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 36/73] TPM: Add new TPMs to the tail of the list to prevent inadvertent change of dev Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 37/73] char: tpm: Add missing error check for devm_kzalloc Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 38/73] tpm: Fix NULL return in tpm_ibmvtpm_get_desired_dma Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 39/73] tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 40/73] Added Little Endian support to vtpm module Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 41/73] NFSv4.1: Fix a kfree() of uninitialised pointers in decode_cb_sequence_args Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 42/73] iscsi-target: Drop problematic active_ts_list usage Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 43/73] cfq-iosched: handle failure of cfq group allocation Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 44/73] cfq-iosched: fix incorrect filing of rt async cfqq Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 45/73] axonram: Fix bug in direct_access Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 46/73] tty: Prevent untrappable signals from malicious program Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 47/73] tty/serial: at91: fix error handling in atmel_serial_probe() Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 48/73] USB: cp210x: add ID for RUGGEDCOM USB Serial Console Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 49/73] USB: fix use-after-free bug in usb_hcd_unlink_urb() Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 50/73] usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 51/73] vt: provide notifications on selection changes Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 52/73] ARM: pxa: add regulator_has_full_constraints to corgi board file Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 53/73] ARM: pxa: add regulator_has_full_constraints to poodle " Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 54/73] kdb: fix incorrect counts in KDB summary command output Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 55/73] ntp: Fixup adjtimex freq validation on 32-bit systems Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 56/73] ARC: fix page address calculation if PAGE_OFFSET != LINUX_LINK_BASE Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 57/73] KVM: s390: floating irqs: fix user triggerable endless loop Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 58/73] KVM: MIPS: Dont leak FPU/DSP to guest Greg Kroah-Hartman
2015-03-04 8:10 ` James Hogan
2015-03-04 18:22 ` Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 59/73] KVM: x86: update masterclock values on TSC writes Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 60/73] hx4700: regulator: declare full constraints Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 61/73] arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 62/73] gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 63/73] gpio: tps65912: fix wrong container_of arguments Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 64/73] xfs: Fix quota type in quota structures when reusing quota file Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 65/73] metag: Fix KSTK_EIP() and KSTK_ESP() macros Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 66/73] md/raid5: Fix livelock when array is both resyncing and degraded Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 68/73] EDAC, amd64_edac: Prevent OOPS with >16 memory controllers Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 69/73] jffs2: fix handling of corrupted summary length Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 70/73] btrfs: set proper message level for skinny metadata Greg Kroah-Hartman
2015-03-04 6:13 ` [PATCH 3.14 71/73] btrfs: fix leak of path in btrfs_find_item Greg Kroah-Hartman
2015-03-04 6:13 ` Greg Kroah-Hartman [this message]
2015-03-04 6:13 ` [PATCH 3.14 73/73] x86, mm/ASLR: Fix stack randomization on 64-bit systems Greg Kroah-Hartman
2015-03-04 14:11 ` [PATCH 3.14 00/73] 3.14.35-stable review Guenter Roeck
2015-03-04 18:16 ` Greg Kroah-Hartman
2015-03-05 2:23 ` Guenter Roeck
2015-03-05 16:08 ` [PATCH stable 3.10, 3.12, 3.14] MIPS: Export FP functions used by lose_fpu(1) for KVM James Hogan
2015-03-06 6:30 ` Greg Kroah-Hartman
2015-03-06 16:22 ` Guenter Roeck
2015-03-06 17:45 ` Greg Kroah-Hartman
2015-03-06 20:42 ` Guenter Roeck
2015-03-07 13:30 ` Jiri Slaby
2015-03-04 23:41 ` [PATCH 3.14 00/73] 3.14.35-stable review Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150304055344.391996114@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=axboe@fb.com \
--cc=cascardo@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmm@br.ibm.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome