This file is indexed.

/usr/src/open-vm-tools-10.0.7/vsock/shared/driverLog.c is in open-vm-tools-dkms 2:10.0.7-3227872-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*********************************************************
 * Copyright (C) 2007-2014 VMware, Inc. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation version 2 and no later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 *
 *********************************************************/


/*
 * driverLog.c --
 *
 *      Common logging functions for Linux kernel modules.
 */

#include "driver-config.h"
#include "compat_kernel.h"
#include "compat_sched.h"
#include <asm/current.h>

#include "driverLog.h"

#define LINUXLOG_BUFFER_SIZE 1024

static const char *driverLogPrefix = "";

/*
 * vsnprintf was born in 2.4.10. Fall back on vsprintf if we're
 * an older kernel.
 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 10)
# define vsnprintf(str, size, fmt, args) vsprintf(str, fmt, args)
#endif


/*
 *----------------------------------------------------------------------------
 *
 * DriverLog_Init --
 *
 *      Initializes the Linux logging.
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      None.
 *
 *----------------------------------------------------------------------------
 */

void
DriverLog_Init(const char *prefix) // IN
{
   driverLogPrefix = prefix ? prefix : "";
}


/*
 *----------------------------------------------------------------------
 *
 * DriverLogPrint --
 *
 *      Log error message from a Linux module.
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      None.
 *
 *----------------------------------------------------------------------
 */

static void
DriverLogPrint(const char *level,     // IN: KERN_* constant
               const char *fmt,       // IN: error format string
               va_list args)          // IN: arguments for format string
{
   static char staticBuf[LINUXLOG_BUFFER_SIZE];
   char stackBuf[128];
   va_list args2;
   const char *buf;

   /*
    * By default, use a small buffer on the stack (thread safe). If it is too
    * small, fall back to a larger static buffer (not thread safe).
    */
   va_copy(args2, args);
   if (vsnprintf(stackBuf, sizeof stackBuf, fmt, args2) < sizeof stackBuf) {
      buf = stackBuf;
   } else {
      vsnprintf(staticBuf, sizeof staticBuf, fmt, args);
      buf = staticBuf;
   }
   va_end(args2);

   printk("%s%s[%d]: %s", level, driverLogPrefix, current->pid, buf);
}


/*
 *----------------------------------------------------------------------
 *
 * Warning --
 *
 *      Warning messages from kernel module: logged into kernel log
 *      as warnings.
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      None.
 *
 *----------------------------------------------------------------------
 */

void
Warning(const char *fmt, ...)  // IN: warning format string
{
   va_list args;

   va_start(args, fmt);
   DriverLogPrint(KERN_WARNING, fmt, args);
   va_end(args);
}


/*
 *----------------------------------------------------------------------
 *
 * Log --
 *
 *      Log messages from kernel module: logged into kernel log
 *      as debug information.
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      None.
 *
 *----------------------------------------------------------------------
 */

void
Log(const char *fmt, ...)  // IN: log format string
{
   va_list args;

   /*
    * Use the kernel log with at least a KERN_DEBUG level
    * so it doesn't garbage the screen at (re)boot time on RedHat 6.0.
    */

   va_start(args, fmt);
   DriverLogPrint(KERN_DEBUG, fmt, args);
   va_end(args);
}


/*
 *----------------------------------------------------------------------
 *
 * Panic --
 *
 *      ASSERTION failures and Panics from kernel module get here.
 *      Message is logged to the kernel log and on console.
 *
 * Results:
 *      None.
 *
 * Side effects:
 *      Never returns
 *
 *----------------------------------------------------------------------
 */

void
Panic(const char *fmt, ...)  // IN: panic format string
{
   va_list args;

   va_start(args, fmt);
   DriverLogPrint(KERN_EMERG, fmt, args);
   va_end(args);

#ifdef BUG
   BUG();
#else
   /* Should die with %cs unwritable, or at least with page fault. */
   asm volatile("movb $0, %cs:(0)");
#endif

   while (1);
}