Mandalika's scratchpad [ Work blog @Oracle | Stock Market Notes | My Music Compositions ]

Old Posts: 09.04  10.04  11.04  12.04  01.05  02.05  03.05  04.05  05.05  06.05  07.05  08.05  09.05  10.05  11.05  12.05  01.06  02.06  03.06  04.06  05.06  06.06  07.06  08.06  09.06  10.06  11.06  12.06  01.07  02.07  03.07  04.07  05.07  06.07  08.07  09.07  10.07  11.07  12.07  01.08  02.08  03.08  04.08  05.08  06.08  07.08  08.08  09.08  10.08  11.08  12.08  01.09  02.09  03.09  04.09  05.09  06.09  07.09  08.09  09.09  10.09  11.09  12.09  01.10  02.10  03.10  04.10  05.10  06.10  07.10  08.10  09.10  10.10  11.10  12.10  01.11  02.11  03.11  04.11  05.11  07.11  08.11  09.11  10.11  11.11  12.11  01.12  02.12  03.12  04.12  05.12  06.12  07.12  08.12  09.12  10.12  11.12  12.12  01.13  02.13  03.13  04.13  05.13  06.13  07.13  08.13  09.13  10.13  11.13  12.13  01.14  02.14  03.14  04.14  05.14  06.14  07.14  09.14  10.14  11.14  12.14  01.15  02.15  03.15  04.15  06.15  09.15  12.15  01.16  03.16  04.16  05.16  06.16  07.16  08.16  09.16  12.16  01.17  02.17  03.17 

Wednesday, March 15, 2017
Word List #2

