VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/chk_stubs.c@ 71635

Last change on this file since 71635 was 70936, checked in by vboxsync, 7 years ago

Additions/linux: support producing builds which work with glibc 2.3.
bugref:9112: tools: update i386 Linux Additions build tool
Add an option - VBOX_WITH_OLD_GLIBC_SUPPORT - for producing Linux Additions
builds which work with glibc 2.3, by not referencing symbols which were
introduced later, including improved versions of APIs supported in glibc 2.3,
by not using GNU_HASH tags and by not using the stack protector.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/* $Id: chk_stubs.c 70936 2018-02-09 15:55:18Z vboxsync $ */
2/** @file
3 * glibc stubs for the VirtualBox Guest Addition X11 Client.
4 */
5
6/*
7 * Copyright (C) 2018 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* If we want the binary to be usable with glibc 2.3, we have to prevent
19 VBoxClient from containing later symbols. This includes resolution of
20 symbols from supc++ and gcc_eh. */
21
22#include <stdio.h>
23#include <stdarg.h>
24#include <string.h>
25#include <unistd.h>
26
27extern int __sprintf_chk(char *psz, int fFlags, size_t cb, const char *pszFormat, ...);
28int __sprintf_chk(char *psz, int fFlags, size_t cb, const char *pszFormat, ...)
29{
30 int rc;
31 va_list va;
32
33 (void)fFlags;
34 va_start(va, pszFormat);
35 rc = vsnprintf(psz, cb, pszFormat, va);
36 va_end(va);
37 return rc;
38}
39
40extern void __stack_chk_fail(void);
41void __stack_chk_fail(void)
42{
43 fprintf(stderr, "Stack check failed!\n");
44 _exit(1);
45}
46
47#ifdef __x86_64
48/* Furthermore, wrap references to memcpy to force them to go to the right
49 * version. We are forced to do it this way because the shared libraries
50 * supc++ and gcc_eh contain references which we cannot change. */
51asm (".symver memcpy, memcpy@GLIBC_2.2.5");
52void *__wrap_memcpy(void *dest, const void *src, size_t n)
53{
54 return memcpy(dest, src, n);
55}
56#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette