Skip to content
  • Daniel P. Berrangé's avatar
    772f1b37
    trace: forbid use of %m in trace event format strings · 772f1b37
    Daniel P. Berrangé authored
    
    
    The '%m' format instructs glibc's printf()/syslog() implementation to
    insert the contents of strerror(errno). Since this is a glibc extension
    it should generally be avoided in QEMU due to need for portability to a
    variety of platforms.
    
    Even though vfio is Linux-only code that could otherwise use "%m", it
    must still be avoided in trace-events files because several of the
    backends do not use the format string and so this error information is
    invisible to them.
    
    The errno string value should be given as an explicit trace argument
    instead, making it accessible to all backends. This also allows it to
    work correctly with future patches that use the format string with
    systemtap's simple printf code.
    
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    Message-id: 20190123120016.4538-4-berrange@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    772f1b37
    trace: forbid use of %m in trace event format strings
    Daniel P. Berrangé authored
    
    
    The '%m' format instructs glibc's printf()/syslog() implementation to
    insert the contents of strerror(errno). Since this is a glibc extension
    it should generally be avoided in QEMU due to need for portability to a
    variety of platforms.
    
    Even though vfio is Linux-only code that could otherwise use "%m", it
    must still be avoided in trace-events files because several of the
    backends do not use the format string and so this error information is
    invisible to them.
    
    The errno string value should be given as an explicit trace argument
    instead, making it accessible to all backends. This also allows it to
    work correctly with future patches that use the format string with
    systemtap's simple printf code.
    
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    Message-id: 20190123120016.4538-4-berrange@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Loading