[Bug stdio/31137] New: Regression vfprintf + setbuf (no buffering)

david.marchand at redhat dot com sourceware-bugzilla@sourceware.org
Mon Dec 11 12:58:41 GMT 2023


https://sourceware.org/bugzilla/show_bug.cgi?id=31137

            Bug ID: 31137
           Summary: Regression vfprintf + setbuf (no buffering)
           Product: glibc
           Version: 2.37
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: david.marchand at redhat dot com
  Target Milestone: ---

Created attachment 15252
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15252&action=edit
log.c

For the context, OVS has its logging framework (which writes to file, console,
syslog etc...). DPDK is a library for networking datapath in userspace, and its
components generate log messages through its own framework. DPDK provides a way
to redirect those logs by passing a FILE * from fopencookie.
OVS does this and disables buffering.

After updating from f37 to f38 (glibc-2.36-17.fc37.x86_64 to
glibc-2.37-13.fc38.x86_64), I noticed a change in how the logs are written for
dpdk messages in OVS.

Example of output:
2023-11-17T12:50:38.137Z|00059|dpdk|INFO|VHOST_CONFIG:
(/home/dmarchan/git/pub/ovs/master/build/tests/system-dpdk-testsuite.dir/003/dpdkvhostclient0)
Linear buffers requ
2023-11-17T12:50:38.137Z|00060|dpdk|INFO|ested without external buffers,

The log message has been split in 128 bytes chunks (if I count correctly).

I attached a simple reproducer (to mimick what is done in OVS, which
takes over DPDK logs with a similar fopencookie + setbuf in non
buffering mode).

# From a f37 container:
[root@cb7d749e838f ~]# gcc -o log -Wall -Werror log.c; ./log
no setbuf
=========

Calling fprintf
idx=0 size=511

Calling vfprintf
idx=0 size=511


setbuf _IONBF
=============

Calling fprintf
idx=0 size=511

Calling vfprintf
idx=0 size=511


# From a f38 container:
[root@3fbf304e6894 ~]# gcc -o log -Wall -Werror log.c; ./log
no setbuf
=========

Calling fprintf
idx=0 size=511

Calling vfprintf
idx=0 size=511


setbuf _IONBF
=============

Calling fprintf
idx=0 size=511

Calling vfprintf
idx=0 size=128
idx=1 size=128
idx=2 size=128
idx=3 size=127

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list