Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1370959
| From | Kamal Mostafa <kamal@canonical.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.13.y-ckt 68/97] tracing: Fix trace_printk() to print when not using bprintk() |
| Date | 2016-04-05 01:30 +0200 |
| Message-ID | <rkm6v-2bK-33@gated-at.bofh.it> (permalink) |
| References | <rkm6u-2bK-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.13.11-ckt38 -stable review patch. If anyone has any objections, please let me know.
---8<------------------------------------------------------------
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
commit 3debb0a9ddb16526de8b456491b7db60114f7b5e upstream.
The trace_printk() code will allocate extra buffers if the compile detects
that a trace_printk() is used. To do this, the format of the trace_printk()
is saved to the __trace_printk_fmt section, and if that section is bigger
than zero, the buffers are allocated (along with a message that this has
happened).
If trace_printk() uses a format that is not a constant, and thus something
not guaranteed to be around when the print happens, the compiler optimizes
the fmt out, as it is not used, and the __trace_printk_fmt section is not
filled. This means the kernel will not allocate the special buffers needed
for the trace_printk() and the trace_printk() will not write anything to the
tracing buffer.
Adding a "__used" to the variable in the __trace_printk_fmt section will
keep it around, even though it is set to NULL. This will keep the string
from being printed in the debugfs/tracing/printk_formats section as it is
not needed.
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Fixes: 07d777fe8c398 "tracing: Add percpu buffers for trace_printk()"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
include/linux/kernel.h | 6 +++---
kernel/trace/trace_printk.c | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ecb8754..e6e8cf9 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -554,7 +554,7 @@ do { \
#define do_trace_printk(fmt, args...) \
do { \
- static const char *trace_printk_fmt \
+ static const char *trace_printk_fmt __used \
__attribute__((section("__trace_printk_fmt"))) = \
__builtin_constant_p(fmt) ? fmt : NULL; \
\
@@ -598,7 +598,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);
*/
#define trace_puts(str) ({ \
- static const char *trace_printk_fmt \
+ static const char *trace_printk_fmt __used \
__attribute__((section("__trace_printk_fmt"))) = \
__builtin_constant_p(str) ? str : NULL; \
\
@@ -620,7 +620,7 @@ extern void trace_dump_stack(int skip);
#define ftrace_vprintk(fmt, vargs) \
do { \
if (__builtin_constant_p(fmt)) { \
- static const char *trace_printk_fmt \
+ static const char *trace_printk_fmt __used \
__attribute__((section("__trace_printk_fmt"))) = \
__builtin_constant_p(fmt) ? fmt : NULL; \
\
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 7c8cef6..7b90047 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -292,6 +292,9 @@ static int t_show(struct seq_file *m, void *v)
const char *str = *fmt;
int i;
+ if (!*fmt)
+ return 0;
+
seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);
/*
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[3.13.y-ckt stable] Linux 3.13.11-ckt38 stable review Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 26/97] quota: Fix possible GPF due to uninitialised pointers Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 68/97] tracing: Fix trace_printk() to print when not using bprintk() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 21/97] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 93/97] paride: make 'verbose' parameter an 'int' again Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 08/97] usb: retry reset if a device times out Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 09/97] HID: core: do not scan reports if the group is already set Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 02/97] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 41/97] iser-target: Separate flows for np listeners and connections cma events Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 86/97] rtc: vr41xx: Wire up alarm_irq_enable Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 01/97] [stable-only] pipe: Fix buffer offset after partially failed read Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:30 +0200 [PATCH 3.13.y-ckt 70/97] rapidio/rionet: fix deadlock on SMP Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 50/97] ALSA: hda - Fix unconditional GPIO toggle via automute Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 84/97] mtd: map: fix .set_vpp() documentation Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 81/97] net/mlx5: Make command timeout way shorter Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 72/97] MAINTAINERS: Update mailing list and web page for hwmon subsystem Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 79/97] ethernet: micrel: fix some error codes Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 69/97] fs/coredump: prevent fsuid=0 dumps into user-controlled directories Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 75/97] clk: xgene: Add missing parenthesis when clearing divider value Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 96/97] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 54/97] x86/iopl: Fix iopl capability check on Xen PV Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 90/97] ASoC: s3c24xx: use const snd_soc_component_driver pointer Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 89/97] lpfc: fix misleading indentation Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 94/97] ppp: ensure file->private_data can't be overridden Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 83/97] ath9k: fix buffer overrun for ar9287 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 63/97] tracing: Fix crash from reading trace_pipe with sendfile Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 65/97] target: Fix target_release_cmd_kref shutdown comp leak Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 77/97] mdio-sun4i: oops in error handling in probe Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 92/97] nbd: ratelimit error msgs after socket close Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 66/97] KVM: VMX: avoid guest hang on invalid invept instruction Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 95/97] clk: versatile: sp810: support reentrance Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 62/97] tracing: Have preempt(irqs)off trace preempt disabled functions Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 82/97] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 76/97] ppp: take reference on channels netns Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 85/97] ARM: OMAP3: Add cpuidle parameters table for omap3430 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 78/97] net: Fix use after free in the recvmmsg exit path Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 91/97] kbuild/mkspec: fix grub2 installkernel issue Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 88/97] ipv4: fix broadcast packets reception Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 97/97] perf stat: Document --detailed option Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 61/97] USB: uas: Reduce can_queue to MAX_CMNDS Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 74/97] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 64/97] splice: handle zero nr_pages in splice_to_pipe() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:40 +0200 [PATCH 3.13.y-ckt 44/97] bus: imx-weim: Take the 'status' property value into account Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 40/97] Bluetooth: btusb: Add a new AR3012 ID 13d3:3472 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 24/97] watchdog: rc32434_wdt: fix ioctl error handling Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 37/97] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards. Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 43/97] xtensa: clear all DBREAKC registers on start Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 33/97] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 51/97] ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 59/97] USB: usb_driver_claim_interface: add sanity checking Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 53/97] nfsd: fix deadlock secinfo+readdir compound Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 35/97] x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 23/97] [media] bttv: Width must be a multiple of 16 when capturing planar formats Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 52/97] ALSA: usb-audio: Add sanity checks for endpoint accesses Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 46/97] s390/pci: enforce fmb page boundary rule Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 27/97] mtip32xx: Print exact time when an internal command is interrupted Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 57/97] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 49/97] HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 34/97] bcache: fix cache_set_flush() NULL pointer dereference on OOM Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 45/97] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41. Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 39/97] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 31/97] pinctrl-bcm2835: Fix cut-and-paste error in "pull" parsing Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 56/97] Input: synaptics - handle spurious release of trackstick buttons, again Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 55/97] Input: ims-pcu - sanity check against missing interfaces Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 28/97] KVM: i8254: change PIT discard tick policy Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 25/97] xfs: fix two memory leaks in xfs_attr_list.c error paths Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 58/97] USB: iowarrior: fix oops with malicious USB descriptors Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 60/97] USB: cdc-acm: more sanity checking Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 47/97] Input: powermate - fix oops with malicious USB descriptors Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 48/97] net: mvneta: enable change MAC address when interface is up Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 38/97] sg: fix dxferp in from_to case Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 42/97] xtensa: ISS: don't hang if stdin EOF is reached Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 30/97] rt2x00: add new rt2800usb device Buffalo WLI-UC-G450 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 36/97] be2iscsi: set the boot_kset pointer to NULL in case of failure Kamal Mostafa <kamal@canonical.com> - 2016-04-05 01:50 +0200 [PATCH 3.13.y-ckt 22/97] IB/srpt: Simplify srpt_handle_tsk_mgmt() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 06/97] 8250: use callbacks to access UART_DLL/UART_DLM Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 05/97] [media] pwc: Add USB id for Philips Spc880nc webcam Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 11/97] scripts/coccinelle: modernize & Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 12/97] [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 13/97] [media] saa7134: Fix bytesperline not being set correctly for planar formats Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 03/97] tty: Fix GPF in flush_to_ldisc(), part 2 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 14/97] perf tools: Dont stop PMU parsing on alias parse error Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 20/97] md/raid5: Compare apples to apples (or sectors to sectors) Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 04/97] [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 07/97] net: irda: Fix use-after-free in irtty_open() Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 15/97] Bluetooth: btusb: Add new AR3012 ID 13d3:3395 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 17/97] aacraid: Fix memory leak in aac_fib_map_free Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 18/97] mtd: onenand: fix deadlock in onenand_block_markbad Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 16/97] Bluetooth: Add new AR3012 ID 0489:e095 Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 19/97] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200 [PATCH 3.13.y-ckt 10/97] HID: fix hid_ignore_special_drivers module parameter Kamal Mostafa <kamal@canonical.com> - 2016-04-05 02:00 +0200
csiph-web