diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 3d1f853c6681..759a8291ff4a 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -113,6 +113,11 @@ Contact: "Jaegeuk Kim" Description: Set timeout to issue discard commands during umount. Default: 5 secs +What: /sys/fs/f2fs//pending_discard +Date: November 2021 +Contact: "Jaegeuk Kim" +Description: Shows the number of pending discard commands in the queue. + What: /sys/fs/f2fs//max_victim_search Date: January 2014 Contact: "Jaegeuk Kim" diff --git a/android/abi_gki_aarch64.xml b/android/abi_gki_aarch64.xml index f87e934ed06d..beeb9ae2d41f 100755 --- a/android/abi_gki_aarch64.xml +++ b/android/abi_gki_aarch64.xml @@ -17,6 +17,7 @@ + @@ -32,10 +33,16 @@ + + + + + + @@ -101,6 +108,7 @@ + @@ -125,6 +133,7 @@ + @@ -151,6 +160,7 @@ + @@ -183,6 +193,7 @@ + @@ -214,6 +225,7 @@ + @@ -230,6 +242,8 @@ + + @@ -257,6 +271,7 @@ + @@ -365,14 +380,21 @@ + + + + + + + @@ -424,6 +446,7 @@ + @@ -537,6 +560,7 @@ + @@ -682,6 +706,7 @@ + @@ -770,9 +795,11 @@ + + @@ -788,6 +815,7 @@ + @@ -857,6 +885,7 @@ + @@ -887,9 +916,12 @@ + + + @@ -922,6 +954,7 @@ + @@ -945,6 +978,7 @@ + @@ -991,9 +1025,12 @@ + + + @@ -1041,6 +1078,7 @@ + @@ -1049,6 +1087,8 @@ + + @@ -1157,6 +1197,7 @@ + @@ -1248,12 +1289,17 @@ + + + + + @@ -1298,6 +1344,7 @@ + @@ -1609,6 +1656,7 @@ + @@ -2191,6 +2239,7 @@ + @@ -2245,6 +2294,9 @@ + + + @@ -2281,11 +2333,23 @@ + + + + + + + + + + + + @@ -2302,6 +2366,7 @@ + @@ -2326,6 +2391,7 @@ + @@ -2375,12 +2441,19 @@ + + + + + + + @@ -2492,6 +2565,7 @@ + @@ -2657,6 +2731,9 @@ + + + @@ -2683,12 +2760,16 @@ + + + + @@ -2696,11 +2777,17 @@ + + + + + + @@ -2737,6 +2824,7 @@ + @@ -2786,8 +2874,14 @@ + + + + + + @@ -2860,12 +2954,15 @@ + + + @@ -2908,6 +3005,7 @@ + @@ -3028,8 +3126,11 @@ + + + @@ -3039,13 +3140,19 @@ + + + + + + @@ -3240,12 +3347,17 @@ + + + + + @@ -3329,6 +3441,7 @@ + @@ -3507,10 +3620,18 @@ + + + + + + + + @@ -3896,6 +4017,7 @@ + @@ -3965,8 +4087,10 @@ + + @@ -4180,6 +4304,7 @@ + @@ -4210,6 +4335,8 @@ + + @@ -4222,6 +4349,7 @@ + @@ -4332,6 +4460,7 @@ + @@ -4389,11 +4518,13 @@ + + @@ -4810,13 +4941,17 @@ + + + + @@ -4855,6 +4990,7 @@ + @@ -4910,8 +5046,10 @@ + + @@ -4939,9 +5077,15 @@ + + + + + + @@ -5112,6 +5256,9 @@ + + + @@ -5309,9 +5456,11 @@ + + @@ -5604,7 +5753,9 @@ + + @@ -5623,6 +5774,9 @@ + + + @@ -5716,6 +5870,7 @@ + @@ -5808,14 +5963,21 @@ + + + + + + + @@ -5868,6 +6030,7 @@ + @@ -5960,6 +6123,7 @@ + @@ -5998,6 +6162,7 @@ + @@ -7939,6 +8104,7 @@ + @@ -9615,174 +9781,174 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -11628,6 +11794,7 @@ + @@ -12264,6 +12431,7 @@ + @@ -13283,6 +13451,7 @@ + @@ -16615,6 +16784,7 @@ + @@ -16964,8 +17134,8 @@ - - + + @@ -21188,6 +21358,17 @@ + + + + + + + + + + + @@ -21335,6 +21516,7 @@ + @@ -21723,222 +21905,222 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -25195,6 +25377,7 @@ + @@ -25300,7 +25483,7 @@ - + @@ -25606,12 +25789,12 @@ - + - + - + @@ -27468,6 +27651,7 @@ + @@ -28114,6 +28298,12 @@ + + + + + + @@ -31002,6 +31192,7 @@ + @@ -31487,6 +31678,7 @@ + @@ -32079,6 +32271,13 @@ + + + + + + + @@ -33463,6 +33662,7 @@ + @@ -35493,27 +35693,27 @@ - + - + - + - + - + - + - + - + @@ -35562,6 +35762,12 @@ + + + + + + @@ -37285,6 +37491,7 @@ + @@ -37779,8 +37986,8 @@ - - + + @@ -40483,6 +40690,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -41410,9 +41643,9 @@ - + - + @@ -45287,6 +45520,7 @@ + @@ -46149,6 +46383,7 @@ + @@ -47241,24 +47476,24 @@ - + - + - + - + - + - + - + @@ -47729,18 +47964,18 @@ - + - + - + - + - + @@ -48145,9 +48380,9 @@ - + - + @@ -48877,6 +49112,12 @@ + + + + + + @@ -49748,7 +49989,71 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -52442,6 +52747,13 @@ + + + + + + + @@ -56396,6 +56708,11 @@ + + + + + @@ -60572,12 +60889,12 @@ - + - + - + @@ -62834,6 +63151,7 @@ + @@ -63030,7 +63348,20 @@ - + + + + + + + + + + + + + + @@ -64656,7 +64987,7 @@ - + @@ -65441,9 +65772,9 @@ - + - + @@ -69886,6 +70217,7 @@ + @@ -70784,14 +71116,7 @@ - - - - - - - - + @@ -71613,6 +71938,7 @@ + @@ -73811,12 +74137,12 @@ - + - + - + @@ -75166,15 +75492,15 @@ - + - + - + - + @@ -77172,6 +77498,7 @@ + @@ -77815,6 +78142,9 @@ + + + @@ -78411,21 +78741,21 @@ - + - + - + - + - + - + @@ -79277,12 +79607,12 @@ - + - + - + @@ -83473,24 +83803,24 @@ - + - + - + - + - + - + - + @@ -87934,6 +88264,7 @@ + @@ -88444,12 +88775,12 @@ - + - + - + @@ -88625,7 +88956,23 @@ - + + + + + + + + + + + + + + + + + @@ -89757,6 +90104,12 @@ + + + + + + @@ -91498,6 +91851,11 @@ + + + + + @@ -93576,30 +93934,30 @@ - + - + - + - + - + - + - + - + - + @@ -94293,12 +94651,12 @@ - + - + - + @@ -95466,6 +95824,7 @@ + @@ -98339,6 +98698,7 @@ + @@ -99720,26 +100080,27 @@ - + - + - + - + - + - + - + + @@ -100096,6 +100457,7 @@ + @@ -101458,6 +101820,17 @@ + + + + + + + + + + + @@ -104156,6 +104529,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -105234,6 +105627,12 @@ + + + + + + @@ -106884,6 +107283,7 @@ + @@ -107908,6 +108308,7 @@ + @@ -109024,12 +109425,12 @@ - + - + - + @@ -109526,6 +109927,7 @@ + @@ -112840,6 +113242,17 @@ + + + + + + + + + + + @@ -113003,6 +113416,11 @@ + + + + + @@ -113121,6 +113539,10 @@ + + + + @@ -113221,6 +113643,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -113244,6 +113698,10 @@ + + + + @@ -113659,6 +114117,11 @@ + + + + + @@ -113802,6 +114265,11 @@ + + + + + @@ -113907,9 +114375,9 @@ - - - + + + @@ -113958,6 +114426,11 @@ + + + + + @@ -114069,9 +114542,9 @@ - - - + + + @@ -114091,11 +114564,11 @@ - - - - - + + + + + @@ -114123,13 +114596,13 @@ - - - - - - - + + + + + + + @@ -114146,6 +114619,10 @@ + + + + @@ -114153,15 +114630,15 @@ - - - + + + - - - - + + + + @@ -114313,6 +114790,10 @@ + + + + @@ -114416,6 +114897,14 @@ + + + + + + + + @@ -114557,6 +115046,11 @@ + + + + + @@ -115265,17 +115759,35 @@ - - - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -115284,12 +115796,12 @@ - - - - - - + + + + + + @@ -115308,6 +115820,22 @@ + + + + + + + + + + + + + + + + @@ -115328,6 +115856,19 @@ + + + + + + + + + + + + + @@ -115653,6 +116194,11 @@ + + + + + @@ -116356,6 +116902,14 @@ + + + + + + + + @@ -116732,6 +117286,7 @@ + @@ -116823,15 +117378,22 @@ - - + + + + + - + + + + + @@ -116884,6 +117446,7 @@ + @@ -116976,6 +117539,7 @@ + @@ -117014,6 +117578,7 @@ + @@ -117112,12 +117677,12 @@ - - - - - - + + + + + + @@ -117467,12 +118032,12 @@ - - - - - - + + + + + + @@ -117489,9 +118054,9 @@ - - - + + + @@ -117507,8 +118072,8 @@ - - + + @@ -117525,6 +118090,13 @@ + + + + + + + @@ -117668,10 +118240,10 @@ - - - - + + + + @@ -117789,11 +118361,11 @@ - - - - - + + + + + @@ -117917,8 +118489,8 @@ - - + + @@ -118002,6 +118574,13 @@ + + + + + + + @@ -118018,6 +118597,11 @@ + + + + + @@ -118109,6 +118693,12 @@ + + + + + + @@ -118443,6 +119033,11 @@ + + + + + @@ -118604,6 +119199,14 @@ + + + + + + + + @@ -118620,6 +119223,18 @@ + + + + + + + + + + + + @@ -118647,18 +119262,18 @@ - - - + + + - - + + - - - + + + @@ -118850,6 +119465,13 @@ + + + + + + + @@ -118949,57 +119571,62 @@ - - + + - - + + - - + + - - - - - + + + + + + + + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - + + - - - + + + @@ -119216,6 +119843,12 @@ + + + + + + @@ -119224,6 +119857,14 @@ + + + + + + + + @@ -119329,9 +119970,9 @@ - - - + + + @@ -119368,8 +120009,8 @@ - - + + @@ -119401,14 +120042,14 @@ - - - + + + - - - + + + @@ -119419,9 +120060,9 @@ - - - + + + @@ -119504,6 +120145,12 @@ + + + + + + @@ -119527,8 +120174,8 @@ - - + + @@ -119546,6 +120193,19 @@ + + + + + + + + + + + + + @@ -120047,6 +120707,12 @@ + + + + + + @@ -120532,7 +121198,10 @@ - + + + + @@ -120540,6 +121209,12 @@ + + + + + + @@ -120549,16 +121224,30 @@ + + + + + + + + + + + + + + @@ -120803,8 +121492,8 @@ - - + + @@ -120815,16 +121504,20 @@ - - + + + + + + - - + + @@ -121718,9 +122411,9 @@ - - - + + + @@ -121735,9 +122428,9 @@ - - - + + + @@ -122118,10 +122811,10 @@ - - - - + + + + @@ -122231,10 +122924,10 @@ - - - - + + + + @@ -122356,17 +123049,17 @@ - - - + + + - - - - - - + + + + + + @@ -122499,6 +123192,12 @@ + + + + + + @@ -122568,108 +123267,108 @@ - - - + + + - - - + + + - - - - - + + + + + - - - + + + - - - - - + + + + + - - - + + + - - - - - + + + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - - - + + + + - - + + - - + + - - + + - - - - + + + + - - + + - - + + - - - + + + - + @@ -123090,14 +123789,14 @@ - - - + + + - - - + + + @@ -123158,8 +123857,8 @@ - - + + @@ -125431,10 +126130,10 @@ - - - - + + + + @@ -125450,19 +126149,19 @@ - - + + - - - + + + - - - - + + + + @@ -125541,6 +126240,10 @@ + + + + @@ -125828,6 +126531,20 @@ + + + + + + + + + + + + + + @@ -126023,6 +126740,11 @@ + + + + + @@ -126032,6 +126754,22 @@ + + + + + + + + + + + + + + + + @@ -126043,11 +126781,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126110,9 +126892,9 @@ - - - + + + @@ -126133,26 +126915,29 @@ - - + + + + + - - + + - - + + - - - - + + + + @@ -126244,6 +127029,12 @@ + + + + + + @@ -126277,10 +127068,10 @@ - - - - + + + + @@ -126523,17 +127314,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -126556,6 +127380,13 @@ + + + + + + + @@ -126683,12 +127514,12 @@ - - - - - - + + + + + + @@ -126743,20 +127574,20 @@ - - - + + + - - - + + + - + - + @@ -126764,20 +127595,20 @@ - - - + + + - - + + - - + + @@ -126808,29 +127639,29 @@ - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + @@ -126848,8 +127679,8 @@ - - + + @@ -127108,6 +127939,12 @@ + + + + + + @@ -127934,7 +128771,23 @@ + + + + + + + + + + + + + + + + @@ -128066,6 +128919,18 @@ + + + + + + + + + + + + @@ -128103,6 +128968,14 @@ + + + + + + + + @@ -128144,6 +129017,12 @@ + + + + + + @@ -128158,11 +129037,30 @@ - - - + + + + + + + + + + + + + + + + + + + + + + @@ -128172,6 +129070,12 @@ + + + + + + @@ -128350,6 +129254,9 @@ + + + @@ -128595,6 +129502,15 @@ + + + + + + + + + @@ -128603,6 +129519,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -128611,6 +129547,10 @@ + + + + @@ -129005,11 +129945,15 @@ + + + + - - + + @@ -129025,6 +129969,14 @@ + + + + + + + + @@ -129032,6 +129984,11 @@ + + + + + @@ -129237,8 +130194,8 @@ - - + + @@ -129264,6 +130221,10 @@ + + + + @@ -129281,9 +130242,9 @@ - - - + + + @@ -129299,15 +130260,15 @@ - - - + + + - - - - + + + + @@ -129332,9 +130293,9 @@ - - - + + + @@ -129720,8 +130681,8 @@ - - + + @@ -129734,8 +130695,8 @@ - - + + @@ -129874,6 +130835,13 @@ + + + + + + + @@ -129884,6 +130852,13 @@ + + + + + + + @@ -129926,6 +130901,10 @@ + + + + @@ -129960,6 +130939,10 @@ + + + + @@ -129967,6 +130950,22 @@ + + + + + + + + + + + + + + + + @@ -130200,12 +131199,12 @@ - + - - - + + + @@ -130568,13 +131567,13 @@ - - + + - - - + + + @@ -130664,8 +131663,8 @@ - - + + @@ -130723,13 +131722,13 @@ - - + + - - - + + + @@ -130768,8 +131767,8 @@ - - + + @@ -130777,20 +131776,20 @@ - - + + - - + + - - + + - - + + @@ -130879,34 +131878,42 @@ - - + + - - - - - - + + + + + + - - + + - - + + - + - - - - - + + + + + + + + + + + + + @@ -130937,6 +131944,24 @@ + + + + + + + + + + + + + + + + + + @@ -131014,8 +132039,8 @@ - - + + @@ -131024,16 +132049,16 @@ - - - + + + - - - - - + + + + + @@ -131206,11 +132231,11 @@ - - - - - + + + + + @@ -131231,12 +132256,12 @@ - - + + - - + + @@ -131246,8 +132271,8 @@ - - + + @@ -131362,6 +132387,12 @@ + + + + + + @@ -131474,53 +132505,53 @@ - - - - + + + + - - - - + + + + - - + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - + + + @@ -131528,14 +132559,14 @@ - - - + + + - - - + + + @@ -132283,16 +133314,36 @@ + + + + + + + + + + + + + + + + + + + + @@ -132301,6 +133352,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -132417,12 +133496,12 @@ - - - - - - + + + + + + @@ -132473,12 +133552,12 @@ - - + + - - + + @@ -132502,15 +133581,15 @@ - - + + - - - - - + + + + + @@ -132594,8 +133673,8 @@ - - + + @@ -132658,14 +133737,14 @@ - - - + + + - - - + + + @@ -132688,13 +133767,13 @@ - - - - + + + + - + @@ -132705,8 +133784,8 @@ - - + + @@ -132944,8 +134023,8 @@ - - + + @@ -132976,8 +134055,8 @@ - - + + @@ -133440,29 +134519,29 @@ - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + @@ -133972,14 +135051,14 @@ - - + + - - - - + + + + @@ -134000,20 +135079,20 @@ - - + + - - - - + + + + - - - - + + + + @@ -134022,12 +135101,12 @@ - - + + - - + + @@ -134044,16 +135123,16 @@ - - - - + + + + - - - - + + + + @@ -134114,36 +135193,36 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + @@ -134280,6 +135359,10 @@ + + + + @@ -134370,17 +135453,17 @@ - - - - - + + + + + - - - - + + + + @@ -134586,6 +135669,10 @@ + + + + @@ -134595,6 +135682,11 @@ + + + + + @@ -134729,8 +135821,8 @@ - - + + @@ -135195,10 +136287,10 @@ - - - - + + + + @@ -135535,8 +136627,8 @@ - - + + @@ -135544,17 +136636,17 @@ - - - + + + - - - - - - + + + + + + @@ -135600,8 +136692,8 @@ - - + + @@ -135629,12 +136721,12 @@ - - + + - - + + @@ -135659,20 +136751,25 @@ - - + + - - - + + + - - - + + + + + + + + @@ -135811,6 +136908,16 @@ + + + + + + + + + + @@ -135880,6 +136987,12 @@ + + + + + + @@ -136423,6 +137536,14 @@ + + + + + + + + @@ -136715,6 +137836,11 @@ + + + + + @@ -136739,6 +137865,11 @@ + + + + + @@ -137472,8 +138603,8 @@ - - + + @@ -137577,15 +138708,15 @@ - - - + + + - - - - + + + + @@ -138988,6 +140119,10 @@ + + + + @@ -139008,6 +140143,10 @@ + + + + @@ -139016,6 +140155,15 @@ + + + + + + + + + @@ -139211,6 +140359,12 @@ + + + + + + @@ -139486,6 +140640,11 @@ + + + + + @@ -139494,6 +140653,10 @@ + + + + @@ -139645,6 +140808,25 @@ + + + + + + + + + + + + + + + + + + + @@ -139660,6 +140842,16 @@ + + + + + + + + + + @@ -140334,9 +141526,9 @@ - - - + + + @@ -140344,9 +141536,9 @@ - - - + + + @@ -140354,8 +141546,8 @@ - - + + @@ -140385,9 +141577,9 @@ - - - + + + @@ -140513,20 +141705,20 @@ - - + + - - + + - - + + - - + + @@ -140547,6 +141739,18 @@ + + + + + + + + + + + + @@ -140646,8 +141850,8 @@ - - + + @@ -140742,10 +141946,10 @@ - - - - + + + + @@ -140833,27 +142037,27 @@ - - - - - + + + + + - - + + - - + + - - + + @@ -140872,17 +142076,17 @@ - - - - + + + + - - - - - + + + + + @@ -141142,45 +142346,45 @@ - - + + - - - - + + + + - - - + + + - - - - + + + + - - - + + + - - + + - - - + + + - - - - + + + + @@ -141198,31 +142402,31 @@ - - + + - - + + - - - + + + - - - + + + - - - + + + @@ -141322,8 +142526,8 @@ - - + + @@ -141354,8 +142558,8 @@ - - + + @@ -141463,6 +142667,11 @@ + + + + + @@ -141477,6 +142686,11 @@ + + + + + @@ -142564,8 +143778,8 @@ - - + + @@ -143038,12 +144252,24 @@ - - - - + + + + + + + + + + + + + + + + @@ -143111,23 +144337,38 @@ - - - - - + + + + + - - + + - - - - + + + + + + + + + + + + + + + + + + + @@ -143251,15 +144492,15 @@ - - - - + + + + - - - + + + @@ -143275,27 +144516,27 @@ - - + + - - + + - - - + + + - - - - + + + + @@ -143308,13 +144549,13 @@ - - - + + + - - + + @@ -143328,13 +144569,13 @@ - - + + - - - + + + @@ -143349,22 +144590,22 @@ - - - - - - + + + + + + - - - + + + - - - + + + @@ -143404,13 +144645,13 @@ - - - + + + - - + + diff --git a/android/abi_gki_aarch64_asus b/android/abi_gki_aarch64_asus new file mode 100755 index 000000000000..a44e7e67e0e4 --- /dev/null +++ b/android/abi_gki_aarch64_asus @@ -0,0 +1,280 @@ +[abi_symbol_list] +add_to_page_cache_locked +__alloc_pages_nodemask +__arch_copy_from_user +__arch_copy_to_user +arm64_const_caps_ready +autoremove_wake_function +balance_dirty_pages_ratelimited +bcmp +bdev_read_only +__bforget +bio_add_page +bio_alloc_bioset +bio_associate_blkg +bio_put +__bitmap_weight +bit_waitqueue +blkdev_issue_discard +blkdev_issue_flush +blk_finish_plug +blk_start_plug +__blockdev_direct_IO +block_invalidatepage +block_is_partially_uptodate +__breadahead +__bread_gfp +__brelse +buffer_migrate_page +__cancel_dirty_page +capable +capable_wrt_inode_uidgid +__cfi_slowpath +__check_object_size +clean_bdev_aliases +__cleancache_invalidate_inode +clear_inode +clear_page +clear_page_dirty_for_io +complete_and_exit +cpu_hwcap_keys +cpu_hwcaps +create_empty_buffers +current_umask +d_add +d_add_ci +delete_from_page_cache +d_instantiate +d_make_root +d_obtain_alias +down_read +down_write +down_write_trylock +dput +drop_nlink +d_splice_alias +dump_stack +end_buffer_read_sync +end_buffer_write_sync +end_page_writeback +errseq_set +failure_tracking +fget +fiemap_fill_next_extent +fiemap_prep +filemap_fault +filemap_fdatawait_range +filemap_fdatawrite +filemap_flush +__filemap_set_wb_err +filemap_write_and_wait_range +file_remove_privs +file_update_time +file_write_and_wait_range +filp_close +filp_open +finish_wait +flush_dcache_page +fput +freezing_slow_path +fs_bio_set +generic_error_remove_page +generic_file_direct_write +generic_file_llseek +generic_file_mmap +generic_file_open +generic_file_read_iter +generic_file_splice_read +generic_fillattr +generic_perform_write +generic_read_dir +generic_write_checks +__getblk_gfp +gic_nonsecure_priorities +grab_cache_page_write_begin +iget5_locked +igrab +ihold +ilookup5 +inc_nlink +in_group_p +__init_rwsem +init_special_inode +init_wait_entry +__init_waitqueue_head +inode_dio_wait +inode_init_once +inode_init_owner +inode_newsize_ok +inode_set_flags +__insert_inode_hash +invalidate_bdev +invalidate_mapping_pages +io_schedule +iov_iter_advance +iov_iter_alignment +iov_iter_copy_from_user_atomic +iov_iter_fault_in_readable +iov_iter_get_pages +iov_iter_single_seg_count +iput +is_bad_inode +iter_file_splice_write +iunique +jiffies +kasan_flag_enabled +kfree +kill_block_super +__kmalloc +kmalloc_caches +kmem_cache_alloc +kmem_cache_alloc_trace +kmem_cache_create +kmem_cache_create_usercopy +kmem_cache_destroy +kmem_cache_free +kthread_create_on_node +kthread_should_stop +kthread_stop +ktime_get_coarse_real_ts64 +kvfree +__list_add_valid +__list_del_entry_valid +ll_rw_block +load_nls +load_nls_default +__lock_buffer +__lock_page +lru_cache_add +make_bad_inode +mark_buffer_async_write +mark_buffer_dirty +mark_buffer_write_io_error +__mark_inode_dirty +mark_page_accessed +memcmp +memcpy +memmove +memset +mktime64 +mnt_drop_write_file +mnt_want_write_file +module_layout +mount_bdev +mpage_readahead +mpage_readpage +__mutex_init +mutex_lock +mutex_trylock +mutex_unlock +new_inode +notify_change +pagecache_get_page +page_cache_next_miss +page_cache_prev_miss +page_mapped +__page_pinner_migration_failed +pagevec_lookup_range +pagevec_lookup_range_tag +__pagevec_release +page_zero_new_buffers +__percpu_down_read +preempt_schedule +preempt_schedule_notrace +prepare_to_wait +prepare_to_wait_event +printk +__printk_ratelimit +__put_page +put_pages_list +___ratelimit +_raw_read_lock +_raw_read_lock_irqsave +_raw_read_unlock +_raw_read_unlock_irqrestore +_raw_spin_lock +_raw_spin_lock_irqsave +_raw_spin_unlock +_raw_spin_unlock_irqrestore +_raw_write_lock +_raw_write_lock_irqsave +_raw_write_unlock +_raw_write_unlock_irqrestore +rcuwait_wake_up +readahead_gfp_mask +read_cache_page +redirty_page_for_writepage +__refrigerator +register_filesystem +__remove_inode_hash +sb_min_blocksize +sb_set_blocksize +schedule +schedule_timeout_interruptible +security_inode_init_security +seq_printf +setattr_prepare +set_freezable +set_nlink +set_page_dirty +__set_page_dirty_buffers +__set_page_dirty_nobuffers +set_user_nice +simple_strtol +simple_strtoul +simple_strtoull +snprintf +sprintf +sscanf +__stack_chk_fail +__stack_chk_guard +strchr +strcmp +strlen +strncasecmp +strncmp +strsep +strstr +submit_bh +submit_bio +sync_blockdev +__sync_dirty_buffer +sync_dirty_buffer +sync_filesystem +sync_inode_metadata +system_freezing_cnt +sys_tz +tag_pages_for_writeback +__test_set_page_writeback +time64_to_tm +timestamp_truncate +touch_atime +truncate_inode_pages +truncate_inode_pages_final +truncate_pagecache +truncate_setsize +try_to_release_page +try_to_writeback_inodes_sb +unload_nls +unlock_buffer +unlock_new_inode +unlock_page +unmap_mapping_range +unregister_filesystem +up_read +up_write +vfree +vfs_fsync_range +vmalloc +__vmalloc +vsnprintf +vzalloc +__wait_on_buffer +wait_on_page_bit +wake_bit_function +__wake_up +wake_up_process +__warn_printk +write_inode_now +write_one_page +xa_load diff --git a/android/abi_gki_aarch64_galaxy b/android/abi_gki_aarch64_galaxy index 343a40594e66..f8d07776abc9 100644 --- a/android/abi_gki_aarch64_galaxy +++ b/android/abi_gki_aarch64_galaxy @@ -4317,9 +4317,11 @@ usb_unpoison_urb usb_unregister_notify usb_wakeup_notification + usbnet_cdc_unbind usbnet_change_mtu usbnet_defer_kevent usbnet_disconnect + usbnet_generic_cdc_bind usbnet_get_drvinfo usbnet_get_endpoints usbnet_get_link diff --git a/android/abi_gki_aarch64_generic b/android/abi_gki_aarch64_generic index f19b3266a8cf..cc8edfd0d35e 100644 --- a/android/abi_gki_aarch64_generic +++ b/android/abi_gki_aarch64_generic @@ -63,6 +63,7 @@ bitmap_to_arr32 __bitmap_weight blk_alloc_queue + blk_check_plugged blk_cleanup_queue blkdev_get_by_dev blkdev_put @@ -686,6 +687,7 @@ drm_property_create_range drm_property_lookup_blob drm_property_replace_blob + drm_puts __drm_puts_seq_file drm_read drm_rect_clip_scaled @@ -1012,6 +1014,7 @@ __kfifo_in __kfifo_init __kfifo_out + __kfifo_out_peek kfree kfree_sensitive kfree_skb @@ -1032,6 +1035,7 @@ kobject_add kobject_create_and_add kobject_del + kobject_get kobject_init kobject_init_and_add kobject_put @@ -1079,6 +1083,7 @@ ktime_get_real_seconds ktime_get_real_ts64 ktime_get_seconds + ktime_get_snapshot ktime_get_ts64 ktime_get_with_offset kvfree @@ -1590,6 +1595,7 @@ rtc_valid_tm __rt_mutex_init rt_mutex_lock + rt_mutex_trylock rt_mutex_unlock rtnl_is_locked rtnl_lock diff --git a/android/abi_gki_aarch64_imx b/android/abi_gki_aarch64_imx index d9b45b8fc993..3218ed541784 100644 --- a/android/abi_gki_aarch64_imx +++ b/android/abi_gki_aarch64_imx @@ -20,6 +20,9 @@ bcmp bdput __bitmap_and + blocking_notifier_call_chain + blocking_notifier_chain_register + blocking_notifier_chain_unregister bpf_trace_run1 bpf_trace_run2 bpf_trace_run3 @@ -67,6 +70,7 @@ clk_set_parent clk_set_rate clk_unprepare + clockevents_config_and_register complete complete_all completion_done @@ -102,6 +106,7 @@ debugfs_create_dir debugfs_create_file debugfs_remove + default_llseek deferred_free delayed_work_timer_fn del_timer @@ -160,6 +165,7 @@ devm_phy_create devm_phy_get devm_pinctrl_get + devm_pinctrl_put devm_platform_ioremap_resource __devm_regmap_init __devm_regmap_init_i2c @@ -201,6 +207,12 @@ dma_buf_map_attachment dma_buf_put dma_buf_unmap_attachment + dma_fence_context_alloc + dma_fence_default_wait + dma_fence_init + dma_fence_release + dma_fence_signal_locked + dma_fence_wait_timeout dma_free_attrs dma_heap_add dma_heap_get_dev @@ -368,6 +380,7 @@ event_triggers_call extcon_set_state_sync failure_tracking + fd_install find_next_bit finish_wait flush_work @@ -398,6 +411,7 @@ get_cpu_device get_device get_random_bytes + get_unused_fd_flags gic_nonsecure_priorities gpiochip_generic_free gpiochip_generic_request @@ -430,6 +444,7 @@ i2c_recover_bus i2c_register_driver i2c_smbus_read_byte_data + i2c_smbus_write_byte_data i2c_transfer i2c_transfer_buffer_flags i2c_unregister_device @@ -510,6 +525,7 @@ __list_add_valid __list_del_entry_valid __local_bh_enable_ip + __lock_page __log_post_read_mmio __log_read_mmio __log_write_mmio @@ -531,6 +547,7 @@ __memcpy_fromio memdup_user memmove + memparse memset __memset_io memstart_addr @@ -590,6 +607,7 @@ of_alias_get_id of_clk_add_hw_provider of_clk_get + of_clk_get_by_name of_clk_hw_onecell_get of_count_phandle_with_args of_device_get_match_data @@ -614,6 +632,7 @@ of_get_next_child of_get_parent of_get_property + of_get_regulator_init_data of_graph_get_next_endpoint of_graph_get_port_by_id of_graph_get_remote_node @@ -881,6 +900,7 @@ __stack_chk_fail __stack_chk_guard strcasecmp + strcat strcmp strcpy strlcpy @@ -889,11 +909,14 @@ strncpy strrchr strscpy + strsep strstr __sw_hweight16 __sw_hweight32 __sw_hweight64 __sw_hweight8 + sync_file_create + sync_file_get_fence synchronize_irq synchronize_net synchronize_rcu @@ -911,6 +934,7 @@ tasklet_init tasklet_kill __tasklet_schedule + timer_of_init trace_event_buffer_commit trace_event_buffer_reserve trace_event_ignore_this_pid @@ -945,6 +969,7 @@ uart_update_timeout uart_write_wakeup __udelay + unlock_page __unregister_chrdev unregister_chrdev_region unregister_inet6addr_notifier @@ -1058,6 +1083,7 @@ vmap vsnprintf vunmap + wait_for_completion wait_for_completion_interruptible wait_for_completion_interruptible_timeout wait_for_completion_timeout @@ -1249,9 +1275,6 @@ mmc_cqe_request_done # required by device_cooling.ko - blocking_notifier_call_chain - blocking_notifier_chain_register - blocking_notifier_chain_unregister thermal_cooling_device_unregister thermal_of_cooling_device_register @@ -1283,6 +1306,29 @@ devm_phy_optional_get drm_of_encoder_active_endpoint +# required by fb.ko + __arch_copy_in_user + compat_alloc_user_space + console_lock + console_unlock + fb_mode_option + file_update_time + file_write_and_wait_range + ignore_console_lock_warning + int_sqrt + is_console_locked + __memcpy_toio + of_get_videomode + page_mkclean + proc_create_seq_private + simple_strtol + vm_get_page_prot + vm_iomap_memory + +# required by fb_fence.ko + put_unused_fd + system_unbound_wq + # required by fec.ko ethtool_op_get_ts_info mdiobus_alloc_size @@ -1329,6 +1375,12 @@ tso_count_descs tso_start +# required by fp9931-core.ko + devm_mfd_add_devices + +# required by fp9931-regulator.ko + gpiod_get_raw_value + # required by fsl-edma-v3.ko dma_get_slave_channel of_dma_controller_free @@ -1355,13 +1407,7 @@ dev_pm_opp_add dev_pm_opp_remove dma_fence_array_ops - dma_fence_context_alloc - dma_fence_default_wait - dma_fence_init - dma_fence_release dma_fence_signal - dma_fence_signal_locked - dma_fence_wait_timeout down driver_create_file driver_remove_file @@ -1369,10 +1415,8 @@ drm_gem_object_lookup drm_gem_object_release drm_gem_private_object_init - fd_install find_vma find_vpid - get_unused_fd_flags get_user_pages hrtimer_resolution iommu_attach_device @@ -1389,24 +1433,18 @@ platform_bus_type reset_control_reset schedule_hrtimeout - sync_file_create - sync_file_get_fence __task_pid_nr_ns _totalram_pages vm_mmap vm_munmap vm_zone_stat -# required by gmsl-max9286.ko - i2c_smbus_write_byte_data - # required by goodix.ko gpiod_direction_input input_alloc_absinfo input_mt_sync_frame touchscreen_parse_properties touchscreen_report_pos - wait_for_completion # required by gpio-imx-rpmsg.ko __irq_alloc_descs @@ -1441,7 +1479,6 @@ # required by gpio-regulator.ko devm_kstrdup gpiod_count - of_get_regulator_init_data # required by gpio-reset.ko reset_controller_register @@ -1759,11 +1796,9 @@ sdio_writeb sdio_writesb skb_realloc_headroom - strcat strchr strim strncasecmp - strsep vprintk wakeup_source_add wakeup_source_remove @@ -1822,13 +1857,15 @@ clk_unregister divider_get_val divider_recalc_rate - of_clk_get_by_name of_clk_get_from_provider # required by mxc-jpeg-encdec.ko v4l2_m2m_dqbuf v4l2_m2m_qbuf +# required by mxc_epdc_v2_fb.ko + fb_get_options + # required by mxs-dma.ko dmaenginem_async_device_register tasklet_setup @@ -1866,9 +1903,6 @@ v4l2_event_subdev_unsubscribe __v4l2_find_nearest_size -# required by ov5640_camera_mipi_v2.ko - devm_pinctrl_put - # required by panel-raydium-rm67191.ko devm_backlight_device_register mipi_dsi_dcs_get_display_brightness @@ -2123,7 +2157,6 @@ snd_interval_refine # required by snd-soc-imx-audmux.ko - default_llseek simple_open simple_read_from_buffer @@ -2236,9 +2269,10 @@ dmabuf_page_pool_destroy dmabuf_page_pool_free -# required by timer-imx-sysctr.ko - clockevents_config_and_register - timer_of_init +# required by timer-imx-tpm.ko + clocksource_mmio_init + clocksource_mmio_readl_up + sched_clock_register # required by trusty-ipc.ko _copy_from_iter @@ -2336,7 +2370,6 @@ fsync_bdev __get_free_pages __init_rwsem - memparse memset64 __num_online_cpus page_endio @@ -2359,7 +2392,6 @@ kern_mount kern_unmount kill_anon_super - __lock_page page_mapping _raw_read_lock _raw_read_unlock @@ -2367,5 +2399,4 @@ _raw_write_unlock register_shrinker __SetPageMovable - unlock_page unregister_shrinker diff --git a/android/abi_gki_aarch64_lenovo b/android/abi_gki_aarch64_lenovo new file mode 100644 index 000000000000..0049535a4a1f --- /dev/null +++ b/android/abi_gki_aarch64_lenovo @@ -0,0 +1,10 @@ +[abi_symbol_list] +# required by raid0.ko + __tracepoint_block_bio_remap + disk_stack_limits + blk_queue_max_write_same_sectors + __traceiter_block_bio_remap + submit_bio_noacct + bio_split +# required by lenovo-fan.ko + clk_set_duty_cycle diff --git a/android/abi_gki_aarch64_oplus b/android/abi_gki_aarch64_oplus index 9afce39e651c..2c5078428d3e 100644 --- a/android/abi_gki_aarch64_oplus +++ b/android/abi_gki_aarch64_oplus @@ -893,6 +893,7 @@ freezing_slow_path freq_qos_add_notifier freq_qos_add_request + freq_qos_remove_notifier freq_qos_remove_request freq_qos_update_request freq_scale @@ -2585,16 +2586,23 @@ __traceiter_android_vh_alter_rwsem_list_add __traceiter_android_vh_arch_set_freq_scale __traceiter_android_vh_binder_alloc_new_buf_locked - __traceiter_android_vh_binder_new_ref __traceiter_android_vh_binder_del_ref - __traceiter_android_vh_binder_proc_transaction + __traceiter_android_vh_binder_free_proc + __traceiter_android_vh_binder_has_work_ilocked + __traceiter_android_vh_binder_looper_state_registered + __traceiter_android_vh_binder_new_ref __traceiter_android_vh_binder_preset __traceiter_android_vh_binder_priority_skip + __traceiter_android_vh_binder_proc_transaction + __traceiter_android_vh_binder_proc_transaction_end + __traceiter_android_vh_binder_read_done __traceiter_android_vh_binder_reply __traceiter_android_vh_binder_restore_priority __traceiter_android_vh_binder_set_priority __traceiter_android_vh_binder_trans __traceiter_android_vh_binder_transaction_init + __traceiter_android_vh_binder_thread_read + __traceiter_android_vh_binder_thread_release __traceiter_android_vh_binder_wait_for_work __traceiter_android_vh_binder_wakeup_ilocked __traceiter_android_vh_build_sched_domains @@ -2626,6 +2634,7 @@ __traceiter_android_vh_ftrace_oops_enter __traceiter_android_vh_ftrace_oops_exit __traceiter_android_vh_ftrace_size_check + __traceiter_android_vh_futex_sleep_start __traceiter_android_vh_get_from_fragment_pool __traceiter_android_vh_gpio_block_read __traceiter_android_vh_include_reserved_zone @@ -2779,14 +2788,21 @@ __tracepoint_android_vh_alter_rwsem_list_add __tracepoint_android_vh_arch_set_freq_scale __tracepoint_android_vh_binder_alloc_new_buf_locked - __tracepoint_android_vh_binder_new_ref __tracepoint_android_vh_binder_del_ref - __tracepoint_android_vh_binder_proc_transaction + __tracepoint_android_vh_binder_free_proc + __tracepoint_android_vh_binder_has_work_ilocked + __tracepoint_android_vh_binder_looper_state_registered + __tracepoint_android_vh_binder_new_ref __tracepoint_android_vh_binder_preset __tracepoint_android_vh_binder_priority_skip + __tracepoint_android_vh_binder_proc_transaction + __tracepoint_android_vh_binder_proc_transaction_end + __tracepoint_android_vh_binder_read_done __tracepoint_android_vh_binder_reply __tracepoint_android_vh_binder_restore_priority __tracepoint_android_vh_binder_set_priority + __tracepoint_android_vh_binder_thread_read + __tracepoint_android_vh_binder_thread_release __tracepoint_android_vh_binder_trans __tracepoint_android_vh_binder_transaction_init __tracepoint_android_vh_binder_wait_for_work @@ -2820,6 +2836,7 @@ __tracepoint_android_vh_ftrace_oops_enter __tracepoint_android_vh_ftrace_oops_exit __tracepoint_android_vh_ftrace_size_check + __tracepoint_android_vh_futex_sleep_start __tracepoint_android_vh_get_from_fragment_pool __tracepoint_android_vh_gpio_block_read __tracepoint_android_vh_include_reserved_zone @@ -3325,6 +3342,7 @@ woken_wake_function work_busy work_on_cpu + wq_worker_comm ww_mutex_lock ww_mutex_unlock __xa_alloc diff --git a/android/abi_gki_aarch64_qcom b/android/abi_gki_aarch64_qcom index 9680a3058076..01c5fe8eea68 100644 --- a/android/abi_gki_aarch64_qcom +++ b/android/abi_gki_aarch64_qcom @@ -899,6 +899,7 @@ finish_wait firmware_request_nowarn flush_dcache_page + flush_delayed_fput flush_delayed_work __flush_icache_range flush_work @@ -1104,6 +1105,7 @@ idr_replace iio_channel_get_all iio_read_channel_processed + iio_write_channel_raw import_iovec in4_pton in6_pton @@ -2089,6 +2091,7 @@ rproc_put rproc_remove_subdev rproc_report_crash + rproc_set_firmware rproc_shutdown rtc_ktime_to_tm __rtc_register_device @@ -2613,6 +2616,7 @@ __tracepoint_android_rvh_cpu_cgroup_online __tracepoint_android_rvh_cpufreq_transition __tracepoint_android_rvh_dequeue_task + __tracepoint_android_rvh_do_ptrauth_fault __tracepoint_android_rvh_do_sched_yield __tracepoint_android_rvh_enqueue_task __tracepoint_android_rvh_find_busiest_queue @@ -2696,6 +2700,7 @@ __tracepoint_android_vh_show_max_freq __tracepoint_android_vh_show_resume_epoch_val __tracepoint_android_vh_show_suspend_epoch_val + __tracepoint_android_vh_subpage_dma_contig_alloc __tracepoint_android_vh_timer_calc_index __tracepoint_android_vh_ufs_check_int_errors __tracepoint_android_vh_ufs_clock_scaling diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl index ee7b01bb7346..95b996b6c4f1 100644 --- a/arch/alpha/kernel/syscalls/syscall.tbl +++ b/arch/alpha/kernel/syscalls/syscall.tbl @@ -480,3 +480,5 @@ 548 common pidfd_getfd sys_pidfd_getfd 549 common faccessat2 sys_faccessat2 550 common process_madvise sys_process_madvise +# 557 reserved for memfd_secret +558 common process_mrelease sys_process_mrelease diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl index d056a548358e..ee8207e943fa 100644 --- a/arch/arm/tools/syscall.tbl +++ b/arch/arm/tools/syscall.tbl @@ -454,3 +454,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index b3b2019f8d16..3cb206aea3db 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -38,7 +38,7 @@ #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) -#define __NR_compat_syscalls 441 +#define __NR_compat_syscalls 449 #endif #define __ARCH_WANT_SYS_CLONE diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 107f08e03b9f..7ae50cc6cd1c 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -889,6 +889,8 @@ __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd) __SYSCALL(__NR_faccessat2, sys_faccessat2) #define __NR_process_madvise 440 __SYSCALL(__NR_process_madvise, sys_process_madvise) +#define __NR_process_mrelease 448 +__SYSCALL(__NR_process_mrelease, sys_process_mrelease) /* * Please add new compat syscalls above this comment and update diff --git a/arch/ia64/kernel/syscalls/syscall.tbl b/arch/ia64/kernel/syscalls/syscall.tbl index b96ed8b8a508..f2b90e45c9c2 100644 --- a/arch/ia64/kernel/syscalls/syscall.tbl +++ b/arch/ia64/kernel/syscalls/syscall.tbl @@ -361,3 +361,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl index 625fb6d32842..a2715bc6d409 100644 --- a/arch/m68k/kernel/syscalls/syscall.tbl +++ b/arch/m68k/kernel/syscalls/syscall.tbl @@ -440,3 +440,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl index aae729c95cf9..5b9f1166dfff 100644 --- a/arch/microblaze/kernel/syscalls/syscall.tbl +++ b/arch/microblaze/kernel/syscalls/syscall.tbl @@ -446,3 +446,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl index 32817c954435..2ee36d91dbf0 100644 --- a/arch/mips/kernel/syscalls/syscall_n32.tbl +++ b/arch/mips/kernel/syscalls/syscall_n32.tbl @@ -379,3 +379,5 @@ 438 n32 pidfd_getfd sys_pidfd_getfd 439 n32 faccessat2 sys_faccessat2 440 n32 process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 n32 process_mrelease sys_process_mrelease diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl index 9e4ea3c31b1c..d7ee167969e7 100644 --- a/arch/mips/kernel/syscalls/syscall_n64.tbl +++ b/arch/mips/kernel/syscalls/syscall_n64.tbl @@ -355,3 +355,5 @@ 438 n64 pidfd_getfd sys_pidfd_getfd 439 n64 faccessat2 sys_faccessat2 440 n64 process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 n64 process_mrelease sys_process_mrelease diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl index 29f5f28cf5ce..03f0ff8f841c 100644 --- a/arch/mips/kernel/syscalls/syscall_o32.tbl +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl @@ -428,3 +428,5 @@ 438 o32 pidfd_getfd sys_pidfd_getfd 439 o32 faccessat2 sys_faccessat2 440 o32 process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 o32 process_mrelease sys_process_mrelease diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl index f375ea528e59..084e3ddba434 100644 --- a/arch/parisc/kernel/syscalls/syscall.tbl +++ b/arch/parisc/kernel/syscalls/syscall.tbl @@ -438,3 +438,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl index 1275daec7fec..1249444185b7 100644 --- a/arch/powerpc/kernel/syscalls/syscall.tbl +++ b/arch/powerpc/kernel/syscalls/syscall.tbl @@ -530,3 +530,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl index 28c168000483..9f0ff9fb01b2 100644 --- a/arch/s390/kernel/syscalls/syscall.tbl +++ b/arch/s390/kernel/syscalls/syscall.tbl @@ -443,3 +443,5 @@ 438 common pidfd_getfd sys_pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease sys_process_mrelease diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl index 783738448ff5..8db35413732c 100644 --- a/arch/sh/kernel/syscalls/syscall.tbl +++ b/arch/sh/kernel/syscalls/syscall.tbl @@ -443,3 +443,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl index 78160260991b..e451795515c8 100644 --- a/arch/sparc/kernel/syscalls/syscall.tbl +++ b/arch/sparc/kernel/syscalls/syscall.tbl @@ -486,3 +486,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl index 0d0667a9fbd7..5a6c85f13d99 100644 --- a/arch/x86/entry/syscalls/syscall_32.tbl +++ b/arch/x86/entry/syscalls/syscall_32.tbl @@ -445,3 +445,4 @@ 438 i386 pidfd_getfd sys_pidfd_getfd 439 i386 faccessat2 sys_faccessat2 440 i386 process_madvise sys_process_madvise +448 i386 process_mrelease sys_process_mrelease diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl index 379819244b91..d31c21e3408d 100644 --- a/arch/x86/entry/syscalls/syscall_64.tbl +++ b/arch/x86/entry/syscalls/syscall_64.tbl @@ -362,6 +362,7 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +448 common process_mrelease sys_process_mrelease # # Due to a historical design error, certain syscalls are numbered differently diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl index b070f272995d..4fd1365f6aa2 100644 --- a/arch/xtensa/kernel/syscalls/syscall.tbl +++ b/arch/xtensa/kernel/syscalls/syscall.tbl @@ -411,3 +411,5 @@ 438 common pidfd_getfd sys_pidfd_getfd 439 common faccessat2 sys_faccessat2 440 common process_madvise sys_process_madvise +# 447 reserved for memfd_secret +448 common process_mrelease sys_process_mrelease diff --git a/build.config.gki.aarch64 b/build.config.gki.aarch64 index 690b6ec805f4..37a8271fd178 100644 --- a/build.config.gki.aarch64 +++ b/build.config.gki.aarch64 @@ -19,6 +19,7 @@ android/abi_gki_aarch64_galaxy android/abi_gki_aarch64_generic android/abi_gki_aarch64_hikey960 android/abi_gki_aarch64_imx +android/abi_gki_aarch64_lenovo android/abi_gki_aarch64_mtk android/abi_gki_aarch64_oplus android/abi_gki_aarch64_qcom @@ -27,6 +28,7 @@ android/abi_gki_aarch64_unisoc android/abi_gki_aarch64_virtual_device android/abi_gki_aarch64_vivo android/abi_gki_aarch64_xiaomi +android/abi_gki_aarch64_asus " FILES="${FILES} diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index a99ff854a2ed..c9636c3c6dbd 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -74,6 +74,23 @@ config ANDROID_VENDOR_HOOKS Allow vendor modules to attach to tracepoint "hooks" defined via DECLARE_HOOK or DECLARE_RESTRICTED_HOOK. +config ANDROID_STRUCT_PADDING + bool "Android Struct Padding" + default y + help + This option enables the padding that the Android GKI kernel adds + to many different kernel structures to support an in-kernel stable ABI + over the lifespan of support for the kernel as well as OEM additional + fields that are needed by some of the Android kernel tracepoints. + + Only disable this option if you have a system that needs the Android + kernel drivers, but is NOT an Android GKI kernel image and you do NOT + use the Android kernel tracepoints. If disabled it has the possibility + to make the kernel static and runtime image slightly smaller but will + NOT be supported by the Google Android kernel team. + + If even slightly unsure, say Y. + endif # if ANDROID endmenu diff --git a/drivers/android/binder.c b/drivers/android/binder.c index d1a1cd56a6aa..c51478a185cc 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -491,6 +491,11 @@ static void binder_inc_node_tmpref_ilocked(struct binder_node *node); static bool binder_has_work_ilocked(struct binder_thread *thread, bool do_proc_work) { + int ret = 0; + + trace_android_vh_binder_has_work_ilocked(thread, do_proc_work, &ret); + if (ret) + return true; return thread->process_todo || thread->looper_need_return || (do_proc_work && @@ -2528,6 +2533,9 @@ static int binder_proc_transaction(struct binder_transaction *t, binder_enqueue_work_ilocked(&t->work, &node->async_todo); } + trace_android_vh_binder_proc_transaction_end(current, proc->tsk, + thread ? thread->task : NULL, t->code, pending_async, !oneway); + if (!pending_async) binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); @@ -3617,6 +3625,7 @@ static int binder_thread_write(struct binder_proc *proc, } thread->looper |= BINDER_LOOPER_STATE_REGISTERED; binder_inner_proc_unlock(proc); + trace_android_vh_binder_looper_state_registered(thread, proc); break; case BC_ENTER_LOOPER: binder_debug(BINDER_DEBUG_THREADS, @@ -4041,6 +4050,7 @@ retry: binder_inner_proc_unlock(proc); break; } + trace_android_vh_binder_thread_read(&list, proc, thread); w = binder_dequeue_work_head_ilocked(list); if (binder_worklist_empty_ilocked(&thread->todo)) thread->process_todo = false; @@ -4507,6 +4517,7 @@ static void binder_free_proc(struct binder_proc *proc) put_task_struct(proc->tsk); put_cred(eproc->cred); binder_stats_deleted(BINDER_STAT_PROC); + trace_android_vh_binder_free_proc(proc); kfree(eproc); } @@ -4605,6 +4616,7 @@ static int binder_thread_release(struct binder_proc *proc, if (send_reply) binder_send_failed_reply(send_reply, BR_DEAD_REPLY); binder_release_work(proc, &thread->todo); + trace_android_vh_binder_thread_release(proc, thread); binder_thread_dec_tmpref(thread); return active_transactions; } @@ -4681,6 +4693,7 @@ static int binder_ioctl_write_read(struct file *filp, if (!binder_worklist_empty_ilocked(&proc->todo)) binder_wakeup_proc_ilocked(proc); binder_inner_proc_unlock(proc); + trace_android_vh_binder_read_done(proc, thread); if (ret < 0) { if (copy_to_user(ubuf, &bwr, sizeof(bwr))) ret = -EFAULT; diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 17f42e726b55..f1e530388bd0 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -110,6 +110,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_finished); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_rwsem_list_add); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_futex_plist_add); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_futex_sleep_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_wait_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_wait_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rtmutex_wait_start); @@ -293,6 +294,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_binder_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); @@ -399,3 +401,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_offline); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_online); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_subpage_dma_contig_alloc); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_looper_state_registered); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_thread_read); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_proc); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_thread_release); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_has_work_ilocked); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_read_done); diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c index 9de751531831..826dcc42629c 100644 --- a/drivers/clocksource/mmio.c +++ b/drivers/clocksource/mmio.c @@ -21,6 +21,7 @@ u64 clocksource_mmio_readl_up(struct clocksource *c) { return (u64)readl_relaxed(to_mmio_clksrc(c)->reg); } +EXPORT_SYMBOL_GPL(clocksource_mmio_readl_up); u64 clocksource_mmio_readl_down(struct clocksource *c) { @@ -46,7 +47,7 @@ u64 clocksource_mmio_readw_down(struct clocksource *c) * @bits: Number of valid bits * @read: One of clocksource_mmio_read*() above */ -int __init clocksource_mmio_init(void __iomem *base, const char *name, +int clocksource_mmio_init(void __iomem *base, const char *name, unsigned long hz, int rating, unsigned bits, u64 (*read)(struct clocksource *)) { @@ -68,3 +69,4 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name, return clocksource_register_hz(&cs->clksrc, hz); } +EXPORT_SYMBOL_GPL(clocksource_mmio_init); diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 8a8a6bcef917..ea35dfb22d9e 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -351,29 +351,18 @@ out: static long _dma_buf_set_name(struct dma_buf *dmabuf, const char *name) { - long ret = 0; - - dma_resv_lock(dmabuf->resv, NULL); - if (!list_empty(&dmabuf->attachments)) { - ret = -EBUSY; - goto out_unlock; - } spin_lock(&dmabuf->name_lock); kfree(dmabuf->name); dmabuf->name = name; spin_unlock(&dmabuf->name_lock); -out_unlock: - dma_resv_unlock(dmabuf->resv); - return ret; + return 0; } /** * dma_buf_set_name - Set a name to a specific dma_buf to track the usage. - * The name of the dma-buf buffer can only be set when the dma-buf is not - * attached to any devices. It could theoritically support changing the - * name of the dma-buf if the same piece of memory is used for multiple - * purpose between different devices. + * It could support changing the name of the dma-buf if the same piece of + * memory is used for multiple purpose between different devices. * * @dmabuf: [in] dmabuf buffer that will be renamed. * @buf: [in] A piece of userspace memory that contains the name of diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 6ed8f98ece57..b07695805c6c 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -246,13 +246,17 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); else if (lvl == 2) table = kmem_cache_zalloc(data->l2_tables, gfp); + + if (!table) + return NULL; + phys = virt_to_phys(table); if (phys != (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */ dev_err(dev, "Page table does not fit in PTE: %pa", &phys); goto out_free; } - if (table && !cfg->coherent_walk) { + if (!cfg->coherent_walk) { dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); if (dma_mapping_error(dev, dma)) goto out_free; diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c index 9a9f1c24d832..9e7cf9f36057 100644 --- a/drivers/mtd/nand/raw/nandsim.c +++ b/drivers/mtd/nand/raw/nandsim.c @@ -2453,5 +2453,6 @@ static void __exit ns_cleanup_module(void) module_exit(ns_cleanup_module); MODULE_LICENSE ("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_AUTHOR ("Artem B. Bityuckiy"); MODULE_DESCRIPTION ("The NAND flash simulator"); diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index e85b04e9716b..0597478129ff 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -1476,3 +1476,4 @@ MODULE_VERSION(__stringify(UBI_VERSION)); MODULE_DESCRIPTION("UBI - Unsorted Block Images"); MODULE_AUTHOR("Artem Bityutskiy"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 9a8fa2e582d5..f0f9d9007d49 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -1602,3 +1602,4 @@ module_init(nvmet_init); module_exit(nvmet_exit); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index bd9ccf9b6bd8..f9612eeb714e 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1944,6 +1944,69 @@ struct rproc *rproc_get_by_phandle(phandle phandle) #endif EXPORT_SYMBOL(rproc_get_by_phandle); +/** + * rproc_set_firmware() - assign a new firmware + * @rproc: rproc handle to which the new firmware is being assigned + * @fw_name: new firmware name to be assigned + * + * This function allows remoteproc drivers or clients to configure a custom + * firmware name that is different from the default name used during remoteproc + * registration. The function does not trigger a remote processor boot, + * only sets the firmware name used for a subsequent boot. This function + * should also be called only when the remote processor is offline. + * + * This allows either the userspace to configure a different name through + * sysfs or a kernel-level remoteproc or a remoteproc client driver to set + * a specific firmware when it is controlling the boot and shutdown of the + * remote processor. + * + * Return: 0 on success or a negative value upon failure + */ +int rproc_set_firmware(struct rproc *rproc, const char *fw_name) +{ + struct device *dev; + int ret, len; + char *p; + + if (!rproc || !fw_name) + return -EINVAL; + + dev = rproc->dev.parent; + + ret = mutex_lock_interruptible(&rproc->lock); + if (ret) { + dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, ret); + return -EINVAL; + } + + if (rproc->state != RPROC_OFFLINE) { + dev_err(dev, "can't change firmware while running\n"); + ret = -EBUSY; + goto out; + } + + len = strcspn(fw_name, "\n"); + if (!len) { + dev_err(dev, "can't provide empty string for firmware name\n"); + ret = -EINVAL; + goto out; + } + + p = kstrndup(fw_name, len, GFP_KERNEL); + if (!p) { + ret = -ENOMEM; + goto out; + } + + kfree(rproc->firmware); + rproc->firmware = p; + +out: + mutex_unlock(&rproc->lock); + return ret; +} +EXPORT_SYMBOL(rproc_set_firmware); + static int rproc_validate(struct rproc *rproc) { switch (rproc->state) { diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index e3dc6ee27e58..60e2be0a4e30 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -157,38 +157,9 @@ static ssize_t firmware_store(struct device *dev, const char *buf, size_t count) { struct rproc *rproc = to_rproc(dev); - char *p; - int err, len = count; + int err; - err = mutex_lock_interruptible(&rproc->lock); - if (err) { - dev_err(dev, "can't lock rproc %s: %d\n", rproc->name, err); - return -EINVAL; - } - - if (rproc->state != RPROC_OFFLINE) { - dev_err(dev, "can't change firmware while running\n"); - err = -EBUSY; - goto out; - } - - len = strcspn(buf, "\n"); - if (!len) { - dev_err(dev, "can't provide a NULL firmware\n"); - err = -EINVAL; - goto out; - } - - p = kstrndup(buf, len, GFP_KERNEL); - if (!p) { - err = -ENOMEM; - goto out; - } - - kfree(rproc->firmware); - rproc->firmware = p; -out: - mutex_unlock(&rproc->lock); + err = rproc_set_firmware(rproc, buf); return err ? err : count; } diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index df90adb83338..6ff55295e362 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5180,6 +5180,19 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) return retval; } +/* Release the resources allocated for processing a SCSI command. */ +static void ufshcd_release_scsi_cmd(struct ufs_hba *hba, + struct ufshcd_lrb *lrbp) +{ + struct scsi_cmnd *cmd = lrbp->cmd; + + scsi_dma_unmap(cmd); + ufshcd_crypto_clear_prdt(hba, lrbp); + lrbp->cmd = NULL; /* Mark the command as completed. */ + ufshcd_release(hba); + ufshcd_clk_scaling_update_busy(hba); +} + /** * __ufshcd_transfer_req_compl - handle SCSI and query command completion * @hba: per adapter instance @@ -5190,9 +5203,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, { struct ufshcd_lrb *lrbp; struct scsi_cmnd *cmd; - int result; int index; - bool update_scaling = false; for_each_set_bit(index, &completed_reqs, hba->nutrs) { if (!test_and_clear_bit(index, &hba->outstanding_reqs)) @@ -5205,16 +5216,10 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, ufshcd_update_monitor(hba, lrbp); trace_android_vh_ufs_compl_command(hba, lrbp); ufshcd_add_command_trace(hba, index, "complete"); - result = ufshcd_transfer_rsp_status(hba, lrbp); - scsi_dma_unmap(cmd); - cmd->result = result; - ufshcd_crypto_clear_prdt(hba, lrbp); - /* Mark completed command as NULL in LRB */ - lrbp->cmd = NULL; + cmd->result = ufshcd_transfer_rsp_status(hba, lrbp); + ufshcd_release_scsi_cmd(hba, lrbp); /* Do not touch lrbp after scsi done */ cmd->scsi_done(cmd); - ufshcd_release(hba); - update_scaling = true; } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE || lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) { if (hba->dev_cmd.complete) { @@ -5222,11 +5227,9 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, ufshcd_add_command_trace(hba, index, "dev_complete"); complete(hba->dev_cmd.complete); - update_scaling = true; + ufshcd_clk_scaling_update_busy(hba); } } - if (update_scaling) - ufshcd_clk_scaling_update_busy(hba); } } @@ -6366,9 +6369,8 @@ static irqreturn_t ufshcd_tmc_handler(struct ufs_hba *hba) irqreturn_t ret = IRQ_NONE; int tag; - pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); - spin_lock_irqsave(hba->host->host_lock, flags); + pending = ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); issued = hba->outstanding_tasks & ~pending; for_each_set_bit(tag, &issued, hba->nutmrs) { struct request *req = tmf_rqs[tag]; @@ -6939,6 +6941,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) unsigned long flags; unsigned int tag; int err = FAILED, res; + bool outstanding; struct ufshcd_lrb *lrbp; u32 reg; @@ -7025,6 +7028,17 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) goto release; } + /* + * Clear the corresponding bit from outstanding_reqs since the command + * has been aborted successfully. + */ + spin_lock_irqsave(host->host_lock, flags); + outstanding = __test_and_clear_bit(tag, &hba->outstanding_reqs); + spin_unlock_irqrestore(host->host_lock, flags); + + if (outstanding) + ufshcd_release_scsi_cmd(hba, lrbp); + err = SUCCESS; release: diff --git a/drivers/staging/android/debug_kinfo.c b/drivers/staging/android/debug_kinfo.c index 8e67fb3a205f..6a162325911e 100644 --- a/drivers/staging/android/debug_kinfo.c +++ b/drivers/staging/android/debug_kinfo.c @@ -81,7 +81,6 @@ static int build_info_set(const char *str, const struct kernel_param *kp) } Exit: - vunmap(all_info_addr); return ret; } diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 56ae882fb7b3..1411f0cb40c5 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -3652,6 +3652,7 @@ static void __exit target_core_exit_configfs(void) MODULE_DESCRIPTION("Target_Core_Mod/ConfigFS"); MODULE_AUTHOR("nab@Linux-iSCSI.org"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); module_init(target_core_init_configfs); module_exit(target_core_exit_configfs); diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 7143d03f0e02..cfa1bbef32e2 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -956,6 +956,7 @@ static void __exit fileio_module_exit(void) MODULE_DESCRIPTION("TCM FILEIO subsystem plugin"); MODULE_AUTHOR("nab@Linux-iSCSI.org"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); module_init(fileio_module_init); module_exit(fileio_module_exit); diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index 73a28f8a38a7..03db2d6b2dba 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -3446,6 +3446,7 @@ static struct usb_function *fsg_alloc(struct usb_function_instance *fi) DECLARE_USB_FUNCTION_INIT(mass_storage, fsg_alloc_inst, fsg_alloc); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_AUTHOR("Michal Nazarewicz"); /************************* Module parameters *************************/ diff --git a/drivers/usb/gadget/function/f_uac1_legacy.c b/drivers/usb/gadget/function/f_uac1_legacy.c index e2d7f69128a0..8ffd477e79e1 100644 --- a/drivers/usb/gadget/function/f_uac1_legacy.c +++ b/drivers/usb/gadget/function/f_uac1_legacy.c @@ -1015,4 +1015,5 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi) DECLARE_USB_FUNCTION_INIT(uac1_legacy, f_audio_alloc_inst, f_audio_alloc); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_AUTHOR("Bryan Wu"); diff --git a/drivers/usb/gadget/function/storage_common.c b/drivers/usb/gadget/function/storage_common.c index f7e6c42558eb..2451e45ada6e 100644 --- a/drivers/usb/gadget/function/storage_common.c +++ b/drivers/usb/gadget/function/storage_common.c @@ -520,3 +520,4 @@ ssize_t fsg_store_inquiry_string(struct fsg_lun *curlun, const char *buf, EXPORT_SYMBOL_GPL(fsg_store_inquiry_string); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index e0cd2825fcdc..0f7e96df7055 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1588,7 +1588,8 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) status = 1; } if (!status && !reset_change) { - xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); + xhci_dbg(xhci, "%s: stopping usb%d port polling\n", + __func__, hcd->self.busnum); clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); } spin_unlock_irqrestore(&xhci->lock, flags); @@ -1620,7 +1621,8 @@ int xhci_bus_suspend(struct usb_hcd *hcd) if (bus_state->resuming_ports || /* USB2 */ bus_state->port_remote_wakeup) { /* USB3 */ spin_unlock_irqrestore(&xhci->lock, flags); - xhci_dbg(xhci, "suspend failed because a port is resuming\n"); + xhci_dbg(xhci, "usb%d bus suspend to fail because a port is resuming\n", + hcd->self.busnum); return -EBUSY; } } diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f04c1839c79a..eb148a3629ec 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -868,9 +868,14 @@ static void xhci_giveback_invalidated_tds(struct xhci_virt_ep *ep) ring = xhci_urb_to_transfer_ring(ep->xhci, td->urb); - if (td->cancel_status == TD_CLEARED) + if (td->cancel_status == TD_CLEARED) { + xhci_dbg(ep->xhci, "%s: Giveback cancelled URB %p TD\n", + __func__, td->urb); xhci_td_cleanup(ep->xhci, td, ring, td->status); - + } else { + xhci_dbg(ep->xhci, "%s: Keep cancelled URB %p TD as cancel_status is %d\n", + __func__, td->urb, td->cancel_status); + } if (ep->xhci->xhc_state & XHCI_STATE_DYING) return; } @@ -888,6 +893,10 @@ static int xhci_reset_halted_ep(struct xhci_hcd *xhci, unsigned int slot_id, goto done; } + xhci_dbg(xhci, "%s-reset ep %u, slot %u\n", + (reset_type == EP_HARD_RESET) ? "Hard" : "Soft", + ep_index, slot_id); + ret = xhci_queue_reset_ep(xhci, command, slot_id, ep_index, reset_type); done: if (ret) @@ -921,7 +930,8 @@ static int xhci_handle_halted_endpoint(struct xhci_hcd *xhci, } if (ep->ep_state & EP_HALTED) { - xhci_dbg(xhci, "Reset ep command already pending\n"); + xhci_dbg(xhci, "Reset ep command for ep_index %d already pending\n", + ep->ep_index); return 0; } @@ -960,9 +970,10 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) list_for_each_entry_safe(td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) { xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, - "Removing canceled TD starting at 0x%llx (dma).", - (unsigned long long)xhci_trb_virt_to_dma( - td->start_seg, td->first_trb)); + "Removing canceled TD starting at 0x%llx (dma) in stream %u URB %p", + (unsigned long long)xhci_trb_virt_to_dma( + td->start_seg, td->first_trb), + td->urb->stream_id, td->urb); list_del_init(&td->td_list); ring = xhci_urb_to_transfer_ring(xhci, td->urb); if (!ring) { @@ -980,17 +991,21 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) td->urb->stream_id); hw_deq &= ~0xf; - if (td->cancel_status == TD_HALTED) { - cached_td = td; - } else if (trb_in_td(xhci, td->start_seg, td->first_trb, - td->last_trb, hw_deq, false)) { + if (td->cancel_status == TD_HALTED || + trb_in_td(xhci, td->start_seg, td->first_trb, td->last_trb, hw_deq, false)) { switch (td->cancel_status) { case TD_CLEARED: /* TD is already no-op */ case TD_CLEARING_CACHE: /* set TR deq command already queued */ break; case TD_DIRTY: /* TD is cached, clear it */ case TD_HALTED: - /* FIXME stream case, several stopped rings */ + td->cancel_status = TD_CLEARING_CACHE; + if (cached_td) + /* FIXME stream case, several stopped rings */ + xhci_dbg(xhci, + "Move dq past stream %u URB %p instead of stream %u URB %p\n", + td->urb->stream_id, td->urb, + cached_td->urb->stream_id, cached_td->urb); cached_td = td; break; } @@ -999,18 +1014,24 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) td->cancel_status = TD_CLEARED; } } - if (cached_td) { - cached_td->cancel_status = TD_CLEARING_CACHE; - err = xhci_move_dequeue_past_td(xhci, slot_id, ep->ep_index, - cached_td->urb->stream_id, - cached_td); - /* Failed to move past cached td, try just setting it noop */ - if (err) { - td_to_noop(xhci, ring, cached_td, false); - cached_td->cancel_status = TD_CLEARED; + /* If there's no need to move the dequeue pointer then we're done */ + if (!cached_td) + return 0; + + err = xhci_move_dequeue_past_td(xhci, slot_id, ep->ep_index, + cached_td->urb->stream_id, + cached_td); + if (err) { + /* Failed to move past cached td, just set cached TDs to no-op */ + list_for_each_entry_safe(td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) { + if (td->cancel_status != TD_CLEARING_CACHE) + continue; + xhci_dbg(xhci, "Failed to clear cancelled cached URB %p, mark clear anyway\n", + td->urb); + td_to_noop(xhci, ring, td, false); + td->cancel_status = TD_CLEARED; } - cached_td = NULL; } return 0; } @@ -1107,6 +1128,8 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, return; case EP_STATE_RUNNING: /* Race, HW handled stop ep cmd before ep was running */ + xhci_dbg(xhci, "Stop ep completion ctx error, ep is running\n"); + command = xhci_alloc_command(xhci, false, GFP_ATOMIC); if (!command) xhci_stop_watchdog_timer_in_irq(xhci, ep); @@ -1428,7 +1451,12 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, ep_ring = xhci_urb_to_transfer_ring(ep->xhci, td->urb); if (td->cancel_status == TD_CLEARING_CACHE) { td->cancel_status = TD_CLEARED; + xhci_dbg(ep->xhci, "%s: Giveback cancelled URB %p TD\n", + __func__, td->urb); xhci_td_cleanup(ep->xhci, td, ep_ring, td->status); + } else { + xhci_dbg(ep->xhci, "%s: Keep cancelled URB %p TD as cancel_status is %d\n", + __func__, td->urb, td->cancel_status); } } cleanup: @@ -2040,7 +2068,8 @@ cleanup: * bits are still set. When an event occurs, switch over to * polling to avoid losing status changes. */ - xhci_dbg(xhci, "%s: starting port polling.\n", __func__); + xhci_dbg(xhci, "%s: starting usb%d port polling.\n", + __func__, hcd->self.busnum); set_bit(HCD_FLAG_POLL_RH, &hcd->flags); spin_unlock(&xhci->lock); /* Pass this up to the core */ diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5818876ef628..611401723258 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -993,7 +993,8 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) xhci_dbc_suspend(xhci); /* Don't poll the roothubs on bus suspend. */ - xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); + xhci_dbg(xhci, "%s: stopping usb%d port polling.\n", + __func__, hcd->self.busnum); clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); del_timer_sync(&hcd->rh_timer); clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); @@ -1257,7 +1258,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) usb_asmedia_modifyflowcontrol(to_pci_dev(hcd->self.controller)); /* Re-enable port polling. */ - xhci_dbg(xhci, "%s: starting port polling.\n", __func__); + xhci_dbg(xhci, "%s: starting usb%d port polling.\n", + __func__, hcd->self.busnum); set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); usb_hcd_poll_rh_status(xhci->shared_hcd); set_bit(HCD_FLAG_POLL_RH, &hcd->flags); diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index e3f5057baa7d..ab6d648a111b 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -419,6 +419,13 @@ int virtio_device_restore(struct virtio_device *dev) struct virtio_driver *drv = drv_to_virtio(dev->dev.driver); int ret; + /* Short path for stateful devices. Here we assume that if the device + * does not have a freeze callback, its state was not changed when + * suspended. + */ + if (drv && !drv->freeze) + goto on_config_enable; + /* We always start by resetting the device, in case a previous * driver messed it up. */ dev->config->reset(dev); @@ -450,6 +457,7 @@ int virtio_device_restore(struct virtio_device *dev) /* Finally, tell the device we're all set */ virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); +on_config_enable: virtio_config_enable(dev); return 0; diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 238383ff1064..de73bd63f6b6 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -763,6 +763,26 @@ static void vm_unregister_cmdline_devices(void) #endif +#ifdef CONFIG_PM_SLEEP +static int virtio_mmio_freeze(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev); + + return virtio_device_freeze(&vm_dev->vdev); +} + +static int virtio_mmio_restore(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev); + + return virtio_device_restore(&vm_dev->vdev); +} +#endif + +static SIMPLE_DEV_PM_OPS(virtio_mmio_pm_ops, virtio_mmio_freeze, virtio_mmio_restore); + /* Platform driver */ static const struct of_device_id virtio_mmio_match[] = { @@ -786,6 +806,7 @@ static struct platform_driver virtio_mmio_driver = { .name = "virtio-mmio", .of_match_table = virtio_mmio_match, .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match), + .pm = &virtio_mmio_pm_ops, }, }; diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 39def020a074..6e3e65deb0b9 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -738,3 +738,4 @@ MODULE_AUTHOR("Latchesar Ionkov "); MODULE_AUTHOR("Eric Van Hensbergen "); MODULE_AUTHOR("Ron Minnich "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/Makefile b/fs/Makefile index 5dca3480ee83..359c63fefa1b 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -6,6 +6,8 @@ # Rewritten to use lists instead of if-statements. # +subdir-ccflags-y += -DANDROID_GKI_VFS_EXPORT_ONLY=VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver + obj-y := open.o read_write.o file_table.o super.o \ char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ ioctl.o readdir.o select.o dcache.o inode.o \ diff --git a/fs/adfs/super.c b/fs/adfs/super.c index bdbd26e571ed..57044e537290 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c @@ -492,3 +492,4 @@ static void __exit exit_adfs_fs(void) module_init(init_adfs_fs) module_exit(exit_adfs_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/affs/super.c b/fs/affs/super.c index c6c2a513ec92..2d2797ef7cfa 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -676,6 +676,7 @@ static void __exit exit_affs_fs(void) MODULE_DESCRIPTION("Amiga filesystem support for Linux"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_affs_fs) module_exit(exit_affs_fs) diff --git a/fs/afs/main.c b/fs/afs/main.c index 179004b15566..c6bd95645499 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c @@ -18,6 +18,7 @@ MODULE_DESCRIPTION("AFS Client File System"); MODULE_AUTHOR("Red Hat, Inc."); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); unsigned afs_debug; module_param_named(debug, afs_debug, uint, S_IWUSR | S_IRUGO); diff --git a/fs/attr.c b/fs/attr.c index b4bbdbd4c8ca..d8c1f796d0e9 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -114,7 +114,7 @@ kill_priv: return 0; } -EXPORT_SYMBOL(setattr_prepare); +EXPORT_SYMBOL_NS(setattr_prepare, ANDROID_GKI_VFS_EXPORT_ONLY); /** * inode_newsize_ok - may this inode be truncated to a given size @@ -158,7 +158,7 @@ out_sig: out_big: return -EFBIG; } -EXPORT_SYMBOL(inode_newsize_ok); +EXPORT_SYMBOL_NS(inode_newsize_ok, ANDROID_GKI_VFS_EXPORT_ONLY); /** * setattr_copy - copy simple metadata updates into the generic inode @@ -345,4 +345,4 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de return error; } -EXPORT_SYMBOL(notify_change); +EXPORT_SYMBOL_NS(notify_change, ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/autofs/init.c b/fs/autofs/init.c index d3f55e874338..ba08261f4faa 100644 --- a/fs/autofs/init.c +++ b/fs/autofs/init.c @@ -44,3 +44,4 @@ static void __exit exit_autofs_fs(void) module_init(init_autofs_fs) module_exit(exit_autofs_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 54f0ce444272..b292859f5f85 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c @@ -207,7 +207,7 @@ void make_bad_inode(struct inode *inode) inode->i_opflags &= ~IOP_XATTR; inode->i_fop = &bad_file_ops; } -EXPORT_SYMBOL(make_bad_inode); +EXPORT_SYMBOL_NS(make_bad_inode, ANDROID_GKI_VFS_EXPORT_ONLY); /* * This tests whether an inode has been flagged as bad. The test uses @@ -227,7 +227,7 @@ bool is_bad_inode(struct inode *inode) return (inode->i_op == &bad_inode_ops); } -EXPORT_SYMBOL(is_bad_inode); +EXPORT_SYMBOL_NS(is_bad_inode, ANDROID_GKI_VFS_EXPORT_ONLY); /** * iget_failed - Mark an under-construction inode as dead and release it diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index c1ba13d19024..abb8f6bb7e39 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -34,6 +34,7 @@ MODULE_DESCRIPTION("BeOS File System (BeFS) driver"); MODULE_AUTHOR("Will Dyson"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); /* The units the vfs expects inode->i_blocks to be in */ #define VFS_BLOCK_SIZE 512 diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index fd691e4815c5..293223cd4b37 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -22,6 +22,7 @@ MODULE_AUTHOR("Tigran Aivazian "); MODULE_DESCRIPTION("SCO UnixWare BFS filesystem for Linux"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); #undef DEBUG diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 11b5bf241955..3e4791efdf77 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -832,3 +832,4 @@ static void __exit exit_misc_binfmt(void) core_initcall(init_misc_binfmt); module_exit(exit_misc_binfmt); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/block_dev.c b/fs/block_dev.c index c7bb901f947e..f250a9866c6b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -186,7 +186,7 @@ int sb_set_blocksize(struct super_block *sb, int size) return sb->s_blocksize; } -EXPORT_SYMBOL(sb_set_blocksize); +EXPORT_SYMBOL_NS(sb_set_blocksize, ANDROID_GKI_VFS_EXPORT_ONLY); int sb_min_blocksize(struct super_block *sb, int size) { @@ -196,7 +196,7 @@ int sb_min_blocksize(struct super_block *sb, int size) return sb_set_blocksize(sb, size); } -EXPORT_SYMBOL(sb_min_blocksize); +EXPORT_SYMBOL_NS(sb_min_blocksize, ANDROID_GKI_VFS_EXPORT_ONLY); static int blkdev_get_block(struct inode *inode, sector_t iblock, diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 2663485c17cb..b5d2005d3415 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2597,6 +2597,7 @@ late_initcall(init_btrfs_fs); module_exit(exit_btrfs_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_SOFTDEP("pre: crc32c"); MODULE_SOFTDEP("pre: xxhash64"); MODULE_SOFTDEP("pre: sha256"); diff --git a/fs/buffer.c b/fs/buffer.c index 7b096c90ae53..d3916df01380 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -173,7 +173,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate) unlock_buffer(bh); put_bh(bh); } -EXPORT_SYMBOL(end_buffer_write_sync); +EXPORT_SYMBOL_NS(end_buffer_write_sync, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Various filesystems appear to want __find_get_block to be non-blocking. @@ -419,7 +419,7 @@ void mark_buffer_async_write(struct buffer_head *bh) { mark_buffer_async_write_endio(bh, end_buffer_async_write); } -EXPORT_SYMBOL(mark_buffer_async_write); +EXPORT_SYMBOL_NS(mark_buffer_async_write, ANDROID_GKI_VFS_EXPORT_ONLY); /* @@ -674,7 +674,7 @@ int __set_page_dirty_buffers(struct page *page) return newly_dirty; } -EXPORT_SYMBOL(__set_page_dirty_buffers); +EXPORT_SYMBOL_NS(__set_page_dirty_buffers, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Write out and wait upon a list of buffers. @@ -1141,7 +1141,7 @@ void mark_buffer_dirty(struct buffer_head *bh) __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); } } -EXPORT_SYMBOL(mark_buffer_dirty); +EXPORT_SYMBOL_NS(mark_buffer_dirty, ANDROID_GKI_VFS_EXPORT_ONLY); void mark_buffer_write_io_error(struct buffer_head *bh) { @@ -1159,7 +1159,7 @@ void mark_buffer_write_io_error(struct buffer_head *bh) errseq_set(&sb->s_wb_err, -EIO); rcu_read_unlock(); } -EXPORT_SYMBOL(mark_buffer_write_io_error); +EXPORT_SYMBOL_NS(mark_buffer_write_io_error, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Decrement a buffer_head's reference count. If all buffers against a page @@ -1176,7 +1176,7 @@ void __brelse(struct buffer_head * buf) } WARN(1, KERN_ERR "VFS: brelse: Trying to free free buffer\n"); } -EXPORT_SYMBOL(__brelse); +EXPORT_SYMBOL_NS(__brelse, ANDROID_GKI_VFS_EXPORT_ONLY); /* * bforget() is like brelse(), except it discards any @@ -1195,7 +1195,7 @@ void __bforget(struct buffer_head *bh) } __brelse(bh); } -EXPORT_SYMBOL(__bforget); +EXPORT_SYMBOL_NS(__bforget, ANDROID_GKI_VFS_EXPORT_ONLY); static struct buffer_head *__bread_slow(struct buffer_head *bh) { @@ -1376,7 +1376,7 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) brelse(bh); } } -EXPORT_SYMBOL(__breadahead); +EXPORT_SYMBOL_NS(__breadahead, ANDROID_GKI_VFS_EXPORT_ONLY); void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size, gfp_t gfp) @@ -1411,7 +1411,7 @@ __bread_gfp(struct block_device *bdev, sector_t block, bh = __bread_slow(bh); return bh; } -EXPORT_SYMBOL(__bread_gfp); +EXPORT_SYMBOL_NS(__bread_gfp, ANDROID_GKI_VFS_EXPORT_ONLY); static void __invalidate_bh_lrus(struct bh_lru *b) { @@ -1573,7 +1573,7 @@ void block_invalidatepage(struct page *page, unsigned int offset, out: return; } -EXPORT_SYMBOL(block_invalidatepage); +EXPORT_SYMBOL_NS(block_invalidatepage, ANDROID_GKI_VFS_EXPORT_ONLY); /* @@ -1609,7 +1609,7 @@ void create_empty_buffers(struct page *page, attach_page_private(page, head); spin_unlock(&page->mapping->private_lock); } -EXPORT_SYMBOL(create_empty_buffers); +EXPORT_SYMBOL_NS(create_empty_buffers, ANDROID_GKI_VFS_EXPORT_ONLY); /** * clean_bdev_aliases: clean a range of buffers in block device @@ -1683,7 +1683,7 @@ unlock_page: break; } } -EXPORT_SYMBOL(clean_bdev_aliases); +EXPORT_SYMBOL_NS(clean_bdev_aliases, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Size is a power-of-two in the range 512..PAGE_SIZE, @@ -1941,7 +1941,7 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to) bh = bh->b_this_page; } while (bh != head); } -EXPORT_SYMBOL(page_zero_new_buffers); +EXPORT_SYMBOL_NS(page_zero_new_buffers, ANDROID_GKI_VFS_EXPORT_ONLY); static void iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, @@ -2275,7 +2275,7 @@ int block_is_partially_uptodate(struct page *page, unsigned long from, return ret; } -EXPORT_SYMBOL(block_is_partially_uptodate); +EXPORT_SYMBOL_NS(block_is_partially_uptodate, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Generic "read page" function for block devices that have the normal @@ -3142,7 +3142,7 @@ void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[]) unlock_buffer(bh); } } -EXPORT_SYMBOL(ll_rw_block); +EXPORT_SYMBOL_NS(ll_rw_block, ANDROID_GKI_VFS_EXPORT_ONLY); void write_dirty_buffer(struct buffer_head *bh, int op_flags) { @@ -3189,13 +3189,13 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags) } return ret; } -EXPORT_SYMBOL(__sync_dirty_buffer); +EXPORT_SYMBOL_NS(__sync_dirty_buffer, ANDROID_GKI_VFS_EXPORT_ONLY); int sync_dirty_buffer(struct buffer_head *bh) { return __sync_dirty_buffer(bh, REQ_SYNC); } -EXPORT_SYMBOL(sync_dirty_buffer); +EXPORT_SYMBOL_NS(sync_dirty_buffer, ANDROID_GKI_VFS_EXPORT_ONLY); /* * try_to_free_buffers() checks if all the buffers on this particular page diff --git a/fs/cachefiles/main.c b/fs/cachefiles/main.c index ddf0cd58d60c..0649e7e60134 100644 --- a/fs/cachefiles/main.c +++ b/fs/cachefiles/main.c @@ -28,6 +28,7 @@ MODULE_PARM_DESC(cachefiles_debug, "CacheFiles debugging mask"); MODULE_DESCRIPTION("Mounted-filesystem based cache"); MODULE_AUTHOR("Red Hat, Inc."); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); struct kmem_cache *cachefiles_object_jar; diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 08c8d34c9809..e0562c55384f 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1335,3 +1335,4 @@ MODULE_AUTHOR("Yehuda Sadeh "); MODULE_AUTHOR("Patience Warnick "); MODULE_DESCRIPTION("Ceph filesystem for Linux"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index f0ed29a9a6f1..090d1e08b97f 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1692,6 +1692,7 @@ exit_cifs(void) MODULE_AUTHOR("Steve French"); MODULE_LICENSE("GPL"); /* combination of LGPL + GPL source behaves as GPL */ +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_DESCRIPTION ("VFS to access SMB3 servers e.g. Samba, Macs, Azure and Windows (and " "also older servers complying with the SNIA CIFS Specification)"); diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 240669f51eac..897c7cb93f47 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -388,6 +388,7 @@ MODULE_AUTHOR("Jan Harkes, Peter J. Braam"); MODULE_DESCRIPTION("Coda Distributed File System VFS interface"); MODULE_ALIAS_CHARDEV_MAJOR(CODA_PSDEV_MAJOR); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_VERSION("7.0"); static int __init init_coda(void) diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 0c6e8cf61953..2ac2d0ea7777 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c @@ -173,6 +173,7 @@ static void __exit configfs_exit(void) MODULE_AUTHOR("Oracle"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_VERSION("0.0.2"); MODULE_DESCRIPTION("Simple RAM filesystem for user driven kernel subsystem configuration."); diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 4b90cfd1ec36..6245470112a1 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -1010,3 +1010,4 @@ static void __exit exit_cramfs_fs(void) module_init(init_cramfs_fs) module_exit(exit_cramfs_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/dcache.c b/fs/dcache.c index ea0485861d93..cb588cee9669 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2110,7 +2110,7 @@ struct dentry *d_obtain_alias(struct inode *inode) { return __d_obtain_alias(inode, true); } -EXPORT_SYMBOL(d_obtain_alias); +EXPORT_SYMBOL_NS(d_obtain_alias, ANDROID_GKI_VFS_EXPORT_ONLY); /** * d_obtain_root - find or allocate a dentry for a given inode @@ -2184,7 +2184,7 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, } return found; } -EXPORT_SYMBOL(d_add_ci); +EXPORT_SYMBOL_NS(d_add_ci, ANDROID_GKI_VFS_EXPORT_ONLY); static inline bool d_same_name(const struct dentry *dentry, @@ -3065,7 +3065,7 @@ out: __d_add(dentry, inode); return NULL; } -EXPORT_SYMBOL(d_splice_alias); +EXPORT_SYMBOL_NS(d_splice_alias, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Test whether new_dentry is a subdirectory of old_dentry. diff --git a/fs/direct-io.c b/fs/direct-io.c index a70fc3267dad..b4bf6bb10dd8 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -1380,7 +1380,7 @@ ssize_t __blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, end_io, submit_io, flags); } -EXPORT_SYMBOL(__blockdev_direct_IO); +EXPORT_SYMBOL_NS(__blockdev_direct_IO, ANDROID_GKI_VFS_EXPORT_ONLY); static __init int dio_init(void) { diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index b2f6a1937d23..eb12d38d000d 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -891,6 +891,7 @@ MODULE_AUTHOR("Michael A. Halcrow "); MODULE_DESCRIPTION("eCryptfs"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(ecryptfs_init) module_exit(ecryptfs_exit) diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 15880a68faad..b62aefe3b4b8 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -272,6 +272,7 @@ static __exit void efivarfs_exit(void) MODULE_AUTHOR("Matthew Garrett, Jeremy Kerr"); MODULE_DESCRIPTION("EFI Variable Filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_ALIAS_FS("efivarfs"); module_init(efivarfs_init); diff --git a/fs/efs/inode.c b/fs/efs/inode.c index 89e73a6f0d36..8c0ecaa62de2 100644 --- a/fs/efs/inode.c +++ b/fs/efs/inode.c @@ -311,3 +311,4 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) { } MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 22991d22af5a..92d9a4a9fc81 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -752,4 +752,5 @@ module_exit(erofs_module_exit); MODULE_DESCRIPTION("Enhanced ROM File System"); MODULE_AUTHOR("Gao Xiang, Chao Yu, Miao Xie, CONSUMER BG, HUAWEI Inc."); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/exfat/super.c b/fs/exfat/super.c index c6d8d2e53486..86bfdabd5cc6 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -836,5 +836,6 @@ module_exit(exit_exfat_fs); MODULE_ALIAS_FS("exfat"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_DESCRIPTION("exFAT filesystem support"); MODULE_AUTHOR("Samsung Electronics Co., Ltd."); diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 09f1fe676972..3b772568cccc 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1650,5 +1650,6 @@ static void __exit exit_ext2_fs(void) MODULE_AUTHOR("Remy Card and others"); MODULE_DESCRIPTION("Second Extended Filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_ext2_fs) module_exit(exit_ext2_fs) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1b53cd6dce12..b95b748ced09 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -6744,6 +6744,7 @@ static void __exit ext4_exit_fs(void) MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others"); MODULE_DESCRIPTION("Fourth Extended Filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_SOFTDEP("pre: crc32c"); module_init(ext4_init_fs) module_exit(ext4_exit_fs) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index a090e3bf7c64..4caf3e5653a7 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2531,6 +2531,11 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + /* The below cases were checked when setting it. */ + if (f2fs_is_pinned_file(inode)) + return false; + if (fio && is_sbi_flag_set(sbi, SBI_NEED_FSCK)) + return true; if (f2fs_lfs_mode(sbi)) return true; if (S_ISDIR(inode->i_mode)) @@ -2539,8 +2544,6 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio) return true; if (f2fs_is_atomic_file(inode)) return true; - if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) - return true; /* swap file is migrating in aligned write mode */ if (is_inode_flag_set(inode, FI_ALIGNED_WRITE)) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 71ff671ffd81..d183efa2c58e 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -3248,17 +3248,17 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg) inode_lock(inode); - if (f2fs_should_update_outplace(inode, NULL)) { - ret = -EINVAL; - goto out; - } - if (!pin) { clear_inode_flag(inode, FI_PIN_FILE); f2fs_i_gc_failures_write(inode, 0); goto done; } + if (f2fs_should_update_outplace(inode, NULL)) { + ret = -EINVAL; + goto out; + } + if (f2fs_pin_file_control(inode, false)) { ret = -EAGAIN; goto out; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index fd4d7ada626b..842585425f51 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4441,5 +4441,6 @@ module_exit(exit_f2fs_fs) MODULE_AUTHOR("Samsung Electronics's Praesto Team"); MODULE_DESCRIPTION("Flash Friendly File System"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_SOFTDEP("pre: crc32"); diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c index 15fe30d3aeb5..78c6c67b43d7 100644 --- a/fs/f2fs/sysfs.c +++ b/fs/f2fs/sysfs.c @@ -117,6 +117,15 @@ static ssize_t sb_status_show(struct f2fs_attr *a, return sprintf(buf, "%lx\n", sbi->s_flag); } +static ssize_t pending_discard_show(struct f2fs_attr *a, + struct f2fs_sb_info *sbi, char *buf) +{ + if (!SM_I(sbi)->dcc_info) + return -EINVAL; + return sprintf(buf, "%llu\n", (unsigned long long)atomic_read( + &SM_I(sbi)->dcc_info->discard_cmd_cnt)); +} + static ssize_t features_show(struct f2fs_attr *a, struct f2fs_sb_info *sbi, char *buf) { @@ -713,6 +722,7 @@ F2FS_GENERAL_RO_ATTR(unusable); F2FS_GENERAL_RO_ATTR(encoding); F2FS_GENERAL_RO_ATTR(mounted_time_sec); F2FS_GENERAL_RO_ATTR(main_blkaddr); +F2FS_GENERAL_RO_ATTR(pending_discard); #ifdef CONFIG_F2FS_STAT_FS F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_foreground_calls, cp_count); F2FS_STAT_ATTR(STAT_INFO, f2fs_stat_info, cp_background_calls, bg_cp_count); @@ -778,6 +788,7 @@ static struct attribute *f2fs_attrs[] = { ATTR_LIST(main_blkaddr), ATTR_LIST(max_small_discards), ATTR_LIST(discard_granularity), + ATTR_LIST(pending_discard), ATTR_LIST(batched_trim_sections), ATTR_LIST(ipu_policy), ATTR_LIST(min_ipu_util), diff --git a/fs/fat/inode.c b/fs/fat/inode.c index bab9b202b496..577c73a55c68 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -1979,3 +1979,4 @@ module_init(init_fat_fs) module_exit(exit_fat_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index 9d062886fbc1..8376577ba014 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c @@ -680,6 +680,7 @@ static void __exit exit_msdos_fs(void) } MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_AUTHOR("Werner Almesberger"); MODULE_DESCRIPTION("MS-DOS filesystem support"); diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 0cdd0fb9f742..01fab05dc7a1 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c @@ -1077,6 +1077,7 @@ static void __exit exit_vfat_fs(void) } MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_DESCRIPTION("VFAT filesystem support"); MODULE_AUTHOR("Gordon Chaffee"); diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 578a5062706e..88fe3f470409 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -52,6 +52,7 @@ MODULE_AUTHOR("Christoph Hellwig, Krzysztof Blaszkowski"); MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver"); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); static struct kmem_cache *vxfs_inode_cachep; diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index a0869194ab73..d51354221fe7 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2338,7 +2338,7 @@ void __mark_inode_dirty(struct inode *inode, int flags) out_unlock_inode: spin_unlock(&inode->i_lock); } -EXPORT_SYMBOL(__mark_inode_dirty); +EXPORT_SYMBOL_NS(__mark_inode_dirty, ANDROID_GKI_VFS_EXPORT_ONLY); /* * The @s_sync_lock is used to serialise concurrent sync operations @@ -2504,7 +2504,7 @@ void try_to_writeback_inodes_sb(struct super_block *sb, enum wb_reason reason) __writeback_inodes_sb_nr(sb, get_nr_dirty_pages(), reason, true); up_read(&sb->s_umount); } -EXPORT_SYMBOL(try_to_writeback_inodes_sb); +EXPORT_SYMBOL_NS(try_to_writeback_inodes_sb, ANDROID_GKI_VFS_EXPORT_ONLY); /** * sync_inodes_sb - sync sb inode pages @@ -2571,7 +2571,7 @@ int write_inode_now(struct inode *inode, int sync) might_sleep(); return writeback_single_inode(inode, &wbc); } -EXPORT_SYMBOL(write_inode_now); +EXPORT_SYMBOL_NS(write_inode_now, ANDROID_GKI_VFS_EXPORT_ONLY); /** * sync_inode - write an inode and its pages to disk. @@ -2608,4 +2608,4 @@ int sync_inode_metadata(struct inode *inode, int wait) return sync_inode(inode, &wbc); } -EXPORT_SYMBOL(sync_inode_metadata); +EXPORT_SYMBOL_NS(sync_inode_metadata, ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index d44bd00d75c9..b6222bdaea80 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -27,6 +27,7 @@ MODULE_AUTHOR("Miklos Szeredi "); MODULE_DESCRIPTION("Filesystem in Userspace"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); static struct kmem_cache *fuse_inode_cachep; struct list_head fuse_conn_list; diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index c7393ee9cf68..81925fd2985f 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c @@ -260,6 +260,7 @@ static void __exit exit_gfs2_fs(void) MODULE_DESCRIPTION("Global File System"); MODULE_AUTHOR("Red Hat, Inc."); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_gfs2_fs); module_exit(exit_gfs2_fs); diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 12d9bae39363..6432d65a0872 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -29,6 +29,7 @@ static struct kmem_cache *hfs_inode_cachep; MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); static int hfs_sync_fs(struct super_block *sb, int wait) { diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 807119ae5adf..2b0031c6daea 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -617,6 +617,7 @@ out: MODULE_AUTHOR("Brad Boyer"); MODULE_DESCRIPTION("Extended Macintosh Filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); static struct kmem_cache *hfsplus_inode_cachep; diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index a7dbfc892022..d7598d70f329 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c @@ -791,3 +791,4 @@ static void __exit exit_hpfs_fs(void) module_init(init_hpfs_fs) module_exit(exit_hpfs_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/incfs/main.c b/fs/incfs/main.c index 23347acac8bf..213faa5e9117 100644 --- a/fs/incfs/main.c +++ b/fs/incfs/main.c @@ -44,5 +44,6 @@ module_init(init_incfs_module); module_exit(cleanup_incfs_module); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_AUTHOR("Eugene Zemtsov "); MODULE_DESCRIPTION("Incremental File System"); diff --git a/fs/inode.c b/fs/inode.c index 638d5d5bf42d..9246236bcdca 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -307,7 +307,7 @@ void drop_nlink(struct inode *inode) if (!inode->i_nlink) atomic_long_inc(&inode->i_sb->s_remove_count); } -EXPORT_SYMBOL(drop_nlink); +EXPORT_SYMBOL_NS(drop_nlink, ANDROID_GKI_VFS_EXPORT_ONLY); /** * clear_nlink - directly zero an inode's link count @@ -346,7 +346,7 @@ void set_nlink(struct inode *inode, unsigned int nlink) inode->__i_nlink = nlink; } } -EXPORT_SYMBOL(set_nlink); +EXPORT_SYMBOL_NS(set_nlink, ANDROID_GKI_VFS_EXPORT_ONLY); /** * inc_nlink - directly increment an inode's link count @@ -399,7 +399,7 @@ void inode_init_once(struct inode *inode) __address_space_init_once(&inode->i_data); i_size_ordered_init(inode); } -EXPORT_SYMBOL(inode_init_once); +EXPORT_SYMBOL_NS(inode_init_once, ANDROID_GKI_VFS_EXPORT_ONLY); static void init_once(void *foo) { @@ -423,7 +423,7 @@ void ihold(struct inode *inode) { WARN_ON(atomic_inc_return(&inode->i_count) < 2); } -EXPORT_SYMBOL(ihold); +EXPORT_SYMBOL_NS(ihold, ANDROID_GKI_VFS_EXPORT_ONLY); static void inode_lru_list_add(struct inode *inode) { @@ -503,7 +503,7 @@ void __insert_inode_hash(struct inode *inode, unsigned long hashval) spin_unlock(&inode->i_lock); spin_unlock(&inode_hash_lock); } -EXPORT_SYMBOL(__insert_inode_hash); +EXPORT_SYMBOL_NS(__insert_inode_hash, ANDROID_GKI_VFS_EXPORT_ONLY); /** * __remove_inode_hash - remove an inode from the hash @@ -519,7 +519,7 @@ void __remove_inode_hash(struct inode *inode) spin_unlock(&inode->i_lock); spin_unlock(&inode_hash_lock); } -EXPORT_SYMBOL(__remove_inode_hash); +EXPORT_SYMBOL_NS(__remove_inode_hash, ANDROID_GKI_VFS_EXPORT_ONLY); void clear_inode(struct inode *inode) { @@ -539,7 +539,7 @@ void clear_inode(struct inode *inode) /* don't need i_lock here, no concurrent mods to i_state */ inode->i_state = I_FREEING | I_CLEAR; } -EXPORT_SYMBOL(clear_inode); +EXPORT_SYMBOL_NS(clear_inode, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Free the inode passed in, removing it from the lists it is still connected @@ -1001,7 +1001,7 @@ void unlock_new_inode(struct inode *inode) wake_up_bit(&inode->i_state, __I_NEW); spin_unlock(&inode->i_lock); } -EXPORT_SYMBOL(unlock_new_inode); +EXPORT_SYMBOL_NS(unlock_new_inode, ANDROID_GKI_VFS_EXPORT_ONLY); void discard_new_inode(struct inode *inode) { @@ -1158,7 +1158,7 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, } return inode; } -EXPORT_SYMBOL(iget5_locked); +EXPORT_SYMBOL_NS(iget5_locked, ANDROID_GKI_VFS_EXPORT_ONLY); /** * iget_locked - obtain an inode from a mounted file system @@ -1290,7 +1290,7 @@ ino_t iunique(struct super_block *sb, ino_t max_reserved) return res; } -EXPORT_SYMBOL(iunique); +EXPORT_SYMBOL_NS(iunique, ANDROID_GKI_VFS_EXPORT_ONLY); struct inode *igrab(struct inode *inode) { @@ -1373,7 +1373,7 @@ again: } return inode; } -EXPORT_SYMBOL(ilookup5); +EXPORT_SYMBOL_NS(ilookup5, ANDROID_GKI_VFS_EXPORT_ONLY); /** * ilookup - search for an inode in the inode cache @@ -1853,7 +1853,7 @@ void touch_atime(const struct path *path) skip_update: sb_end_write(inode->i_sb); } -EXPORT_SYMBOL(touch_atime); +EXPORT_SYMBOL_NS(touch_atime, ANDROID_GKI_VFS_EXPORT_ONLY); /* * The logic we want is @@ -1949,7 +1949,7 @@ int file_remove_privs(struct file *file) return error; } -EXPORT_SYMBOL(file_remove_privs); +EXPORT_SYMBOL_NS(file_remove_privs, ANDROID_GKI_VFS_EXPORT_ONLY); /** * file_update_time - update mtime and ctime time @@ -2130,7 +2130,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev) " inode %s:%lu\n", mode, inode->i_sb->s_id, inode->i_ino); } -EXPORT_SYMBOL(init_special_inode); +EXPORT_SYMBOL_NS(init_special_inode, ANDROID_GKI_VFS_EXPORT_ONLY); /** * inode_init_owner - Init uid,gid,mode for new inode according to posix standards @@ -2156,7 +2156,7 @@ void inode_init_owner(struct inode *inode, const struct inode *dir, inode->i_gid = current_fsgid(); inode->i_mode = mode; } -EXPORT_SYMBOL(inode_init_owner); +EXPORT_SYMBOL_NS(inode_init_owner, ANDROID_GKI_VFS_EXPORT_ONLY); /** * inode_owner_or_capable - check current task permissions to inode @@ -2210,7 +2210,7 @@ void inode_dio_wait(struct inode *inode) if (atomic_read(&inode->i_dio_count)) __inode_dio_wait(inode); } -EXPORT_SYMBOL(inode_dio_wait); +EXPORT_SYMBOL_NS(inode_dio_wait, ANDROID_GKI_VFS_EXPORT_ONLY); /* * inode_set_flags - atomically set some inode flags @@ -2234,7 +2234,7 @@ void inode_set_flags(struct inode *inode, unsigned int flags, WARN_ON_ONCE(flags & ~mask); set_mask_bits(&inode->i_flags, mask, flags); } -EXPORT_SYMBOL(inode_set_flags); +EXPORT_SYMBOL_NS(inode_set_flags, ANDROID_GKI_VFS_EXPORT_ONLY); void inode_nohighmem(struct inode *inode) { @@ -2271,7 +2271,7 @@ struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode) WARN(1, "invalid file time granularity: %u", gran); return t; } -EXPORT_SYMBOL(timestamp_truncate); +EXPORT_SYMBOL_NS(timestamp_truncate, ANDROID_GKI_VFS_EXPORT_ONLY); /** * current_time - Return FS time diff --git a/fs/ioctl.c b/fs/ioctl.c index 4e6cc0a7d69c..32d8bd3f958b 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -146,7 +146,7 @@ int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical, return 1; return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; } -EXPORT_SYMBOL(fiemap_fill_next_extent); +EXPORT_SYMBOL_NS(fiemap_fill_next_extent, ANDROID_GKI_VFS_EXPORT_ONLY); /** * fiemap_prep - check validity of requested flags for fiemap @@ -191,7 +191,7 @@ int fiemap_prep(struct inode *inode, struct fiemap_extent_info *fieinfo, ret = filemap_write_and_wait(inode->i_mapping); return ret; } -EXPORT_SYMBOL(fiemap_prep); +EXPORT_SYMBOL_NS(fiemap_prep, ANDROID_GKI_VFS_EXPORT_ONLY); static int ioctl_fiemap(struct file *filp, struct fiemap __user *ufiemap) { diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index f62b5a501566..ecbc8ef0da17 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -1612,3 +1612,4 @@ static void __exit exit_iso9660_fs(void) module_init(init_iso9660_fs) module_exit(exit_iso9660_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 188f79d76988..7232d7cee8f4 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -3012,6 +3012,7 @@ static void __exit journal_exit(void) } MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(journal_init); module_exit(journal_exit); diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 81ca58c10b72..16dcc359fd35 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -439,3 +439,4 @@ MODULE_DESCRIPTION("The Journalling Flash File System, v2"); MODULE_AUTHOR("Red Hat, Inc."); MODULE_LICENSE("GPL"); // Actually dual-licensed, but it doesn't matter for // the sake of this tag. It's Free Software. +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/jfs/super.c b/fs/jfs/super.c index b2dc4d1f9dcc..8a02b9bdea19 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -37,6 +37,7 @@ MODULE_DESCRIPTION("The Journaled Filesystem (JFS)"); MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); static struct kmem_cache *jfs_inode_cachep; diff --git a/fs/libfs.c b/fs/libfs.c index 1b4a215f7b74..40359a0b57e1 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -225,7 +225,7 @@ ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t { return -EISDIR; } -EXPORT_SYMBOL(generic_read_dir); +EXPORT_SYMBOL_NS(generic_read_dir, ANDROID_GKI_VFS_EXPORT_ONLY); const struct file_operations simple_dir_operations = { .open = dcache_dir_open, diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 34f546404aa1..8a9d4a28290d 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -719,4 +719,5 @@ static void __exit exit_minix_fs(void) module_init(init_minix_fs) module_exit(exit_minix_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/mpage.c b/fs/mpage.c index 6bdb8dc021cc..ebbaf31cdea7 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -430,7 +430,7 @@ void mpage_readahead(struct readahead_control *rac, get_block_t get_block) if (args.bio) mpage_bio_submit(REQ_OP_READ, REQ_RAHEAD, args.bio); } -EXPORT_SYMBOL(mpage_readahead); +EXPORT_SYMBOL_NS(mpage_readahead, ANDROID_GKI_VFS_EXPORT_ONLY); /* * This isn't called much at all @@ -448,7 +448,7 @@ int mpage_readpage(struct page *page, get_block_t get_block) mpage_bio_submit(REQ_OP_READ, 0, args.bio); return 0; } -EXPORT_SYMBOL(mpage_readpage); +EXPORT_SYMBOL_NS(mpage_readpage, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Writing is not so simple. diff --git a/fs/namei.c b/fs/namei.c index 6d8635536485..297b2a774eaf 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2533,7 +2533,7 @@ int kern_path(const char *name, unsigned int flags, struct path *path) return filename_lookup(AT_FDCWD, getname_kernel(name), flags, path, NULL); } -EXPORT_SYMBOL(kern_path); +EXPORT_SYMBOL_NS(kern_path, ANDROID_GKI_VFS_EXPORT_ONLY); /** * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair @@ -2887,7 +2887,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, fsnotify_create(dir, dentry); return error; } -EXPORT_SYMBOL(vfs_create); +EXPORT_SYMBOL_NS(vfs_create, ANDROID_GKI_VFS_EXPORT_ONLY); int vfs_mkobj(struct dentry *dentry, umode_t mode, int (*f)(struct dentry *, umode_t, void *), @@ -3727,7 +3727,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) fsnotify_mkdir(dir, dentry); return error; } -EXPORT_SYMBOL(vfs_mkdir); +EXPORT_SYMBOL_NS(vfs_mkdir, ANDROID_GKI_VFS_EXPORT_ONLY); static long do_mkdirat(int dfd, const char __user *pathname, umode_t mode) { @@ -3802,7 +3802,7 @@ out: d_delete(dentry); return error; } -EXPORT_SYMBOL(vfs_rmdir); +EXPORT_SYMBOL_NS(vfs_rmdir, ANDROID_GKI_VFS_EXPORT_ONLY); long do_rmdir(int dfd, struct filename *name) { @@ -3924,7 +3924,7 @@ out: return error; } -EXPORT_SYMBOL(vfs_unlink); +EXPORT_SYMBOL_NS(vfs_unlink, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Make sure that the actual truncation of the file will occur outside its @@ -4159,7 +4159,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de fsnotify_link(dir, inode, new_dentry); return error; } -EXPORT_SYMBOL(vfs_link); +EXPORT_SYMBOL_NS(vfs_link, ANDROID_GKI_VFS_EXPORT_ONLY); /* * Hardlinks are often used in delicate situations. We avoid @@ -4419,7 +4419,7 @@ out: return error; } -EXPORT_SYMBOL(vfs_rename); +EXPORT_SYMBOL_NS(vfs_rename, ANDROID_GKI_VFS_EXPORT_ONLY); static int do_renameat2(int olddfd, const char __user *oldname, int newdfd, const char __user *newname, unsigned int flags) diff --git a/fs/namespace.c b/fs/namespace.c index 046b084136c5..6d1f11a6b290 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -415,7 +415,7 @@ int mnt_want_write_file(struct file *file) sb_end_write(file_inode(file)->i_sb); return ret; } -EXPORT_SYMBOL_GPL(mnt_want_write_file); +EXPORT_SYMBOL_NS_GPL(mnt_want_write_file, ANDROID_GKI_VFS_EXPORT_ONLY); /** * __mnt_drop_write - give up write access to a mount @@ -457,7 +457,7 @@ void mnt_drop_write_file(struct file *file) __mnt_drop_write_file(file); sb_end_write(file_inode(file)->i_sb); } -EXPORT_SYMBOL(mnt_drop_write_file); +EXPORT_SYMBOL_NS(mnt_drop_write_file, ANDROID_GKI_VFS_EXPORT_ONLY); static int mnt_make_readonly(struct mount *mnt) { diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 21addb78523d..6fe263d2657e 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -2326,6 +2326,7 @@ static void __exit exit_nfs_fs(void) /* Not quite true; I just maintain it */ MODULE_AUTHOR("Olaf Kirch "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_param(enable_ino64, bool, 0644); module_init(init_nfs_fs) diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index d09bcfd7db89..b422e8a09d25 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c @@ -309,6 +309,7 @@ static void __exit exit_nfs_v4(void) } MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_nfs_v4); module_exit(exit_nfs_v4); diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index a8f954bbde4f..5798e0a91ab6 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1583,5 +1583,6 @@ static void __exit exit_nfsd(void) MODULE_AUTHOR("Olaf Kirch "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_nfsd) module_exit(exit_nfsd) diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 4abd928b0bc8..ab1a5e8467f2 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -53,6 +53,7 @@ MODULE_AUTHOR("NTT Corp."); MODULE_DESCRIPTION("A New Implementation of the Log-structured Filesystem " "(NILFS)"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); static struct kmem_cache *nilfs_inode_cachep; struct kmem_cache *nilfs_transaction_cachep; diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 52ccd34b1e79..06c368ce3aa2 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c @@ -541,8 +541,8 @@ struct nls_table *load_nls_default(void) } EXPORT_SYMBOL(unregister_nls); -EXPORT_SYMBOL(unload_nls); -EXPORT_SYMBOL(load_nls); -EXPORT_SYMBOL(load_nls_default); +EXPORT_SYMBOL_NS(unload_nls, ANDROID_GKI_VFS_EXPORT_ONLY); +EXPORT_SYMBOL_NS(load_nls, ANDROID_GKI_VFS_EXPORT_ONLY); +EXPORT_SYMBOL_NS(load_nls_default, ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/fs/nls/nls_euc-jp.c b/fs/nls/nls_euc-jp.c index 162b3f160353..498b8a435d7e 100644 --- a/fs/nls/nls_euc-jp.c +++ b/fs/nls/nls_euc-jp.c @@ -578,3 +578,4 @@ module_init(init_nls_euc_jp) module_exit(exit_nls_euc_jp) MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/nls/nls_koi8-ru.c b/fs/nls/nls_koi8-ru.c index a80a741a8676..99ceec9085ec 100644 --- a/fs/nls/nls_koi8-ru.c +++ b/fs/nls/nls_koi8-ru.c @@ -80,3 +80,4 @@ module_init(init_nls_koi8_ru) module_exit(exit_nls_koi8_ru) MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 0d7e948cb29c..56edd625cf4d 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -3186,6 +3186,7 @@ MODULE_AUTHOR("Anton Altaparmakov "); MODULE_DESCRIPTION("NTFS 1.2/3.x driver - Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc."); MODULE_VERSION(NTFS_VERSION); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); #ifdef DEBUG module_param(debug_msgs, bint, 0); MODULE_PARM_DESC(debug_msgs, "Enable debug messages."); diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 583820ec63e2..5b3a8681f87e 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c @@ -615,6 +615,7 @@ static void __exit exit_dlmfs_fs(void) MODULE_AUTHOR("Oracle"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_DESCRIPTION("OCFS2 DLM-Filesystem"); module_init(init_dlmfs_fs) diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 435f82892432..f48369c02111 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -71,6 +71,7 @@ static struct dentry *ocfs2_debugfs_root; MODULE_AUTHOR("Oracle"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_DESCRIPTION("OCFS2 cluster file system"); struct mount_options diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index ce93ccca8639..27143a2cd962 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -20,6 +20,7 @@ MODULE_AUTHOR("Bob Copeland "); MODULE_DESCRIPTION("OMFS (ReplayTV/Karma) Filesystem for Linux"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); struct buffer_head *omfs_bread(struct super_block *sb, sector_t block) { diff --git a/fs/open.c b/fs/open.c index 78f32d483aef..b9d55ca3763b 100644 --- a/fs/open.c +++ b/fs/open.c @@ -1158,7 +1158,7 @@ struct file *filp_open(const char *filename, int flags, umode_t mode) } return file; } -EXPORT_SYMBOL(filp_open); +EXPORT_SYMBOL_NS(filp_open, ANDROID_GKI_VFS_EXPORT_ONLY); /* ANDROID: Allow drivers to open only block files from kernel mode */ struct file *filp_open_block(const char *filename, int flags, umode_t mode) @@ -1390,7 +1390,7 @@ int generic_file_open(struct inode * inode, struct file * filp) return 0; } -EXPORT_SYMBOL(generic_file_open); +EXPORT_SYMBOL_NS(generic_file_open, ANDROID_GKI_VFS_EXPORT_ONLY); /* * This is used by subsystems that don't want seekable diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c index 74a3d6337ef4..a76a6ba8b355 100644 --- a/fs/orangefs/orangefs-mod.c +++ b/fs/orangefs/orangefs-mod.c @@ -36,6 +36,7 @@ int orangefs_dcache_timeout_msecs = 50; int orangefs_getattr_timeout_msecs = 50; MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_AUTHOR("ORANGEFS Development Team"); MODULE_DESCRIPTION("The Linux Kernel VFS interface to ORANGEFS"); MODULE_PARM_DESC(module_parm_debug_mask, "debugging level (see orangefs-debug.h for values)"); diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index e7f7163fae10..4a2ce2eeee88 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -20,6 +20,7 @@ MODULE_AUTHOR("Miklos Szeredi "); MODULE_DESCRIPTION("Overlay filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); struct ovl_dir_cache; diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 3fb7fc819b4f..704fb7d09f0e 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -420,4 +420,5 @@ static void __exit exit_qnx4_fs(void) module_init(init_qnx4_fs) module_exit(exit_qnx4_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index 61191f7bdf62..ac771f0e0238 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c @@ -679,3 +679,4 @@ static void __exit exit_qnx6_fs(void) module_init(init_qnx6_fs) module_exit(exit_qnx6_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/read_write.c b/fs/read_write.c index 75f764b43418..ae703cb90599 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -471,7 +471,7 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) return ret; return __kernel_read(file, buf, count, pos); } -EXPORT_SYMBOL(kernel_read); +EXPORT_SYMBOL_NS(kernel_read, ANDROID_GKI_VFS_EXPORT_ONLY); ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) { @@ -580,7 +580,7 @@ ssize_t kernel_write(struct file *file, const void *buf, size_t count, file_end_write(file); return ret; } -EXPORT_SYMBOL(kernel_write); +EXPORT_SYMBOL_NS(kernel_write, ANDROID_GKI_VFS_EXPORT_ONLY); ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) { diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 913f5af9bf24..d84c2f2df0b7 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -2655,6 +2655,7 @@ MODULE_ALIAS_FS("reiserfs"); MODULE_DESCRIPTION("ReiserFS journaled filesystem"); MODULE_AUTHOR("Hans Reiser "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_reiserfs_fs); module_exit(exit_reiserfs_fs); diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 259f684d9236..c335658c2e0f 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -666,3 +666,4 @@ module_exit(exit_romfs_fs); MODULE_DESCRIPTION("Direct-MTD Capable RomFS"); MODULE_AUTHOR("Red Hat, Inc."); MODULE_LICENSE("GPL"); /* Actually dual-licensed, but it doesn't matter for */ +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/splice.c b/fs/splice.c index 866d5c2367b2..036a47937c18 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -326,7 +326,7 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, return ret; } -EXPORT_SYMBOL(generic_file_splice_read); +EXPORT_SYMBOL_NS(generic_file_splice_read, ANDROID_GKI_VFS_EXPORT_ONLY); const struct pipe_buf_operations default_pipe_buf_ops = { .release = generic_pipe_buf_release, @@ -722,7 +722,7 @@ done: return ret; } -EXPORT_SYMBOL(iter_file_splice_write); +EXPORT_SYMBOL_NS(iter_file_splice_write, ANDROID_GKI_VFS_EXPORT_ONLY); /** * generic_splice_sendpage - splice data from a pipe to a socket diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 88cc94be1076..83c48769f414 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c @@ -498,3 +498,4 @@ module_exit(exit_squashfs_fs); MODULE_DESCRIPTION("squashfs 4.0, a compressed read-only filesystem"); MODULE_AUTHOR("Phillip Lougher "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/stat.c b/fs/stat.c index 1196af4d1ea0..c8a078f3acf8 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -49,7 +49,7 @@ void generic_fillattr(struct inode *inode, struct kstat *stat) stat->blksize = i_blocksize(inode); stat->blocks = inode->i_blocks; } -EXPORT_SYMBOL(generic_fillattr); +EXPORT_SYMBOL_NS(generic_fillattr, ANDROID_GKI_VFS_EXPORT_ONLY); /** * vfs_getattr_nosec - getattr without security checks diff --git a/fs/super.c b/fs/super.c index 98bb0629ee10..5df72b0b35d7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1435,7 +1435,7 @@ error_bdev: error: return ERR_PTR(error); } -EXPORT_SYMBOL(mount_bdev); +EXPORT_SYMBOL_NS(mount_bdev, ANDROID_GKI_VFS_EXPORT_ONLY); void kill_block_super(struct super_block *sb) { @@ -1449,7 +1449,7 @@ void kill_block_super(struct super_block *sb) blkdev_put(bdev, mode | FMODE_EXCL); } -EXPORT_SYMBOL(kill_block_super); +EXPORT_SYMBOL_NS(kill_block_super, ANDROID_GKI_VFS_EXPORT_ONLY); #endif struct dentry *mount_nodev(struct file_system_type *fs_type, diff --git a/fs/sync.c b/fs/sync.c index 8e1c2272470f..9bbaa61994fc 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -66,7 +66,7 @@ int sync_filesystem(struct super_block *sb) return ret; return __sync_filesystem(sb, 1); } -EXPORT_SYMBOL(sync_filesystem); +EXPORT_SYMBOL_NS(sync_filesystem, ANDROID_GKI_VFS_EXPORT_ONLY); static void sync_inodes_one_sb(struct super_block *sb, void *arg) { diff --git a/fs/sysv/super.c b/fs/sysv/super.c index cc8e2ed155c8..e5383bff5dad 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c @@ -592,3 +592,4 @@ static void __exit exit_sysv_fs(void) module_init(init_sysv_fs) module_exit(exit_sysv_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index cfd46753a685..79de5f9dca17 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -2476,6 +2476,7 @@ static void __exit ubifs_exit(void) module_exit(ubifs_exit); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_VERSION(__stringify(UBIFS_VERSION)); MODULE_AUTHOR("Artem Bityutskiy, Adrian Hunter"); MODULE_DESCRIPTION("UBIFS - UBI File System"); diff --git a/fs/udf/super.c b/fs/udf/super.c index 3448098e5476..c31c5c44b9fe 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -2545,5 +2545,6 @@ static unsigned int udf_count_free(struct super_block *sb) MODULE_AUTHOR("Ben Fennema"); MODULE_DESCRIPTION("Universal Disk Format Filesystem"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(init_udf_fs) module_exit(exit_udf_fs) diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 983558b572c7..e0d7149f76ca 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -1542,3 +1542,4 @@ static void __exit exit_ufs_fs(void) module_init(init_ufs_fs) module_exit(exit_ufs_fs) MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c index c578e772cbd5..0d4a0408cbd7 100644 --- a/fs/vboxsf/super.c +++ b/fs/vboxsf/super.c @@ -482,4 +482,5 @@ module_exit(vboxsf_fini); MODULE_DESCRIPTION("Oracle VM VirtualBox Module for Host File System Access"); MODULE_AUTHOR("Oracle Corporation"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); MODULE_ALIAS_FS("vboxsf"); diff --git a/fs/xattr.c b/fs/xattr.c index d6bf5a7e2420..f157f0b1bdfc 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -291,7 +291,7 @@ retry_deleg: } return error; } -EXPORT_SYMBOL_GPL(vfs_setxattr); +EXPORT_SYMBOL_NS_GPL(vfs_setxattr, ANDROID_GKI_VFS_EXPORT_ONLY); static ssize_t xattr_getsecurity(struct inode *inode, const char *name, void *value, @@ -405,7 +405,7 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) { return __vfs_getxattr(dentry, dentry->d_inode, name, value, size, 0); } -EXPORT_SYMBOL_GPL(vfs_getxattr); +EXPORT_SYMBOL_NS_GPL(vfs_getxattr, ANDROID_GKI_VFS_EXPORT_ONLY); ssize_t vfs_listxattr(struct dentry *dentry, char *list, size_t size) @@ -425,7 +425,7 @@ vfs_listxattr(struct dentry *dentry, char *list, size_t size) } return error; } -EXPORT_SYMBOL_GPL(vfs_listxattr); +EXPORT_SYMBOL_NS_GPL(vfs_listxattr, ANDROID_GKI_VFS_EXPORT_ONLY); int __vfs_removexattr(struct dentry *dentry, const char *name) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index e3e229e52512..6a7724a3560a 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -2224,3 +2224,4 @@ module_exit(exit_xfs_fs); MODULE_AUTHOR("Silicon Graphics, Inc."); MODULE_DESCRIPTION(XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index e60759d8bb5f..0ed752c6ef25 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -1800,5 +1800,6 @@ MODULE_AUTHOR("Damien Le Moal"); MODULE_DESCRIPTION("Zone file system for zoned block devices"); MODULE_LICENSE("GPL"); MODULE_ALIAS_FS("zonefs"); +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); module_init(zonefs_init); module_exit(zonefs_exit); diff --git a/include/linux/android_kabi.h b/include/linux/android_kabi.h index 9c7b6c035ad3..dc0da1ab45d6 100644 --- a/include/linux/android_kabi.h +++ b/include/linux/android_kabi.h @@ -83,7 +83,11 @@ * number: the "number" of the padding variable in the structure. Start with * 1 and go up. */ +#ifdef CONFIG_ANDROID_STRUCT_PADDING #define ANDROID_KABI_RESERVE(number) _ANDROID_KABI_RESERVE(number) +#else +#define ANDROID_KABI_RESERVE(number) +#endif /* diff --git a/include/linux/android_vendor.h b/include/linux/android_vendor.h index 59fc5734bca2..ab3dca23966a 100644 --- a/include/linux/android_vendor.h +++ b/include/linux/android_vendor.h @@ -26,10 +26,25 @@ * Same as ANDROID_VENDOR_DATA but allocates an array of u64 with * the specified size */ +#ifdef CONFIG_ANDROID_STRUCT_PADDING #define ANDROID_VENDOR_DATA(n) u64 android_vendor_data##n #define ANDROID_VENDOR_DATA_ARRAY(n, s) u64 android_vendor_data##n[s] #define ANDROID_OEM_DATA(n) u64 android_oem_data##n #define ANDROID_OEM_DATA_ARRAY(n, s) u64 android_oem_data##n[s] +#define android_init_vendor_data(p, n) \ + memset(&p->android_vendor_data##n, 0, sizeof(p->android_vendor_data##n)) +#define android_init_oem_data(p, n) \ + memset(&p->android_oem_data##n, 0, sizeof(p->android_oem_data##n)) +#else +#define ANDROID_VENDOR_DATA(n) +#define ANDROID_VENDOR_DATA_ARRAY(n, s) +#define ANDROID_OEM_DATA(n) +#define ANDROID_OEM_DATA_ARRAY(n, s) + +#define android_init_vendor_data(p, n) +#define android_init_oem_data(p, n) +#endif + #endif /* _ANDROID_VENDOR_H */ diff --git a/include/linux/export.h b/include/linux/export.h index 888980992415..3b25f680180f 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -190,8 +190,10 @@ struct kernel_symbol { #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "") #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl") #define EXPORT_SYMBOL_GPL_FUTURE(sym) _EXPORT_SYMBOL(sym, "_gpl_future") -#define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns) -#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns) +#define _EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", #ns) +#define _EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", #ns) +#define EXPORT_SYMBOL_NS(sym, ns) _EXPORT_SYMBOL_NS(sym, ns) +#define EXPORT_SYMBOL_NS_GPL(sym, ns) _EXPORT_SYMBOL_NS_GPL(sym, ns) #ifdef CONFIG_UNUSED_SYMBOLS #define EXPORT_UNUSED_SYMBOL(sym) _EXPORT_SYMBOL(sym, "_unused") diff --git a/include/linux/fs.h b/include/linux/fs.h index bee53f02348e..4019e6fa3b95 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3287,7 +3287,7 @@ static inline bool vma_is_fsdax(struct vm_area_struct *vma) { struct inode *inode; - if (!vma->vm_file) + if (!IS_ENABLED(CONFIG_FS_DAX) || !vma->vm_file) return false; if (!vma_is_dax(vma)) return false; diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index a7255f582d7c..2c6567b60198 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include #include #include @@ -15,6 +17,13 @@ struct mmu_notifier; struct mmu_notifier_range; struct mmu_interval_notifier; +struct mmu_notifier_subscriptions_hdr { + bool valid; +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + struct percpu_rw_semaphore_atomic *mmu_notifier_lock; +#endif +}; + /** * enum mmu_notifier_event - reason for the mmu notifier callback * @MMU_NOTIFY_UNMAP: either munmap() that unmap the range or a mremap() that @@ -281,9 +290,30 @@ struct mmu_notifier_range { void *migrate_pgmap_owner; }; +static inline +struct mmu_notifier_subscriptions_hdr *get_notifier_subscriptions_hdr( + struct mm_struct *mm) +{ + /* + * container_of() can't be used here because mmu_notifier_subscriptions + * struct should be kept invisible to mm_struct, otherwise it + * introduces KMI CRC breakage. Therefore the callers don't know what + * members struct mmu_notifier_subscriptions contains and can't call + * container_of(), which requires a member name. + * + * WARNING: For this typecasting to work, mmu_notifier_subscriptions_hdr + * should be the first member of struct mmu_notifier_subscriptions. + */ + return (struct mmu_notifier_subscriptions_hdr *)mm->notifier_subscriptions; +} + static inline int mm_has_notifiers(struct mm_struct *mm) { +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + return unlikely(get_notifier_subscriptions_hdr(mm)->valid); +#else return unlikely(mm->notifier_subscriptions); +#endif } struct mmu_notifier *mmu_notifier_get_locked(const struct mmu_notifier_ops *ops, @@ -502,9 +532,29 @@ static inline void mmu_notifier_invalidate_range(struct mm_struct *mm, __mmu_notifier_invalidate_range(mm, start, end); } -static inline void mmu_notifier_subscriptions_init(struct mm_struct *mm) +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + +extern bool mmu_notifier_subscriptions_init(struct mm_struct *mm); +extern void mmu_notifier_subscriptions_destroy(struct mm_struct *mm); + +static inline bool mmu_notifier_trylock(struct mm_struct *mm) +{ + return percpu_down_read_trylock( + &get_notifier_subscriptions_hdr(mm)->mmu_notifier_lock->rw_sem); +} + +static inline void mmu_notifier_unlock(struct mm_struct *mm) +{ + percpu_up_read( + &get_notifier_subscriptions_hdr(mm)->mmu_notifier_lock->rw_sem); +} + +#else /* CONFIG_SPECULATIVE_PAGE_FAULT */ + +static inline bool mmu_notifier_subscriptions_init(struct mm_struct *mm) { mm->notifier_subscriptions = NULL; + return true; } static inline void mmu_notifier_subscriptions_destroy(struct mm_struct *mm) @@ -513,6 +563,16 @@ static inline void mmu_notifier_subscriptions_destroy(struct mm_struct *mm) __mmu_notifier_subscriptions_destroy(mm); } +static inline bool mmu_notifier_trylock(struct mm_struct *mm) +{ + return true; +} + +static inline void mmu_notifier_unlock(struct mm_struct *mm) +{ +} + +#endif /* CONFIG_SPECULATIVE_PAGE_FAULT */ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, enum mmu_notifier_event event, @@ -727,14 +787,24 @@ static inline void mmu_notifier_invalidate_range(struct mm_struct *mm, { } -static inline void mmu_notifier_subscriptions_init(struct mm_struct *mm) +static inline bool mmu_notifier_subscriptions_init(struct mm_struct *mm) { + return true; } static inline void mmu_notifier_subscriptions_destroy(struct mm_struct *mm) { } +static inline bool mmu_notifier_trylock(struct mm_struct *mm) +{ + return true; +} + +static inline void mmu_notifier_unlock(struct mm_struct *mm) +{ +} + #define mmu_notifier_range_update_to_read_only(r) false #define ptep_clear_flush_young_notify ptep_clear_flush_young diff --git a/include/linux/module.h b/include/linux/module.h index 4fa2f7de56e6..c5c3ce08f646 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -293,7 +293,8 @@ extern typeof(name) __mod_##type##__##name##_device_table \ * files require multiple MODULE_FIRMWARE() specifiers */ #define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) -#define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, #ns) +#define _MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, #ns) +#define MODULE_IMPORT_NS(ns) _MODULE_IMPORT_NS(ns) struct notifier_block; diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h index 5fda40f97fe9..536976636c58 100644 --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h @@ -20,6 +20,11 @@ struct percpu_rw_semaphore { #endif }; +struct percpu_rw_semaphore_atomic { + struct percpu_rw_semaphore rw_sem; + struct list_head destroy_list_entry; +}; + #ifdef CONFIG_DEBUG_LOCK_ALLOC #define __PERCPU_RWSEM_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname }, #else @@ -127,8 +132,12 @@ extern void percpu_up_write(struct percpu_rw_semaphore *); extern int __percpu_init_rwsem(struct percpu_rw_semaphore *, const char *, struct lock_class_key *); +/* Can't be called in atomic context. */ extern void percpu_free_rwsem(struct percpu_rw_semaphore *); +/* Invokes percpu_free_rwsem and frees the semaphore from a worker thread. */ +extern void percpu_rwsem_async_destroy(struct percpu_rw_semaphore_atomic *sem); + #define percpu_init_rwsem(sem) \ ({ \ static struct lock_class_key rwsem_key; \ diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 25621ffdb99b..fa1e7f6ec7bc 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -657,6 +657,7 @@ rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len, int rproc_boot(struct rproc *rproc); void rproc_shutdown(struct rproc *rproc); +int rproc_set_firmware(struct rproc *rproc, const char *fw_name); void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type); /* from remoteproc_coredump.c */ diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index aea0ce9f3b74..112ff24ea927 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -905,6 +905,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len, asmlinkage long sys_madvise(unsigned long start, size_t len, int behavior); asmlinkage long sys_process_madvise(int pidfd, const struct iovec __user *vec, size_t vlen, int behavior, unsigned int flags); +asmlinkage long sys_process_mrelease(int pidfd, unsigned int flags); asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long flags); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index 36a70248f5cf..42d974f76573 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -64,6 +64,11 @@ DECLARE_HOOK(android_vh_binder_proc_transaction, struct task_struct *binder_th_task, int node_debug_id, unsigned int code, bool pending_async), TP_ARGS(caller_task, binder_proc_task, binder_th_task, node_debug_id, code, pending_async)); +DECLARE_HOOK(android_vh_binder_proc_transaction_end, + TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, + struct task_struct *binder_th_task, unsigned int code, + bool pending_async, bool sync), + TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync)); DECLARE_HOOK(android_vh_binder_new_ref, TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id), TP_ARGS(proc, ref_desc, node_debug_id)); @@ -74,7 +79,25 @@ DECLARE_HOOK(android_vh_binder_print_transaction_info, TP_PROTO(struct seq_file *m, struct binder_proc *proc, const char *prefix, struct binder_transaction *t), TP_ARGS(m, proc, prefix, t)); - +DECLARE_HOOK(android_vh_binder_looper_state_registered, + TP_PROTO(struct binder_thread *thread, struct binder_proc *proc), + TP_ARGS(thread, proc)); +DECLARE_HOOK(android_vh_binder_thread_read, + TP_PROTO(struct list_head **list, struct binder_proc *proc, + struct binder_thread *thread), + TP_ARGS(list, proc, thread)); +DECLARE_HOOK(android_vh_binder_free_proc, + TP_PROTO(struct binder_proc *proc), + TP_ARGS(proc)); +DECLARE_HOOK(android_vh_binder_thread_release, + TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), + TP_ARGS(proc, thread)); +DECLARE_HOOK(android_vh_binder_read_done, + TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), + TP_ARGS(proc, thread)); +DECLARE_HOOK(android_vh_binder_has_work_ilocked, + TP_PROTO(struct binder_thread *thread, bool do_proc_work, int *ret), + TP_ARGS(thread, do_proc_work, ret)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_BINDER_H */ diff --git a/include/trace/hooks/futex.h b/include/trace/hooks/futex.h index 0692dd68d93c..f8bf394ea013 100644 --- a/include/trace/hooks/futex.h +++ b/include/trace/hooks/futex.h @@ -18,6 +18,10 @@ DECLARE_HOOK(android_vh_alter_futex_plist_add, bool *already_on_hb), TP_ARGS(node, head, already_on_hb)); +DECLARE_HOOK(android_vh_futex_sleep_start, + TP_PROTO(struct task_struct *p), + TP_ARGS(p)); + /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_FUTEX_H */ diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 4b299fd6e613..5821f6d74a07 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -126,6 +126,10 @@ DECLARE_HOOK(android_vh_mmap_region, DECLARE_HOOK(android_vh_try_to_unmap_one, TP_PROTO(struct vm_area_struct *vma, struct page *page, unsigned long addr, bool ret), TP_ARGS(vma, page, addr, ret)); +struct device; +DECLARE_HOOK(android_vh_subpage_dma_contig_alloc, + TP_PROTO(bool *allow_subpage_alloc, struct device *dev, size_t *size), + TP_ARGS(allow_subpage_alloc, dev, size)); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_MM_H */ diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 2056318988f7..f7b735dabf35 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -859,9 +859,11 @@ __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd) __SYSCALL(__NR_faccessat2, sys_faccessat2) #define __NR_process_madvise 440 __SYSCALL(__NR_process_madvise, sys_process_madvise) +#define __NR_process_mrelease 448 +__SYSCALL(__NR_process_mrelease, sys_process_mrelease) #undef __NR_syscalls -#define __NR_syscalls 441 +#define __NR_syscalls 449 /* * 32 bit systems traditionally used different diff --git a/init/init_task.c b/init/init_task.c index fba7fbed71dc..26e018fbbf78 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -213,8 +213,10 @@ struct task_struct init_task #ifdef CONFIG_SECCOMP_FILTER .seccomp = { .filter_count = ATOMIC_INIT(0) }, #endif +#ifdef CONFIG_ANDROID_STRUCT_PADDING .android_vendor_data1 = {0, }, .android_oem_data1 = {0, }, +#endif }; EXPORT_SYMBOL(init_task); diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index 2e0763463b59..e678bf688f6d 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef CONFIG_CMA_SIZE_MBYTES #define CMA_SIZE_MBYTES CONFIG_CMA_SIZE_MBYTES @@ -309,14 +310,19 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) #ifdef CONFIG_DMA_PERNUMA_CMA int nid = dev_to_node(dev); #endif + bool allow_subpage_alloc = false; /* CMA can be used only in the context which permits sleeping */ if (!gfpflags_allow_blocking(gfp)) return NULL; if (dev->cma_area) return cma_alloc_aligned(dev->cma_area, size, gfp); - if (size <= PAGE_SIZE) - return NULL; + + if (size <= PAGE_SIZE) { + trace_android_vh_subpage_dma_contig_alloc(&allow_subpage_alloc, dev, &size); + if (!allow_subpage_alloc) + return NULL; + } #ifdef CONFIG_DMA_PERNUMA_CMA if (nid != NUMA_NO_NODE && !(gfp & (GFP_DMA | GFP_DMA32))) { diff --git a/kernel/fork.c b/kernel/fork.c index bdca9cfa9df7..66065e013958 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -978,8 +978,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) #ifdef CONFIG_MEMCG tsk->active_memcg = NULL; #endif - memset(&tsk->android_vendor_data1, 0, sizeof(tsk->android_vendor_data1)); - memset(&tsk->android_oem_data1, 0, sizeof(tsk->android_oem_data1)); + + android_init_vendor_data(tsk, 1); + android_init_oem_data(tsk, 1); + trace_android_vh_dup_task_struct(tsk, orig); return tsk; @@ -1072,7 +1074,8 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, mm_init_owner(mm, p); mm_init_pasid(mm); RCU_INIT_POINTER(mm->exe_file, NULL); - mmu_notifier_subscriptions_init(mm); + if (!mmu_notifier_subscriptions_init(mm)) + goto fail_nopgd; init_tlb_flush_pending(mm); #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS mm->pmd_huge_pte = NULL; diff --git a/kernel/futex.c b/kernel/futex.c index 3cd0ae850fde..29bd9cd92468 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2607,8 +2607,10 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, * flagged for rescheduling. Only call schedule if there * is no timeout, or if it has yet to expire. */ - if (!timeout || timeout->task) + if (!timeout || timeout->task) { + trace_android_vh_futex_sleep_start(current); freezable_schedule(); + } } __set_current_state(TASK_RUNNING); } diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c index 70a32a576f3f..b88eda4eb624 100644 --- a/kernel/locking/percpu-rwsem.c +++ b/kernel/locking/percpu-rwsem.c @@ -7,6 +7,7 @@ #include #include #include +#include #include int __percpu_init_rwsem(struct percpu_rw_semaphore *sem, @@ -268,3 +269,34 @@ void percpu_up_write(struct percpu_rw_semaphore *sem) rcu_sync_exit(&sem->rss); } EXPORT_SYMBOL_GPL(percpu_up_write); + +static LIST_HEAD(destroy_list); +static DEFINE_SPINLOCK(destroy_list_lock); + +static void destroy_list_workfn(struct work_struct *work) +{ + struct percpu_rw_semaphore_atomic *sem, *sem2; + LIST_HEAD(to_destroy); + + spin_lock(&destroy_list_lock); + list_splice_init(&destroy_list, &to_destroy); + spin_unlock(&destroy_list_lock); + + if (list_empty(&to_destroy)) + return; + + list_for_each_entry_safe(sem, sem2, &to_destroy, destroy_list_entry) { + percpu_free_rwsem(&sem->rw_sem); + kfree(sem); + } +} + +static DECLARE_WORK(destroy_list_work, destroy_list_workfn); + +void percpu_rwsem_async_destroy(struct percpu_rw_semaphore_atomic *sem) +{ + spin_lock(&destroy_list_lock); + list_add_tail(&sem->destroy_list_entry, &destroy_list); + spin_unlock(&destroy_list_lock); + schedule_work(&destroy_list_work); +} diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index f27ac94d5fa7..6b8203edf531 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -281,6 +281,7 @@ COND_SYSCALL(munlockall); COND_SYSCALL(mincore); COND_SYSCALL(madvise); COND_SYSCALL(process_madvise); +COND_SYSCALL(process_mrelease); COND_SYSCALL(remap_file_pages); COND_SYSCALL(mbind); COND_SYSCALL_COMPAT(mbind); diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index d5ab3fbc191c..6740dd02a402 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -150,8 +150,7 @@ static enum hrtimer_restart sched_clock_poll(struct hrtimer *hrt) return HRTIMER_RESTART; } -void __init -sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) +void sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) { u64 res, wrap, new_mask, new_epoch, cyc, ns; u32 new_mult, new_shift; @@ -225,6 +224,7 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate) pr_debug("Registered %pS as sched_clock source\n", read); } +EXPORT_SYMBOL_GPL(sched_clock_register); void __init generic_sched_clock_init(void) { diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 7a15cffd33f5..dfab7aa912c3 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -4907,6 +4907,7 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task) mutex_unlock(&wq_pool_attach_mutex); } +EXPORT_SYMBOL_GPL(wq_worker_comm); #ifdef CONFIG_SMP diff --git a/lib/test_lockup.c b/lib/test_lockup.c index f1a020bcc763..5359e2d1a2f2 100644 --- a/lib/test_lockup.c +++ b/lib/test_lockup.c @@ -595,5 +595,6 @@ static int __init test_lockup_init(void) module_init(test_lockup_init); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_AUTHOR("Konstantin Khlebnikov "); MODULE_DESCRIPTION("Test module to generate lockups"); diff --git a/mm/gup.c b/mm/gup.c index b56d9748a102..54b0a694712e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -948,6 +948,9 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags) if (gup_flags & FOLL_ANON && !vma_is_anonymous(vma)) return -EFAULT; + if ((gup_flags & FOLL_LONGTERM) && vma_is_fsdax(vma)) + return -EOPNOTSUPP; + if (write) { if (!(vm_flags & VM_WRITE)) { if (!(gup_flags & FOLL_FORCE)) @@ -1085,10 +1088,14 @@ static long __get_user_pages(struct mm_struct *mm, goto next_page; } - if (!vma || check_vma_flags(vma, gup_flags)) { + if (!vma) { ret = -EFAULT; goto out; } + ret = check_vma_flags(vma, gup_flags); + if (ret) + goto out; + if (is_vm_hugetlb_page(vma)) { i = follow_hugetlb_page(mm, vma, pages, vmas, &start, &nr_pages, i, @@ -1592,26 +1599,6 @@ struct page *get_dump_page(unsigned long addr) } #endif /* CONFIG_ELF_CORE */ -#if defined(CONFIG_FS_DAX) || defined (CONFIG_CMA) -static bool check_dax_vmas(struct vm_area_struct **vmas, long nr_pages) -{ - long i; - struct vm_area_struct *vma_prev = NULL; - - for (i = 0; i < nr_pages; i++) { - struct vm_area_struct *vma = vmas[i]; - - if (vma == vma_prev) - continue; - - vma_prev = vma; - - if (vma_is_fsdax(vma)) - return true; - } - return false; -} - #ifdef CONFIG_CMA static long check_and_migrate_cma_pages(struct mm_struct *mm, unsigned long start, @@ -1730,63 +1717,23 @@ static long __gup_longterm_locked(struct mm_struct *mm, struct vm_area_struct **vmas, unsigned int gup_flags) { - struct vm_area_struct **vmas_tmp = vmas; unsigned long flags = 0; - long rc, i; + long rc; - if (gup_flags & FOLL_LONGTERM) { - if (!pages) - return -EINVAL; - - if (!vmas_tmp) { - vmas_tmp = kcalloc(nr_pages, - sizeof(struct vm_area_struct *), - GFP_KERNEL); - if (!vmas_tmp) - return -ENOMEM; - } + if (gup_flags & FOLL_LONGTERM) flags = memalloc_nocma_save(); - } - rc = __get_user_pages_locked(mm, start, nr_pages, pages, - vmas_tmp, NULL, gup_flags); + rc = __get_user_pages_locked(mm, start, nr_pages, pages, vmas, NULL, + gup_flags); if (gup_flags & FOLL_LONGTERM) { - if (rc < 0) - goto out; - - if (check_dax_vmas(vmas_tmp, rc)) { - if (gup_flags & FOLL_PIN) - unpin_user_pages(pages, rc); - else - for (i = 0; i < rc; i++) - put_page(pages[i]); - rc = -EOPNOTSUPP; - goto out; - } - - rc = check_and_migrate_cma_pages(mm, start, rc, pages, - vmas_tmp, gup_flags); -out: + if (rc > 0) + rc = check_and_migrate_cma_pages(mm, start, rc, pages, + vmas, gup_flags); memalloc_nocma_restore(flags); } - - if (vmas_tmp != vmas) - kfree(vmas_tmp); return rc; } -#else /* !CONFIG_FS_DAX && !CONFIG_CMA */ -static __always_inline long __gup_longterm_locked(struct mm_struct *mm, - unsigned long start, - unsigned long nr_pages, - struct page **pages, - struct vm_area_struct **vmas, - unsigned int flags) -{ - return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, - NULL, flags); -} -#endif /* CONFIG_FS_DAX || CONFIG_CMA */ static bool is_valid_gup_flags(unsigned int gup_flags) { diff --git a/mm/memory.c b/mm/memory.c index 5db2a3ed395b..dfe88223c483 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4717,8 +4717,19 @@ static vm_fault_t handle_pte_fault(struct vm_fault *vmf) goto unlock; } if (vmf->flags & FAULT_FLAG_WRITE) { - if (!pte_write(entry)) - return do_wp_page(vmf); + if (!pte_write(entry)) { + if (!(vmf->flags & FAULT_FLAG_SPECULATIVE)) + return do_wp_page(vmf); + + if (!mmu_notifier_trylock(vmf->vma->vm_mm)) { + ret = VM_FAULT_RETRY; + goto unlock; + } + + ret = do_wp_page(vmf); + mmu_notifier_unlock(vmf->vma->vm_mm); + return ret; + } entry = pte_mkdirty(entry); } entry = pte_mkyoung(entry); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 3803f2d8fab8..5d62209290ad 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1136,9 +1136,6 @@ int add_memory_subsection(int nid, u64 start, u64 size) struct resource *res; int ret; - if (size == memory_block_size_bytes()) - return add_memory(nid, start, size, MHP_NONE); - if (!IS_ALIGNED(start, SUBSECTION_SIZE) || !IS_ALIGNED(size, SUBSECTION_SIZE)) { pr_err("%s: start 0x%llx size 0x%llx not aligned to subsection size\n", @@ -1837,9 +1834,6 @@ EXPORT_SYMBOL_GPL(remove_memory); int remove_memory_subsection(int nid, u64 start, u64 size) { - if (size == memory_block_size_bytes()) - return remove_memory(nid, start, size); - if (!IS_ALIGNED(start, SUBSECTION_SIZE) || !IS_ALIGNED(size, SUBSECTION_SIZE)) { pr_err("%s: start 0x%llx size 0x%llx not aligned to subsection size\n", diff --git a/mm/mmap.c b/mm/mmap.c index 9a4f09216130..d3ecf5917c63 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3297,10 +3297,9 @@ void exit_mmap(struct mm_struct *mm) (void)__oom_reap_task_mm(mm); set_bit(MMF_OOM_SKIP, &mm->flags); - mmap_write_lock(mm); - mmap_write_unlock(mm); } + mmap_write_lock(mm); if (mm->locked_vm) { vma = mm->mmap; while (vma) { @@ -3313,8 +3312,11 @@ void exit_mmap(struct mm_struct *mm) arch_exit_mmap(mm); vma = mm->mmap; - if (!vma) /* Can happen if dup_mmap() received an OOM */ + if (!vma) { + /* Can happen if dup_mmap() received an OOM */ + mmap_write_unlock(mm); return; + } lru_add_drain(); flush_cache_mm(mm); @@ -3325,16 +3327,14 @@ void exit_mmap(struct mm_struct *mm) free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING); tlb_finish_mmu(&tlb, 0, -1); - /* - * Walk the list again, actually closing and freeing it, - * with preemption enabled, without holding any MM locks. - */ + /* Walk the list again, actually closing and freeing it. */ while (vma) { if (vma->vm_flags & VM_ACCOUNT) nr_accounted += vma_pages(vma); vma = remove_vma(vma); cond_resched(); } + mmap_write_unlock(mm); vm_unacct_memory(nr_accounted); } diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 07f42a7a6065..cee61bab214b 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -35,6 +35,12 @@ struct lockdep_map __mmu_notifier_invalidate_range_start_map = { * in mmdrop(). */ struct mmu_notifier_subscriptions { + /* + * WARNING: hdr should be the first member of this structure + * so that it can be typecasted into mmu_notifier_subscriptions_hdr. + * This is required to avoid KMI CRC breakage. + */ + struct mmu_notifier_subscriptions_hdr hdr; /* all mmu notifiers registered in this mm are queued in this list */ struct hlist_head list; bool has_itree; @@ -621,6 +627,37 @@ void __mmu_notifier_invalidate_range(struct mm_struct *mm, srcu_read_unlock(&srcu, id); } +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + +static inline void mmu_notifier_write_lock(struct mm_struct *mm) +{ + percpu_down_write( + &mm->notifier_subscriptions->hdr.mmu_notifier_lock->rw_sem); +} + +static inline void mmu_notifier_write_unlock(struct mm_struct *mm) +{ + percpu_up_write( + &mm->notifier_subscriptions->hdr.mmu_notifier_lock->rw_sem); +} + +#else /* CONFIG_SPECULATIVE_PAGE_FAULT */ + +static inline void mmu_notifier_write_lock(struct mm_struct *mm) {} +static inline void mmu_notifier_write_unlock(struct mm_struct *mm) {} + +#endif /* CONFIG_SPECULATIVE_PAGE_FAULT */ + +static void init_subscriptions(struct mmu_notifier_subscriptions *subscriptions) +{ + INIT_HLIST_HEAD(&subscriptions->list); + spin_lock_init(&subscriptions->lock); + subscriptions->invalidate_seq = 2; + subscriptions->itree = RB_ROOT_CACHED; + init_waitqueue_head(&subscriptions->wq); + INIT_HLIST_HEAD(&subscriptions->deferred_list); +} + /* * Same as mmu_notifier_register but here the caller must hold the mmap_lock in * write mode. A NULL mn signals the notifier is being registered for itree @@ -653,17 +690,16 @@ int __mmu_notifier_register(struct mmu_notifier *subscription, if (!subscriptions) return -ENOMEM; - INIT_HLIST_HEAD(&subscriptions->list); - spin_lock_init(&subscriptions->lock); - subscriptions->invalidate_seq = 2; - subscriptions->itree = RB_ROOT_CACHED; - init_waitqueue_head(&subscriptions->wq); - INIT_HLIST_HEAD(&subscriptions->deferred_list); + init_subscriptions(subscriptions); } + mmu_notifier_write_lock(mm); + ret = mm_take_all_locks(mm); - if (unlikely(ret)) + if (unlikely(ret)) { + mmu_notifier_write_unlock(mm); goto out_clean; + } /* * Serialize the update against mmu_notifier_unregister. A @@ -683,6 +719,7 @@ int __mmu_notifier_register(struct mmu_notifier *subscription, */ if (subscriptions) smp_store_release(&mm->notifier_subscriptions, subscriptions); + mm->notifier_subscriptions->hdr.valid = true; if (subscription) { /* Pairs with the mmdrop in mmu_notifier_unregister_* */ @@ -698,6 +735,7 @@ int __mmu_notifier_register(struct mmu_notifier *subscription, mm->notifier_subscriptions->has_itree = true; mm_drop_all_locks(mm); + mmu_notifier_write_unlock(mm); BUG_ON(atomic_read(&mm->mm_users) <= 0); return 0; @@ -1125,3 +1163,41 @@ mmu_notifier_range_update_to_read_only(const struct mmu_notifier_range *range) return range->vma->vm_flags & VM_READ; } EXPORT_SYMBOL_GPL(mmu_notifier_range_update_to_read_only); + +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT + +bool mmu_notifier_subscriptions_init(struct mm_struct *mm) +{ + struct mmu_notifier_subscriptions *subscriptions; + struct percpu_rw_semaphore_atomic *sem; + + subscriptions = kzalloc( + sizeof(struct mmu_notifier_subscriptions), GFP_KERNEL); + if (!subscriptions) + return false; + + sem = kzalloc(sizeof(struct percpu_rw_semaphore_atomic), GFP_KERNEL); + if (!sem) { + kfree(subscriptions); + return false; + } + percpu_init_rwsem(&sem->rw_sem); + + init_subscriptions(subscriptions); + subscriptions->has_itree = true; + subscriptions->hdr.valid = false; + subscriptions->hdr.mmu_notifier_lock = sem; + mm->notifier_subscriptions = subscriptions; + + return true; +} + +void mmu_notifier_subscriptions_destroy(struct mm_struct *mm) +{ + percpu_rwsem_async_destroy( + mm->notifier_subscriptions->hdr.mmu_notifier_lock); + kfree(mm->notifier_subscriptions); + mm->notifier_subscriptions = NULL; +} + +#endif /* CONFIG_SPECULATIVE_PAGE_FAULT */ diff --git a/mm/mprotect.c b/mm/mprotect.c index 05073d7abff4..d95115a57283 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -35,51 +35,6 @@ #include "internal.h" -/* Determine whether we can avoid taking write faults for known dirty pages. */ -static bool may_avoid_write_fault(pte_t pte, struct vm_area_struct *vma, - unsigned long cp_flags) -{ - /* - * The dirty accountable bit indicates that we can always make the page - * writable regardless of the number of references. - */ - if (!(cp_flags & MM_CP_DIRTY_ACCT)) { - /* Otherwise, we must have exclusive access to the page. */ - if (!(vma_is_anonymous(vma) && (vma->vm_flags & VM_WRITE))) - return false; - - if (page_count(pte_page(pte)) != 1) - return false; - } - - /* - * Don't do this optimization for clean pages as we need to be notified - * of the transition from clean to dirty. - */ - if (!pte_dirty(pte)) - return false; - - /* Same for softdirty. */ - if (!pte_soft_dirty(pte) && (vma->vm_flags & VM_SOFTDIRTY)) - return false; - - /* - * For userfaultfd the user program needs to monitor write faults so we - * can't do this optimization. - */ - if (pte_uffd_wp(pte)) - return false; - - /* - * It is unclear whether this optimization can be done safely for NUMA - * pages. - */ - if (cp_flags & MM_CP_PROT_NUMA) - return false; - - return true; -} - static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, unsigned long addr, unsigned long end, pgprot_t newprot, unsigned long cp_flags) @@ -88,6 +43,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, spinlock_t *ptl; unsigned long pages = 0; int target_node = NUMA_NO_NODE; + bool dirty_accountable = cp_flags & MM_CP_DIRTY_ACCT; bool prot_numa = cp_flags & MM_CP_PROT_NUMA; bool uffd_wp = cp_flags & MM_CP_UFFD_WP; bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE; @@ -175,8 +131,12 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, ptent = pte_clear_uffd_wp(ptent); } - if (may_avoid_write_fault(ptent, vma, cp_flags)) + /* Avoid taking write faults for known dirty pages */ + if (dirty_accountable && pte_dirty(ptent) && + (pte_soft_dirty(ptent) || + !(vma->vm_flags & VM_SOFTDIRTY))) { ptent = pte_mkwrite(ptent); + } ptep_modify_prot_commit(vma, addr, pte, oldpte, ptent); pages++; } else if (is_swap_pte(oldpte)) { diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 482224d5e2cb..e722c6877faf 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1192,6 +1193,85 @@ void pagefault_out_of_memory(void) pr_warn("Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF\n"); } +SYSCALL_DEFINE2(process_mrelease, int, pidfd, unsigned int, flags) +{ +#ifdef CONFIG_MMU + struct mm_struct *mm = NULL; + struct task_struct *task; + struct task_struct *p; + unsigned int f_flags; + bool reap = false; + struct pid *pid; + long ret = 0; + + if (flags) + return -EINVAL; + + pid = pidfd_get_pid(pidfd, &f_flags); + if (IS_ERR(pid)) + return PTR_ERR(pid); + + task = get_pid_task(pid, PIDTYPE_TGID); + if (!task) { + ret = -ESRCH; + goto put_pid; + } + + /* + * Make sure to choose a thread which still has a reference to mm + * during the group exit + */ + p = find_lock_task_mm(task); + if (!p) { + ret = -ESRCH; + goto put_task; + } + + mm = p->mm; + mmgrab(mm); + + /* + * If we are too late and exit_mmap already checked mm_is_oom_victim + * then will block on mmap_read_lock until exit_mmap releases mmap_lock + */ + set_bit(MMF_OOM_VICTIM, &mm->flags); + + if (task_will_free_mem(p)) + reap = true; + else { + /* Error only if the work has not been done already */ + if (!test_bit(MMF_OOM_SKIP, &mm->flags)) + ret = -EINVAL; + } + task_unlock(p); + + if (!reap) + goto drop_mm; + + if (mmap_read_lock_killable(mm)) { + ret = -EINTR; + goto drop_mm; + } + /* + * Check MMF_OOM_SKIP again under mmap_read_lock protection to ensure + * possible change in exit_mmap is seen + */ + if (!test_bit(MMF_OOM_SKIP, &mm->flags) && !__oom_reap_task_mm(mm)) + ret = -EAGAIN; + mmap_read_unlock(mm); + +drop_mm: + mmdrop(mm); +put_task: + put_task_struct(task); +put_pid: + put_pid(pid); + return ret; +#else + return -ENOSYS; +#endif /* CONFIG_MMU */ +} + void add_to_oom_reaper(struct task_struct *p) { p = find_lock_task_mm(p); diff --git a/mm/slub.c b/mm/slub.c index e585d6e030e2..3cc7184af092 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -433,6 +433,18 @@ static inline bool cmpxchg_double_slab(struct kmem_cache *s, struct page *page, static unsigned long object_map[BITS_TO_LONGS(MAX_OBJS_PER_PAGE)]; static DEFINE_SPINLOCK(object_map_lock); +static void __fill_map(unsigned long *obj_map, struct kmem_cache *s, + struct page *page) +{ + void *addr = page_address(page); + void *p; + + bitmap_zero(obj_map, page->objects); + + for (p = page->freelist; p; p = get_freepointer(s, p)) + set_bit(__obj_to_index(s, addr, p), obj_map); +} + /* * Determine a map of object in use on a page. * @@ -442,17 +454,11 @@ static DEFINE_SPINLOCK(object_map_lock); static unsigned long *get_map(struct kmem_cache *s, struct page *page) __acquires(&object_map_lock) { - void *p; - void *addr = page_address(page); - VM_BUG_ON(!irqs_disabled()); spin_lock(&object_map_lock); - bitmap_zero(object_map, page->objects); - - for (p = page->freelist; p; p = get_freepointer(s, p)) - set_bit(__obj_to_index(s, addr, p), object_map); + __fill_map(object_map, s, page); return object_map; } @@ -4510,13 +4516,15 @@ int __kmem_cache_create(struct kmem_cache *s, slab_flags_t flags) return 0; err = sysfs_slab_add(s); - if (err) + if (err) { __kmem_cache_release(s); + return err; + } if (s->flags & SLAB_STORE_USER) debugfs_slab_add(s); - return err; + return 0; } void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller) @@ -4787,17 +4795,17 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, } static void process_slab(struct loc_track *t, struct kmem_cache *s, - struct page *page, enum track_item alloc) + struct page *page, enum track_item alloc, + unsigned long *obj_map) { void *addr = page_address(page); void *p; - unsigned long *map; - map = get_map(s, page); + __fill_map(obj_map, s, page); + for_each_object(p, s, addr, page->objects) - if (!test_bit(__obj_to_index(s, addr, p), map)) + if (!test_bit(__obj_to_index(s, addr, p), obj_map)) add_location(t, s, get_track(s, p, alloc)); - put_map(map); } #endif /* CONFIG_DEBUG_FS */ #endif /* CONFIG_SLUB_DEBUG */ @@ -5792,14 +5800,27 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep) struct loc_track *t = __seq_open_private(filep, &slab_debugfs_sops, sizeof(struct loc_track)); struct kmem_cache *s = file_inode(filep)->i_private; + unsigned long *obj_map; + + if (!t) + return -ENOMEM; + + obj_map = bitmap_alloc(oo_objects(s->oo), GFP_KERNEL); + if (!obj_map) { + seq_release_private(inode, filep); + return -ENOMEM; + } if (strcmp(filep->f_path.dentry->d_name.name, "alloc_traces") == 0) alloc = TRACK_ALLOC; else alloc = TRACK_FREE; - if (!alloc_loc_track(t, PAGE_SIZE / sizeof(struct location), GFP_KERNEL)) + if (!alloc_loc_track(t, PAGE_SIZE / sizeof(struct location), GFP_KERNEL)) { + bitmap_free(obj_map); + seq_release_private(inode, filep); return -ENOMEM; + } /* Push back cpu slabs */ flush_all(s); @@ -5813,12 +5834,13 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep) spin_lock_irqsave(&n->list_lock, flags); list_for_each_entry(page, &n->partial, slab_list) - process_slab(t, s, page, alloc); + process_slab(t, s, page, alloc, obj_map); list_for_each_entry(page, &n->full, slab_list) - process_slab(t, s, page, alloc); + process_slab(t, s, page, alloc, obj_map); spin_unlock_irqrestore(&n->list_lock, flags); } + bitmap_free(obj_map); return 0; } diff --git a/net/9p/mod.c b/net/9p/mod.c index 5126566850bd..94cd2d132fd7 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c @@ -189,4 +189,5 @@ MODULE_AUTHOR("Latchesar Ionkov "); MODULE_AUTHOR("Eric Van Hensbergen "); MODULE_AUTHOR("Ron Minnich "); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_DESCRIPTION("Plan 9 Resource Sharing Support (9P2000)"); diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c index 51a941b56ec3..4dfcd0d7ff3f 100644 --- a/net/bpfilter/bpfilter_kern.c +++ b/net/bpfilter/bpfilter_kern.c @@ -134,3 +134,4 @@ static void __exit fini_umh(void) module_init(load_umh); module_exit(fini_umh); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 236fadc4a439..6c320623cdcd 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c @@ -139,5 +139,6 @@ cleanup_sunrpc(void) rcu_barrier(); /* Wait for completion of call_rcu()'s */ } MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); fs_initcall(init_sunrpc); /* Ensure we're initialised before nfs */ module_exit(cleanup_sunrpc); diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index b7edca89e0ba..fa99fe5bcf6c 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -3008,4 +3008,5 @@ fs_initcall(af_unix_init); module_exit(af_unix_exit); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_ALIAS_NETPROTO(PF_UNIX); diff --git a/samples/crypto/fips140_lab_test.c b/samples/crypto/fips140_lab_test.c deleted file mode 100644 index dd2324b8f84a..000000000000 --- a/samples/crypto/fips140_lab_test.c +++ /dev/null @@ -1,187 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright 2021 Google LLC - * - * This is a sample program which calls some ioctls on /dev/fips140 and prints - * the results. The purpose of this program is to allow the FIPS certification - * lab to test some services of fips140.ko, which they are required to do. This - * is a sample program only, and it can be modified by the lab as needed. This - * program must be run as root, and it only works if the system has loaded a - * build of fips140.ko with evaluation testing support enabled. - * - * This program can be compiled and run on an Android device as follows: - * - * NDK_DIR=$HOME/android-ndk-r23b # adjust directory path as needed - * $NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang \ - * fips140_lab_test.c -O2 -Wall -o fips140_lab_test - * adb push fips140_lab_test /data/local/tmp/ - * adb root - * adb shell /data/local/tmp/fips140_lab_test - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../crypto/fips140-eval-testing-uapi.h" - -static int fips140_dev_fd = -1; - -#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) - -static const char *booltostr(bool b) -{ - return b ? "true" : "false"; -} - -static void __attribute__((noreturn)) -do_die(const char *format, va_list va, int err) -{ - fputs("ERROR: ", stderr); - vfprintf(stderr, format, va); - if (err) - fprintf(stderr, ": %s", strerror(err)); - putc('\n', stderr); - exit(1); -} - -static void __attribute__((noreturn, format(printf, 1, 2))) -die_errno(const char *format, ...) -{ - va_list va; - - va_start(va, format); - do_die(format, va, errno); - va_end(va); -} - -static void __attribute__((noreturn, format(printf, 1, 2))) -die(const char *format, ...) -{ - va_list va; - - va_start(va, format); - do_die(format, va, 0); - va_end(va); -} - -static int get_fips140_device_number(void) -{ - FILE *f; - char line[128]; - int number; - char name[32]; - - f = fopen("/proc/devices", "r"); - if (!f) - die_errno("failed to open /proc/devices"); - while (fgets(line, sizeof(line), f)) { - if (sscanf(line, "%d %31s", &number, name) == 2 && - strcmp(name, "fips140") == 0) - return number; - } - fclose(f); - die("fips140 device node is unavailable.\n" -"The fips140 device node is only available when the fips140 module is loaded\n" -"and has been built with evaluation testing support."); -} - -static void create_fips140_node_if_needed(void) -{ - struct stat stbuf; - int major; - - if (stat("/dev/fips140", &stbuf) == 0) - return; - - major = get_fips140_device_number(); - if (mknod("/dev/fips140", S_IFCHR | 0600, makedev(major, 1)) != 0) - die_errno("failed to create fips140 device node"); -} - -static bool fips140_is_approved_service(const char *name) -{ - int ret = ioctl(fips140_dev_fd, FIPS140_IOCTL_IS_APPROVED_SERVICE, name); - - if (ret < 0) - die_errno("FIPS140_IOCTL_IS_APPROVED_SERVICE unexpectedly failed"); - if (ret == 1) - return true; - if (ret == 0) - return false; - die("FIPS140_IOCTL_IS_APPROVED_SERVICE returned unexpected value %d", - ret); -} - -static const char *fips140_module_version(void) -{ - char buf[256]; - char *str; - int ret = ioctl(fips140_dev_fd, FIPS140_IOCTL_MODULE_VERSION, buf); - - if (ret < 0) - die_errno("FIPS140_IOCTL_MODULE_VERSION unexpectedly failed"); - if (ret != 0) - die("FIPS140_IOCTL_MODULE_VERSION returned unexpected value %d", ret); - str = strdup(buf); - if (!str) - die("out of memory"); - return str; -} - -static const char * const services_to_check[] = { - "aes", - "cbc(aes)", - "cbcmac(aes)", - "cmac(aes)", - "ctr(aes)", - "cts(cbc(aes))", - "ecb(aes)", - "essiv(cbc(aes),sha256)", - "gcm(aes)", - "hmac(sha1)", - "hmac(sha224)", - "hmac(sha256)", - "hmac(sha384)", - "hmac(sha512)", - "jitterentropy_rng", - "sha1", - "sha224", - "sha256", - "sha384", - "sha512", - "stdrng", - "xcbc(aes)", - "xts(aes)", -}; - -int main(void) -{ - size_t i; - - if (getuid() != 0) - die("This program requires root. Run 'adb root' first."); - - create_fips140_node_if_needed(); - - fips140_dev_fd = open("/dev/fips140", O_RDONLY); - if (fips140_dev_fd < 0) - die_errno("failed to open /dev/fips140"); - - printf("fips140_module_version() => \"%s\"\n", fips140_module_version()); - for (i = 0; i < ARRAY_SIZE(services_to_check); i++) { - const char *service = services_to_check[i]; - - printf("fips140_is_approved_service(\"%s\") => %s\n", service, - booltostr(fips140_is_approved_service(service))); - } - return 0; -} diff --git a/samples/crypto/fips140_lab_util.c b/samples/crypto/fips140_lab_util.c new file mode 100644 index 000000000000..996839dbd2e3 --- /dev/null +++ b/samples/crypto/fips140_lab_util.c @@ -0,0 +1,550 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2021 Google LLC + * + * This program provides commands that dump certain types of output from the + * fips140 kernel module, as required by the FIPS lab for evaluation purposes. + * + * While the fips140 kernel module can only be accessed directly by other kernel + * code, an easy-to-use userspace utility program was desired for lab testing. + * When possible, this program uses AF_ALG to access the crypto algorithms; this + * requires that the kernel has AF_ALG enabled. Where AF_ALG isn't sufficient, + * a custom device node /dev/fips140 is used instead; this requires that the + * fips140 module is loaded and has evaluation testing support compiled in. + * + * This program can be compiled and run on an Android device as follows: + * + * NDK_DIR=$HOME/android-ndk-r23b # adjust directory path as needed + * $NDK_DIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang \ + * fips140_lab_util.c -O2 -Wall -o fips140_lab_util + * adb push fips140_lab_util /data/local/tmp/ + * adb root + * adb shell /data/local/tmp/fips140_lab_util + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../crypto/fips140-eval-testing-uapi.h" + +/* --------------------------------------------------------------------------- + * Utility functions + * ---------------------------------------------------------------------------*/ + +#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) + +static void __attribute__((noreturn)) +do_die(const char *format, va_list va, int err) +{ + fputs("ERROR: ", stderr); + vfprintf(stderr, format, va); + if (err) + fprintf(stderr, ": %s", strerror(err)); + putc('\n', stderr); + exit(1); +} + +static void __attribute__((noreturn, format(printf, 1, 2))) +die_errno(const char *format, ...) +{ + va_list va; + + va_start(va, format); + do_die(format, va, errno); + va_end(va); +} + +static void __attribute__((noreturn, format(printf, 1, 2))) +die(const char *format, ...) +{ + va_list va; + + va_start(va, format); + do_die(format, va, 0); + va_end(va); +} + +static void __attribute__((noreturn)) +assertion_failed(const char *expr, const char *file, int line) +{ + die("Assertion failed: %s at %s:%d", expr, file, line); +} + +#define ASSERT(e) ({ if (!(e)) assertion_failed(#e, __FILE__, __LINE__); }) + +static void rand_bytes(uint8_t *bytes, size_t count) +{ + size_t i; + + for (i = 0; i < count; i++) + bytes[i] = rand(); +} + +static const char *booltostr(bool b) +{ + return b ? "true" : "false"; +} + +static const char *bytes_to_hex(const uint8_t *bytes, size_t count) +{ + static char hex[1025]; + size_t i; + + ASSERT(count <= 512); + for (i = 0; i < count; i++) + sprintf(&hex[2*i], "%02x", bytes[i]); + return hex; +} + +static void usage(void); + +/* --------------------------------------------------------------------------- + * /dev/fips140 ioctls + * ---------------------------------------------------------------------------*/ + +static int get_fips140_device_number(void) +{ + FILE *f; + char line[128]; + int number; + char name[32]; + + f = fopen("/proc/devices", "r"); + if (!f) + die_errno("Failed to open /proc/devices"); + while (fgets(line, sizeof(line), f)) { + if (sscanf(line, "%d %31s", &number, name) == 2 && + strcmp(name, "fips140") == 0) + return number; + } + fclose(f); + die("fips140 device node is unavailable.\n" +"The fips140 device node is only available when the fips140 module is loaded\n" +"and has been built with evaluation testing support."); +} + +static void create_fips140_node_if_needed(void) +{ + struct stat stbuf; + int major; + + if (stat("/dev/fips140", &stbuf) == 0) + return; + + major = get_fips140_device_number(); + if (mknod("/dev/fips140", S_IFCHR | 0600, makedev(major, 1)) != 0) + die_errno("Failed to create fips140 device node"); +} + +static int fips140_dev_fd = -1; + +static int fips140_ioctl(int cmd, const void *arg) +{ + if (fips140_dev_fd < 0) { + create_fips140_node_if_needed(); + fips140_dev_fd = open("/dev/fips140", O_RDONLY); + if (fips140_dev_fd < 0) + die_errno("Failed to open /dev/fips140"); + } + return ioctl(fips140_dev_fd, cmd, arg); +} + +static bool fips140_is_approved_service(const char *name) +{ + int ret = fips140_ioctl(FIPS140_IOCTL_IS_APPROVED_SERVICE, name); + + if (ret < 0) + die_errno("FIPS140_IOCTL_IS_APPROVED_SERVICE unexpectedly failed"); + if (ret == 1) + return true; + if (ret == 0) + return false; + die("FIPS140_IOCTL_IS_APPROVED_SERVICE returned unexpected value %d", + ret); +} + +static const char *fips140_module_version(void) +{ + static char buf[256]; + int ret; + + memset(buf, 0, sizeof(buf)); + ret = fips140_ioctl(FIPS140_IOCTL_MODULE_VERSION, buf); + if (ret < 0) + die_errno("FIPS140_IOCTL_MODULE_VERSION unexpectedly failed"); + if (ret != 0) + die("FIPS140_IOCTL_MODULE_VERSION returned unexpected value %d", + ret); + return buf; +} + +/* --------------------------------------------------------------------------- + * AF_ALG utilities + * ---------------------------------------------------------------------------*/ + +#define AF_ALG_MAX_RNG_REQUEST_SIZE 128 + +static int get_alg_fd(const char *alg_type, const char *alg_name) +{ + struct sockaddr_alg addr = {}; + int alg_fd; + + alg_fd = socket(AF_ALG, SOCK_SEQPACKET, 0); + if (alg_fd < 0) + die("Failed to create AF_ALG socket.\n" +"AF_ALG is only available when it has been enabled in the kernel.\n"); + + strncpy((char *)addr.salg_type, alg_type, sizeof(addr.salg_type) - 1); + strncpy((char *)addr.salg_name, alg_name, sizeof(addr.salg_name) - 1); + + if (bind(alg_fd, (void *)&addr, sizeof(addr)) != 0) + die_errno("Failed to bind AF_ALG socket to %s %s", + alg_type, alg_name); + return alg_fd; +} + +static int get_req_fd(int alg_fd, const char *alg_name) +{ + int req_fd = accept(alg_fd, NULL, NULL); + + if (req_fd < 0) + die_errno("Failed to get request file descriptor for %s", + alg_name); + return req_fd; +} + +/* --------------------------------------------------------------------------- + * show_invalid_inputs command + * ---------------------------------------------------------------------------*/ + +enum direction { + UNSPECIFIED, + DECRYPT, + ENCRYPT, +}; + +static const struct invalid_input_test { + const char *alg_type; + const char *alg_name; + const char *key; + size_t key_size; + const char *msg; + size_t msg_size; + const char *iv; + size_t iv_size; + enum direction direction; + int setkey_error; + int crypt_error; +} invalid_input_tests[] = { + { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 16, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 17, + .setkey_error = EINVAL, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 24, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 32, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 33, + .setkey_error = EINVAL, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 16, + .msg_size = 1, + .direction = DECRYPT, + .crypt_error = EINVAL, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 16, + .msg_size = 16, + .direction = ENCRYPT, + }, { + .alg_type = "skcipher", + .alg_name = "cbc(aes)", + .key_size = 16, + .msg_size = 17, + .direction = ENCRYPT, + .crypt_error = EINVAL, + }, { + .alg_type = "hash", + .alg_name = "cmac(aes)", + .key_size = 29, + .setkey_error = EINVAL, + }, { + .alg_type = "skcipher", + .alg_name = "xts(aes)", + .key_size = 32, + }, { + .alg_type = "skcipher", + .alg_name = "xts(aes)", + .key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", + .key_size = 32, + .setkey_error = EINVAL, + } +}; + +static const char *describe_crypt_op(const struct invalid_input_test *t) +{ + if (t->direction == ENCRYPT) + return "encryption"; + if (t->direction == DECRYPT) + return "decryption"; + if (strcmp(t->alg_type, "hash") == 0) + return "hashing"; + ASSERT(0); +} + +static bool af_alg_setkey(const struct invalid_input_test *t, int alg_fd) +{ + const uint8_t *key = (const uint8_t *)t->key; + uint8_t _key[t->key_size]; + + if (t->key_size == 0) + return true; + + if (t->key == NULL) { + rand_bytes(_key, t->key_size); + key = _key; + } + if (setsockopt(alg_fd, SOL_ALG, ALG_SET_KEY, key, t->key_size) != 0) { + printf("%s: setting %zu-byte key failed with error '%s'\n", + t->alg_name, t->key_size, strerror(errno)); + printf("\tkey was %s\n\n", bytes_to_hex(key, t->key_size)); + ASSERT(t->setkey_error == errno); + return false; + } + printf("%s: setting %zu-byte key succeeded\n", + t->alg_name, t->key_size); + printf("\tkey was %s\n\n", bytes_to_hex(key, t->key_size)); + ASSERT(t->setkey_error == 0); + return true; +} + +static void af_alg_process_msg(const struct invalid_input_test *t, int alg_fd) +{ + struct iovec iov; + struct msghdr hdr = { + .msg_iov = &iov, + .msg_iovlen = 1, + }; + const uint8_t *msg = (const uint8_t *)t->msg; + uint8_t *_msg = NULL; + uint8_t *output = NULL; + uint8_t *control = NULL; + size_t controllen = 0; + struct cmsghdr *cmsg; + int req_fd; + + if (t->msg_size == 0) + return; + + req_fd = get_req_fd(alg_fd, t->alg_name); + + if (t->msg == NULL) { + _msg = malloc(t->msg_size); + rand_bytes(_msg, t->msg_size); + msg = _msg; + } + output = malloc(t->msg_size); + iov.iov_base = (void *)msg; + iov.iov_len = t->msg_size; + + if (t->direction != UNSPECIFIED) + controllen += CMSG_SPACE(sizeof(uint32_t)); + if (t->iv_size) + controllen += CMSG_SPACE(sizeof(struct af_alg_iv) + t->iv_size); + control = calloc(1, controllen); + hdr.msg_control = control; + hdr.msg_controllen = controllen; + cmsg = CMSG_FIRSTHDR(&hdr); + if (t->direction != UNSPECIFIED) { + cmsg->cmsg_level = SOL_ALG; + cmsg->cmsg_type = ALG_SET_OP; + cmsg->cmsg_len = CMSG_LEN(sizeof(uint32_t)); + *(uint32_t *)CMSG_DATA(cmsg) = t->direction == DECRYPT ? + ALG_OP_DECRYPT : ALG_OP_ENCRYPT; + cmsg = CMSG_NXTHDR(&hdr, cmsg); + } + if (t->iv_size) { + struct af_alg_iv *alg_iv; + + cmsg->cmsg_level = SOL_ALG; + cmsg->cmsg_type = ALG_SET_IV; + cmsg->cmsg_len = CMSG_LEN(sizeof(*alg_iv) + t->iv_size); + alg_iv = (struct af_alg_iv *)CMSG_DATA(cmsg); + alg_iv->ivlen = t->iv_size; + memcpy(alg_iv->iv, t->iv, t->iv_size); + } + + if (sendmsg(req_fd, &hdr, 0) != t->msg_size) + die_errno("sendmsg failed"); + + if (read(req_fd, output, t->msg_size) != t->msg_size) { + printf("%s: %s of %zu-byte message failed with error '%s'\n", + t->alg_name, describe_crypt_op(t), t->msg_size, + strerror(errno)); + printf("\tmessage was %s\n\n", bytes_to_hex(msg, t->msg_size)); + ASSERT(t->crypt_error == errno); + } else { + printf("%s: %s of %zu-byte message succeeded\n", + t->alg_name, describe_crypt_op(t), t->msg_size); + printf("\tmessage was %s\n\n", bytes_to_hex(msg, t->msg_size)); + ASSERT(t->crypt_error == 0); + } + free(_msg); + free(output); + free(control); + close(req_fd); +} + +static void test_invalid_input(const struct invalid_input_test *t) +{ + int alg_fd = get_alg_fd(t->alg_type, t->alg_name); + + if (af_alg_setkey(t, alg_fd)) + af_alg_process_msg(t, alg_fd); + + close(alg_fd); +} + +static int cmd_show_invalid_inputs(int argc, char *argv[]) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(invalid_input_tests); i++) + test_invalid_input(&invalid_input_tests[i]); + return 0; +} + +/* --------------------------------------------------------------------------- + * show_module_version command + * ---------------------------------------------------------------------------*/ + +static int cmd_show_module_version(int argc, char *argv[]) +{ + printf("fips140_module_version() => \"%s\"\n", + fips140_module_version()); + return 0; +} + +/* --------------------------------------------------------------------------- + * show_service_indicators command + * ---------------------------------------------------------------------------*/ + +static const char * const default_services_to_show[] = { + "aes", + "cbc(aes)", + "cbcmac(aes)", + "cmac(aes)", + "ctr(aes)", + "cts(cbc(aes))", + "ecb(aes)", + "essiv(cbc(aes),sha256)", + "gcm(aes)", + "hmac(sha1)", + "hmac(sha224)", + "hmac(sha256)", + "hmac(sha384)", + "hmac(sha512)", + "jitterentropy_rng", + "sha1", + "sha224", + "sha256", + "sha384", + "sha512", + "stdrng", + "xcbc(aes)", + "xts(aes)", +}; + +static int cmd_show_service_indicators(int argc, char *argv[]) +{ + const char * const *services = default_services_to_show; + int count = ARRAY_SIZE(default_services_to_show); + int i; + + if (argc > 1) { + services = (const char **)(argv + 1); + count = argc - 1; + } + for (i = 0; i < count; i++) { + printf("fips140_is_approved_service(\"%s\") => %s\n", + services[i], + booltostr(fips140_is_approved_service(services[i]))); + } + return 0; +} + +/* --------------------------------------------------------------------------- + * main() + * ---------------------------------------------------------------------------*/ + +static const struct command { + const char *name; + int (*func)(int argc, char *argv[]); +} commands[] = { + { "show_invalid_inputs", cmd_show_invalid_inputs }, + { "show_module_version", cmd_show_module_version }, + { "show_service_indicators", cmd_show_service_indicators }, +}; + +static void usage(void) +{ + fprintf(stderr, +"Usage:\n" +" fips140_lab_util show_invalid_inputs\n" +" fips140_lab_util show_module_version\n" +" fips140_lab_util show_service_indicators [SERVICE]...\n" + ); +} + +int main(int argc, char *argv[]) +{ + int i; + + if (argc < 2) { + usage(); + return 2; + } + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "--help") == 0) { + usage(); + return 2; + } + } + + for (i = 0; i < ARRAY_SIZE(commands); i++) { + if (strcmp(commands[i].name, argv[1]) == 0) + return commands[i].func(argc - 1, argv + 1); + } + fprintf(stderr, "Unknown command: %s\n\n", argv[1]); + usage(); + return 2; +} diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 0f335162f87c..966bef5acc75 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -133,6 +133,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, if (WARN_ON(!dmab)) return -ENXIO; + size = PAGE_ALIGN(size); dmab->dev.type = type; dmab->dev.dev = device; dmab->bytes = 0;