Bug 762698 (GLUSTER-966) - NULL check for avoiding NULL dereferencing of pointers..
Summary: NULL check for avoiding NULL dereferencing of pointers..
Keywords:
Status: CLOSED DUPLICATE of bug 762569
Alias: GLUSTER-966
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Pranith Kumar K
QA Contact:
URL:
Whiteboard:
: GLUSTER-802 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-05-28 09:45 UTC by Amar Tumballi
Modified: 2015-12-01 16:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Anand Avati 2010-05-28 07:25:10 UTC
PATCH: http://patches.gluster.com/patch/3339 in master (cluster/stripe: added STACK_UNWIND_STRICT macro)

Comment 1 Anand Avati 2010-05-28 07:25:15 UTC
PATCH: http://patches.gluster.com/patch/3340 in master (cluster/stripe: NULL pointer dereference checks added)

Comment 2 Amar Tumballi 2010-05-28 09:45:32 UTC
This has to happen throughout the code base to avoid crashing of the product in any circumstances.

Comment 3 Anand Avati 2010-07-02 09:17:06 UTC
PATCH: http://patches.gluster.com/patch/3518 in master (NULL dereference fixes in code base after running with 'clang')

Comment 4 Amar Tumballi 2010-07-21 03:38:42 UTC
I ran clang by setting 'GF_CALLOC', GF_MALLOC and GF_REALLOC to be set as NULL..

out put says, on these lines, we may face NULL dereference errors.. 

  glusterfsd /src /glusterfsd.c                                   340
  libglusterfs /src /common-utils.c                               96
  libglusterfs /src /event.c                                      202
  libglusterfs /src /event.c                                      409
  libglusterfs /src /logging.c                                    333
  libglusterfs /src /logging.c                                    319
  libglusterfs /src /xlator.c                                     752
  rpc /rpc-lib /src /rpcsvc.c                                     2008
  rpc /rpc-transport /socket /src /socket.c                       1509
  xlators /cluster /afr /src /afr-dir-read.c                      392
  xlators /cluster /afr /src /afr-self-heal-algorithm.c           1041
  xlators /cluster /afr /src /afr-self-heal-common.c              156
  xlators /cluster /afr /src /afr-self-heal-common.c              1597
  xlators /cluster /afr /src /afr-self-heal-common.c              173
  xlators /cluster /afr /src /afr-self-heal-common.c              494
  xlators /cluster /afr /src /afr-self-heal-common.c              497
  xlators /cluster /afr /src /afr-self-heal-common.c              500
  xlators /cluster /afr /src /afr-self-heal-common.c              623
  xlators /cluster /afr /src /afr-self-heal-common.c              944
  xlators /cluster /afr /src /afr-self-heal-common.c              1465
  xlators /cluster /afr /src /afr-self-heal-data.c                397
  xlators /cluster /afr /src /afr-self-heal-data.c                407
  xlators /cluster /afr /src /afr-self-heal-data.c                774
  xlators /cluster /afr /src /afr-self-heal-entry.c               259
  xlators /cluster /afr /src /afr-self-heal-entry.c               246
  xlators /cluster /afr /src /afr-self-heal-metadata.c            235
  xlators /cluster /afr /src /afr-self-heal-metadata.c            254
  xlators /features /quota /src /quota.c                          782
  xlators /features /quota /src /quota.c                          1070
  xlators /features /quota /src /quota.c                          288
  xlators /features /quota /src /quota.c                          213
  xlators /mgmt /glusterd /src /glusterd-sm.c                     554
  xlators /nfs /server /src /mount3.c                             246
  xlators /performance /write-behind /src /write-behind.c         583
  xlators /protocol /legacy /server /src /server-helpers.c        579
  xlators /protocol /legacy /server /src /server-protocol.c       4918
  xlators /protocol /legacy /server /src /server-resolve.c        85
  xlators /protocol /legacy /transport /ib-verbs /src /ib-verbs.c 1835
  xlators /protocol /legacy /transport /ib-verbs /src /ib-verbs.c 2515
  xlators /protocol /legacy /transport /ib-verbs /src /ib-verbs.c 508
  xlators /protocol /legacy /transport /socket /src /socket.c     947
  xlators /protocol /server /src /server-handshake.c              95
  xlators /protocol /server /src /server-helpers.c                688
  xlators /protocol /server /src /server-resolve.c                80
  xlators /storage /posix /src /posix.c                           186