polemic a strong verbal or written attack on someone or something
emeritus having retired but allowed to retain their title as an honor
yank (short for yankee) slang for someone of American origin or heritage
pejorative expressing contempt or disapproval
gander look or glance at something (eg., take a gander at sth)
valiant showing courage or determination (eg., a valiant effort to do sth)
recuse to remove (oneself) from participation to avoid a conflict of interest
consigliere an adviser esp to a crime boss
hankering a strong desire to have or do something
crib copy (another person's work) illicitly or without acknowledgment
flummox perplex (someone) greatly; bewilder
ensconce establish or settle (someone) in a comfortable, safe, or secret place
ad hominem (of an argument or reaction) directed against a person rather than the position they are maintaining
vis-a-vis in relation to; with regard to
nascent (esp of a process or organization) just coming into existence and beginning to display signs of future potential
forage (of a person or animal) search widely for food or provisions
amble walk or move at a slow, relaxed pace
brook a small stream
compunction a feeling of guilt or moral scruple that prevents or follows the doing of something bad
vacuous having or showing a lack of thought or intelligence; mindless
mete dispense or allot justice, a punishment, or harsh treatment
glower have an angry or sullen look on one's face; scowl
disseminate spread or disperse (something, esp information) widely


Saturday, March 04, 2017
Blast from the Past : The Weekend Playlist #11

Previous playlists:

    #1    #8 (50s, 60s and 70s)    |    #2    #3    #4    #5 (80s)    |    #6    #7    #9 (90s)    |    #10 (Instrumental)

New category: "00s" (2000s) playlist. Audio & Widget courtesy: Spotify


Monday, February 20, 2017
Word List #1

groundswell a buildup of opinion or feeling in a large section of the population
cock-a-hoop extremely and obviously pleased esp about a triumph or success
beset to attack on all sides; assail; harass
tawdry showy but cheap and of poor quality
cordon prevent access to or from (an area or building) by surrounding it with police or other guards (think of "do not cross" yellow tape)
daft silly, foolish
ratched (same as wretched) of poor quality; shabby or filthy in appearance; unfortunate conditions or circumstances. 'hot mess'
beckon make a gesture with the hand, arm, or head to encourage someone to come nearer or follow
sidle to move close to someone in a quiet or secret way
detente the easing of hostility or strained relations, esp between countries
emissary a person sent on a special mission, usually as a diplomatic representative (a messenger)
gingerly in a careful or cautious manner
svelte (of a person) slender or graceful in figure or outline; slim
gaggle a disorderly or noisy group of people
daylight a perceptible space, gap, or difference
revel enjoy oneself in a lively and noisy way, esp with drinking and dancing
quaint attractively unusual or old-fashioned
caprice a sudden and unaccountable change of mood or behavior
salvo a simultaneous discharge of artillery or other guns in a battle
despondent in low spirits from loss of hope or courage
insinuate suggest or hint (something bad or reprehensible) in an indirect and unpleasant way
confluence an act or process of merging (eg., rivers)
decorum behavior in keeping with good taste and propriety (etiquette)
drudgery hard, menial, or dull work
exegesis critical explanation or interpretation of a text, esp of scripture

25 words


Tuesday, January 31, 2017
C, Solaris & SPARC M7: Get Defensive with Few Techniques .. Part 3/3

SPARC: Silicon Secured Memory (SSM)

Silicon Secured Memory (SSM) is a hardware feature available on the latest Oracle SPARC M7/T7/S7 platform that is designed to protect against invalid data accesses such as freed memory accesses, stale pointer references and buffer overflows real-time. It stops unauthorized access to memory whether that access is due to a programming error or a malicious attempt to exploit buffer overruns. This feature is designed to help prevent security vulnerabilities such as Heartbleed ♡. The hardware does it by comparing the version number stored in software managed pointer with the version number maintained in the memory cache lines§. A mismatch leads to a hardware trap that ultimately turns to an error.

This feature can be used during application development as well as in production to detect potential memory corruption issues. Applications written in programming languages such as C/C++ benefit the most as manual memory management plays an important role in those applications making them vulnerable to memory corruption triggered by programming errors. Existing applications can be enabled with SSM [without recompiling] by linking with a Oracle Solaris library during runtime. The overhead incurred by enabling this feature is minimal as the hardware has to generate a trap to report the error only when there is a memory access error.

As of now only 64-bit binaries can take advantage of SSM feature. One requirement is that allocated memory (target memory area for checking memory errors) needs to be 64-byte aligned and its size must be multiple of 64. Also watchout for other requirements and limitations that were outlined in some of the documents listed at the bottom of this post.

Rest of this blog post uses the following buggy code to demonstrate Silicon Secured Memory (SSM) feature.

% cat -n memerr.c

     1  #include <stdio.h>
     2  #include <stdlib.h>
     3  #include <string.h>
     5  void main(int argc, char *argv[])
     6  {
     7          char *longstr  = malloc( sizeof(char) * 64 );
     8          char *longstr2 = malloc( sizeof(char) * 64 );
    10          strcpy( longstr , argv[1] );
    11          strcpy( longstr2, argv[2] );
    13          for (int i = 0; i < 96; ++i)
    14                  printf( "%c ", longstr[i] ); /* read beyond boundary */
    15          printf( "\n" );
    17          free( longstr );
    18          free( longstr2 );
    20          strcpy( longstr , argv[2] ); /* freed memory access */
    21          strcpy( longstr2, argv[1] ); /* freed memory access */
    23          for (int i = 0; i < 96; ++i)
    24                  printf( "%c ", longstr[i] );
    25          printf( "\n" );
    27          free( longstr );  /* double free */
    28          free( longstr2 );  /* double free */
    29  }

% cc -g -m64 -o memerr memerr.c

SSM in Development Environment

Rely on Oracle Solaris Studio Code Analyzer and SSM to find and fix memory access errors.

Couple of options here. Both options require access to Oracle Solaris Studio 12.4 4/15 Platform Specific Enhancement (PSE) or later software.

  1. Preload libdiscoverADI library and run the application. This will run all 64-bit binaries in the application in SSM mode.

    % LD_PRELOAD_64=<install-dir>/lib/compilers/sparcv9/ ./memerr
  2. Enable discover utility to detect and understand runtime memory access errors identified by ADI. This can be done on a per binary basis in a large application.

     .. on build system ..
    % discover -i adi -A on -P on -w memerrs.txt memerr
     .. on deployment system (M7/T7/S7) ..
    % ./memerr jack jill
    j a c k                                                             j i l l
    j i l l                                                             j a c k
    % cat memerrs.txt
    ERROR 1 (ABR): reading memory beyond array bounds at address 0x2fffffff7d47e040 {memory: v3}:
            main() + 0x7c  
        was allocated at (0x2fffffff7d47e000, 64 bytes):
            main() + 0x10  
    ERROR 2 (FMW): writing to freed memory at address 0x2fffffff7d47e000 {memory: v9}:
            strcpy() + 0x4c
            _start() + 0x108
        was allocated at (0x2fffffff7d47e000, 64 bytes):
            main() + 0x10  
        freed at (0x2fffffff7d47e000, 64 bytes):
            main() + 0xc4  
    ERROR 12 (DFM): double freeing memory at address 0x3fffffff7d47e040 {memory: v10}:
            main() + 0x17c  
        was allocated at (0x3fffffff7d47e040, 64 bytes):
            main() + 0x20  
        freed at (0x3fffffff7d47e040, 64 bytes):
            main() + 0xd0  
            unique errors   : 12 (12 total)
     .. running the ADI enabled binary on a non-SSM system fails ..
    % ./memerr
    adi_set_enabled() failed: Operation not supported
    ADI/SSM is only supported on SPARC-xx machines. See discover -i adi documentation for more information

SSM in Production Environment

Preload libadimalloc(3LIB) library on target M7/T7/S7 system to enable real-time data protection. Data integrity is the ultimate goal.

Check the platform supported extensions to ensure that the target M7/T7/S7 system is SSM-ready.

% isainfo -v
64-bit sparcv9 applications
        xmpmul mwait sparc5 adi vis3b

Check the normal behavior of the above sample code that has quite a few memory access errors.

% ./memerr jack jill
j a c k    ▒                                                                A         j i l l    ▒
j i l l    ▒                                                                A         j a c k    ▒

Now check the behavior of the same buggy code under SSM surveillance.

% LD_PRELOAD_64=/lib/64/ ./memerr jack jill
Segmentation Fault (core dumped)

% echo ::status | mdb core
debugging core file of memerr (64-bit) from dummyhost
file: /var/tmp/memerr
initial argv: ./memerr jack jill
threading model: native threads
status: process terminated by SIGSEGV (Segmentation Fault), pc=100000bbc
, ADI version d mismatch for VA ffffffff7b13ff80

Notice that an existing binary was used as is in the above example to show the benefit of SSM in catching potential memory corruption issues.

For details, SEE:

Credit: various


Saturday, December 31, 2016
Blast from the Past : The Weekend Playlist #10

Previous playlists:

    #1    #8 (50s, 60s and 70s)    |    #2    #3    #4    #5 (80s)    |    #6    #7    #9 (90s)

New category: "instrumental" playlist. Audio & Widget courtesy: Spotify



This page is powered by Blogger. Isn't yours?