Comment 5 Amar Tumballi 2010-07-23 12:25:37 UTC
with patch http://patches.gluster.com/patch/3879/

we will be left with only below null derefs:

>   xlators /cluster /afr /src /afr-dir-read.c                      392
>   xlators /cluster /afr /src /afr-self-heal-algorithm.c           1041
>   xlators /cluster /afr /src /afr-self-heal-common.c              156
>   xlators /cluster /afr /src /afr-self-heal-common.c              1597
>   xlators /cluster /afr /src /afr-self-heal-common.c              173
>   xlators /cluster /afr /src /afr-self-heal-common.c              494
>   xlators /cluster /afr /src /afr-self-heal-common.c              497
>   xlators /cluster /afr /src /afr-self-heal-common.c              500
>   xlators /cluster /afr /src /afr-self-heal-common.c              623
>   xlators /cluster /afr /src /afr-self-heal-common.c              944
>   xlators /cluster /afr /src /afr-self-heal-common.c              1465
>   xlators /cluster /afr /src /afr-self-heal-data.c                397
>   xlators /cluster /afr /src /afr-self-heal-data.c                407
>   xlators /cluster /afr /src /afr-self-heal-data.c                774
>   xlators /cluster /afr /src /afr-self-heal-entry.c               259
>   xlators /cluster /afr /src /afr-self-heal-entry.c               246
>   xlators /cluster /afr /src /afr-self-heal-metadata.c            235
>   xlators /cluster /afr /src /afr-self-heal-metadata.c            254
>   xlators /features /quota /src /quota.c                          782
>   xlators /features /quota /src /quota.c                          1070
>   xlators /features /quota /src /quota.c                          288
>   xlators /features /quota /src /quota.c                          213
>   xlators /nfs /server /src /mount3.c                             246


We may skip these for now, as these are moved to legacy, and we may take it out of build from 3.1.1+ versions..

>   xlators /protocol /legacy /server /src /server-helpers.c        579
>   xlators /protocol /legacy /server /src /server-resolve.c        85
>   xlators /protocol /legacy /transport /ib-verbs /src /ib-verbs.c 1835
>   xlators /protocol /legacy /transport /ib-verbs /src /ib-verbs.c 2515
>   xlators /protocol /legacy /transport /ib-verbs /src /ib-verbs.c 508
>   xlators /protocol /legacy /transport /socket /src /socket.c     947

Comment 6 Amar Tumballi 2010-07-23 12:27:43 UTC
NULL dereferences are surely blocker for release

Comment 7 Tejas Bhise 2010-07-27 06:42:35 UTC
Amar, RaghuB - are these covered under the clang checks ? If they are all included, we can close this defect as its all being tracked in other defects.

Comment 8 Amar Tumballi 2010-07-27 07:36:05 UTC
Nope, these are not covered under 'clang' bugs which Raghu filed. I got these list by setting '#define GF_CALLOC NULL' in code and running the clang. It did report new null pointer dereference.

I have posted the files and line number where the bugs are above.

-Amar

Comment 9 Anand Avati 2010-07-28 07:34:53 UTC
PATCH: http://patches.gluster.com/patch/3931 in master (some check added to the variables after GF_CALLOC)

Comment 10 Anand Avati 2010-07-28 07:34:57 UTC
PATCH: http://patches.gluster.com/patch/3940 in master (removed last few remaining 'ERR_ABORT's from codebase)

Comment 11 Amar Tumballi 2010-07-28 07:49:34 UTC
*** Bug 802 has been marked as a duplicate of this bug. ***

Comment 12 Amar Tumballi 2010-08-12 05:57:21 UTC
Pranith, As you are handling afr bugs, the listed lines have NULL dereferences, please fix them.

Comment 13 Amar Tumballi 2010-09-13 04:07:36 UTC

*** This bug has been marked as a duplicate of bug 837 ***


Note You need to log in before you can comment on or make changes to this bug.